Fixed (file) comments.
This commit is contained in:
@ -30,7 +30,7 @@ function ensureDir(string $filepath) {
|
||||
*/
|
||||
function ensureJson(string $filepath) {
|
||||
|
||||
if (!file_exists($filepath) or filesize($filepath) < 2) {
|
||||
if (!file_exists($filepath) or filesize($filepath) < 2) { // If file exists, but is smaller than 2 byte, it is not valid JSON.
|
||||
file_put_contents($filepath, "[]");
|
||||
}
|
||||
|
||||
@ -90,6 +90,8 @@ function ensureEnvironment() {
|
||||
|
||||
$GLOBALS['settings'] = $settings;
|
||||
|
||||
// Send headers for increased security
|
||||
|
||||
if ($settings['sendHTTPHeaders']) {
|
||||
header('X-Content-Type-Options: nosniff');
|
||||
header('X-XSS-Protection: 1; mode=block');
|
||||
@ -145,7 +147,7 @@ function queryCachePage(string $url, string $area = "", array $settings = ['cach
|
||||
$fileName = md5($url);
|
||||
$filePath = "$fileDir/$fileName.json";
|
||||
|
||||
// Load from cache.
|
||||
// Load from cache if appropriate.
|
||||
if (file_exists($filePath) && time() - filemtime($filePath) < $settings['cacheRefreshInterval']) {
|
||||
return file_get_contents($filePath);
|
||||
}
|
||||
@ -379,8 +381,8 @@ function checkPreviewAccess($sessionStarted = false) {
|
||||
* @return boolean
|
||||
*/
|
||||
function startswith(string $haystack, string $needle):bool {
|
||||
if (substr($haystack, 0, strlen($needle)) == $needle) return (true);
|
||||
else return (false);
|
||||
if (substr($haystack, 0, strlen($needle)) == $needle) return true;
|
||||
else return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user