Сборка 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 - документация на русском: ИЗМЕНЕНИЯ, БЕЗОПАСНОСТЬ, ИНСТРУКЦИЯ
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/*
|
||||
Copyright (c) 2020 HOSTINPL (HOSTING-RUS) https://vk.com/hosting_rus
|
||||
Developed by Samir Shelenko (https://vk.com/id00v)
|
||||
*/
|
||||
class viewController extends Controller {
|
||||
public function index($newid = null) {
|
||||
$this->data['vk_id'] = $this->config->vk_id;
|
||||
$this->data['url'] = $this->config->url;
|
||||
if(!$this->user->isLogged()) {
|
||||
$this->response->redirect($this->config->url . 'account/login');
|
||||
}
|
||||
if($this->user->getAccessLevel() < 0) {
|
||||
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
|
||||
$this->response->redirect($this->config->url);
|
||||
}
|
||||
|
||||
$this->load->model('news');
|
||||
$this->load->model('newsMessages');
|
||||
|
||||
$error = $this->validate($newid);
|
||||
if($error) {
|
||||
$this->session->data['error'] = $error;
|
||||
$this->response->redirect($this->config->url . 'news/index');
|
||||
}
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$new = $this->newsModel->getNewsById($newid, array('users'));
|
||||
$messages = $this->newsMessagesModel->getNewsMessages(array('news_id' => $newid), array('users'));
|
||||
$this->data['new'] = $new;
|
||||
$this->data['messages'] = $messages;
|
||||
$this->data['user_img'] = $this->user->getUser_img();
|
||||
|
||||
$nq = $new['look']+1;
|
||||
$this->newsModel->updateNews($newid, array('look' => $nq));
|
||||
|
||||
$this->getChild(array('common/header', 'common/footer'));
|
||||
return $this->load->view('news/view', $this->data);
|
||||
}
|
||||
|
||||
public function ajax($newid = null) {
|
||||
$this->load->model('news');
|
||||
$this->load->model('newsMessages');
|
||||
|
||||
$error = $this->validate($newid);
|
||||
if($error) {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $error;
|
||||
return json_encode($this->data);
|
||||
}
|
||||
|
||||
if($this->request->server['REQUEST_METHOD'] == 'POST') {
|
||||
$errorPOST = $this->validatePOST($newid);
|
||||
if(!$errorPOST) {
|
||||
$text = @$this->request->post['text'];
|
||||
|
||||
$userid = $this->user->getId();
|
||||
|
||||
$messageData = array(
|
||||
'news_id' => $newid,
|
||||
'user_id' => $userid,
|
||||
'news_message' => $text
|
||||
);
|
||||
$this->newsMessagesModel->createNewsMessage($messageData);
|
||||
|
||||
$this->data['status'] = "success";
|
||||
$this->data['success'] = "Вы успешно создали коментарий!";
|
||||
} else {
|
||||
$this->data['status'] = "error";
|
||||
$this->data['error'] = $errorPOST;
|
||||
}
|
||||
}
|
||||
|
||||
return json_encode($this->data);
|
||||
}
|
||||
private function validate($newid) {
|
||||
$result = null;
|
||||
if(!$this->newsModel->getTotalNews(array('news_id' => (int)$newid))) {
|
||||
$result = "Запрашиваемая новость не существует!";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
private function validatePOST($newid) {
|
||||
$result = null;
|
||||
|
||||
$text = @$this->request->post['text'];
|
||||
if(mb_strlen($text) < 10 || mb_strlen($text) > 128) {
|
||||
$result = "Текст коментариф должен содержать от 10 до 128 символов.";
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user