From: mumin Date: Sun, 19 Jul 2009 14:20:45 +0000 (+0900) Subject: #17862 - parse_ini_file() has not compatibility at 5.2.x and 5.3.0. X-Git-Url: http://git.sourceforge.jp/view?a=commitdiff_plain;h=27852202e07349ac3e419312ce44ac3fb9676154;p=mulab%2FXCLite.git #17862 - parse_ini_file() has not compatibility at 5.2.x and 5.3.0. --- diff --git a/documents/changes.en.txt b/documents/changes.en.txt index e9e43f2..56dded1 100644 --- a/documents/changes.en.txt +++ b/documents/changes.en.txt @@ -1,3 +1,4 @@ +#17862 - parse_ini_file() has not compatibility at 5.2.x and 5.3.0. #17846 - Fatal erro at User_UserAdminEditForm. #17680 - Append change list. #17619 - Call to undefined method at GroupPermAction. diff --git a/documents/changes.ja.txt b/documents/changes.ja.txt index 9f94df9..20d77e0 100644 --- a/documents/changes.ja.txt +++ b/documents/changes.ja.txt @@ -1,3 +1,4 @@ +#17862 - 5.3.0 ‚Å parse_ini_file() ‚ÌŽÀ‘•‚ª•Ï‚í‚Á‚Ä Fatal ‚É‚È‚Á‚Ä‚¢‚½‚Ì‚ðC³ #17846 - ŠÇ—‰æ–Ê‚Ì‚ä[‚´•ÒW‚ª Fatal ‚É‚È‚Á‚Ä‚½‚̂ŏC³ #17680 - •ÏX—š—ð(‚±‚Ì‚Ó‚Ÿ‚¢‚é)‚ð’ljÁ #17619 - ‚®‚é[‚ÕŒ ŒÀ‚ð•ÏX‚·‚é‚Æ Fatal ‚É‚È‚Á‚Ä‚½‚̂ŏC³ diff --git a/public_html/core/XCube_Root.class.php b/public_html/core/XCube_Root.class.php index e42a581..92d198b 100644 --- a/public_html/core/XCube_Root.class.php +++ b/public_html/core/XCube_Root.class.php @@ -12,14 +12,34 @@ if (!defined('XCUBE_CORE_PATH')) define('XCUBE_CORE_PATH', dirname(__FILE__)); require_once XCUBE_CORE_PATH . '/XCube_HttpContext.class.php'; -function XC_CLASS_EXISTS($className) +if(version_compare(PHP_VERSION, '5.0', '>=')) { - if (version_compare(PHP_VERSION, "5.0", ">=")) { - return class_exists($className, false); - } - else { - return class_exists($className); - } + function XC_CLASS_EXISTS($className) + { + return class_exists($className, false); + } +} +else +{ + function XC_CLASS_EXISTS($className) + { + return class_exists($className); + } +} + +if(version_compare(PHP_VERSION, '5.3', '>=')) +{ + function XC_PARSE_INI_FILE($file) + { + return parse_ini_string(preg_replace(array('|^<\?php\s*/\*+|','|\*+/(?:\s*\?>)?\s*$|'),'',file_get_contents($file)), true); + } +} +else +{ + function XC_PARSE_INI_FILE($file) + { + return parse_ini_file($file, true); + } } /** @@ -160,7 +180,7 @@ class XCube_Root die("FETAL: open error: site setting config."); } - $this->setSiteConfig(parse_ini_file($file, true)); + $this->setSiteConfig(XC_PARSE_INI_FILE($file)); // // Override setting. @@ -170,7 +190,7 @@ class XCube_Root $overrideFile = func_get_arg($i); if (file_exists($overrideFile)) { - $this->overrideSiteConfig(parse_ini_file($overrideFile, true)); + $this->overrideSiteConfig(XC_PARSE_INI_FILE($overrideFile)); } } } diff --git a/public_html/core/XCube_Theme.class.php b/public_html/core/XCube_Theme.class.php index 43a6eff..7e6c873 100644 --- a/public_html/core/XCube_Theme.class.php +++ b/public_html/core/XCube_Theme.class.php @@ -82,7 +82,7 @@ class XCube_Theme function loadManifesto($file) { if (file_exists($file)) { - $this->_mManifesto = parse_ini_file($file, true); + $this->_mManifesto = XCUBE_PARSE_INI_FILE($file); $this->mName = isset($this->_mManifesto['Manifesto']['Name']) ? $this->_mManifesto['Manifesto']['Name'] : ""; $this->mDepends = isset($this->_mManifesto['Manifesto']['Depends']) ? $this->_mManifesto['Manifesto']['Depends'] : ""; $this->mVersion = isset($this->_mManifesto['Manifesto']['Version']) ? $this->_mManifesto['Manifesto']['Version'] : ""; diff --git a/public_html/modules/legacyRender/admin/class/LegacyTheme.class.php b/public_html/modules/legacyRender/admin/class/LegacyTheme.class.php index 06b7857..2315bd8 100644 --- a/public_html/modules/legacyRender/admin/class/LegacyTheme.class.php +++ b/public_html/modules/legacyRender/admin/class/LegacyTheme.class.php @@ -45,7 +45,7 @@ class LegacyThemeHandler if (is_dir($themeDir)) { $manifesto = array(); if (file_exists($mnfFile = $themeDir . "/manifesto.ini.php")) { - $manifesto = parse_ini_file($mnfFile, true); + $manifesto = XCUBE_PARSE_INI_FILE($mnfFile); } if(count($manifesto) > 0) { diff --git a/public_html/modules/legacyRender/class/theme.php b/public_html/modules/legacyRender/class/theme.php index e864911..aaf1009 100644 --- a/public_html/modules/legacyRender/class/theme.php +++ b/public_html/modules/legacyRender/class/theme.php @@ -20,7 +20,7 @@ class LegacyRenderThemeObject extends XoopsSimpleObject $themeDir = XOOPS_THEME_PATH . "/" . $this->get('name'); if (file_exists($mnfFile = $themeDir . "/manifesto.ini.php")) { - $this->mPackage = parse_ini_file($mnfFile, true); + $this->mPackage = XCUBE_PARSE_INI_FILE($mnfFile); } if (isset($this->mPackage['Manifesto'])) { @@ -79,7 +79,7 @@ class LegacyRenderThemeHandler extends XoopsObjectGenericHandler if(is_dir($themeDir)) { $manifesto = array(); if (file_exists($mnfFile = $themeDir . "/manifesto.ini.php")) { - $manifesto = parse_ini_file($mnfFile, true); + $manifesto = XCUBE_PARSE_INI_FILE($mnfFile); } if(count($manifesto) > 0) {