diff options
author | Kevin Chabowski <kevin@kch42.de> | 2012-01-11 22:57:09 +0100 |
---|---|---|
committer | Kevin Chabowski <kevin@kch42.de> | 2012-01-11 22:57:09 +0100 |
commit | f570dab1ebfda9d80dca0d1dcffe4c195b8932be (patch) | |
tree | 940ee035637dda0a04bf9faaf62e02c60ebd4597 | |
parent | 0b69ffd38b545fe7e027c2111b1a7c412b1cdd92 (diff) | |
download | ratatoeskr-cms-f570dab1ebfda9d80dca0d1dcffe4c195b8932be.tar.gz ratatoeskr-cms-f570dab1ebfda9d80dca0d1dcffe4c195b8932be.tar.bz2 ratatoeskr-cms-f570dab1ebfda9d80dca0d1dcffe4c195b8932be.zip |
Added PLUGIN_ENABLED switch.
Useful, if a Plugin runs amok and prevent you from accessiong the site.
-rw-r--r-- | ratatoeskr/config.php | 1 | ||||
-rw-r--r-- | ratatoeskr/main.php | 30 |
2 files changed, 19 insertions, 12 deletions
diff --git a/ratatoeskr/config.php b/ratatoeskr/config.php index c8c4acb..ae48950 100644 --- a/ratatoeskr/config.php +++ b/ratatoeskr/config.php @@ -2,6 +2,7 @@ define("__DEBUG__", True); define("CONFIG_FILLED_OUT", True); +define("PLUGINS_ENABLED", True); $config["mysql"]["db"] = "s_db_47"; $config["mysql"]["user"] = "dbuser_47"; diff --git a/ratatoeskr/main.php b/ratatoeskr/main.php index 616fed1..d6f42d2 100644 --- a/ratatoeskr/main.php +++ b/ratatoeskr/main.php @@ -34,19 +34,22 @@ function ratatoeskr() clean_database(); - $activeplugins = array_filter(Plugin::all(), function($plugin) { return $plugin->active; }); - foreach($activeplugins as $plugin) + if(PLUGINS_ENABLED) { - eval($plugin->code); - $plugin_obj = new $plugin->classname($plugin->get_id()); - if($plugin->update) + $activeplugins = array_filter(Plugin::all(), function($plugin) { return $plugin->active; }); + foreach($activeplugins as $plugin) { - $plugin_obj->update(); - $plugin->update = False; - $plugin->save(); + eval($plugin->code); + $plugin_obj = new $plugin->classname($plugin->get_id()); + if($plugin->update) + { + $plugin_obj->update(); + $plugin->update = False; + $plugin->save(); + } + $plugin_obj->init(); + $plugin_objs[$plugin->get_id()] = $plugin_obj; } - $plugin_obj->init(); - $plugin_objs[$plugin->get_id()] = $plugin_obj; } /* Register URL handlers */ @@ -72,8 +75,11 @@ function ratatoeskr() url_process($urlpath, $url_handlers, $data); - foreach($plugin_objs as $plugin_obj) - $plugin_obj->atexit(); + if(PLUGINS_ENABLED) + { + foreach($plugin_objs as $plugin_obj) + $plugin_obj->atexit(); + } $ratatoeskr_settings->save(); } |