diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index f18514096f..96ecf739ed 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -4288,6 +4288,7 @@ function page_footer($run_cron = true) if (!defined('IN_CRON') && $run_cron && !$config['board_disable']) { $call_cron = true; + $time_now = (!empty($user->time_now) && is_int($user->time_now)) ? $user->time_now : time(); // Any old lock present? if (!empty($config['cron_lock'])) @@ -4295,7 +4296,7 @@ function page_footer($run_cron = true) $cron_time = explode(' ', $config['cron_lock']); // If 1 hour lock is present we do not call cron.php - if ($cron_time[0] + 3600 >= time()) + if ($cron_time[0] + 3600 >= $time_now) { $call_cron = false; } @@ -4307,31 +4308,31 @@ function page_footer($run_cron = true) { $cron_type = ''; - if (time() - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) + if ($time_now - $config['queue_interval'] > $config['last_queue_run'] && !defined('IN_ADMIN') && file_exists($phpbb_root_path . 'cache/queue.' . $phpEx)) { // Process email queue $cron_type = 'queue'; } - else if (method_exists($cache, 'tidy') && time() - $config['cache_gc'] > $config['cache_last_gc']) + else if (method_exists($cache, 'tidy') && $time_now - $config['cache_gc'] > $config['cache_last_gc']) { // Tidy the cache $cron_type = 'tidy_cache'; } - else if ($config['warnings_expire_days'] && (time() - $config['warnings_gc'] > $config['warnings_last_gc'])) + else if ($config['warnings_expire_days'] && ($time_now - $config['warnings_gc'] > $config['warnings_last_gc'])) { $cron_type = 'tidy_warnings'; } - else if (time() - $config['database_gc'] > $config['database_last_gc']) + else if ($time_now - $config['database_gc'] > $config['database_last_gc']) { // Tidy the database $cron_type = 'tidy_database'; } - else if (time() - $config['search_gc'] > $config['search_last_gc']) + else if ($time_now - $config['search_gc'] > $config['search_last_gc']) { // Tidy the search $cron_type = 'tidy_search'; } - else if (time() - $config['session_gc'] > $config['session_last_gc']) + else if ($time_now - $config['session_gc'] > $config['session_last_gc']) { $cron_type = 'tidy_sessions'; }