aboutsummaryrefslogtreecommitdiffstats
path: root/mod/admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/admin.php')
-rw-r--r--mod/admin.php53
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) {