Rev 236 | Rev 239 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 236 | Rev 237 | ||
---|---|---|---|
Line 89... | Line 89... | ||
89 | return self::$dbPlugins; |
89 | return self::$dbPlugins; |
90 | } |
90 | } |
91 | 91 | ||
92 | public static function db() { |
92 | public static function db() { |
93 | if (!isset(self::$dbPlugins[OIDPLUS_DATABASE_PLUGIN])) { |
93 | if (!isset(self::$dbPlugins[OIDPLUS_DATABASE_PLUGIN])) { |
94 | if ($this::$html) { |
94 | if (self::$html) { |
95 | /*throw new Exception*/die("Database plugin '".htmlentities(OIDPLUS_DATABASE_PLUGIN)."' not found. Please check config.inc.php or run <a href=\"setup/\">setup</a> again."); |
95 | echo "<h1>Error</h1><p>Database plugin '".htmlentities(OIDPLUS_DATABASE_PLUGIN)."' not found.</p><p>Please check config.inc.php or run <a href=\"".OIDplus::getSystemUrl()."setup/\">setup</a> again.</p>"; |
96 | } else { |
96 | } else { |
97 | /*throw new Exception*/die("Database plugin '".OIDPLUS_DATABASE_PLUGIN."' not found. Please check config.inc.php or run setup again.\n"); |
97 | echo "ERROR: Database plugin '".OIDPLUS_DATABASE_PLUGIN."' not found. Please check config.inc.php or run setup again.\n"; |
98 | } |
98 | } |
- | 99 | die(); |
|
99 | } |
100 | } |
100 | $obj = self::$dbPlugins[OIDPLUS_DATABASE_PLUGIN]; |
101 | $obj = self::$dbPlugins[OIDPLUS_DATABASE_PLUGIN]; |
101 | if (!$obj->isConnected()) $obj->connect(); |
102 | if (!$obj->isConnected()) $obj->connect(); |
102 | return $obj; |
103 | return $obj; |
103 | } |
104 | } |
Line 260... | Line 261... | ||
260 | 261 | ||
261 | if (file_exists(__DIR__ . '/../config.inc.php')) { |
262 | if (file_exists(__DIR__ . '/../config.inc.php')) { |
262 | include_once __DIR__ . '/../config.inc.php'; |
263 | include_once __DIR__ . '/../config.inc.php'; |
263 | } else { |
264 | } else { |
264 | if ($html) { |
265 | if ($html) { |
265 | if (!is_dir('setup')) { |
266 | if (!is_dir(__DIR__.'/../../setup')) { |
266 | echo 'Error: Setup directory missing.'; |
267 | echo 'Error: Setup directory missing.'; |
267 | } else { |
268 | } else { |
268 | header('Location:setup/'); |
269 | header('Location:'.OIDplus::getSystemUrl().'setup/'); |
269 | } |
270 | } |
270 | } else { |
271 | } else { |
271 | echo 'Error: Setup directory missing!'; |
272 | echo 'Error: Setup directory missing!'; |
272 | } |
273 | } |
273 | die(); |
274 | die(); |
Line 292... | Line 293... | ||
292 | 293 | ||
293 | // Check version of the config file |
294 | // Check version of the config file |
294 | 295 | ||
295 | if (OIDPLUS_CONFIG_VERSION != 2.0) { |
296 | if (OIDPLUS_CONFIG_VERSION != 2.0) { |
296 | if ($html) { |
297 | if ($html) { |
297 | echo '<h1>Error</h1><p>The information located in <b>includes/config.inc.php</b> is outdated.</p><p>Please run <a href="setup/">setup</a> again.</p>'; |
298 | echo '<h1>Error</h1><p>The information located in <b>includes/config.inc.php</b> is outdated.</p><p>Please run <a href="'.OIDplus::getSystemUrl().'setup/">setup</a> again.</p>'; |
298 | } else { |
299 | } else { |
299 | echo 'The information located in includes/config.inc.php is outdated. Please run setup again.'; |
300 | echo 'The information located in includes/config.inc.php is outdated. Please run setup again.'; |
300 | } |
301 | } |
301 | die(); |
302 | die(); |
302 | } |
303 | } |
Line 310... | Line 311... | ||
310 | if (is_subclass_of($c, 'OIDplusDataBasePlugin')) { |
311 | if (is_subclass_of($c, 'OIDplusDataBasePlugin')) { |
311 | self::registerDatabasePlugin(new $c()); |
312 | self::registerDatabasePlugin(new $c()); |
312 | } |
313 | } |
313 | } |
314 | } |
314 | 315 | ||
- | 316 | foreach (OIDplus::getDatabasePlugins() as $plugin) { |
|
- | 317 | $plugin->init($html); |
|
- | 318 | } |
|
- | 319 | ||
315 | // Do redirect stuff etc. |
320 | // Do redirect stuff etc. |
316 | 321 | ||
317 | self::isSslAvailable(); // This function does automatic redirects |
322 | self::isSslAvailable(); // This function does automatic redirects |
318 | 323 | ||
319 | // System config settings |
324 | // System config settings |
Line 326... | Line 331... | ||
326 | 331 | ||
327 | // Initialize public / private keys |
332 | // Initialize public / private keys |
328 | 333 | ||
329 | OIDplus::getPkiStatus(true); |
334 | OIDplus::getPkiStatus(true); |
330 | 335 | ||
331 | // Register other plugins |
336 | // Register non-DB plugins |
332 | 337 | ||
333 | $ary = glob(__DIR__ . '/../../plugins/objectTypes/'.'*'.'/plugin.inc.php'); |
338 | $ary = glob(__DIR__ . '/../../plugins/objectTypes/'.'*'.'/plugin.inc.php'); |
334 | foreach ($ary as $a) include $a; |
339 | foreach ($ary as $a) include $a; |
335 | 340 | ||
336 | $ary = glob(__DIR__ . '/../../plugins/publicPages/'.'*'.'/plugin.inc.php'); |
341 | $ary = glob(__DIR__ . '/../../plugins/publicPages/'.'*'.'/plugin.inc.php'); |
Line 353... | Line 358... | ||
353 | if (is_subclass_of($c, 'OIDplusObjectTypePlugin')) { |
358 | if (is_subclass_of($c, 'OIDplusObjectTypePlugin')) { |
354 | self::registerObjectTypePlugin(new $c()); |
359 | self::registerObjectTypePlugin(new $c()); |
355 | } |
360 | } |
356 | } |
361 | } |
357 | 362 | ||
358 | // Initialize plugins |
363 | // Initialize non-DB plugins |
359 | 364 | ||
360 | foreach (OIDplus::getDatabasePlugins() as $plugin) { |
- | |
361 | $plugin->init($html); |
- | |
362 | } |
- | |
363 | foreach (OIDplus::getPagePlugins('*') as $plugin) { |
365 | foreach (OIDplus::getPagePlugins('*') as $plugin) { |
364 | $plugin->init($html); |
366 | $plugin->init($html); |
365 | } |
367 | } |
366 | foreach (OIDplus::getAuthPlugins() as $plugin) { |
368 | foreach (OIDplus::getAuthPlugins() as $plugin) { |
367 | $plugin->init($html); |
369 | $plugin->init($html); |