mirror of
https://github.com/slawkens/myaac.git
synced 2025-04-26 09:19:22 +02:00

commit 94a61f32ae20d6b772ac90ef68ff983e1a082422 Merge: 57772569 8227303b Author: slawkens <slawkens@gmail.com> Date: Sat Nov 11 11:11:13 2023 +0100 Merge branch 'develop' into feature/debug-bar commit 577725690d177c6bb3af440e51b27a81b1723818 Author: slawkens <slawkens@gmail.com> Date: Mon Aug 21 11:08:12 2023 +0200 Add option to enable debugbar, even if dev mode is disabled commit c227fd4e9655f2dd7c1de0955f99e607c6881cbf Merge: 9fef84bf a692607c Author: slawkens <slawkens@gmail.com> Date: Mon Aug 21 10:20:04 2023 +0200 Merge branch 'develop' into feature/debug-bar commit 9fef84bffe63eb7bf0fcf68811873393164cb543 Author: slawkens <slawkens@gmail.com> Date: Fri Aug 11 06:39:50 2023 +0200 Fix debugBar mysql logs (Thanks @gpedro) commit dedd54286f6f086cb78287a5c1cd0f8cc9155984 Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:21:36 2023 +0200 Log PDO queries, as stated in docs, but doesn't work yet (don't know the reason) commit 7403a24030d75e525467dcaad937a4b14fd4ffae Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:21:20 2023 +0200 Use dev-master, cause of some bugs appearing commit cc7aec8e28c8839b2640ca9a7f62a1b4464fdbb3 Author: slawkens <slawkens@gmail.com> Date: Thu Aug 10 13:05:02 2023 +0200 Init debugBar
93 lines
2.4 KiB
PHP
93 lines
2.4 KiB
PHP
<?php
|
|
|
|
// few things we'll need
|
|
require '../common.php';
|
|
|
|
const ADMIN_PANEL = true;
|
|
const MYAAC_ADMIN = true;
|
|
|
|
if(file_exists(BASE . 'install') && (!isset($config['installed']) || !$config['installed']))
|
|
{
|
|
header('Location: ' . BASE_URL . 'install/');
|
|
throw new RuntimeException('Setup detected that <b>install/</b> directory exists. Please visit <a href="' . BASE_URL . 'install">this</a> url to start MyAAC Installation.<br/>Delete <b>install/</b> directory if you already installed MyAAC.<br/>Remember to REFRESH this page when you\'re done!');
|
|
}
|
|
|
|
$content = '';
|
|
|
|
// validate page
|
|
$page = $_GET['p'] ?? '';
|
|
if(empty($page) || preg_match("/[^a-zA-Z0-9_\-\/.]/", $page))
|
|
$page = 'dashboard';
|
|
|
|
$page = strtolower($page);
|
|
define('PAGE', $page);
|
|
|
|
require SYSTEM . 'functions.php';
|
|
require SYSTEM . 'init.php';
|
|
|
|
// verify myaac tables exists in database
|
|
if(!$db->hasTable('myaac_account_actions')) {
|
|
throw new RuntimeException('Seems that the table <strong>myaac_account_actions</strong> of MyAAC doesn\'t exist in the database. This is a fatal error. You can try to reinstall MyAAC by visiting <a href="' . BASE_URL . 'install">this</a> url.');
|
|
}
|
|
|
|
$hooks->register('debugbar_admin_head_end', HOOK_ADMIN_HEAD_END, function ($params) {
|
|
global $debugBar;
|
|
|
|
if (!isset($debugBar)) {
|
|
return;
|
|
}
|
|
|
|
$debugBarRenderer = $debugBar->getJavascriptRenderer();
|
|
echo $debugBarRenderer->renderHead();
|
|
});
|
|
$hooks->register('debugbar_admin_body_end', HOOK_ADMIN_BODY_END, function ($params) {
|
|
global $debugBar;
|
|
|
|
if (!isset($debugBar)) {
|
|
return;
|
|
}
|
|
|
|
$debugBarRenderer = $debugBar->getJavascriptRenderer();
|
|
echo $debugBarRenderer->render();
|
|
});
|
|
|
|
require SYSTEM . 'status.php';
|
|
require SYSTEM . 'login.php';
|
|
require __DIR__ . '/includes/functions.php';
|
|
|
|
$twig->addGlobal('config', $config);
|
|
$twig->addGlobal('status', $status);
|
|
|
|
if (ACTION == 'logout') {
|
|
require SYSTEM . 'logout.php';
|
|
}
|
|
|
|
// if we're not logged in - show login box
|
|
if(!$logged || !admin()) {
|
|
$page = 'login';
|
|
}
|
|
|
|
// include our page
|
|
$file = __DIR__ . '/pages/' . $page . '.php';
|
|
if(!@file_exists($file)) {
|
|
if (strpos($page, 'plugins/') !== false) {
|
|
$file = BASE . $page;
|
|
}
|
|
else {
|
|
$page = '404';
|
|
$file = SYSTEM . 'pages/404.php';
|
|
}
|
|
}
|
|
|
|
ob_start();
|
|
if($hooks->trigger(HOOK_ADMIN_BEFORE_PAGE)) {
|
|
require $file;
|
|
}
|
|
|
|
$content .= ob_get_contents();
|
|
ob_end_clean();
|
|
|
|
// template
|
|
$template_path = 'template/';
|
|
require __DIR__ . '/' . $template_path . 'template.php';
|