OSDN Git Service

#17862 - parse_ini_file() has not compatibility at 5.2.x and 5.3.0.
authormumin <mumincacao@users.sourceforge.jp>
Sun, 19 Jul 2009 14:20:45 +0000 (23:20 +0900)
committermumin <mumincacao@users.sourceforge.jp>
Sun, 19 Jul 2009 14:20:45 +0000 (23:20 +0900)
documents/changes.en.txt
documents/changes.ja.txt
public_html/core/XCube_Root.class.php
public_html/core/XCube_Theme.class.php
public_html/modules/legacyRender/admin/class/LegacyTheme.class.php
public_html/modules/legacyRender/class/theme.php

index e9e43f2..56dded1 100644 (file)
@@ -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.
index 9f94df9..20d77e0 100644 (file)
@@ -1,3 +1,4 @@
+#17862 - 5.3.0 \82Å parse_ini_file() \82Ì\8eÀ\91\95\82ª\95Ï\82í\82Á\82Ä Fatal \82É\82È\82Á\82Ä\82¢\82½\82Ì\82ð\8fC\90³
 #17846 - \8aÇ\97\9d\89æ\96Ê\82Ì\82ä\81[\82´\95Ò\8fW\82ª Fatal \82É\82È\82Á\82Ä\82½\82Ì\82Å\8fC\90³
 #17680 - \95Ï\8dX\97\9a\97ð(\82±\82Ì\82Ó\82\9f\82¢\82é)\82ð\92Ç\89Á
 #17619 - \82®\82é\81[\82Õ\8c \8cÀ\82ð\95Ï\8dX\82·\82é\82Æ Fatal \82É\82È\82Á\82Ä\82½\82Ì\82Å\8fC\90³
index e42a581..92d198b 100644 (file)
@@ -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));
                                }
                        }
                }
index 43a6eff..7e6c873 100644 (file)
@@ -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'] : "";
index 06b7857..2315bd8 100644 (file)
@@ -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) {
index e864911..aaf1009 100644 (file)
@@ -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) {