1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-07 23:26:41 +02:00

Issue #4757 Prevent infinite loop and possible PHP 8.1 errors.

This commit is contained in:
Cameron
2022-04-21 10:54:43 -07:00
parent cf20dfc36b
commit c2fc8fce0a
5 changed files with 20 additions and 12 deletions

View File

@@ -656,6 +656,12 @@ if(!isset($_E107['no_event']))
$dbg->logTime('Register Core Events'); $dbg->logTime('Register Core Events');
e107::getNotify()->registerEvents(); e107::getNotify()->registerEvents();
} }
if(!defined('SITENAME')) // Allow override by English_custom.php or English_global.php plugin files.
{
define('SITENAME', trim($tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs')));
}
// //
// O: Start user session // O: Start user session
// //
@@ -680,10 +686,7 @@ $developerMode = (vartrue($pref['developer'],false) || E107_DEBUG_LEVEL > 0);
// for multi-language these definitions needs to come after the language loaded. // for multi-language these definitions needs to come after the language loaded.
if(!defined('SITENAME')) // Allow override by English_custom.php or English_global.php plugin files.
{
define('SITENAME', trim($tp->toHTML($pref['sitename'], '', 'USER_TITLE,er_on,defs')));
}
if(!defined('SITEDESCRIPTION')) // Allow override by English_custom.php or English_global.php plugin files. if(!defined('SITEDESCRIPTION')) // Allow override by English_custom.php or English_global.php plugin files.
{ {
define('SITEDESCRIPTION', $tp->toHTML($pref['sitedescription'], '', 'emotes_off,defs')); define('SITEDESCRIPTION', $tp->toHTML($pref['sitedescription'], '', 'emotes_off,defs'));

View File

@@ -3363,7 +3363,7 @@ class e107
$path = self::templatePath($plug_name, $id, $override); $path = self::templatePath($plug_name, $id, $override);
if(ADMIN && E107_DBG_INCLUDES) if(deftrue('ADMIN') && E107_DBG_INCLUDES)
{ {
self::getMessage()->addDebug( "Attempting to load Template File: ".$path ); self::getMessage()->addDebug( "Attempting to load Template File: ".$path );
} }

View File

@@ -3045,7 +3045,7 @@ class e_parse
$e107::getFolder('web'), $e107::getFolder('web'),
$e107->site_theme ? $e107::getFolder('themes') . $e107->site_theme . '/' : '', $e107->site_theme ? $e107::getFolder('themes') . $e107->site_theme . '/' : '',
defset('THEME_ABS'), defset('THEME_ABS'),
(ADMIN ? $e107::getFolder('admin') : ''), (deftrue('ADMIN') ? $e107::getFolder('admin') : ''),
'', '',
$e107::getFolder('core'), $e107::getFolder('core'),
$e107::getFolder('system'), $e107::getFolder('system'),
@@ -3109,7 +3109,7 @@ class e_parse
SITEURLBASE . e_WEB_ABS, SITEURLBASE . e_WEB_ABS,
defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '',
defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '', defset('THEME_ABS') ? SITEURLBASE . THEME_ABS : '',
(ADMIN ? SITEURLBASE . e_ADMIN_ABS : ''), (deftrue('ADMIN') ? SITEURLBASE . e_ADMIN_ABS : ''),
SITEURL, SITEURL,
'', // no e_CORE absolute path '', // no e_CORE absolute path
'', // no e_SYSTEM absolute path '', // no e_SYSTEM absolute path
@@ -5261,7 +5261,7 @@ class e_parse
{ {
$this->grantScriptAccess(); $this->grantScriptAccess();
} }
elseif(ADMIN && (strpos($html, '</script>') !== false)) elseif(deftrue('ADMIN') && (strpos($html, '</script>') !== false))
{ {
$lan1 = defset('LAN_NO_SCRIPT_ACCESS', "You don't have permission to use [script] tags."); $lan1 = defset('LAN_NO_SCRIPT_ACCESS', "You don't have permission to use [script] tags.");
$lan2 = defset('', "If you believe this is an error, please ask the main administrator to grant you script access via [b]Preferences > Content Filters[/b]"); $lan2 = defset('', "If you believe this is an error, please ask the main administrator to grant you script access via [b]Preferences > Content Filters[/b]");

View File

@@ -231,7 +231,7 @@ class notify
$devMode = e107::getPref('developer', false); $devMode = e107::getPref('developer', false);
if((ADMIN || $devMode) && E107_DEBUG_LEVEL > 0 || deftrue('e_DEBUG_NOTIFY')) if((deftrue('ADMIN') || $devMode) && E107_DEBUG_LEVEL > 0 || deftrue('e_DEBUG_NOTIFY'))
{ {
$data = array('id'=>$id, 'subject'=>$subject, 'recipients'=> $recipients, 'prefs'=>$this->notify_prefs['event'][$id], 'message'=>$message); $data = array('id'=>$id, 'subject'=>$subject, 'recipients'=> $recipients, 'prefs'=>$this->notify_prefs['event'][$id], 'message'=>$message);

View File

@@ -2140,6 +2140,7 @@ class e_user extends e_user_model
$this->set('last_ip', $this->get('user_ip')); $this->set('last_ip', $this->get('user_ip'));
$current_ip = e107::getIPHandler()->getIP(); $current_ip = e107::getIPHandler()->getIP();
$update_ip = ''; $update_ip = '';
$edata = [];
if($this->get('user_ip') != $current_ip) if($this->get('user_ip') != $current_ip)
{ {
@@ -2152,12 +2153,11 @@ class e_user extends e_user_model
'user_name' => $this->get('user_name'), 'user_name' => $this->get('user_name'),
]; ];
e107::getEvent()->trigger('user_ip_changed', $edata); // new v2.3.3
} }
$update_ip = ($this->get('user_ip') != $current_ip) ? ", user_ip = '".$current_ip."'" : '';
$this->set('user_ip', $current_ip); $this->set('user_ip', $current_ip);
if($this->get('user_currentvisit') + 3600 < time() || !$this->get('user_lastvisit')) if($this->get('user_currentvisit') + 3600 < time() || !$this->get('user_lastvisit'))
{ {
$this->set('user_lastvisit', (integer) $this->get('user_currentvisit')); $this->set('user_lastvisit', (integer) $this->get('user_currentvisit'));
@@ -2169,6 +2169,11 @@ class e_user extends e_user_model
$this->set('user_currentvisit', time()); $this->set('user_currentvisit', time());
$sql->update('user', "user_currentvisit = ".$this->get('user_currentvisit').$update_ip." WHERE user_id = ".$this->getId()." LIMIT 1 "); $sql->update('user', "user_currentvisit = ".$this->get('user_currentvisit').$update_ip." WHERE user_id = ".$this->getId()." LIMIT 1 ");
} }
if(!empty($edata))
{
e107::getEvent()->trigger('user_ip_changed', $edata); // new v2.3.3
}
} }
} }