mirror of
https://github.com/fruithost/Panel.git
synced 2026-11-30 12:25:25 +09:00
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
namespace fruithost;
|
|
|
|
use fruithost\Encryption;
|
|
use fruithost\Auth;
|
|
use fruithost\Database;
|
|
use fruithost\Response;
|
|
use fruithost\ModuleInterface;
|
|
|
|
class CoreAdmin extends ModuleInterface {
|
|
public function init() {
|
|
$this->getCore()->getHooks()->runAction('core_admin_pre_init');
|
|
|
|
$this->addModal((new Modal('confirmation', I18N::get('Confirmation'), NULL))->addButton([
|
|
(new Button())->setName('cancel')->setLabel(I18N::get('No'))->addClass('btn-outline-danger')->setDismissable(),
|
|
(new Button())->setName('create')->setLabel(I18N::get('Yes'))->addClass('btn-outline-success')
|
|
])->onSave(function(array $data = []) : string {
|
|
// @ToDo Check permissions?
|
|
return 'CONFIRMED';
|
|
}));
|
|
|
|
$this->getRouter()->addRoute('/admin', function() {
|
|
if(!Auth::isLoggedIn()) {
|
|
Response::redirect('/');
|
|
}
|
|
|
|
$this->getTemplate()->display('admin');
|
|
});
|
|
|
|
$this->getRouter()->addRoute('^/admin(?:(?:/([a-zA-Z0-9\-_]+)?)(?:/([a-zA-Z0-9\-_]+)(?:/([a-zA-Z0-9\-_]+))?)?)?$', function($destination = null, $tab = NULL, $action = NULL) {
|
|
if(!Auth::isLoggedIn()) {
|
|
Response::redirect('/');
|
|
}
|
|
|
|
$this->getTemplate()->display('admin' . (!empty($destination) ? sprintf('/%s', $destination) : ''), [
|
|
'tab' => $tab,
|
|
'action' => $action
|
|
]);
|
|
});
|
|
|
|
$this->getRouter()->addRoute('^/server(?:/([a-zA-Z0-9\-_]+))(?:/([a-zA-Z0-9\-_]+))?$', function($destination = null, $tab = NULL) {
|
|
if(!Auth::isLoggedIn()) {
|
|
Response::redirect('/');
|
|
}
|
|
|
|
$this->getTemplate()->display('server' . (!empty($destination) ? sprintf('/%s', $destination) : ''), [
|
|
'tab' => $tab
|
|
]);
|
|
});
|
|
}
|
|
}
|
|
?>
|