[*] восстановлена работа админки в обход стандартного роутинга
This commit is contained in:
1 parent
4e8ea1514e
commit
9fea80faec
5 files changed
+34
-5
No files matched your search
Generated
+8
@@ -1,4 +1,12 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
|
<component name="PhpIncludePathManager">
|
||||||
|
<include_path>
|
||||||
|
<path value="$PROJECT_DIR$/vendor/twig/twig" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||||
|
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||||
|
</include_path>
|
||||||
|
</component>
|
||||||
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
|
<component name="PhpProjectSharedConfiguration" php_language_level="7.4" />
|
||||||
</project>
|
</project>
|
||||||
+4
-4
@@ -30,7 +30,6 @@
|
|||||||
require_once __DIR__ . '/config.php';
|
require_once __DIR__ . '/config.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Реализация механизма автозагрузки классов
|
* Реализация механизма автозагрузки классов
|
||||||
*/
|
*/
|
||||||
@@ -50,8 +49,7 @@
|
|||||||
* Инициализация шаблонизатора
|
* Инициализация шаблонизатора
|
||||||
*/
|
*/
|
||||||
$loader = new \Twig\Loader\FilesystemLoader(PATH_TO_TEMPLATES);
|
$loader = new \Twig\Loader\FilesystemLoader(PATH_TO_TEMPLATES);
|
||||||
$twig = new \Twig\Environment($loader, [
|
$twig = new \Twig\Environment($loader, [//'cache' => CACHE_DIR,
|
||||||
//'cache' => CACHE_DIR,
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Cache::init(CACHE_DIR, USE_CACHE);
|
Cache::init(CACHE_DIR, USE_CACHE);
|
||||||
@@ -82,7 +80,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Запускаем маршрутизатор
|
* Запускаем маршрутизатор если не сказано иного
|
||||||
*/
|
*/
|
||||||
|
if (defined('USE_ROUTER') && USE_ROUTER === true) {
|
||||||
Router::execute();
|
Router::execute();
|
||||||
die();
|
die();
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Класс административной панели
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Core;
|
||||||
|
|
||||||
|
class Panel
|
||||||
|
{
|
||||||
|
public static function index()
|
||||||
|
{
|
||||||
|
global $twig;
|
||||||
|
$navbarItems = [
|
||||||
|
['name' => 'Главная', 'url' => '/', 'active' => true],
|
||||||
|
['name' => 'Админка', 'url' => '/admin', 'active' => false],
|
||||||
|
['name' => 'Командная PHP строка', 'url' => '/phpcmd.php', 'active' => false],
|
||||||
|
['name' => 'Тест', 'url' => '/test', 'active' => false],
|
||||||
|
];
|
||||||
|
echo $twig->render('admin/index.twig', ['navbarItems' => $navbarItems, 'name' => 'Roman Grinko']);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Core\Models\Router;
|
use Core\Models\Router;
|
||||||
|
|
||||||
Router::route('/', '\Core\App::index');
|
Router::route('/', '\Core\App::index');
|
||||||
|
|
||||||
Router::route('/404', function () {
|
Router::route('/404', function () {
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
use Core\Models\{User, DB, Roles};
|
use Core\Models\{User, DB, Roles};
|
||||||
use Core\Helpers\{SystemFunctions, Cache, Log, Mail, Zip, Pagination, Files};
|
use Core\Helpers\{SystemFunctions, Cache, Log, Mail, Zip, Pagination, Files};
|
||||||
|
|
||||||
|
const USE_ROUTER = true;
|
||||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
|
|||||||
Reference in new issue
Block a user