Skip to content

Commit

Permalink
Fixes #5091 Fixes PHP Notices/Warnings and sends some cron execution …
Browse files Browse the repository at this point in the history
…errors to error_log.
  • Loading branch information
CaMer0n committed Oct 26, 2023
1 parent 64cf23a commit 4467ad3
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion class2.php
Original file line number Diff line number Diff line change
Expand Up @@ -698,7 +698,7 @@
define('SITEADMIN', $pref['siteadmin']);
define('SITEADMINEMAIL', $pref['siteadminemail']);
define('SITEDISCLAIMER', $tp->toHTML($pref['sitedisclaimer'], '', 'emotes_off,defs'));
define('SITECONTACTINFO', $tp->toHTML($pref['sitecontactinfo'], true, 'emotes_off,defs'));
define('SITECONTACTINFO', (!empty($pref['sitecontactinfo']) ? $tp->toHTML($pref['sitecontactinfo'], true, 'emotes_off,defs') : ''));
define('SITEEMAIL', vartrue($pref['replyto_email'],$pref['siteadminemail']));
define('USER_REGISTRATION', vartrue($pref['user_reg'],false)); // User Registration System Active or Not.
define('e_DEVELOPER', $developerMode);
Expand Down
15 changes: 14 additions & 1 deletion e107_handlers/cron_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1080,10 +1080,18 @@ public function run()

if(!$valid)
{
if($this->debug)
{
error_log('e107: Invalid token used for cron class');
}
return false;
}

@file_put_contents(e_CACHE . 'cronLastLoad.php', time());
if(!@file_put_contents(e_CACHE . 'cronLastLoad.php', time()))
{
error_log('e107: Unable to write to: '.e_CACHE . 'cronLastLoad.php. Permissions issue?');
}


// Get active cron jobs.
$cron_jobs = $this->getCronJobs(true);
Expand Down Expand Up @@ -1260,6 +1268,11 @@ public function validateToken()
$pwd = str_replace('token=', '', $pwd);
}

if($this->debug)
{
error_log("Cron Token: ".$pwd, E_NOTICE);
}

if(empty($this->pref['e_cron_pwd']) || (varset($this->pref['e_cron_pwd']) != $pwd))
{
if(!empty($pwd))
Expand Down
9 changes: 8 additions & 1 deletion e107_handlers/e107_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -5027,7 +5027,14 @@ public function set_paths()

$path = dirname(self::getRelativePath(getcwd(), $target_path)) . "/";

$http_path = dirname($_SERVER['SCRIPT_NAME']);
$SCRIPT_NAME = !empty($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '';

if(empty($SCRIPT_NAME) && !empty($_SERVER['_']))
{
$SCRIPT_NAME = $_SERVER['_'];
}

$http_path = dirname($SCRIPT_NAME);
$http_path = explode("/", $http_path);
for ($i = 0; $i < substr_count($path, "../"); $i ++)
{
Expand Down

0 comments on commit 4467ad3

Please sign in to comment.