2019-04-14 11:13:18 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
2019-04-27 22:19:54 -04:00
|
|
|
use Friendica\Core\Addon;
|
2019-04-14 11:13:18 -04:00
|
|
|
use Friendica\Core\L10n;
|
|
|
|
use Friendica\Core\Renderer;
|
2019-04-25 23:56:14 -04:00
|
|
|
use Friendica\Core\System;
|
2019-04-14 11:13:18 -04:00
|
|
|
use Friendica\Database\DBA;
|
|
|
|
|
2019-04-14 11:20:44 -04:00
|
|
|
abstract class BaseAdminModule extends BaseModule
|
2019-04-14 11:13:18 -04:00
|
|
|
{
|
|
|
|
public static function post()
|
|
|
|
{
|
|
|
|
if (!is_site_admin()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// do not allow a page manager to access the admin panel at all.
|
|
|
|
if (!empty($_SESSION['submanage'])) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-25 23:56:14 -04:00
|
|
|
public static function rawContent()
|
|
|
|
{
|
|
|
|
if (!is_site_admin()) {
|
|
|
|
System::httpExit(403);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($_SESSION['submanage'])) {
|
|
|
|
System::httpExit(403);
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
2019-04-14 11:13:18 -04:00
|
|
|
public static function content()
|
|
|
|
{
|
|
|
|
if (!is_site_admin()) {
|
|
|
|
return Login::form();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!empty($_SESSION['submanage'])) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
$a = self::getApp();
|
|
|
|
|
|
|
|
// APC deactivated, since there are problems with PHP 5.5
|
|
|
|
//if (function_exists("apc_delete")) {
|
|
|
|
// $toDelete = new APCIterator('user', APC_ITER_VALUE);
|
|
|
|
// apc_delete($toDelete);
|
|
|
|
//}
|
|
|
|
// Header stuff
|
|
|
|
$a->page['htmlhead'] .= Renderer::replaceMacros(Renderer::getMarkupTemplate('admin/settings_head.tpl'), []);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Side bar links
|
|
|
|
*/
|
|
|
|
|
|
|
|
// array(url, name, extra css classes)
|
|
|
|
// not part of $aside to make the template more adjustable
|
|
|
|
$aside_sub = [
|
|
|
|
'information' => [L10n::t('Information'), [
|
|
|
|
'overview' => ['admin' , L10n::t('Overview') , 'overview'],
|
2019-04-14 11:20:44 -04:00
|
|
|
'federation' => ['admin/federation' , L10n::t('Federation Statistics') , 'federation']
|
2019-04-14 11:13:18 -04:00
|
|
|
]],
|
2019-04-14 11:25:27 -04:00
|
|
|
'configuration' => [L10n::t('Configuration'), [
|
2019-04-25 22:35:38 -04:00
|
|
|
'site' => ['admin/site' , L10n::t('Site') , 'site'],
|
2019-04-21 19:14:31 -04:00
|
|
|
'users' => ['admin/users' , L10n::t('Users') , 'users'],
|
2019-04-21 12:20:04 -04:00
|
|
|
'addons' => ['admin/addons' , L10n::t('Addons') , 'addons'],
|
2019-04-15 01:11:46 -04:00
|
|
|
'themes' => ['admin/themes' , L10n::t('Themes') , 'themes'],
|
2019-04-21 20:32:02 -04:00
|
|
|
'features' => ['admin/features' , L10n::t('Additional features') , 'features'],
|
2019-04-14 11:25:27 -04:00
|
|
|
'tos' => ['admin/tos' , L10n::t('Terms of Service') , 'tos'],
|
|
|
|
]],
|
2019-04-22 17:31:12 -04:00
|
|
|
'database' => [L10n::t('Database'), [
|
2019-04-25 23:47:10 -04:00
|
|
|
'dbsync' => ['admin/dbsync' , L10n::t('DB updates') , 'dbsync'],
|
2019-04-22 17:31:12 -04:00
|
|
|
'deferred' => ['admin/queue/deferred', L10n::t('Inspect Deferred Workers'), 'deferred'],
|
|
|
|
'workerqueue' => ['admin/queue' , L10n::t('Inspect worker Queue') , 'workerqueue'],
|
|
|
|
]],
|
2019-04-21 20:46:37 -04:00
|
|
|
'tools' => [L10n::t('Tools'), [
|
|
|
|
'contactblock' => ['admin/blocklist/contact', L10n::t('Contact Blocklist') , 'contactblock'],
|
2019-04-21 21:40:05 -04:00
|
|
|
'blocklist' => ['admin/blocklist/server' , L10n::t('Server Blocklist') , 'blocklist'],
|
2019-04-25 23:47:49 -04:00
|
|
|
'deleteitem' => ['admin/item/delete' , L10n::t('Delete Item') , 'deleteitem'],
|
2019-04-21 20:46:37 -04:00
|
|
|
]],
|
2019-04-25 22:55:05 -04:00
|
|
|
'logs' => [L10n::t('Logs'), [
|
2019-04-25 23:56:14 -04:00
|
|
|
'logsconfig' => ['admin/logs/', L10n::t('Logs') , 'logs'],
|
2019-04-25 22:55:05 -04:00
|
|
|
'logsview' => ['admin/logs/view' , L10n::t('View Logs') , 'viewlogs'],
|
|
|
|
]],
|
2019-04-26 00:08:08 -04:00
|
|
|
'diagnostics' => [L10n::t('Diagnostics'), [
|
2019-04-25 23:56:14 -04:00
|
|
|
'phpinfo' => ['admin/phpinfo' , L10n::t('PHP Info') , 'phpinfo'],
|
2019-04-25 23:56:57 -04:00
|
|
|
'probe' => ['probe' , L10n::t('probe address') , 'probe'],
|
|
|
|
'webfinger' => ['webfinger' , L10n::t('check webfinger') , 'webfinger'],
|
2019-04-26 00:08:08 -04:00
|
|
|
'itemsource' => ['admin/item/source' , L10n::t('Item Source') , 'itemsource'],
|
2019-04-25 23:56:57 -04:00
|
|
|
'babel' => ['babel' , L10n::t('Babel') , 'babel'],
|
2019-04-26 00:08:08 -04:00
|
|
|
]],
|
2019-04-14 11:13:18 -04:00
|
|
|
];
|
|
|
|
|
|
|
|
$t = Renderer::getMarkupTemplate('admin/aside.tpl');
|
|
|
|
$a->page['aside'] .= Renderer::replaceMacros($t, [
|
2019-04-27 22:19:54 -04:00
|
|
|
'$admin' => ['addons_admin' => Addon::getAdminList()],
|
2019-04-14 11:13:18 -04:00
|
|
|
'$subpages' => $aside_sub,
|
|
|
|
'$admtxt' => L10n::t('Admin'),
|
|
|
|
'$plugadmtxt' => L10n::t('Addon Features'),
|
|
|
|
'$h_pending' => L10n::t('User registrations waiting for confirmation'),
|
|
|
|
'$admurl' => 'admin/'
|
|
|
|
]);
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
}
|