summaryrefslogtreecommitdiff
path: root/src/views/pages/plugins.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/views/pages/plugins.php')
-rw-r--r--src/views/pages/plugins.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/views/pages/plugins.php b/src/views/pages/plugins.php
new file mode 100644
index 0000000..a526871
--- /dev/null
+++ b/src/views/pages/plugins.php
@@ -0,0 +1,61 @@
+<?php
+
+global $m;
+require_once('MessageManager.class.php');
+$m = new MessageManager($BASE.'/conf.php');
+
+$uid = $m->isLoggedIn();
+$auth = ($uid!==false) && ($m->getStatus($uid)>=2);
+
+if (!$auth) {
+ $m->status('401 Unauthorized');
+ $m->header('Unauthorized');
+ $t = $m->template();
+ $t->tag('h1',array(),"401: Unauthorized");
+ $t->paragraph('You need to be logged in as an admin (at least user '.
+ 'level 2) to edit global plugin settings. :(');
+ $m->footer();
+ exit();
+}
+
+$m->header('Administrator Plugin Management');
+
+$t = $m->template();
+
+$t->openTag('form',array('method'=>'post','action'=>$m->baseUrl().plugins));
+
+global $BASE;
+set_include_path(get_include_path().PATH_SEPARATOR."$BASE/src/plugins");
+
+$plugin_list = $m->getSysConf('plugins');
+$plugins = explode(',', $plugin_list);
+foreach ($plugins as $plugin) {
+ $t->openFieldSet($plugin);
+
+ require_once("$plugin.class.php");
+ $description = call_user_func("$plugin::description");
+ $params = call_user_func("$plugin::configList");
+
+ $t->inputP($description);
+
+ foreach ($params as $param => $type) {
+ $name = $plugin.'_'.$param;
+ if (isset($_POST[$name])) {
+ $m->setPluginConf($plugin, $param, $_POST[$name]);
+ }
+ $value = $m->getPluginConf($plugin, $param);
+ $hint = "Type: $type";
+ switch ($type) {
+ case 'text':
+ case 'int':
+ $t->inputText( $name, $param, $hint, $value); break;
+ case 'password':
+ $t->inputPassword($name, $param, $hint, $value); break;
+ }
+ }
+ $t->closeFieldSet();
+}
+
+$t->tag('input', array('type'=>'submit', 'value'=>'Save'));
+$t->closeTag('form');
+$m->footer(); \ No newline at end of file