3 namespace Friendica\Module;
5 use Friendica\BaseModule;
6 use Friendica\Core\Addon;
7 use Friendica\Core\L10n;
8 use Friendica\Core\Renderer;
9 use Friendica\Core\System;
12 * This abstract module is meant to be extended by all modules that are reserved to administrator users.
14 * It performs a blanket permission check in all the module methods as long as the relevant `parent::method()` is
15 * called in the inheriting module.
17 * Additionally, it puts together the administration page aside with all the administration links.
19 * @package Friendica\Module
21 abstract class BaseAdminModule extends BaseModule
23 public static function post()
25 if (!is_site_admin()) {
29 // do not allow a page manager to access the admin panel at all.
30 if (!empty($_SESSION['submanage'])) {
35 public static function rawContent()
37 if (!is_site_admin()) {
38 System::httpExit(403);
41 if (!empty($_SESSION['submanage'])) {
42 System::httpExit(403);
48 public static function content()
50 if (!is_site_admin()) {
54 if (!empty($_SESSION['submanage'])) {
60 // APC deactivated, since there are problems with PHP 5.5
61 //if (function_exists("apc_delete")) {
62 // $toDelete = new APCIterator('user', APC_ITER_VALUE);
63 // apc_delete($toDelete);
66 $a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
72 // array(url, name, extra css classes)
73 // not part of $aside to make the template more adjustable
75 'information' => [L10n::t('Information'), [
76 'overview' => ['admin' , L10n::t('Overview') , 'overview'],
77 'federation' => ['admin/federation' , L10n::t('Federation Statistics') , 'federation']
79 'configuration' => [L10n::t('Configuration'), [
80 'site' => ['admin/site' , L10n::t('Site') , 'site'],
81 'users' => ['admin/users' , L10n::t('Users') , 'users'],
82 'addons' => ['admin/addons' , L10n::t('Addons') , 'addons'],
83 'themes' => ['admin/themes' , L10n::t('Themes') , 'themes'],
84 'features' => ['admin/features' , L10n::t('Additional features') , 'features'],
85 'tos' => ['admin/tos' , L10n::t('Terms of Service') , 'tos'],
87 'database' => [L10n::t('Database'), [
88 'dbsync' => ['admin/dbsync' , L10n::t('DB updates') , 'dbsync'],
89 'deferred' => ['admin/queue/deferred', L10n::t('Inspect Deferred Workers'), 'deferred'],
90 'workerqueue' => ['admin/queue' , L10n::t('Inspect worker Queue') , 'workerqueue'],
92 'tools' => [L10n::t('Tools'), [
93 'contactblock' => ['admin/blocklist/contact', L10n::t('Contact Blocklist') , 'contactblock'],
94 'blocklist' => ['admin/blocklist/server' , L10n::t('Server Blocklist') , 'blocklist'],
95 'deleteitem' => ['admin/item/delete' , L10n::t('Delete Item') , 'deleteitem'],
97 'logs' => [L10n::t('Logs'), [
98 'logsconfig' => ['admin/logs/', L10n::t('Logs') , 'logs'],
99 'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],
101 'diagnostics' => [L10n::t('Diagnostics'), [
102 'phpinfo' => ['admin/phpinfo' , L10n::t('PHP Info') , 'phpinfo'],
103 'probe' => ['probe' , L10n::t('probe address') , 'probe'],
104 'webfinger' => ['webfinger' , L10n::t('check webfinger') , 'webfinger'],
105 'itemsource' => ['admin/item/source' , L10n::t('Item Source') , 'itemsource'],
106 'babel' => ['babel' , L10n::t('Babel') , 'babel'],
110 $t = Renderer::getMarkupTemplate('admin/aside.tpl');
111 $a->page['aside'] .= Renderer::replaceMacros($t, [
112 '$admin' => ['addons_admin' => Addon::getAdminList()],
113 '$subpages' => $aside_sub,
114 '$admtxt' => L10n::t('Admin'),
115 '$plugadmtxt' => L10n::t('Addon Features'),
116 '$h_pending' => L10n::t('User registrations waiting for confirmation'),
117 '$admurl' => 'admin/'