From f570dab1ebfda9d80dca0d1dcffe4c195b8932be Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Wed, 11 Jan 2012 22:57:09 +0100 Subject: Added PLUGIN_ENABLED switch. Useful, if a Plugin runs amok and prevent you from accessiong the site. --- ratatoeskr/config.php | 1 + 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(); } -- cgit v1.2.3-70-g09d2