aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Widget/Admin.php
blob: a761eebe3322874c28eaffdf983a71f9dbfeee18 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php

namespace Zotlabs\Widget;

class Admin {

	function widget($arr) {

		/*
		 * Side bar links
		 */

		if(! is_site_admin()) {
			return '';
		}

		$o = '';

		// array( url, name, extra css classes )

		$aside = [
			'site'      => array(z_root() . '/admin/site/',     t('Site'),           'site'),
			'accounts'  => array(z_root() . '/admin/accounts/', t('Accounts'),       'accounts', 'pending-update', t('Member registrations waiting for confirmation')),
			'channels'  => array(z_root() . '/admin/channels/', t('Channels'),       'channels'),
			'security'  => array(z_root() . '/admin/security/', t('Security'),       'security'),
			'features'  => array(z_root() . '/admin/features/', t('Features'),       'features'),
			'plugins'   => array(z_root() . '/admin/plugins/',  t('Plugins'),        'plugins'),
			'themes'    => array(z_root() . '/admin/themes/',   t('Themes'),         'themes'),
			'queue'     => array(z_root() . '/admin/queue',     t('Inspect queue'),  'queue'),
			'profs'     => array(z_root() . '/admin/profs',     t('Profile Fields'), 'profs'),
			'dbsync'    => array(z_root() . '/admin/dbsync/',   t('DB updates'),     'dbsync')
		];

		/* get plugins admin page */

		$r = q("SELECT * FROM addon WHERE plugin_admin = 1");

		$plugins = array();
		if($r) {
			foreach ($r as $h){
				$plugin = $h['aname'];
				$plugins[] = array(z_root() . '/admin/plugins/' . $plugin, $plugin, 'plugin');
				// temp plugins with admin
				\App::$plugins_admin[] = $plugin;
			}
		}

		$logs = array(z_root() . '/admin/logs/', t('Logs'), 'logs');

		$arr = array('links' => $aside,'plugins' => $plugins,'logs' => $logs);
		call_hooks('admin_aside',$arr);

		$o .= replace_macros(get_markup_template('admin_aside.tpl'), array(
			'$admin' => $aside,
			'$admtxt' => t('Admin'),
			'$plugadmtxt' => t('Plugin Features'),
			'$plugins' => $plugins,
			'$logtxt' => t('Logs'),
			'$logs' => $logs,
			'$h_pending' => t('Member registrations waiting for confirmation'),
			'$admurl'=> z_root() . '/admin/'
		));

		return $o;

	}
}