aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Admin.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Module/Admin.php')
-rw-r--r--Zotlabs/Module/Admin.php54
1 files changed, 24 insertions, 30 deletions
diff --git a/Zotlabs/Module/Admin.php b/Zotlabs/Module/Admin.php
index 3ffbdd7fa..536d85dde 100644
--- a/Zotlabs/Module/Admin.php
+++ b/Zotlabs/Module/Admin.php
@@ -1,21 +1,20 @@
<?php
-namespace Zotlabs\Module;
-
-
/**
- * @file mod/admin.php
+ * @file Zotlabs/Module/Admin.php
* @brief Hubzilla's admin controller.
*
* Controller for the /admin/ area.
*/
+namespace Zotlabs\Module;
+
require_once('include/queue_fn.php');
require_once('include/account.php');
/**
- * @param App &$a
+ * @brief Admin area.
+ *
*/
-
class Admin extends \Zotlabs\Web\Controller {
private $sm = null;
@@ -26,36 +25,35 @@ class Admin extends \Zotlabs\Web\Controller {
function post(){
logger('admin_post', LOGGER_DEBUG);
-
+
if(! is_site_admin()) {
return;
}
if (argc() > 1) {
$this->sm->call('post');
}
-
+
goaway(z_root() . '/admin' );
}
-
+
/**
* @return string
*/
function get() {
-
+
logger('admin_content', LOGGER_DEBUG);
-
+
if(! is_site_admin()) {
return login(false);
}
-
-
+
/*
* Page content
*/
$o = '';
-
+
if(argc() > 1) {
$o = $this->sm->call('get');
if($o === false) {
@@ -65,9 +63,9 @@ class Admin extends \Zotlabs\Web\Controller {
else {
$o = $this->admin_page_summary();
}
-
+
if(is_ajax()) {
- echo $o;
+ echo $o;
killme();
return '';
}
@@ -75,16 +73,15 @@ class Admin extends \Zotlabs\Web\Controller {
return $o;
}
}
-
-
+
+
/**
* @brief Returns content for Admin Summary Page.
*
- * @param App &$a
* @return string HTML from parsed admin_summary.tpl
*/
function admin_page_summary() {
-
+
// list total user accounts, expirations etc.
$accounts = array();
$r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN account_expires > %s THEN 1 ELSE NULL END) AS expiring, COUNT(CASE WHEN account_expires < %s AND account_expires > '%s' THEN 1 ELSE NULL END) AS expired, COUNT(CASE WHEN (account_flags & %d)>0 THEN 1 ELSE NULL END) AS blocked FROM account",
@@ -99,11 +96,11 @@ class Admin extends \Zotlabs\Web\Controller {
$accounts['expired'] = array('label' => t('# expired accounts'), 'val' => $r[0]['expired']);
$accounts['expiring'] = array('label' => t('# expiring accounts'), 'val' => $r[0]['expiring']);
}
-
+
// pending registrations
$r = q("SELECT COUNT(id) AS rtotal FROM register WHERE uid != '0'");
$pending = $r[0]['rtotal'];
-
+
// available channels, primary and clones
$channels = array();
$r = q("SELECT COUNT(*) AS total, COUNT(CASE WHEN channel_primary = 1 THEN 1 ELSE NULL END) AS main, COUNT(CASE WHEN channel_primary = 0 THEN 1 ELSE NULL END) AS clones FROM channel WHERE channel_removed = 0");
@@ -112,15 +109,15 @@ class Admin extends \Zotlabs\Web\Controller {
$channels['main'] = array('label' => t('# primary'), 'val' => $r[0]['main']);
$channels['clones'] = array('label' => t('# clones'), 'val' => $r[0]['clones']);
}
-
+
// We can do better, but this is a quick queue status
$r = q("SELECT COUNT(outq_delivered) AS total FROM outq WHERE outq_delivered = 0");
$queue = (($r) ? $r[0]['total'] : 0);
$queues = array( 'label' => t('Message queues'), 'queue' => $queue );
-
+
// If no plugins active return 0, otherwise list of plugin names
$plugins = (count(\App::$plugins) == 0) ? count(\App::$plugins) : \App::$plugins;
-
+
// Could be extended to provide also other alerts to the admin
$alertmsg = '';
// annoy admin about upcoming unsupported PHP version
@@ -135,7 +132,6 @@ class Admin extends \Zotlabs\Web\Controller {
$upgrade = ((version_compare(STD_VERSION,$vmaster) < 0) ? t('Your software should be updated') : '');
-
$t = get_markup_template('admin_summary.tpl');
return replace_macros($t, array(
'$title' => t('Administration'),
@@ -150,10 +146,8 @@ class Admin extends \Zotlabs\Web\Controller {
'$vmaster' => array( t('Repository version (master)'), $vmaster),
'$vdev' => array( t('Repository version (dev)'), $vdev),
'$upgrade' => $upgrade,
- '$build' => get_config('system', 'db_version')
+ '$build' => get_config('system', 'db_version')
));
}
-
-
-
+
}