I am a French user, so sorry for my english.
I don't have Github account since Microsoft buy it and introduice IA in it.
So I post a pull request if it can help....
Issue : when a file is not found, a warning is raised because of file_get_contents function in pagex.class.php
So, I propose to split this warning with catching error.
In bl-kernel/helpers/filesystem.class.php, I add this static function :
Code: Select all
public static function fileGetContents($filePath)
{
set_error_handler(
function ($severity, $message, $file, $line) {
throw new ErrorException($message, $severity, $severity, $file, $line);
}
);
try {
$contentRaw = file_get_contents($filePath);
}
catch (Exception $e) {
header("HTTP/1.0 404 Not Found");
echo 'File not found';
exit();
}
restore_error_handler();
return $contentRaw;
}
Code: Select all
// Returns the raw content
// This content is not markdown parser
// (boolean) $sanitize, TRUE returns the content sanitized
public function contentRaw($sanitize = false)
{
$key = $this->key();
$filePath = PATH_PAGES . $key . DS . FILENAME;
$contentRaw = Filesystem::fileGetContents($filePath);
if ($sanitize) {
return Sanitize::html($contentRaw);
}
return $contentRaw;
}
I hope this can help.
Best regards