Various fixes to improve PHP 8.0 compatibility

- XmlParser 클래스가 PHP 내장 클래스가 되어버려서 XeXmlParser로 변경
- 함수나 파라미터의 형태가 맞지 않아서 치명적인 오류 나는 곳 수정
- undefined 변수 및 배열 키 다수 수정 (치명적인 오류는 아님)
- 계속 수정중...
This commit is contained in:
Kijin Sung 2020-10-31 00:25:26 +09:00
parent 90084efd75
commit 8c161bc28d
38 changed files with 136 additions and 100 deletions

View file

@ -342,7 +342,7 @@ class Context
// Set global variables for backward compatibility. // Set global variables for backward compatibility.
$GLOBALS['oContext'] = self::$_instance; $GLOBALS['oContext'] = self::$_instance;
$GLOBALS['__Context__'] = &self::$_tpl_vars; $GLOBALS['__Context__'] = &self::$_tpl_vars;
$GLOBALS['_time_zone'] = self::$_instance->db_info->time_zone; $GLOBALS['_time_zone'] = config('locale.default_timezone');
$GLOBALS['lang'] = &$lang; $GLOBALS['lang'] = &$lang;
// set session handler // set session handler
@ -357,7 +357,7 @@ class Context
} }
// start session // start session
$relax_key_checks = (self::$_get_vars->act === 'procFileUpload' && preg_match('/shockwave\s?flash/i', $_SERVER['HTTP_USER_AGENT'])); $relax_key_checks = ((self::$_get_vars->act ?? null) === 'procFileUpload' && preg_match('/shockwave\s?flash/i', $_SERVER['HTTP_USER_AGENT']));
Rhymix\Framework\Session::checkSSO($site_module_info); Rhymix\Framework\Session::checkSSO($site_module_info);
Rhymix\Framework\Session::start(false, $relax_key_checks); Rhymix\Framework\Session::start(false, $relax_key_checks);
@ -1528,11 +1528,11 @@ class Context
*/ */
public static function getJSCallbackFunc() public static function getJSCallbackFunc()
{ {
$js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : $_POST['xe_js_callback']; $js_callback_func = isset($_GET['xe_js_callback']) ? $_GET['xe_js_callback'] : ($_POST['xe_js_callback'] ?? null);
if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func)) if(!preg_match('/^[a-z0-9\.]+$/i', $js_callback_func))
{ {
unset($js_callback_func); $js_callback_func = null;
unset($_GET['xe_js_callback']); unset($_GET['xe_js_callback']);
unset($_POST['xe_js_callback']); unset($_POST['xe_js_callback']);
} }
@ -1602,7 +1602,7 @@ class Context
} }
// If the first argument is '', reset existing parameters. // If the first argument is '', reset existing parameters.
if (strval($args_list[0]) === '') if (!is_array($args_list[0]) && strval($args_list[0]) === '')
{ {
array_shift($args_list); array_shift($args_list);
$get_vars = array(); $get_vars = array();

View file

@ -27,7 +27,7 @@ class ExtraVar
* @param int $module_srl Sequence of module * @param int $module_srl Sequence of module
* @return ExtraVar * @return ExtraVar
*/ */
function &getInstance($module_srl) public static function getInstance($module_srl)
{ {
return new ExtraVar($module_srl); return new ExtraVar($module_srl);
} }

View file

@ -38,7 +38,7 @@ class Mobile
} }
// Not mobile if disabled explicitly. // Not mobile if disabled explicitly.
if (!self::isMobileEnabled() || Context::get('full_browse') || $_COOKIE["FullBrowse"]) if (!self::isMobileEnabled() || Context::get('full_browse') || ($_COOKIE['FullBrowse'] ?? 0))
{ {
return self::$_ismobile = false; return self::$_ismobile = false;
} }

View file

@ -118,7 +118,7 @@ class ModuleHandler extends Handler
$site_module_info = Context::get('site_module_info'); $site_module_info = Context::get('site_module_info');
// Check unregistered domain action. // Check unregistered domain action.
if (!$site_module_info || !isset($site_module_info->domain_srl) || $site_module_info->is_default_replaced) if (!$site_module_info || !isset($site_module_info->domain_srl) || ($site_module_info->is_default_replaced ?? false))
{ {
$site_module_info = ModuleModel::getDefaultDomainInfo(); $site_module_info = ModuleModel::getDefaultDomainInfo();
if ($site_module_info) if ($site_module_info)
@ -183,6 +183,10 @@ class ModuleHandler extends Handler
return false; return false;
} }
} }
else
{
$module_info = null;
}
// Get module info from mid. // Get module info from mid.
if(!$module_info && $this->mid) if(!$module_info && $this->mid)
@ -373,7 +377,11 @@ class ModuleHandler extends Handler
} }
} }
if($this->module_info->use_mobile != "Y") if(!isset($this->module_info->use_mobile))
{
$this->module_info->use_mobile = 'N';
}
if($this->module_info->use_mobile !== 'Y')
{ {
Mobile::setMobile(FALSE); Mobile::setMobile(FALSE);
} }
@ -815,27 +823,27 @@ class ModuleHandler extends Handler
*/ */
protected static function _setInputErrorToContext() protected static function _setInputErrorToContext()
{ {
if($_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR')) if(isset($_SESSION['XE_VALIDATOR_ERROR']) && $_SESSION['XE_VALIDATOR_ERROR'] && !Context::get('XE_VALIDATOR_ERROR'))
{ {
Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']); Context::set('XE_VALIDATOR_ERROR', $_SESSION['XE_VALIDATOR_ERROR']);
} }
if($_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE')) if(isset($_SESSION['XE_VALIDATOR_MESSAGE']) && $_SESSION['XE_VALIDATOR_MESSAGE'] && !Context::get('XE_VALIDATOR_MESSAGE'))
{ {
Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']); Context::set('XE_VALIDATOR_MESSAGE', $_SESSION['XE_VALIDATOR_MESSAGE']);
} }
if($_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE')) if(isset($_SESSION['XE_VALIDATOR_MESSAGE_TYPE']) && $_SESSION['XE_VALIDATOR_MESSAGE_TYPE'] && !Context::get('XE_VALIDATOR_MESSAGE_TYPE'))
{ {
Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']); Context::set('XE_VALIDATOR_MESSAGE_TYPE', $_SESSION['XE_VALIDATOR_MESSAGE_TYPE']);
} }
if($_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL')) if(isset($_SESSION['XE_VALIDATOR_RETURN_URL']) && $_SESSION['XE_VALIDATOR_RETURN_URL'] && !Context::get('XE_VALIDATOR_RETURN_URL'))
{ {
Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']); Context::set('XE_VALIDATOR_RETURN_URL', $_SESSION['XE_VALIDATOR_RETURN_URL']);
} }
if($_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID')) if(isset($_SESSION['XE_VALIDATOR_ID']) && $_SESSION['XE_VALIDATOR_ID'] && !Context::get('XE_VALIDATOR_ID'))
{ {
Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']); Context::set('XE_VALIDATOR_ID', $_SESSION['XE_VALIDATOR_ID']);
} }
if(countobj($_SESSION['INPUT_ERROR'])) if(isset($_SESSION['INPUT_ERROR']) && countobj($_SESSION['INPUT_ERROR']))
{ {
Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']); Context::set('INPUT_ERROR', $_SESSION['INPUT_ERROR']);
} }

View file

@ -196,11 +196,11 @@ class ModuleObject extends BaseObject
{ {
// Set default variables // Set default variables
$this->mid = $module_info->mid; $this->mid = $module_info->mid;
$this->module_srl = $module_info->module_srl; $this->module_srl = $module_info->module_srl ?? null;
$this->module_info = $module_info; $this->module_info = $module_info;
$this->origin_module_info = $module_info; $this->origin_module_info = $module_info;
$this->xml_info = $xml_info; $this->xml_info = $xml_info;
$this->skin_vars = $module_info->skin_vars; $this->skin_vars = $module_info->skin_vars ?? null;
$this->module_config = ModuleModel::getInstance()->getModuleConfig($this->module, $module_info->site_srl); $this->module_config = ModuleModel::getInstance()->getModuleConfig($this->module, $module_info->site_srl);
// Set privileges(granted) information // Set privileges(granted) information

View file

@ -8,85 +8,85 @@ class Password
Rhymix\Framework\Password::addAlgorithm($name, $regexp, $callback); Rhymix\Framework\Password::addAlgorithm($name, $regexp, $callback);
} }
public function getSupportedAlgorithms() public static function getSupportedAlgorithms()
{ {
return Rhymix\Framework\Password::getSupportedAlgorithms(); return Rhymix\Framework\Password::getSupportedAlgorithms();
} }
public function getBestAlgorithm() public static function getBestAlgorithm()
{ {
return Rhymix\Framework\Password::getBestSupportedAlgorithm(); return Rhymix\Framework\Password::getBestSupportedAlgorithm();
} }
public function getCurrentlySelectedAlgorithm() public static function getCurrentlySelectedAlgorithm()
{ {
return Rhymix\Framework\Password::getDefaultAlgorithm(); return Rhymix\Framework\Password::getDefaultAlgorithm();
} }
public function getWorkFactor() public static function getWorkFactor()
{ {
return Rhymix\Framework\Password::getWorkFactor(); return Rhymix\Framework\Password::getWorkFactor();
} }
public function createHash($password, $algorithm = null) public static function createHash($password, $algorithm = null)
{ {
return Rhymix\Framework\Password::hashPassword($password, $algorithm); return Rhymix\Framework\Password::hashPassword($password, $algorithm);
} }
public function checkPassword($password, $hash, $algorithm = null) public static function checkPassword($password, $hash, $algorithm = null)
{ {
return Rhymix\Framework\Password::checkPassword($password, $hash, $algorithm); return Rhymix\Framework\Password::checkPassword($password, $hash, $algorithm);
} }
function checkAlgorithm($hash) public static function checkAlgorithm($hash)
{ {
$algos = Rhymix\Framework\Password::checkAlgorithm($hash); $algos = Rhymix\Framework\Password::checkAlgorithm($hash);
return count($algos) ? $algos[0] : false; return count($algos) ? $algos[0] : false;
} }
function checkWorkFactor($hash) public static function checkWorkFactor($hash)
{ {
return Rhymix\Framework\Password::checkWorkFactor($hash); return Rhymix\Framework\Password::checkWorkFactor($hash);
} }
public function createSecureSalt($length, $format = 'hex') public static function createSecureSalt($length, $format = 'hex')
{ {
return Rhymix\Framework\Security::getRandom($length, $format); return Rhymix\Framework\Security::getRandom($length, $format);
} }
public function createTemporaryPassword($length = 16) public static function createTemporaryPassword($length = 16)
{ {
return Rhymix\Framework\Password::getRandomPassword($length); return Rhymix\Framework\Password::getRandomPassword($length);
} }
public function createSignature($string) public static function createSignature($string)
{ {
return Rhymix\Framework\Security::createSignature($string); return Rhymix\Framework\Security::createSignature($string);
} }
public function checkSignature($string, $signature) public static function checkSignature($string, $signature)
{ {
return Rhymix\Framework\Security::verifySignature($string, $signature); return Rhymix\Framework\Security::verifySignature($string, $signature);
} }
public function getSecretKey() public static function getSecretKey()
{ {
return config('crypto.authentication_key'); return config('crypto.authentication_key');
} }
public function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24) public static function pbkdf2($password, $salt, $algorithm = 'sha256', $iterations = 8192, $length = 24)
{ {
$hash = Rhymix\Framework\Security::pbkdf2($password, $salt, $algorithm, $iterations, $length); $hash = Rhymix\Framework\Security::pbkdf2($password, $salt, $algorithm, $iterations, $length);
$hash = explode(':', $hash); $hash = explode(':', $hash);
return base64_decode($hash[3]); return base64_decode($hash[3]);
} }
public function bcrypt($password, $salt = null) public static function bcrypt($password, $salt = null)
{ {
return Rhymix\Framework\Security::bcrypt($password, $salt); return Rhymix\Framework\Security::bcrypt($password, $salt);
} }
function strcmpConstantTime($a, $b) public static function strcmpConstantTime($a, $b)
{ {
return Rhymix\Framework\Security::compareStrings($a, $b); return Rhymix\Framework\Security::compareStrings($a, $b);
} }

View file

@ -124,7 +124,7 @@ class Validator
return FALSE; return FALSE;
} }
$parser = new XmlParser(); $parser = new XeXmlParser();
$xml = $parser->loadXmlFile($xml_path); $xml = $parser->loadXmlFile($xml_path);
if(!isset($xml->ruleset) || !isset($xml->ruleset->fields) || !isset($xml->ruleset->fields->field)) if(!isset($xml->ruleset) || !isset($xml->ruleset->fields) || !isset($xml->ruleset->fields->field))
{ {

View file

@ -46,7 +46,7 @@
* @package /classes/xml * @package /classes/xml
* @version 0.2 * @version 0.2
*/ */
class XmlJsFilter extends XmlParser class XmlJsFilter extends XeXmlParser
{ {
/** /**

View file

@ -8,7 +8,7 @@
* @package /classes/xml * @package /classes/xml
* @version 0.1 * @version 0.1
*/ */
class XmlLangParser extends XmlParser class XmlLangParser extends XeXmlParser
{ {
/** /**

View file

@ -35,7 +35,7 @@ class Xml_Node_
* @package /classes/xml * @package /classes/xml
* @version 0.1 * @version 0.1
*/ */
class XmlParser class XeXmlParser
{ {
/** /**
@ -75,7 +75,7 @@ class XmlParser
} }
$buff = FileHandler::readFile($filename); $buff = FileHandler::readFile($filename);
$oXmlParser = new XmlParser(); $oXmlParser = new self();
return $oXmlParser->parse($buff); return $oXmlParser->parse($buff);
} }
@ -232,5 +232,14 @@ class XmlParser
} }
} }
/**
* Alias to XmlParser for backward compatibility.
*/
if (!class_exists('XmlParser'))
{
class_alias('XeXmlParser', 'XmlParser');
}
/* End of file XmlParser.class.php */ /* End of file XmlParser.class.php */
/* Location: ./classes/xml/XmlParser.class.php */ /* Location: ./classes/xml/XmlParser.class.php */

View file

@ -83,6 +83,7 @@ $GLOBALS['RX_AUTOLOAD_FILE_MAP'] = array_change_key_case(array(
'XmlJsFilter' => 'classes/xml/XmlJsFilter.class.php', 'XmlJsFilter' => 'classes/xml/XmlJsFilter.class.php',
'XmlLangParser' => 'classes/xml/XmlLangParser.class.php', 'XmlLangParser' => 'classes/xml/XmlLangParser.class.php',
'XmlParser' => 'classes/xml/XmlParser.class.php', 'XmlParser' => 'classes/xml/XmlParser.class.php',
'XeXmlParser' => 'classes/xml/XmlParser.class.php',
'Bmp' => 'common/libraries/bmp.php', 'Bmp' => 'common/libraries/bmp.php',
'Ftp' => 'common/libraries/ftp.php', 'Ftp' => 'common/libraries/ftp.php',
'Tar' => 'common/libraries/tar.php', 'Tar' => 'common/libraries/tar.php',

View file

@ -836,6 +836,10 @@ class DB
$dbtype = $matches[1]; $dbtype = $matches[1];
$size = $matches[2]; $size = $matches[2];
} }
else
{
$size = '';
}
$xetype = Parsers\DBTableParser::getXEType($dbtype, $size ?: ''); $xetype = Parsers\DBTableParser::getXEType($dbtype, $size ?: '');
// Return the result as an object. // Return the result as an object.

View file

@ -528,6 +528,8 @@ class Query extends VariableBase
{ {
return ''; return '';
} }
$page = 0;
$offset = 0;
// Get the offset from the page or offset variable. // Get the offset from the page or offset variable.
if ($navigation->page) if ($navigation->page)

View file

@ -39,7 +39,7 @@ class VariableBase
$value = '(' . $this->getQueryString($prefix, $args) . ')'; $value = '(' . $this->getQueryString($prefix, $args) . ')';
$params = $this->getQueryParams(); $params = $this->getQueryParams();
} }
elseif ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite)) elseif ($this->var && Query::isValidVariable($args[$this->var] ?? null, $this instanceof ColumnWrite))
{ {
if ($args[$this->var] instanceof EmptyString || $args[$this->var] instanceof NullValue) if ($args[$this->var] instanceof EmptyString || $args[$this->var] instanceof NullValue)
{ {
@ -285,7 +285,7 @@ class VariableBase
*/ */
public function getValue(array $args) public function getValue(array $args)
{ {
if ($this->var && Query::isValidVariable($args[$this->var], $this instanceof ColumnWrite)) if ($this->var && Query::isValidVariable($args[$this->var] ?? null, $this instanceof ColumnWrite))
{ {
if ($args[$this->var] === '') if ($args[$this->var] === '')
{ {
@ -321,7 +321,7 @@ class VariableBase
public function getDefaultValue() public function getDefaultValue()
{ {
// Get the current column name. // Get the current column name.
$column = $this instanceof ColumnWrite ? $this->name : $this->column; $column = $this instanceof ColumnWrite ? $this->name : ($this->column ?? null);
// If the default value is a column name, escape it. // If the default value is a column name, escape it.
if (strpos($this->default, '.') !== false && Query::isValidColumnName($this->default)) if (strpos($this->default, '.') !== false && Query::isValidColumnName($this->default))
@ -382,7 +382,7 @@ class VariableBase
// Don't apply a filter if there is no variable. // Don't apply a filter if there is no variable.
$column = $this instanceof ColumnWrite ? $this->name : $this->column; $column = $this instanceof ColumnWrite ? $this->name : $this->column;
$filter = isset($this->filter) ? $this->filter : ''; $filter = isset($this->filter) ? $this->filter : '';
if (strval($value) === '') if (!is_array($value) && strval($value) === '')
{ {
$filter = ''; $filter = '';
} }

View file

@ -146,7 +146,8 @@ class Router
$prefix_type = 'mid'; $prefix_type = 'mid';
// Find the module associated with this prefix. // Find the module associated with this prefix.
$action_info = self::_getActionInfoByPrefix($prefix, $module_name = ''); $module_name = '';
$action_info = self::_getActionInfoByPrefix($prefix, $module_name);
if ($action_info === false) if ($action_info === false)
{ {
$action_info = self::_getActionInfoByModule($prefix); $action_info = self::_getActionInfoByModule($prefix);

View file

@ -963,7 +963,7 @@ class Session
public static function getValidityInfo($member_srl) public static function getValidityInfo($member_srl)
{ {
$member_srl = intval($member_srl); $member_srl = intval($member_srl);
$validity_info = Cache::get(sprintf('session:validity_info:%d', $member_srl), $invalid_before); $validity_info = Cache::get(sprintf('session:validity_info:%d', $member_srl));
if ($validity_info) if ($validity_info)
{ {
return $validity_info; return $validity_info;

View file

@ -34,7 +34,7 @@ function config($key, $value = null)
*/ */
function lang($code, $value = null) function lang($code, $value = null)
{ {
if (!$GLOBALS['lang'] instanceof Rhymix\Framework\Lang) if (!isset($GLOBALS['lang']) || !$GLOBALS['lang'] instanceof Rhymix\Framework\Lang)
{ {
$GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(Context::getLangType() ?: config('locale.default_lang') ?: 'ko'); $GLOBALS['lang'] = Rhymix\Framework\Lang::getInstance(Context::getLangType() ?: config('locale.default_lang') ?: 'ko');
$GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common'); $GLOBALS['lang']->loadDirectory(RX_BASEDIR . 'common/lang', 'common');
@ -554,7 +554,7 @@ function tobool($input)
*/ */
function countobj($array_or_object) function countobj($array_or_object)
{ {
if (is_array($array_or_object)) if (is_array($array_or_object) || $array_or_object instanceof Countable)
{ {
return count($array_or_object); return count($array_or_object);
} }
@ -564,7 +564,7 @@ function countobj($array_or_object)
} }
else else
{ {
return @count($array_or_object); return $array_or_object ? 1 : 0;
} }
} }

View file

@ -30,10 +30,10 @@
</block> </block>
<!-- RSS --> <!-- RSS -->
<link rel="alternate" type="application/rss+xml" title="RSS" href="{$rss_url}" cond="$rss_url" /> <link rel="alternate" type="application/rss+xml" title="RSS" href="{$rss_url}" cond="isset($rss_url) && $rss_url" />
<link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" cond="$general_rss_url" /> <link rel="alternate" type="application/rss+xml" title="Site RSS" href="{$general_rss_url}" cond="isset($general_rss_url) && $general_rss_url" />
<link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" cond="$rss_url" /> <link rel="alternate" type="application/atom+xml" title="Atom" href="{$atom_url}" cond="isset($atom_url) && $atom_url" />
<link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" cond="$general_rss_url" /> <link rel="alternate" type="application/atom+xml" title="Site Atom" href="{$general_atom_url}" cond="isset($general_atom_url) && $general_atom_url" />
<!-- ICONS AND OTHER LINKS --> <!-- ICONS AND OTHER LINKS -->
<link cond="Context::getCanonicalURL()" rel="canonical" href="{Context::getCanonicalURL()}" /> <link cond="Context::getCanonicalURL()" rel="canonical" href="{Context::getCanonicalURL()}" />
@ -52,7 +52,7 @@
var current_url = "{\Rhymix\Framework\URL::encodeIdna($current_url)}"; var current_url = "{\Rhymix\Framework\URL::encodeIdna($current_url)}";
var request_uri = "{\Rhymix\Framework\URL::encodeIdna($request_uri)}"; var request_uri = "{\Rhymix\Framework\URL::encodeIdna($request_uri)}";
var current_lang = xe.current_lang = "{$lang_type}"; var current_lang = xe.current_lang = "{$lang_type}";
var current_mid = {json_encode($mid ?: null)}; var current_mid = {json_encode((isset($mid) && $mid) ?: null)};
var http_port = {Context::get("_http_port") ?: 'null'}; var http_port = {Context::get("_http_port") ?: 'null'};
var https_port = {Context::get("_https_port") ?: 'null'}; var https_port = {Context::get("_https_port") ?: 'null'};
var enforce_ssl = {$site_module_info->security === 'always' ? 'true' : 'false'}; var enforce_ssl = {$site_module_info->security === 'always' ? 'true' : 'false'};

View file

@ -169,7 +169,7 @@ class addonAdminModel extends addon
return; return;
} }
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->addon; $xml_obj = $tmp_xml_obj->addon;

View file

@ -7,6 +7,7 @@
*/ */
class addonController extends addon class addonController extends addon
{ {
public $addon_file_called = false;
/** /**
* Initialization * Initialization

View file

@ -425,7 +425,7 @@ class adminAdminModel extends admin
return; return;
} }
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$_xml_obj = $oXmlParser->loadXmlFile($info_file); $_xml_obj = $oXmlParser->loadXmlFile($info_file);
if(!$_xml_obj->theme) if(!$_xml_obj->theme)
{ {

View file

@ -113,7 +113,7 @@ class adminAdminView extends admin
$params["act"] = "getResourceapiLastupdate"; $params["act"] = "getResourceapiLastupdate";
$body = XmlGenerater::generate($params); $body = XmlGenerater::generate($params);
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml"); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml");
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XeXmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff); $lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body; $updateDate = $lUpdateDoc->response->updatedate->body;
@ -224,7 +224,7 @@ class adminAdminView extends admin
if(file_exists($cache_file)) if(file_exists($cache_file))
{ {
$oXml = new XmlParser(); $oXml = new XeXmlParser();
$buff = $oXml->parse(FileHandler::readFile($cache_file)); $buff = $oXml->parse(FileHandler::readFile($cache_file));
$item = $buff->zbxe_news->item; $item = $buff->zbxe_news->item;

View file

@ -79,7 +79,7 @@ class autoinstallAdminController extends autoinstall
$config = $oAdminModel->getAutoInstallAdminModuleConfig(); $config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml = new XmlParser(); $xml = new XeXmlParser();
$xmlDoc = $xml->parse($buff); $xmlDoc = $xml->parse($buff);
$this->updateCategory($xmlDoc); $this->updateCategory($xmlDoc);
$this->updatePackages($xmlDoc); $this->updatePackages($xmlDoc);
@ -150,7 +150,7 @@ class autoinstallAdminController extends autoinstall
continue; continue;
} }
$xml = new XmlParser(); $xml = new XeXmlParser();
$xmlDoc = $xml->loadXmlFile($real_path . $config_file); $xmlDoc = $xml->loadXmlFile($real_path . $config_file);
if(!$xmlDoc) if(!$xmlDoc)

View file

@ -202,7 +202,7 @@ class autoinstallAdminModel extends autoinstall
} }
$result = array(); $result = array();
$xml = new XmlParser(); $xml = new XeXmlParser();
foreach($output->data as $package) foreach($output->data as $package)
{ {
$packageSrl = $package->package_srl; $packageSrl = $package->package_srl;

View file

@ -266,7 +266,7 @@ class autoinstallAdminView extends autoinstall
continue; continue;
} }
$xml = new XmlParser(); $xml = new XeXmlParser();
$xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file); $xmlDoc = $xml->loadXmlFile(FileHandler::getRealPath($path) . $config_file);
if(!$xmlDoc) if(!$xmlDoc)
{ {
@ -336,7 +336,7 @@ class autoinstallAdminView extends autoinstall
$config = $oAdminModel->getAutoInstallAdminModuleConfig(); $config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XeXmlParser();
$xmlDoc = $xml_lUpdate->parse($buff); $xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item) if($xmlDoc && $xmlDoc->response->packagelist->item)
{ {
@ -434,7 +434,7 @@ class autoinstallAdminView extends autoinstall
$config = $oAdminModel->getAutoInstallAdminModuleConfig(); $config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XeXmlParser();
$lUpdateDoc = $xml_lUpdate->parse($buff); $lUpdateDoc = $xml_lUpdate->parse($buff);
$updateDate = $lUpdateDoc->response->updatedate->body; $updateDate = $lUpdateDoc->response->updatedate->body;
@ -590,7 +590,7 @@ class autoinstallAdminView extends autoinstall
$config = $oAdminModel->getAutoInstallAdminModuleConfig(); $config = $oAdminModel->getAutoInstallAdminModuleConfig();
$buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config); $buff = FileHandler::getRemoteResource($config->download_server, $body, 3, "POST", "application/xml", array(), array(), array(), $request_config);
$xml_lUpdate = new XmlParser(); $xml_lUpdate = new XeXmlParser();
$xmlDoc = $xml_lUpdate->parse($buff); $xmlDoc = $xml_lUpdate->parse($buff);
if($xmlDoc && $xmlDoc->response->packagelist->item) if($xmlDoc && $xmlDoc->response->packagelist->item)
{ {

View file

@ -56,7 +56,7 @@ class XmlGenerater
return; return;
} }
$xml = new XmlParser(); $xml = new XeXmlParser();
$xmlDoc = $xml->parse($buff); $xmlDoc = $xml->parse($buff);
return $xmlDoc; return $xmlDoc;
} }

View file

@ -347,7 +347,7 @@ class importerAdminController extends importer
{ {
if(!$cur) $cur = 0; if(!$cur) $cur = 0;
// Create the xmlParser object // Create the xmlParser object
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
// Create objects for importing member information // Create objects for importing member information
$this->oMemberController = getController('member'); $this->oMemberController = getController('member');
$this->oMemberModel = getModel('member'); $this->oMemberModel = getModel('member');
@ -534,7 +534,7 @@ class importerAdminController extends importer
{ {
if(!$cur) $cur = 0; if(!$cur) $cur = 0;
// Create the xmlParser object // Create the xmlParser object
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
// Open an index file // Open an index file
$f = fopen($index_file,"r"); $f = fopen($index_file,"r");
// Pass if already read // Pass if already read
@ -633,7 +633,7 @@ class importerAdminController extends importer
function importModule($key, $cur, $index_file, $module_srl) function importModule($key, $cur, $index_file, $module_srl)
{ {
// Pre-create the objects needed // Pre-create the objects needed
$this->oXmlParser = new XmlParser(); $this->oXmlParser = new XeXmlParser();
// Get category information of the target module // Get category information of the target module
$oDocumentController = getController('document'); $oDocumentController = getController('document');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');
@ -1245,7 +1245,7 @@ class importerAdminController extends importer
if(!$buff) return array(); if(!$buff) return array();
$buff = '<extra_vars>'.$buff; $buff = '<extra_vars>'.$buff;
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$xmlDoc = $this->oXmlParser->parse($buff); $xmlDoc = $this->oXmlParser->parse($buff);
if(!count($xmlDoc->extra_vars->key)) return array(); if(!count($xmlDoc->extra_vars->key)) return array();

View file

@ -34,7 +34,7 @@ class ttimport
function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null) function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null)
{ {
// Pre-create the objects needed // Pre-create the objects needed
$this->oXmlParser = new XmlParser(); $this->oXmlParser = new XeXmlParser();
// Get category information of the target module // Get category information of the target module
$oDocumentController = getController('document'); $oDocumentController = getController('document');
$oDocumentModel = getModel('document'); $oDocumentModel = getModel('document');

View file

@ -160,7 +160,7 @@ class krzipModel extends krzip
$request_config $request_config
); );
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$result = $oXmlParser->parse($buff); $result = $oXmlParser->parse($buff);
if($result->error) if($result->error)
{ {

View file

@ -529,7 +529,7 @@ class layoutModel extends layout
return $layout_info; return $layout_info;
} }
// If no cache file exists, parse the xml and then return the variable. // If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;

View file

@ -3854,6 +3854,7 @@ class memberController extends member
Rhymix\Framework\Cache::delete("member:member_groups:$member_srl:site:0"); Rhymix\Framework\Cache::delete("member:member_groups:$member_srl:site:0");
Rhymix\Framework\Cache::delete("site_and_module:accessible_modules:$member_srl"); Rhymix\Framework\Cache::delete("site_and_module:accessible_modules:$member_srl");
unset($GLOBALS['__member_info__'][$member_srl]); unset($GLOBALS['__member_info__'][$member_srl]);
unset($GLOBALS['__member_groups__'][$member_srl]);
} }
} }
/* End of file member.controller.php */ /* End of file member.controller.php */

View file

@ -89,7 +89,7 @@ class memberModel extends member
if(!$config->member_allow_fileupload) $config->member_allow_fileupload = 'N'; if(!$config->member_allow_fileupload) $config->member_allow_fileupload = 'N';
if(!$config->member_profile_view) $config->member_profile_view = 'N'; if(!$config->member_profile_view) $config->member_profile_view = 'N';
if($config->redirect_mid) if(isset($config->redirect_mid) && $config->redirect_mid)
{ {
$config->redirect_url = getNotEncodedFullUrl('','mid',$config->redirect_mid); $config->redirect_url = getNotEncodedFullUrl('','mid',$config->redirect_mid);
} }
@ -344,7 +344,7 @@ class memberModel extends member
{ {
if(!$member_srl) return new stdClass; if(!$member_srl) return new stdClass;
if(!$GLOBALS['__member_info__'][$member_srl]) if(!isset($GLOBALS['__member_info__'][$member_srl]))
{ {
$cache_key = sprintf('member:member_info:%d', $member_srl); $cache_key = sprintf('member:member_info:%d', $member_srl);
$GLOBALS['__member_info__'][$member_srl] = Rhymix\Framework\Cache::get($cache_key); $GLOBALS['__member_info__'][$member_srl] = Rhymix\Framework\Cache::get($cache_key);
@ -385,7 +385,7 @@ class memberModel extends member
*/ */
public static function arrangeMemberInfo($info, $site_srl = 0) public static function arrangeMemberInfo($info, $site_srl = 0)
{ {
if(!$GLOBALS['__member_info__'][$info->member_srl]) if(!isset($GLOBALS['__member_info__'][$info->member_srl]))
{ {
$config = self::getMemberConfig(); $config = self::getMemberConfig();
@ -530,13 +530,11 @@ class memberModel extends member
*/ */
public static function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false) public static function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false)
{ {
static $member_groups = array();
// cache controll // cache controll
$cache_key = sprintf('member:member_groups:%d:site:%d', $member_srl, $site_srl); $cache_key = sprintf('member:member_groups:%d:site:%d', $member_srl, $site_srl);
$group_list = Rhymix\Framework\Cache::get($cache_key); $group_list = Rhymix\Framework\Cache::get($cache_key);
if(!$member_groups[$member_srl][$site_srl] || $force_reload) if(!isset($GLOBALS['__member_groups__'][$member_srl]) || $force_reload)
{ {
if(!$group_list) if(!$group_list)
{ {
@ -563,9 +561,9 @@ class memberModel extends member
{ {
$result[$group->group_srl] = $group->title; $result[$group->group_srl] = $group->title;
} }
$member_groups[$member_srl][$site_srl] = $result; $GLOBALS['__member_groups__'][$member_srl] = $result;
} }
return $member_groups[$member_srl][$site_srl]; return $GLOBALS['__member_groups__'][$member_srl];
} }
/** /**
@ -637,7 +635,7 @@ class memberModel extends member
*/ */
public static function getGroups($site_srl = 0) public static function getGroups($site_srl = 0)
{ {
if(!$GLOBALS['__group_info__'][$site_srl]) if(!isset($GLOBALS['__group_info__'][$site_srl]))
{ {
$result = array(); $result = array();

View file

@ -255,6 +255,10 @@ class moduleModel extends module
Rhymix\Framework\Cache::set('site_and_module:module_srl:' . $mid, $module_info->module_srl, 0, true); Rhymix\Framework\Cache::set('site_and_module:module_srl:' . $mid, $module_info->module_srl, 0, true);
Rhymix\Framework\Cache::set('site_and_module:mid_info:' . $module_info->module_srl, $module_info, 0, true); Rhymix\Framework\Cache::set('site_and_module:mid_info:' . $module_info->module_srl, $module_info, 0, true);
} }
else
{
return;
}
} }
self::_applyDefaultSkin($module_info); self::_applyDefaultSkin($module_info);
@ -517,7 +521,10 @@ class moduleModel extends module
if(!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) continue; if(!$extra_vars[$val->module_srl] || !count(get_object_vars($extra_vars[$val->module_srl]))) continue;
foreach($extra_vars[$val->module_srl] as $k => $v) foreach($extra_vars[$val->module_srl] as $k => $v)
{ {
if($target_module_info[$key]->{$k}) continue; if(isset($target_module_info[$key]->{$k}) && $target_module_info[$key]->{$k})
{
continue;
}
$target_module_info[$key]->{$k} = $v; $target_module_info[$key]->{$k} = $v;
} }
} }
@ -706,7 +713,7 @@ class moduleModel extends module
*/ */
public static function getTriggers($trigger_name, $called_position) public static function getTriggers($trigger_name, $called_position)
{ {
if(is_null($GLOBALS['__triggers__'])) if(!isset($GLOBALS['__triggers__']))
{ {
$triggers = Rhymix\Framework\Cache::get('triggers'); $triggers = Rhymix\Framework\Cache::get('triggers');
if($triggers === null) if($triggers === null)
@ -726,7 +733,7 @@ class moduleModel extends module
} }
} }
return $GLOBALS['__triggers__'][$trigger_name][$called_position]; return $GLOBALS['__triggers__'][$trigger_name][$called_position] ?? [];
} }
/** /**
@ -893,7 +900,7 @@ class moduleModel extends module
$skinInfos = $info->skin_infos; $skinInfos = $info->skin_infos;
if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme) if(isset($skinInfos[$module]) && $skinInfos[$module]->is_theme)
{ {
$themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name]; $themeSkinInfo = $GLOBALS['__ThemeModuleSkin__'][$module]['skins'][$skinInfos[$module]->name] ?? null;
$skin_list[$skinInfos[$module]->name] = $themeSkinInfo; $skin_list[$skinInfos[$module]->name] = $themeSkinInfo;
} }
} }
@ -942,7 +949,7 @@ class moduleModel extends module
$skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin);
if(!file_exists($skin_xml_file)) return; if(!file_exists($skin_xml_file)) return;
// Create XmlParser object // Create XmlParser object
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file);
// Return if no skin information is // Return if no skin information is
if(!$_xml_obj->skin) return; if(!$_xml_obj->skin) return;
@ -1871,10 +1878,13 @@ class moduleModel extends module
$module_info->module = $module_info->module_srl = 0; $module_info->module = $module_info->module_srl = 0;
} }
$__cache = &$GLOBALS['__MODULE_GRANT__'][$module_info->module][intval($module_info->module_srl)][intval($member_info->member_srl)]; if (isset($GLOBALS['__MODULE_GRANT__'][$module_info->module][intval($module_info->module_srl ?? 0)][intval($member_info->member_srl)]))
if (is_object($__cache) && !$xml_info)
{ {
return $__cache; $__cache = &$GLOBALS['__MODULE_GRANT__'][$module_info->module][intval($module_info->module_srl ?? 0)][intval($member_info->member_srl)];
if (is_object($__cache) && !$xml_info)
{
return $__cache;
}
} }
$grant = new stdClass; $grant = new stdClass;

View file

@ -275,7 +275,7 @@ class widgetController extends widget
{ {
$buff = trim($matches[0]); $buff = trim($matches[0]);
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$xml_doc = $oXmlParser->parse(trim($buff)); $xml_doc = $oXmlParser->parse(trim($buff));
if($xml_doc->img) $vars = $xml_doc->img->attrs; if($xml_doc->img) $vars = $xml_doc->img->attrs;
@ -294,7 +294,7 @@ class widgetController extends widget
function transWidgetBox($matches) function transWidgetBox($matches)
{ {
$buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]); $buff = preg_replace('/<div><div>(.*)$/i','</div>',$matches[0]);
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$xml_doc = $oXmlParser->parse($buff); $xml_doc = $oXmlParser->parse($buff);
$vars = $xml_doc->div->attrs; $vars = $xml_doc->div->attrs;
@ -317,7 +317,7 @@ class widgetController extends widget
// Bringing widget cache sequence // Bringing widget cache sequence
preg_match_all('!<img([^\>]*)widget=([^\>]*?)\>!is', $content, $matches); preg_match_all('!<img([^\>]*)widget=([^\>]*?)\>!is', $content, $matches);
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$cnt = count($matches[1]); $cnt = count($matches[1]);
for($i=0;$i<$cnt;$i++) for($i=0;$i<$cnt;$i++)

View file

@ -137,7 +137,7 @@ class widgetModel extends widget
return $widget_info; return $widget_info;
} }
// If no cache file exists, parse the xml and then return the variable. // If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widget; $xml_obj = $tmp_xml_obj->widget;
if(!$xml_obj) return; if(!$xml_obj) return;
@ -207,6 +207,7 @@ class widgetModel extends widget
$extra_var_count = count($extra_vars); $extra_var_count = count($extra_vars);
$buff .= sprintf('$widget_info->extra_var_count = %d;', $extra_var_count); $buff .= sprintf('$widget_info->extra_var_count = %d;', $extra_var_count);
$buff .= '$widget_info->extra_var = new stdClass;';
for($i=0;$i<$extra_var_count;$i++) for($i=0;$i<$extra_var_count;$i++)
{ {
unset($var); unset($var);
@ -279,7 +280,7 @@ class widgetModel extends widget
return $widgetStyle_info; return $widgetStyle_info;
} }
// If no cache file exists, parse the xml and then return the variable. // If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
$xml_obj = $tmp_xml_obj->widgetstyle; $xml_obj = $tmp_xml_obj->widgetstyle;
if(!$xml_obj) return; if(!$xml_obj) return;

View file

@ -746,7 +746,7 @@ class lessc {
if ($suffix !== null && if ($suffix !== null &&
$subProp[0] == "assign" && $subProp[0] == "assign" &&
is_string($subProp[1]) && is_string($subProp[1]) &&
$subProp[1]{0} != $this->vPrefix) $subProp[1][0] != $this->vPrefix)
{ {
$subProp[2] = array( $subProp[2] = array(
'list', ' ', 'list', ' ',
@ -1857,7 +1857,7 @@ class lessc {
$this->pushEnv(); $this->pushEnv();
$parser = new lessc_parser($this, __METHOD__); $parser = new lessc_parser($this, __METHOD__);
foreach ($args as $name => $strValue) { foreach ($args as $name => $strValue) {
if ($name{0} != '@') $name = '@'.$name; if ($name[0] != '@') $name = '@'.$name;
$parser->count = 0; $parser->count = 0;
$parser->buffer = (string)$strValue; $parser->buffer = (string)$strValue;
if (!$parser->propertyValue($value)) { if (!$parser->propertyValue($value)) {
@ -2516,7 +2516,7 @@ class lessc_parser {
$hidden = true; $hidden = true;
if (!isset($block->args)) { if (!isset($block->args)) {
foreach ($block->tags as $tag) { foreach ($block->tags as $tag) {
if (!is_string($tag) || $tag{0} != $this->lessc->mPrefix) { if (!is_string($tag) || $tag[0] != $this->lessc->mPrefix) {
$hidden = false; $hidden = false;
break; break;
} }
@ -2570,7 +2570,7 @@ class lessc_parser {
protected function fixTags($tags) { protected function fixTags($tags) {
// move @ tags out of variable namespace // move @ tags out of variable namespace
foreach ($tags as &$tag) { foreach ($tags as &$tag) {
if ($tag{0} == $this->lessc->vPrefix) if ($tag[0] == $this->lessc->vPrefix)
$tag[0] = $this->lessc->mPrefix; $tag[0] = $this->lessc->mPrefix;
} }
return $tags; return $tags;

View file

@ -496,7 +496,7 @@ class content extends WidgetHandler
$buff = preg_replace("/<\?xml.*\?>/i", "", $buff); $buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$xml_doc = $oXmlParser->parse($buff); $xml_doc = $oXmlParser->parse($buff);
if($xml_doc->rss) if($xml_doc->rss)
{ {

View file

@ -416,7 +416,7 @@ class mcontent extends WidgetHandler
$buff = preg_replace("/<\?xml.*\?>/i", "", $buff); $buff = preg_replace("/<\?xml.*\?>/i", "", $buff);
$oXmlParser = new XmlParser(); $oXmlParser = new XeXmlParser();
$xml_doc = $oXmlParser->parse($buff); $xml_doc = $oXmlParser->parse($buff);
$rss = new stdClass(); $rss = new stdClass();
if($xml_doc->rss) if($xml_doc->rss)