aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2011-06-14 11:54:14 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2011-06-14 11:54:14 +0200
commit25d1637ec4b980d6ac8daf2f028f0ff579d5c977 (patch)
treeb3c810eb4987bfed4a6596305993935444dcdef7
parent5dc8fbccb29169601ad5fed2b5289631e32e5ac5 (diff)
downloadvolse-hubzilla-25d1637ec4b980d6ac8daf2f028f0ff579d5c977.tar.gz
volse-hubzilla-25d1637ec4b980d6ac8daf2f028f0ff579d5c977.tar.bz2
volse-hubzilla-25d1637ec4b980d6ac8daf2f028f0ff579d5c977.zip
simple plugin details and log view in admin
-rw-r--r--mod/admin.php58
-rw-r--r--view/admin_logs.tpl17
-rw-r--r--view/admin_plugins_details.tpl7
3 files changed, 80 insertions, 2 deletions
diff --git a/mod/admin.php b/mod/admin.php
index 054b49a21..e40c50396 100644
--- a/mod/admin.php
+++ b/mod/admin.php
@@ -19,10 +19,12 @@ function admin_post(&$a){
// urls
if ($a->argc > 1){
switch ($a->argv[1]){
- case 'site': {
+ case 'site':
admin_page_site_post($a);
break;
- }
+ case 'logs':
+ admin_page_logs_post($a);
+ break;
}
}
@@ -83,6 +85,9 @@ function admin_content(&$a) {
case 'plugins':
$o = admin_page_plugins($a);
break;
+ case 'logs':
+ $o = admin_page_logs($a);
+ break;
default:
notice( t("Item not found.") );
}
@@ -386,3 +391,52 @@ function admin_page_plugins(&$a){
));
}
+
+/**
+ * Logs admin page
+ */
+
+function admin_page_logs_post(&$a) {
+ if (x($_POST,"page_logs")) {
+
+ $logfile = ((x($_POST,'logfile')) ? notags(trim($_POST['logfile'])) : '');
+ $debugging = ((x($_POST,'debugging')) ? true : false);
+ $loglevel = ((x($_POST,'loglevel')) ? intval(trim($_POST['loglevel'])) : 0);
+
+ set_config('system','logfile', $logfile);
+ set_config('system','debugging', $debugging);
+ set_config('system','loglevel', $loglevel);
+
+
+ }
+
+ goaway($a->get_baseurl() . '/admin/logs' );
+ return; // NOTREACHED
+}
+
+function admin_page_logs(&$a){
+
+ $log_choices = Array(
+ LOGGER_NORMAL => 'Normal',
+ LOGGER_TRACE => 'Trace',
+ LOGGER_DEBUG => 'Debug',
+ LOGGER_DATA => 'Data',
+ LOGGER_ALL => 'All'
+ );
+
+ $t = get_markup_template("admin_logs.tpl");
+ return replace_macros($t, array(
+ '$title' => t('Administration'),
+ '$page' => t('Logs'),
+ '$submit' => t('Submit'),
+ '$clear' => t('Clear'),
+ '$baseurl' => $a->get_baseurl(),
+ '$logname' => get_config('system','logfile'),
+
+ // name, label, value, help string, extra data...
+ '$debugging' => array('debugging', t("Debugging"),get_config('system','debugging'), ""),
+ '$logfile' => array('logfile', t("Log file"), get_config('system','logfile'), "Must be writable by web server. Relative to your Friendika index.php."),
+ '$loglevel' => array('loglevel', t("Log level"), get_config('system','loglevel'), "", $log_choices),
+ ));
+}
+
diff --git a/view/admin_logs.tpl b/view/admin_logs.tpl
new file mode 100644
index 000000000..f2939a7ac
--- /dev/null
+++ b/view/admin_logs.tpl
@@ -0,0 +1,17 @@
+<div id='adminpage'>
+ <h1>$title - $page</h1>
+
+ <form action="$baseurl/admin/logs" method="post">
+
+ {{ inc field_checkbox.tpl with $field=$debugging }}{{ endinc }}
+ {{ inc field_input.tpl with $field=$logfile }}{{ endinc }}
+ {{ inc field_select.tpl with $field=$loglevel }}{{ endinc }}
+
+ <div class="submit"><input type="submit" name="page_logs" value="$submit" /></div>
+
+ </form>
+
+ <h3>$logname</h3>
+ <iframe src='$baseurl/$logname' style="width:100%; height:400px"></iframe>
+ <!-- <div class="submit"><input type="submit" name="page_logs_clear_log" value="$clear" /></div> -->
+</div>
diff --git a/view/admin_plugins_details.tpl b/view/admin_plugins_details.tpl
new file mode 100644
index 000000000..7e2e95521
--- /dev/null
+++ b/view/admin_plugins_details.tpl
@@ -0,0 +1,7 @@
+<div id='adminpage'>
+ <h1>$title - $page</h1>
+
+ <p><span class='icon $status'></span> $plugin</p>
+
+ <p><a href="$baseurl/admin/plugins/$plugin/?a=t">$action</a></p>
+</div>