streams/Code/Widget/Admin.php

69 lines
2.1 KiB
PHP
Raw Normal View History

2017-03-16 04:26:28 +00:00
<?php
2022-02-16 04:08:28 +00:00
namespace Code\Widget;
2017-03-16 04:26:28 +00:00
2021-12-02 22:33:36 +00:00
use App;
2022-02-16 04:08:28 +00:00
use Code\Extend\Hook;
use Code\Render\Theme;
2022-02-12 20:43:29 +00:00
2021-12-02 22:33:36 +00:00
2022-10-23 21:18:44 +00:00
class Admin implements WidgetInterface
2021-12-02 23:02:31 +00:00
{
2017-03-16 04:26:28 +00:00
2022-10-24 03:39:49 +00:00
public function widget(array $arguments): string
2021-12-02 23:02:31 +00:00
{
2017-03-16 04:26:28 +00:00
2021-12-02 23:02:31 +00:00
/*
* Side bar links
*/
2017-03-16 04:26:28 +00:00
2021-12-02 23:02:31 +00:00
if (!is_site_admin()) {
return '';
}
2017-03-16 04:26:28 +00:00
2021-12-02 23:02:31 +00:00
$o = '';
2017-03-16 04:26:28 +00:00
2021-12-02 23:02:31 +00:00
$aside = [
2022-10-23 21:18:44 +00:00
'site' => [z_root() . '/admin/site/', t('Site'), 'site'],
'accounts' => [z_root() . '/admin/accounts/', t('Accounts'), 'accounts', 'pending-update', t('Member registrations waiting for confirmation')],
'channels' => [z_root() . '/admin/channels/', t('Channels'), 'channels'],
'security' => [z_root() . '/admin/security/', t('Security'), 'security'],
'addons' => [z_root() . '/admin/addons/', t('Addons'), 'addons'],
'themes' => [z_root() . '/admin/themes/', t('Themes'), 'themes'],
'queue' => [z_root() . '/admin/queue', t('Inspect queue'), 'queue'],
'dbsync' => [z_root() . '/admin/dbsync/', t('DB updates'), 'dbsync']
2021-12-02 23:02:31 +00:00
];
/* get plugins admin page */
$r = q("SELECT * FROM addon WHERE plugin_admin = 1");
$plugins = [];
if ($r) {
foreach ($r as $h) {
$plugin = $h['aname'];
2022-10-23 21:18:44 +00:00
$plugins[] = [z_root() . '/admin/addons/' . $plugin, $plugin, 'plugin'];
2021-12-02 23:02:31 +00:00
// temp plugins with admin
App::$addons_admin[] = $plugin;
2021-12-02 23:02:31 +00:00
}
}
2022-10-23 21:18:44 +00:00
$logs = [z_root() . '/admin/logs/', t('Logs'), 'logs'];
2021-12-02 23:02:31 +00:00
2022-10-24 03:39:49 +00:00
$arguments = ['links' => $aside, 'plugins' => $plugins, 'logs' => $logs];
Hook::call('admin_aside', $arguments);
2021-12-02 23:02:31 +00:00
2022-10-24 03:39:49 +00:00
return replace_macros(Theme::get_template('admin_aside.tpl'), [
'$admin' => $arguments['links'],
2021-12-02 23:02:31 +00:00
'$admtxt' => t('Admin'),
'$plugadmtxt' => t('Addon Features'),
2022-10-24 03:39:49 +00:00
'$plugins' => $arguments['plugins'],
2021-12-02 23:02:31 +00:00
'$logtxt' => t('Logs'),
2022-10-24 03:39:49 +00:00
'$logs' => $arguments['logs'],
2021-12-02 23:02:31 +00:00
'$h_pending' => t('Member registrations waiting for confirmation'),
'$admurl' => z_root() . '/admin/'
2022-10-23 21:18:44 +00:00
]);
2021-12-02 23:02:31 +00:00
}
2017-03-16 04:26:28 +00:00
}