Files
redl-gamepanel/panel/engine/main/action.php
T
redl 6ee2744e3a Сборка REDL: панель на PHP 8, капча-тумблер, закрытые уязвимости, установщики в один клик
- панель работает на PHP 8.4 (оригинал под PHP 7.0): elFinder utf8_encode, apache_get_modules, warnings
- капча выключена и управляется из админки (флаг captcha_enable + блок настроек)
- закрыты две SQL-инъекции без авторизации (createAuthLog: пароль из POST и CF-Connecting-IP)
- убрано хранение паролей в открытом виде в authlog, XSS в поле ref
- установщики install-panel.sh и install-node.sh (оригинальный затирал sources.list репозиториями Debian 9)
- современный Dockerfile (оригинальный на debian:stretch больше не собирается)
- планировщик и автозапуск работают без systemd
- брендинг REDL.IO, год 2026, ссылки на redl.io
- документация на русском: ИЗМЕНЕНИЯ, БЕЗОПАСНОСТЬ, ИНСТРУКЦИЯ
2026-07-30 02:00:01 +00:00

95 lines
2.4 KiB
PHP

<?php
/*
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
Developed by Samir Shelenko and Alexander Zemlyanoy (https://vk.com/id00v / https://vk.com/mrsasha082)
*/
class Action {
private $registry;
private $folder;
private $controller;
private $method;
private $args;
public function __construct($registry)
{
$this->registry = $registry;
}
public function make($action) {
$this->folder = null;
$this->controller = null;
$this->method = null;
$this->args = null;
$action = preg_replace("/[^\w\d\s\/]/", '', $action);
$parts = explode('/', $action);
$parts = array_filter($parts);
foreach($parts as $item) {
$fullpath = APPLICATION_DIR . 'controllers' . $this->folder . '/' . $item;
if(is_dir($fullpath)) {
$this->folder .= '/' . $item;
array_shift($parts);
continue;
}
elseif(is_file($fullpath . '.php')) {
$this->controller = $item;
array_shift($parts);
break;
} else break;
}
// Проверка папки
if(empty($this->folder)) {
$this->folder = 'errore';
}
// Проверка контроллера
if(empty($this->controller)) {
$this->controller = 'index';
}
// Получения метода
if($c = array_shift($parts)) {
$this->method = $c;
} else {
$this->method = 'index';
}
// Получение аргументов
if(isset($parts[0])) {
$this->args = $parts;
}
}
public function go($commonEnable = false) {
$controllerFile = APPLICATION_DIR . 'controllers/' . $this->folder . '/' . $this->controller . '.php';
$controllerClass = $this->controller . 'Controller';
if($this->folder != "common" || $commonEnable == true) { // Защита папки "common"
if(is_readable($controllerFile)) {
require_once($controllerFile);
$controller = new $controllerClass($this->registry);
if(is_callable(array($controller, $this->method))) {
$this->method = $this->method;
} else {
$this->method = 'index';
}
if(empty($this->args)) {
return call_user_func(array($controller, $this->method));
} else {
return call_user_func_array(array($controller, $this->method), $this->args);
}
}
}
$error = 'Ошибка: Не удалось загрузить контроллер ' . $this->controller . '!';
require_once("application/views/main/error.php");
exit();
}
}
?>