diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-06-14 11:16:27 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-06-14 11:16:27 +0200 |
commit | 5dc8fbccb29169601ad5fed2b5289631e32e5ac5 (patch) | |
tree | 026c8e82bc9173904ca66a2dffd371c2e5b9e3a2 /mod | |
parent | b1184f3fdeb4dcc6126b7ea8d7ac1a2980c9cbac (diff) | |
download | volse-hubzilla-5dc8fbccb29169601ad5fed2b5289631e32e5ac5.tar.gz volse-hubzilla-5dc8fbccb29169601ad5fed2b5289631e32e5ac5.tar.bz2 volse-hubzilla-5dc8fbccb29169601ad5fed2b5289631e32e5ac5.zip |
enable/disable plugins from admin page
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 53 |
1 files changed, 52 insertions, 1 deletions
diff --git a/mod/admin.php b/mod/admin.php index f9d248210..054b49a21 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -310,7 +310,58 @@ function admin_page_users(&$a){ function admin_page_plugins(&$a){ - /* all plugins */ + /** + * Single plugin + */ + if ($a->argc == 3){ + $plugin = $a->argv[2]; + if (!is_file("addon/$plugin/$plugin.php")){ + notice( t("Item not found.") ); + return; + } + + if (x($_GET,"a") && $_GET['a']=="t"){ + // Toggle plugin status + $idx = array_search($plugin, $a->plugins); + if ($idx){ + unset($a->plugins[$idx]); + uninstall_plugin($plugin); + } else { + $a->plugins[] = $plugin; + install_plugin($plugin); + } + set_config("system","addon", implode(", ",$a->plugins)); + goaway($a->get_baseurl() . '/admin/plugins' ); + return; // NOTREACHED + } + // display plugin details + + + if (in_array($plugin, $a->plugins)){ + $status="on"; $action= t("Disable"); + } else { + $status="off"; $action= t("Enable"); + } + + $t = get_markup_template("admin_plugins_details.tpl"); + return replace_macros($t, array( + '$title' => t('Administration'), + '$page' => t('Plugins'), + '$toggle' => t('Toggle'), + '$baseurl' => $a->get_baseurl(), + + '$plugin' => $plugin, + '$status' => $status, + '$action' => $action + )); + } + + + + /** + * List plugins + */ + $plugins = array(); $files = glob("addon/*/"); if($files) { |