mirror of
https://github.com/friendica/friendica
synced 2025-04-26 15:10:11 +00:00
The boot.php had been cleared of most functions
This commit is contained in:
parent
4989d1fa99
commit
63da4a75e9
37 changed files with 279 additions and 401 deletions
|
@ -277,6 +277,44 @@ class Worker
|
|||
return DBA::exists('workerqueue', $condition);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the given file is valid to be included
|
||||
*
|
||||
* @param mixed $file
|
||||
* @return bool
|
||||
*/
|
||||
private static function validateInclude(&$file)
|
||||
{
|
||||
$orig_file = $file;
|
||||
|
||||
$file = realpath($file);
|
||||
|
||||
if (strpos($file, getcwd()) !== 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$file = str_replace(getcwd() . "/", "", $file, $count);
|
||||
if ($count != 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($orig_file !== $file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$valid = false;
|
||||
if (strpos($file, "include/") === 0) {
|
||||
$valid = true;
|
||||
}
|
||||
|
||||
if (strpos($file, "addon/") === 0) {
|
||||
$valid = true;
|
||||
}
|
||||
|
||||
// Simply return flag
|
||||
return $valid;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute a worker entry
|
||||
*
|
||||
|
@ -360,7 +398,7 @@ class Worker
|
|||
$include = "include/".$include.".php";
|
||||
}
|
||||
|
||||
if (!validate_include($include)) {
|
||||
if (!self::validateInclude($include)) {
|
||||
Logger::warning("Include file is not valid", ['file' => $argv[0]]);
|
||||
$stamp = (float)microtime(true);
|
||||
DBA::delete('workerqueue', ['id' => $queue["id"]]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue