diff --git a/addons/adminlogging/adminlogging.addon.php b/addons/adminlogging/adminlogging.addon.php index 42f5bd581..97750ca50 100644 --- a/addons/adminlogging/adminlogging.addon.php +++ b/addons/adminlogging/adminlogging.addon.php @@ -10,9 +10,9 @@ if(!defined('__XE__')) * @brief admin log */ $logged_info = Context::get('logged_info'); -if(Context::get('is_logged') && $logged_info->is_admin == 'Y' && stripos(Context::get('act'), 'admin') !== false && $called_position == 'before_module_proc') +if ($called_position === 'before_module_proc' && $logged_info->is_admin === 'Y' && stripos(Context::get('act') ?? '', 'admin') !== false) { - $oAdminloggingController = getController('adminlogging'); + $oAdminloggingController = adminloggingController::getInstance(); $oAdminloggingController->insertLog($this->module, $this->act); } /* End of file adminlogging.php */ diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index 6c574b4be..abc5e2b87 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -185,7 +185,7 @@ class BaseObject { $type = $this->get('message_type'); $typeList = array('error' => 1, 'info' => 1, 'update' => 1); - if(!isset($typeList[$type])) + if (!isset($type) || !isset($typeList[$type])) { $type = $this->getError() ? 'error' : 'info'; } diff --git a/common/framework/DB.php b/common/framework/DB.php index 31fb26104..084299617 100644 --- a/common/framework/DB.php +++ b/common/framework/DB.php @@ -127,9 +127,18 @@ class DB \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::ATTR_EMULATE_PREPARES => false, \PDO::ATTR_STATEMENT_CLASS => array('\Rhymix\Framework\Helpers\DBStmtHelper'), - \PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => false, ); + // Use unbuffered queries to reduce memory usage. + if (\PHP_VERSION_ID >= 80400) + { + $options[\PDO\MySQL::ATTR_USE_BUFFERED_QUERY] = false; + } + else + { + $options[\PDO::MYSQL_ATTR_USE_BUFFERED_QUERY] = false; + } + // Preload the statement helper class. class_exists('\Rhymix\Framework\Helpers\DBStmtHelper'); diff --git a/common/framework/parsers/template/TemplateParser_v2.php b/common/framework/parsers/template/TemplateParser_v2.php index f85f30ccc..1376616ce 100644 --- a/common/framework/parsers/template/TemplateParser_v2.php +++ b/common/framework/parsers/template/TemplateParser_v2.php @@ -179,14 +179,18 @@ class TemplateParser_v2 */ protected function _addContextSwitches(string $content): string { + $context_index = random_int(12000, 99000); + // Inline styles. $content = preg_replace_callback('#(?<=\s)(style=")([^"]*?)"#i', function($match) { return $match[1] . 'config->context = \'CSS\'; ?>' . $match[2] . 'config->context = \'HTML\'; ?>"'; }, $content); // Inline scripts. - $content = preg_replace_callback('#(?<=\s)(href="javascript:|pattern="|on[a-z]+=")([^"]*?)"#i', function($match) { - return $match[1] . 'config->context = \'JS\'; ?>' . $match[2] . 'config->context = \'HTML\'; ?>"'; + $content = preg_replace_callback('#(?<=\s)(href="javascript:|pattern="|on[a-z]+=")([^"]*?)"#i', function($match) use(&$context_index) { + $context_index++; + return $match[1] . 'config->context = \'JS\'; /* !CTX' . $context_index . '! */?>' . + $match[2] . 'config->context = \'HTML\'; /* !CTX' . $context_index . '! */?>"'; }, $content); //