Rev 1051 | Rev 1059 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1051 | Rev 1055 | ||
---|---|---|---|
Line 51... | Line 51... | ||
51 | ); |
51 | ); |
52 | 52 | ||
53 | private function __construct() { |
53 | private function __construct() { |
54 | } |
54 | } |
55 | 55 | ||
- | 56 | private static function insideSetup() { |
|
- | 57 | return (strpos($_SERVER['REQUEST_URI'], OIDplus::webpath(null,OIDplus::PATH_RELATIVE_TO_ROOT).'setup/') === 0); |
|
- | 58 | } |
|
- | 59 | ||
56 | // --- Static classes |
60 | // --- Static classes |
57 | 61 | ||
58 | private static $baseConfig = null; |
62 | private static $baseConfig = null; |
59 | private static $oldConfigFormatLoaded = false; |
63 | private static $oldConfigFormatLoaded = false; |
60 | public static function baseConfig() { |
64 | public static function baseConfig() { |
Line 62... | Line 66... | ||
62 | 66 | ||
63 | if ($first_init = is_null(self::$baseConfig)) { |
67 | if ($first_init = is_null(self::$baseConfig)) { |
64 | self::$baseConfig = new OIDplusBaseConfig(); |
68 | self::$baseConfig = new OIDplusBaseConfig(); |
65 | } |
69 | } |
66 | 70 | ||
- | 71 | if (self::insideSetup()) return self::$baseConfig; |
|
- | 72 | if ((basename($_SERVER['SCRIPT_NAME']) === 'oidplus.min.js.php') && isset($_REQUEST['noBaseConfig']) && ($_REQUEST['noBaseConfig'] == '1')) return self::$baseConfig; |
|
- | 73 | if ((basename($_SERVER['SCRIPT_NAME']) === 'oidplus.min.css.php') && isset($_REQUEST['noBaseConfig']) && ($_REQUEST['noBaseConfig'] == '1')) return self::$baseConfig; |
|
- | 74 | ||
67 | if ($first_init) { |
75 | if ($first_init) { |
68 | // Include a file containing various size/depth limitations of OIDs |
76 | // Include a file containing various size/depth limitations of OIDs |
69 | // It is important to include it before userdata/baseconfig/config.inc.php was included, |
77 | // It is important to include it before userdata/baseconfig/config.inc.php was included, |
70 | // so we can give userdata/baseconfig/config.inc.php the chance to override the values. |
78 | // so we can give userdata/baseconfig/config.inc.php the chance to override the values. |
71 | 79 | ||
Line 121... | Line 129... | ||
121 | } else { |
129 | } else { |
122 | include $config_file; |
130 | include $config_file; |
123 | } |
131 | } |
124 | } |
132 | } |
125 | 133 | ||
- | 134 | // Backwards compatibility 2.0 => 2.1 |
|
126 | if (defined('OIDPLUS_CONFIG_VERSION') && (OIDPLUS_CONFIG_VERSION == 2.0)) { |
135 | if (defined('OIDPLUS_CONFIG_VERSION') && (OIDPLUS_CONFIG_VERSION == 2.0)) { |
127 | self::$oldConfigFormatLoaded = true; |
136 | self::$oldConfigFormatLoaded = true; |
128 | - | ||
129 | // Backwards compatibility 2.0 => 2.1 |
- | |
130 | foreach (get_defined_constants(true)['user'] as $name => $value) { |
137 | foreach (get_defined_constants(true)['user'] as $name => $value) { |
131 | $name = str_replace('OIDPLUS_', '', $name); |
138 | $name = str_replace('OIDPLUS_', '', $name); |
132 | if ($name == 'SESSION_SECRET') $name = 'SERVER_SECRET'; |
139 | if ($name == 'SESSION_SECRET') $name = 'SERVER_SECRET'; |
133 | if ($name == 'MYSQL_QUERYLOG') $name = 'QUERY_LOGFILE'; |
140 | if ($name == 'MYSQL_QUERYLOG') $name = 'QUERY_LOGFILE'; |
134 | $name = str_replace('DISABLE_PLUGIN_OIDplusPagePublicRdap', |
141 | $name = str_replace('DISABLE_PLUGIN_OIDplusPagePublicRdap', |
Line 137... | Line 144... | ||
137 | 'DISABLE_PLUGIN_Frdlweb\OIDplus\OIDplusPagePublicAltIds', $name); |
144 | 'DISABLE_PLUGIN_Frdlweb\OIDplus\OIDplusPagePublicAltIds', $name); |
138 | $name = str_replace('DISABLE_PLUGIN_OIDplusPagePublicUITweaks', |
145 | $name = str_replace('DISABLE_PLUGIN_OIDplusPagePublicUITweaks', |
139 | 'DISABLE_PLUGIN_TushevOrg\OIDplus\OIDplusPagePublicUITweaks', $name); |
146 | 'DISABLE_PLUGIN_TushevOrg\OIDplus\OIDplusPagePublicUITweaks', $name); |
140 | $name = str_replace('DISABLE_PLUGIN_OIDplus', |
147 | $name = str_replace('DISABLE_PLUGIN_OIDplus', |
141 | 'DISABLE_PLUGIN_ViaThinkSoft\OIDplus\OIDplus', $name); |
148 | 'DISABLE_PLUGIN_ViaThinkSoft\OIDplus\OIDplus', $name); |
142 | if (($name == 'MYSQL_PASSWORD') || ($name == 'ODBC_PASSWORD') || ($name == 'PDO_PASSWORD') || ($name == 'PGSQL_PASSWORD')) { |
- | |
143 | self::$baseConfig->setValue($name, base64_decode($value)); |
149 | if ($name == 'CONFIG_VERSION') { |
144 | } else { |
150 | $value = 2.1; |
145 | if ($name == 'CONFIG_VERSION') $value = 2.1; |
151 | } else if (($name == 'MYSQL_PASSWORD') || ($name == 'ODBC_PASSWORD') || ($name == 'PDO_PASSWORD') || ($name == 'PGSQL_PASSWORD')) { |
146 | self::$baseConfig->setValue($name, $value); |
152 | $value = base64_decode($value); |
147 | } |
153 | } |
- | 154 | self::$baseConfig->setValue($name, $value); |
|
148 | } |
155 | } |
149 | } |
156 | } |
150 | } else { |
157 | } else { |
151 | if (!is_dir(OIDplus::localpath().'setup')) { |
158 | if (!is_dir(OIDplus::localpath().'setup')) { |
152 | throw new OIDplusConfigInitializationException(_L('File %1 is missing, but setup can\'t be started because its directory missing.',$config_file)); |
159 | throw new OIDplusConfigInitializationException(_L('File %1 is missing, but setup can\'t be started because its directory missing.',$config_file)); |
153 | } else { |
160 | } else { |
154 | if (self::$html) { |
161 | if (self::$html) { |
155 | if (strpos($_SERVER['REQUEST_URI'], OIDplus::webpath(null,OIDplus::PATH_RELATIVE_TO_ROOT).'setup/') !== 0) { |
162 | if (!self::insideSetup()) { |
156 | header('Location:'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/'); |
163 | header('Location:'.OIDplus::webpath(null,OIDplus::PATH_RELATIVE).'setup/'); |
157 | die(_L('Redirecting to setup...')); |
164 | die(_L('Redirecting to setup...')); |
158 | } else { |
165 | } else { |
159 | return self::$baseConfig; |
166 | return self::$baseConfig; |
160 | } |
167 | } |