Сборка 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:
2026-07-30 02:00:01 +00:00
commit 6ee2744e3a
492 changed files with 354172 additions and 0 deletions
@@ -0,0 +1,29 @@
<?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 indexController extends Controller {
public function index($page = 1) {
$this->document->setActiveSection('admin/checksys');
$this->document->setActiveItem('index');
$this->data['token'] = $this->config->token;
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->data['user_access_level'] = $this->user->getAccessLevel();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/checksys/index', $this->data);
}
}
?>
@@ -0,0 +1,72 @@
<?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 indexController extends Controller {
public function index($userid = null) {
$this->document->setActiveSection('admin/emailinfo');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/emailinfo/index', $this->data);
}
public function ajax($userid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('users');
$this->load->library('mail');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$text = @$this->request->post['text'];
$data=$this->usersModel->getUsers();
foreach($data as $tmp){
$email=$tmp['user_email'];
$firstname=$tmp['user_firstname'];
$lastname=$tmp['user_lastname'];
$mailLib = new mailLibrary();
$mailLib->setFrom($this->config->mail_from);
$mailLib->setSender($this->config->mail_sender);
$mailLib->setTo($email);
$mailLib->setSubject('Обратите внимание!');
$mailData = array();
$mailData['firstname'] = $firstname;
$mailData['lastname'] = $lastname;
$mailData['text'] = $text;
$texts = $this->load->view('mail/info/users', $mailData);
$mailLib->setText($texts);
$mailLib->send();
}
$this->data['status'] = "success";
$this->data['success'] = "Рассылка успешно завершенна.";
} else {
$this->data['status'] = "error";
$this->data['error'] = "Не POST данные";
}
return json_encode($this->data);
}
}
?>
@@ -0,0 +1,140 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/games');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->data['queryDrivers'] = $this->getQueryDrivers();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/games/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('games');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$code = @$this->request->post['code'];
$query = @$this->request->post['query'];
$minslots = @$this->request->post['minslots'];
$maxslots = @$this->request->post['maxslots'];
$minport = @$this->request->post['minport'];
$maxport = @$this->request->post['maxport'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$cpu = @$this->request->post['cores'];
$ram = @$this->request->post['ram'];
$ssd = @$this->request->post['ssd'];
$gameData = array(
'game_name' => $name,
'game_code' => $code,
'game_query' => $query,
'game_min_slots' => (int)$minslots,
'game_max_slots' => (int)$maxslots,
'game_min_port' => (int)$minport,
'game_max_port' => (int)$maxport,
'game_price' => (float)$price,
'game_status' => (int)$status,
'game_ram' => (int)$ram,
'game_cores' => (float)$cpu,
'game_ssd' => (int)$ssd
);
$this->gamesModel->createGame($gameData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали игру!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$code = @$this->request->post['code'];
$query = @$this->request->post['query'];
$minslots = @$this->request->post['minslots'];
$maxslots = @$this->request->post['maxslots'];
$minport = @$this->request->post['minport'];
$maxport = @$this->request->post['maxport'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$cpu = @$this->request->post['cores'];
$ram = @$this->request->post['ram'];
$ssd = @$this->request->post['ssd'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 92) {
$result = "Название игры должно содержать от 2 до 92 символов!";
}
elseif(mb_strlen($code) < 2 || mb_strlen($code) > 8) {
$result = "Код игры должен содержать от 2 до 8 символов!";
}
elseif(!in_array($query, $this->getQueryDrivers())) {
$result = "Укажите допустимый Query-драйвер.";
}
elseif(!$validateLib->money($price)) {
$result = "Укажите допустимую стоимость!";
}
elseif(!$validateLib->money($cpu)) {
$result = "Укажите допустимое количество ядер!";
}
elseif(!$validateLib->money($ram)) {
$result = "Укажите допустимый объем оперативной памяти!";
}
elseif(!$validateLib->money($ssd)) {
$result = "Укажите допустимую объем жесткого диска!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
function getQueryDrivers() {
$result = array();
$drivers = glob(ENGINE_DIR . 'libs/query/*.driver.php');
foreach ($drivers as $filename) {
$result[] = basename($filename, ".driver.php");
}
return $result;
}
}
?>
@@ -0,0 +1,204 @@
<?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 editController extends Controller {
public function index($gameid = null) {
$this->document->setActiveSection('admin/games');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('games');
$error = $this->validate($gameid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/games/index');
}
$game = $this->gamesModel->getGameById($gameid);
$this->data['game'] = $game;
$this->data['queryDrivers'] = $this->getQueryDrivers();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/games/edit', $this->data);
}
public function ajax($gameid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('games');
$error = $this->validate($gameid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$code = @$this->request->post['code'];
$query = @$this->request->post['query'];
$minslots = @$this->request->post['minslots'];
$maxslots = @$this->request->post['maxslots'];
$minport = @$this->request->post['minport'];
$maxport = @$this->request->post['maxport'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$cpu = @$this->request->post['cores'];
$ram = @$this->request->post['ram'];
$ssd = @$this->request->post['ssd'];
$gameData = array(
'game_name' => $name,
'game_code' => $code,
'game_query' => $query,
'game_min_slots' => (int)$minslots,
'game_max_slots' => (int)$maxslots,
'game_min_port' => (int)$minport,
'game_max_port' => (int)$maxport,
'game_price' => (float)$price,
'game_status' => (int)$status,
'game_ram' => (int)$ram,
'game_cores' => (float)$cpu,
'game_ssd' => (int)$ssd
);
$this->gamesModel->updateGame($gameid, $gameData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали информацию об игре!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($gameid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('games');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('games');
$error = $this->validate($gameid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/games/index');
}
$this->gamesModel->deleteGame($gameid);
$this->session->data['success'] = "Вы успешно удалили игру!";
$this->response->redirect($this->config->url . 'admin/games/index');
return null;
}
private function validate($gameid) {
$result = null;
if(!$this->gamesModel->getTotalGames(array('game_id' => (int)$gameid))) {
$result = "Запрашиваемая игра не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$code = @$this->request->post['code'];
$query = @$this->request->post['query'];
$minslots = @$this->request->post['minslots'];
$maxslots = @$this->request->post['maxslots'];
$minport = @$this->request->post['minport'];
$maxport = @$this->request->post['maxport'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$cpu = @$this->request->post['cores'];
$ram = @$this->request->post['ram'];
$ssd = @$this->request->post['ssd'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 92) {
$result = "Название игры должно содержать от 2 до 92 символов!";
}
elseif(mb_strlen($code) < 2 || mb_strlen($code) > 8) {
$result = "Код игры должен содержать от 2 до 8 символов!";
}
elseif(!in_array($query, $this->getQueryDrivers())) {
$result = "Укажите допустимый Query-драйвер.";
}
elseif($maxslots < $minslots)
{
$result = "Укажите допустимый интервал слотов.";
}
elseif($maxport < $minport)
{
$result = "Укажите допустимый интервал портов.";
}
elseif(!$validateLib->money($price)) {
$result = "Укажите допустимую стоимость!";
}
elseif(!$validateLib->money($cpu)) {
$result = "Укажите допустимое количество ядер!";
}
elseif(!$validateLib->money($ram)) {
$result = "Укажите допустимый объем оперативной памяти!";
}
elseif(!$validateLib->money($ssd)) {
$result = "Укажите допустимую объем жесткого диска!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
function getQueryDrivers() {
$result = array();
$drivers = glob(ENGINE_DIR . 'libs/query/*.driver.php');
foreach ($drivers as $filename) {
$result[] = basename($filename, ".driver.php");
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/games');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('games');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->gamesModel->getTotalGames();
$games = $this->gamesModel->getGames(array(), array(), $options);
$paginationUrl = '/admin/games/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['games'] = $games;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/games/index', $this->data);
}
}
?>
@@ -0,0 +1,62 @@
<?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 indexController extends Controller {
public function index() {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$getlvl = $this->user->getAccessLevel();
$this->data['getlvl'] = $getlvl;
$this->load->model('servers');
$this->load->model('tickets');
$this->load->model('users');
$this->load->model('invoices');
$this->load->model('waste');
$userid = $this->user->getId();
$options = array(
'start' => 0,
'limit' => 50000
);
$tickets = $this->ticketsModel->getTickets(array(), array('users'), array(), array());
$this->data['tickets'] = $tickets;
$tservers = $this->serversModel->getServers(array(), array('games', 'locations'), array(), array());
$this->data['tservers'] = $tservers;
$invoices = $this->invoicesModel->getInvoices(array(), array('users'), array(), $options);
$this->data['invoices'] = $invoices;
$users = $this->usersModel->getUsers(array(), array(), $options);
$this->data['users'] = $users;
$hostin = array(
'waste_date_add' => 'DESC'
);
$pl = array(
'start' => 0,
'limit' => 10
);
$waste = $this->wasteModel->getWaste(array(), array('users'), $hostin, $pl);
$this->data['waste'] = $waste;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/index', $this->data);
}
}
?>
@@ -0,0 +1,53 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/infobox');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('mail');
$getData = array();
$getSort = array(
'status' => 'DESC',
'inbox_date_add' => 'DESC'
);
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->mailModel->getTotalInbox($getData);
$this->data['mail'] = $this->mailModel->getInboxs($getData, $getSort, $getOptions);
$paginationUrl = '/admin/infobox/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/infobox/index', $this->data);
}
}
?>
@@ -0,0 +1,91 @@
<?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 sendController extends Controller {
public function index($id = null) {
$this->document->setActiveSection('admin/infobox');
$this->document->setActiveItem('send');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('mail');
$this->data['mail'] = $this->mailModel->getInboxById($id);
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/infobox/send', $this->data);
}
public function sendMForm($id = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('mail');
$this->load->library('mail');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
if(@$this->request->post['msg'] == ""){
$this->data['status'] = "error";
$this->data['error'] = "Введите текст ответа!";
}elseif(@$this->request->post['msg'] != ""){
$text = @$this->request->post['msg'];
$dell = @$this->request->post['dell'];
$data = $this->mailModel->getInboxById($id);
$email = $data['user_email'];
$firstname = $data['user_firstname'];
$lastname = $data['user_lastname'];
$mailLib = new mailLibrary();
$mailLib->setFrom($this->config->mail_from);
$mailLib->setSender($this->config->mail_sender);
$mailLib->setTo($email);
$mailLib->setSubject('Ответ на ваше сообщение');
$mailData = array();
$mailData['firstname'] = $firstname;
$mailData['lastname'] = $lastname;
$mailData['text'] = $text;
$texts = $this->load->view('mail/infobox/user', $mailData);
$mailLib->setText($texts);
$mailLib->send();
if($dell) {
$this->mailModel->deleteInbox($id);
$this->data['status'] = "success";
$this->data['success'] = "Сообщение отправлено, и удалено!";
} else {
$this->mailModel->updateInbox($id, array('status' => 0));
$this->data['status'] = "success";
$this->data['success'] = "Сообщение отправлено!";
}
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Не POST данные";
}
return json_encode($this->data);
}
}
?>
@@ -0,0 +1,59 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/invoices');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('invoices');
$userid = @$this->request->get['userid'];
$getData = array();
if(!empty($userid)) {
$getData['invoices.user_id'] = (int)$userid;
}
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->invoicesModel->getTotalInvoices($getData);
$invoices = $this->invoicesModel->getInvoices($getData, array('users'), array(), $getOptions);
$paginationUrl = '/admin/invoices/index/index/{page}';
if(!empty($userid)) {
$paginationUrl .= '&userid=' . $userid;
}
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['invoices'] = $invoices;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/invoices/index', $this->data);
}
}
?>
@@ -0,0 +1,110 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/locations');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/locations/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('locations');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$ip2 = @$this->request->post['ip2'];
$user = @$this->request->post['user'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
$locationData = array(
'location_name' => $name,
'location_ip' => $ip,
'location_ip2' => $ip2,
'location_user' => $user,
'location_password' => $password,
'location_status' => (int)$status
);
$this->locationsModel->createLocation($locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали локацию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$ip2 = @$this->request->post['ip2'];
$user = @$this->request->post['user'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название локации должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->ip($ip)) {
$result = "Укажите допустимый IP!";
}
elseif(!$validateLib->ip($ip2)) {
$result = "Укажите допустимый IP!";
}
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,171 @@
<?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 editController extends Controller {
public function index($locationid = null) {
$this->document->setActiveSection('admin/locations');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('locations');
$error = $this->validate($locationid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/locations/index');
}
$location = $this->locationsModel->getLocationById($locationid);
$this->data['location'] = $location;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/locations/edit', $this->data);
}
public function ajax($locationid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('locations');
$error = $this->validate($locationid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$ip2 = @$this->request->post['ip2'];
$user = @$this->request->post['user'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$editpassword = @$this->request->post['editpassword'];
$status = @$this->request->post['status'];
$location_games = @$this->request->post['location_games'];
$locationData = array(
'location_name' => $name,
'location_ip' => $ip,
'location_ip2' => $ip2,
'location_user' => $user,
'location_status' => (int)$status,
'location_games' => $location_games
);
if($editpassword) {
$locationData['location_password'] = $password;
}
$this->locationsModel->updateLocation($locationid, $locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали локацию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($locationid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('locations');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('locations');
$error = $this->validate($locationid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/locations/index');
}
$this->locationsModel->deleteLocation($locationid);
$this->session->data['success'] = "Вы успешно удалили локацию!";
$this->response->redirect($this->config->url . 'admin/locations/index');
return null;
}
private function validate($locationid) {
$result = null;
if(!$this->locationsModel->getTotalLocations(array('location_id' => (int)$locationid))) {
$result = "Запрашиваемая локация не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$user = @$this->request->post['user'];
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название локации должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->ip($ip)) {
$result = "Укажите допустимый IP!";
}
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
}
elseif($editpassword) {
if(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/locations');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('locations');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->locationsModel->getTotalLocations();
$locations = $this->locationsModel->getLocations(array(), array(), $options);
$paginationUrl = '/admin/locations/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['locations'] = $locations;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/locations/index', $this->data);
}
}
?>
@@ -0,0 +1,117 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/mods');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('games');
$options = array(
'start' => 0,
'limit' => $this->limit
);
$games = $this->gamesModel->getGames(array(), array(), $options);
$this->data['games'] = $games;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/mods/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$arch = @$this->request->post['arch'];
$textx = @$this->request->post['textx'];
$img = @$this->request->post['img'];
$status = @$this->request->post['status'];
$price = @$this->request->post['price'];
$uploaddir = (TMP_DIR . 'mods/');
$apend = $_FILES['userfile']['name'];
$uploadfile = "$uploaddir$apend";
if($_FILES['userfile']['size'] > 1024*90*1024) {
$this->data['error'] = 'Размер файла не должен превышать 90МБ';
$this->data['status'] = "error";
}
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile))
$dir = "".$this->config->url."tmp/mods/".$apend."";
$modsData = array(
'game_id' => $gameid,
'mod_name' => $name,
'mod_url' => $dir,
'mod_status' => (int)$status,
'mod_textx' => $textx,
'mod_img' => $img,
'mod_arch' => $apend,
'mod_price' => $price
);
$this->serversModel->createMod($modsData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали мод!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$arch = @$this->request->post['arch'];
$status = @$this->request->post['status'];
$textx = @$this->request->post['textx'];
$price = @$this->request->post['price'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название мода должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($textx) < 2 || mb_strlen($textx) > 500) {
$result = "Описание должно содержать от 2 до 500 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
elseif(0 > $price || $price > 5000) {
$result = "Укажите сумму от 0 до 5000 рублей!";
}
return $result;
}
}
?>
@@ -0,0 +1,162 @@
<?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 editController extends Controller {
public function index($modid = null) {
$this->document->setActiveSection('admin/mods');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$error = $this->validate($modid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/mods/index');
}
$mod = $this->serversModel->getModById($modid);
$this->data['mod'] = $mod;
$this->load->model('games');
$options = array(
'start' => 0,
'limit' => $this->limit
);
$games = $this->gamesModel->getGames(array(), array(), $options);
$this->data['games'] = $games;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/mods/edit', $this->data);
}
public function ajax($modid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
$error = $this->validate($modid);
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();
if(!$errorPOST) {
$gameid = @$this->request->post['gameid'];
$name = @$this->request->post['name'];
$url = @$this->request->post['url'];
$status = @$this->request->post['status'];
$textx = @$this->request->post['textx'];
$img = @$this->request->post['img'];
$arch = @$this->request->post['arch'];
$price = @$this->request->post['price'];
$modsData = array(
'game_id' => $gameid,
'mod_name' => $name,
'mod_url' => $url,
'mod_status' => (int)$status,
'mod_textx' => $textx,
'mod_img' => $img,
'mod_arch' => $arch,
'mod_price' => $price
);
$this->serversModel->updateMod($modid, $modsData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали мод!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($modid = null) {
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$error = $this->validate($modid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/mods/index');
}
$this->serversModel->deleteMod($modid);
$this->session->data['success'] = "Вы успешно удалили мод!";
$this->response->redirect($this->config->url . 'admin/mods/index');
return null;
}
private function validate($modid) {
$result = null;
if(!$this->serversModel->getTotalMods(array('mod_id' => (int)$modid))) {
$result = "Запрашиваемый мод не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$gameid = @$this->request->post['gameid'];
$url = @$this->request->post['url'];
$arch = @$this->request->post['arch'];
$name = @$this->request->post['name'];
$status = @$this->request->post['status'];
$textx = @$this->request->post['textx'];
$img = @$this->request->post['img'];
$price = @$this->request->post['price'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название мода должно содержать от 2 до 32 символов!";
}
elseif(0 > $price || $price > 5000) {
$result = "Укажите сумму от 0 до 5000 рублей!";
}
elseif(mb_strlen($textx) < 2 || mb_strlen($textx) > 500) {
$result = "Описание должно содержать от 2 до 500 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/mods');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('servers');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->serversModel->getTotalMods();
$mods = $this->serversModel->getMods(array(),array('games'),array(), $options);
$paginationUrl = '/admin/mods/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['mods'] = $mods;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/mods/index', $this->data);
}
}
?>
@@ -0,0 +1,79 @@
<?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 createController extends Controller {
public function index($ticketid = null) {
$this->document->setActiveSection('admin/news');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/news/create', $this->data);
}
public function ajax($ticketid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('news');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$text = @$this->request->post['text'];
$userid = $this->user->getId();
$newsData = array(
'user_id' => $userid,
'news_title' => $name,
'news_text' => $text
);
$newsid = $this->newsModel->createNews($newsData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали новость!";
$this->data['id'] = $newsid;
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$result = null;
$name = @$this->request->post['name'];
$text = @$this->request->post['text'];
if(mb_strlen($name) < 6 || mb_strlen($name) > 100) {
$result = "Название новости должно содержать от 2 до 100 символов!";
}
elseif(mb_strlen($text) < 10 || mb_strlen($text) > 1000) {
$result = "Текст новости должен содержать от 2 до 1000 символов!";
}
return $result;
}
}
@@ -0,0 +1,135 @@
<?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 editController extends Controller {
public function index($newid = null) {
$this->document->setActiveSection('admin/news');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('news');
$error = $this->validate($newid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/news/index');
}
$new = $this->newsModel->getNewsById($newid);
$this->data['new'] = $new;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/news/edit', $this->data);
}
public function ajax($newid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('news');
$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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$text = @$this->request->post['text'];
$locationData = array(
'news_title' => $name,
'news_text' => $text
);
$this->newsModel->updateNews($newid, $locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали новость!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($newid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('locations');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('news');
$error = $this->validate($newid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/news/index');
}
$this->newsModel->deleteNews($newid);
$this->session->data['success'] = "Вы успешно удалили новость!";
$this->response->redirect($this->config->url . 'admin/news/index');
return null;
}
private function validate($newid) {
$result = null;
if(!$this->newsModel->getTotalNews(array('news_id' => (int)$newid))) {
$result = "Запрашиваемая новость не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$text = @$this->request->post['text'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 100) {
$result = "Текст должен содержать от 2 до 100 символов!";
}
if(mb_strlen($text) < 2 || mb_strlen($text) > 1000) {
$result = "Текст должен содержать от 2 до 1000 символов!";
}
return $result;
}
}
?>
@@ -0,0 +1,49 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/news');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('news');
$sort = array(
'news_date_add' => 'DESC'
);
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->newsModel->getTotalNews();
$news = $this->newsModel->getNews(array(), array('users'), $sort, $options);
$paginationUrl = '/admin/news/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['news'] = $news;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/news/index', $this->data);
}
}
?>
@@ -0,0 +1,86 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/promo');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/promo/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('promos');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$cod = @$this->request->post['cod'];
$uses = @$this->request->post['uses'];
$skidka = @$this->request->post['skidka'];
$locationData = array(
'cod' => $cod,
'uses' => $uses,
'used' => 0,
'skidka' => (int)$skidka
);
$this->promosModel->createPromo($locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали промо-Код!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$cod = @$this->request->post['cod'];
$uses = @$this->request->post['uses'];
$skidka = @$this->request->post['skidka'];
if(mb_strlen($cod) < 2 || mb_strlen($cod) > 32) {
$result = "Код должен содержать от 2 до 32 символов!";
}
elseif(mb_strlen($uses) < 1 || mb_strlen($uses) > 10000) {
$result = "Введите количество использований от 1 до 10000!";
}
return $result;
}
}
?>
@@ -0,0 +1,142 @@
<?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 editController extends Controller {
public function index($promoid = null) {
$this->document->setActiveSection('admin/promo');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('promos');
$error = $this->validate($promoid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/promo/index');
}
$promo= $this->promosModel->getpromoById($promoid);
$this->data['promo'] = $promo;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/promo/edit', $this->data);
}
public function ajax($promoid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('promos');
$error = $this->validate($promoid);
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();
if(!$errorPOST) {
$cod = @$this->request->post['cod'];
$uses = @$this->request->post['uses'];
$skidka = @$this->request->post['skidka'];
$locationData = array(
'cod' => $cod,
'uses' => $uses,
'skidka' => (int)$skidka
);
$this->promosModel->updatepromo($promoid, $locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали промо-код!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($promoid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('locations');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('promos');
$error = $this->validate($promoid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/promo/index');
}
$this->promosModel->deletepromo($promoid);
$this->session->data['success'] = "Вы успешно удалили промо-код!";
$this->response->redirect($this->config->url . 'admin/promo/index');
return null;
}
private function validate($promoid) {
$result = null;
if(!$this->promosModel->getTotalpromo(array('id' => (int)$promoid))) {
$result = "Запрашиваемый код не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$cod = @$this->request->post['cod'];
$uses = @$this->request->post['uses'];
$skidka = @$this->request->post['skidka'];
if(mb_strlen($cod) < 2 || mb_strlen($cod) > 32) {
$result = "Код должен содержать от 2 до 32 символов!";
}
elseif(mb_strlen($uses) < 1 || mb_strlen($uses) > 10000) {
$result = "Введите количество использований от 1 до 10000!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/promo');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('promos');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->promosModel->getTotalpromo();
$promos = $this->promosModel->getpromo(array(), array(), $options);
$paginationUrl = '/admin/promo/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['promos'] = $promos;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/promo/index', $this->data);
}
}
?>
@@ -0,0 +1,104 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/repo');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('games');
$options = array(
'start' => 0,
'limit' => $this->limit
);
$games = $this->gamesModel->getGames(array(), array(), $options);
$this->data['games'] = $games;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/repo/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$url = @$this->request->post['url'];
$textx = @$this->request->post['textx'];
$img = @$this->request->post['img'];
$status = @$this->request->post['status'];
$price = @$this->request->post['price'];
$repoData = array(
'game_id' => $gameid,
'repo_name' => $name,
'repo_url' => $url,
'repo_status' => (int)$status,
'repo_textx' => $textx,
'repo_img' => $img,
'repo_price' => $price
);
$this->serversModel->createRepo($repoData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно добавили файл в репозиторий!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$status = @$this->request->post['status'];
$textx = @$this->request->post['textx'];
$price = @$this->request->post['price'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название файла должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($textx) < 2 || mb_strlen($textx) > 500) {
$result = "Описание должно содержать от 2 до 500 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
elseif(0 > $price || $price > 5000) {
$result = "Укажите сумму от 0 до 5000 рублей!";
}
return $result;
}
}
?>
@@ -0,0 +1,157 @@
<?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 editController extends Controller {
public function index($repoid = null) {
$this->document->setActiveSection('admin/repo');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$error = $this->validate($repoid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/repo/index');
}
$repo = $this->serversModel->getRepoById($repoid);
$this->data['repo'] = $repo;
$this->load->model('games');
$options = array(
'start' => 0,
'limit' => $this->limit
);
$games = $this->gamesModel->getGames(array(), array(), $options);
$this->data['games'] = $games;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/repo/edit', $this->data);
}
public function ajax($repoid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
$error = $this->validate($repoid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$url = @$this->request->post['url'];
$textx = @$this->request->post['textx'];
$img = @$this->request->post['img'];
$status = @$this->request->post['status'];
$price = @$this->request->post['price'];
$repoData = array(
'game_id' => $gameid,
'repo_name' => $name,
'repo_url' => $url,
'repo_status' => (int)$status,
'repo_textx' => $textx,
'repo_img' => $img,
'repo_price' => $price
);
$this->serversModel->updateRepo($repoid, $repoData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали файл в репозитории!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($repoid = null) {
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$error = $this->validate($repoid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/repo/index');
}
$this->serversModel->deleteRepo($repoid);
$this->session->data['success'] = "Вы успешно удалили файл с репозитория!";
$this->response->redirect($this->config->url . 'admin/repo/index');
return null;
}
private function validate($repoid) {
$result = null;
if(!$this->serversModel->getTotalRepos(array('repo_id' => (int)$repoid))) {
$result = "Запрашиваемый файл не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$gameid = @$this->request->post['gameid'];
$status = @$this->request->post['status'];
$textx = @$this->request->post['textx'];
$price = @$this->request->post['price'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название файла должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($textx) < 2 || mb_strlen($textx) > 500) {
$result = "Описание должно содержать от 2 до 500 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
elseif(0 > $price || $price > 5000) {
$result = "Укажите сумму от 0 до 5000 рублей!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/repo');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('servers');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->serversModel->getTotalRepos();
$repo = $this->serversModel->getRepos(array(),array('games'),array(), $options);
$paginationUrl = '/admin/repo/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['repo'] = $repo;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/repo/index', $this->data);
}
}
?>
@@ -0,0 +1,687 @@
<?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 controlController extends Controller {
public function index($serverid = null) {
$this->document->setActiveSection('admin/servers');
$this->document->setActiveItem('control');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('query');
$this->load->model('servers');
$error = $this->validate($serverid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/servers/index');
}
$server = $this->serversModel->getServerById($serverid, array('users', 'games', 'locations'));
$this->data['server'] = $server;
if($server['server_status'] == 2) {
$queryLib = new queryLibrary($server['game_query']);
$queryLib->connect($server['location_ip'], $server['server_port']);
$query = $queryLib->getInfo();
$queryLib->disconnect();
$this->data['query'] = $query;
}
if($server['server_status'] == 1 AND $server['game_code'] == "cs" || $server['game_code'] == "css" || $server['game_code'] == "csgo") {
if($server["game_code"] == "cs") {
$fps = array("300", "500", "1100");
$this->data["fps"] = $fps;
}
if($server["game_code"] == "csgo") {
$tickrate = array("64", "128");
$this->data["tickrate"] = $tickrate;
}
if($server["game_code"] == "css") {
$tickrate = array("66", "100");
$this->data["tickrate"] = $tickrate;
}
}
$stats = $this->serversModel->getServerStats($serverid, "NOW() - INTERVAL 1 DAY", "NOW()");
$this->data['stats'] = $stats;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/servers/control', $this->data);
}
public function actionserver($serverid = null, $actionserver = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->library('mail');
$this->load->library('ssh2');
$this->load->model('servers');
$error = $this->validate($serverid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
$server = $this->serversModel->getServerById($serverid, array('users', 'locations', 'games'));
if($server['server_status'] == 3) {
$this->data["status"] = "error";
$this->data["error"] = "Идет установка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 4) {
$this->data["status"] = "error";
$this->data["error"] = "Идет переустановка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 5) {
$this->data["status"] = "error";
$this->data["error"] = "Идет создание BackUP сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 6) {
$this->data["status"] = "error";
$this->data["error"] = "Идет восстанновление сервера из BackUP!";
return json_encode($this->data);
} else if($server['server_status'] == 7) {
$this->data["status"] = "error";
$this->data["error"] = "Идет обновление сервера!";
return json_encode($this->data);
} else if($actionserver == "start" || $actionserver == "stop" || $actionserver == "restart" || $actionserver == "backup" || $actionserver == "unbackup") {
if($server["server_status"] == 0) {
$this->data["status"] = "error";
$this->data["error"] = "Сервер заблокирован!";
return json_encode($this->data);
}
}
switch($actionserver) {
case "start": {
if($server["server_status"] == 1) {
$stats = $this->serversModel->getHDD($server['server_id']);
if((int)$stats < $server['game_ssd']) {
$result = $this->serversModel->action($serverid, 'start');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'enable', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array("server_status" => 2));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешный запуск сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно запустили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Вы привысили ограничение размера директории на ". round($stats - $server['game_ssd'], 2) ."МБ, запуск сервера невозможен!";
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть выключен!";
}
break;
}
case "reinstall": {
if($server["server_status"] == 1) {
$logData = array(
'server_id' => $serverid,
'reason' => 'Сервер успешно поставлен на переустановку!',
'status' => 2
);
$this->serversModel->createLog($logData);
$this->serversModel->updateServer($serverid, array('server_status' => 4, 'server_work' => 0));
$this->data["status"] = "success";
$this->data["success"] = "Сервер успешно поставлен на переустановку!";
} else {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть выключен!";
}
break;
}
case "restart": {
if($server["server_status"] == 2) {
$stats = $this->serversModel->getHDD($server['server_id']);
if((int)$stats < $server['game_ssd']) {
$result = $this->serversModel->action($serverid, 'restart');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешный перезапуск сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно перезапустили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$result = $this->serversModel->action($serverid, 'stop');
if($result['status'] == "success") {
$this->serversModel->updateServer($serverid, array('server_status' => 1));
$this->data["status"] = "error";
$this->data["error"] = "Вы привысили ограничение размера директории на ". round($stats - $server['game_ssd'], 2) ."МБ, перезагрузка сервера невозможна!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
}
} else if($server["server_status"] == 2) {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть включен!";
}
break;
}
case "stop": {
if($server["server_status"] == 2) {
$result = $this->serversModel->action($serverid, 'stop');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'disable', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array("server_status" => 1, 'server_work' => 0));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешное выключение сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно выключили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть вылючен!";
}
break;
}
case 'backup': {
if($server['server_status'] == 1) {
$stats = $this->serversModel->getHDD($server['server_id']);
if((int)$stats < $server['game_ssd']) {
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'enable', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'disable', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array('server_status' => 5, 'server_work' => 0));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешное начало создания BackUP сервера.',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно начали создание BackUP сервера!";
} else {
$this->data["status"] = "error";
$this->data["error"] = "Вы привысили ограничение размера директории на ". round($stats - $server['game_ssd'], 2) ."МБ, создание бекапа сервера невозможено!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
break;
}
case 'unbackup': {
if($server['server_status'] == 1) {
if (file_exists('ssh2.sftp://'.$server['location_user'].':'.$server['location_password'].'@'.$server['location_ip'].':22/home/cp/backups/gs'.$serverid.'.tar')) {
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'enable', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'disable', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array('server_status' => 6, 'server_work' => 0));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешное начало восстановление BackUP сервера.',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно восстановили BackUP сервера!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "У сервера нет BackUP!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
break;
}
case 'delete_backup': {
if($server['server_status'] == 1) {
if (file_exists('ssh2.sftp://'.$server['location_user'].':'.$server['location_password'].'@'.$server['location_ip'].':22/home/cp/backups/gs'.$serverid.'.tar')) {
$result = $this->serversModel->action($serverid, 'delete_backup');
if($result["status"] == "success") {
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешное удаление BackUP сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно удалили BackUP сервера!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "У сервера нет BackUP!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
break;
}
case 'block': {
if($server['server_status'] == 1) {
$this->serversModel->updateServer($serverid, array('server_status' => 0));
$this->serversModel->action($serverid, "block");
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно заблокировали сервер!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
break;
}
case 'delete': {
if($server['server_status'] == 1) {
if($this->user->getAccessLevel() == 3){
$mailLib = new mailLibrary();
$mailLib->setFrom($this->config->mail_from);
$mailLib->setSender($this->config->mail_sender);
$result = $this->serversModel->action($serverid, 'delete');
if($result['status'] == "success") {
if($server['server_mysql'] == 1 || $server['server_mysql'] == 2) {
$this->serversModel->action($serverid, "delete_mysql");
}
$this->serversModel->deleteServer($serverid);
$this->serversModel->deleteServerStats($serverid);
$this->serversModel->deleteserverOwners($serverid);
$this->serversModel->deleteLog($serverid);
$firewall = $this->serversModel->getFirewallsById($serverid);
if ($firewall) {
foreach ($firewall as $item2) {
$ssh2Lib = new ssh2Library();
$link = $ssh2Lib->connect($server['location_ip'], $server['location_user'], $server['location_password']);
$ssh2Lib->execute($link, "iptables -D INPUT -s ".$item2['server_ip']." -p udp -d ".$server['location_ip']." --dport ".$server['server_port']." -j DROP;");
$ssh2Lib->execute($link, "iptables -D INPUT -s ".$item2['server_ip']." -p tcp -d ".$server['location_ip']." --dport ".$server['server_port']." -j DROP;");
$ssh2Lib->disconnect($link);
$this->serversModel->deleteFirewallDB($item2['firewall_id']);
}
}
$mailLib->setTo($server['user_email']);
$mailLib->setSubject("Удаление сервера администратором #$serverid");
$mailData = array();
$mailData['firstname'] = $server['user_firstname'];
$mailData['lastname'] = $server['user_lastname'];
$mailData['serverid'] = $serverid;
$text = $this->load->view('mail/servers/deleted', $mailData);
$mailLib->setText($text);
$mailLib->send();
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно удалили сервер!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $result['description'];
}
} else {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
break;
}
case 'unblock': {
if($server['server_status'] == 0) {
$this->serversModel->updateServer($serverid, array('server_status' => 1));
$this->serversModel->action($serverid, "updatepassm");
$this->serversModel->action($serverid, "updatepass");
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно разблокировали сервер!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть заблокирован!";
}
break;
}
default: {
$this->data['status'] = "error";
$this->data['error'] = "Вы выбрали несуществующее действие!";
break;
}
}
return json_encode($this->data);
}
public function settingStart($serverid = null) {
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'news/index');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$server = $this->serversModel->getServerById($serverid, array('games', 'locations'));
$error = $this->validate($serverid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
if($server['server_status'] == 3) {
$this->data["status"] = "error";
$this->data["error"] = "Идет установка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 4) {
$this->data["status"] = "error";
$this->data["error"] = "Идет переустановка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 5) {
$this->data["status"] = "error";
$this->data["error"] = "Идет создание BackUP сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 6) {
$this->data["status"] = "error";
$this->data["error"] = "Идет восстанновление сервера из BackUP!";
return json_encode($this->data);
} else if($server['server_status'] == 7) {
$this->data["status"] = "error";
$this->data["error"] = "Идет обновление сервера!";
return json_encode($this->data);
} else if($server["server_status"] == 0) {
$this->data["status"] = "error";
$this->data["error"] = "Сервер заблокирован!";
return json_encode($this->data);
}
if($this->request->server['REQUEST_METHOD'] == 'POST') {
if($server['server_status'] == 1){
if($server["game_code"] == "cs" || $server["game_code"] == "css" || $server["game_code"] == "csgo" || $server["game_query"] == "samp") {
$rcon_password = @$this->request->post['rcon_password'];
if(mb_strlen($rcon_password) < 2 || mb_strlen($rcon_password) > 18) {
$this->data["status"] = "error";
$this->data["error"] = "RCON Пароль должен содержать от 2 до 18 символов!";
return json_encode($this->data);
}
$this->serversModel->updateServer($serverid, array('rcon_password' => $rcon_password));
if($server["game_code"] == "cs" || $server["game_code"] == "css" || $server["game_code"] == "csgo") {
$vac = @$this->request->post['vac'];
if(!in_array($vac, array("0", "1"))) {
$this->data["status"] = "error";
$this->data["error"] = "Статус античита VAC указан неверно!";
return json_encode($this->data);
}
$this->serversModel->updateServer($serverid, array('server_vac' => $vac));
$fastdl = @$this->request->post['fastdl'];
if(!in_array($fastdl, array("0", "1"))) {
$this->data["status"] = "error";
$this->data["error"] = "Статус FastDL указан неверно!";
return json_encode($this->data);
}
$this->serversModel->updateServer($serverid, array('fastdl_status' => $fastdl));
if($server["game_code"] == "cs") {
$fps = @$this->request->post['fps'];
if(!in_array($fps, array("300", "500", "1100"))) {
$this->data["status"] = "error";
$this->data["error"] = "Параметр FPS указан неверно!";
return json_encode($this->data);
} else {
$this->serversModel->updateServer($serverid, array('server_fps' => $fps));
}
}
if($server["game_code"] == "csgo") {
$tickrate = @$this->request->post['tickrate'];
if(!in_array($tickrate, array("64", "128"))) {
$this->data["status"] = "error";
$this->data["error"] = "Параметр Tickrate указан неверно!";
return json_encode($this->data);
} else {
$this->serversModel->updateServer($serverid, array('server_tickrate' => $tickrate));
}
}
if($server["game_code"] == "css") {
$tickrate = @$this->request->post['tickrate'];
if(!in_array($tickrate, array("66", "100"))) {
$this->data["status"] = "error";
$this->data["error"] = "Параметр Tickrate указан неверно!";
return json_encode($this->data);
} else {
$this->serversModel->updateServer($serverid, array('server_tickrate' => $tickrate));
}
}
}
$this->data["status"] = "success";
$this->data["success"] = "Параметры запуска успешно изменены!";
} else {
$this->data["status"] = "error";
$this->data["error"] = "Не для данной игры!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Сервер должен быть выключен!";
}
}
return json_encode($this->data);
}
private function validate($serverid) {
$result = null;
if(!$this->serversModel->getTotalServers(array('server_id' => (int)$serverid))) {
$result = "Запрашиваемый сервер не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$slots = @$this->request->post['slots'];
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
if($editpassword) {
if(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
}
return $result;
}
public function mysqlhostin($serverid = null, $mysqlhostin = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 0) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
$error = $this->validate($serverid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
$server = $this->serversModel->getServerById($serverid);
switch($mysqlhostin) {
case 'mysqlon': {
if($server['server_mysql'] == 2) {
$this->serversModel->updateServer($serverid, array('server_mysql' => 1));
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно включили базу данных gs$serverid!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "База данных и так включена либо вы ее еще не создали!";
}
break;
}
case 'mysqloff': {
if($server['server_mysql'] == 1) {
$this->serversModel->updateServer($serverid, array('server_mysql' => 2));
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно выключили базу данных gs$serverid!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "База данных и так выключена!";
}
break;
}
case 'mysqlcr': {
if($server['server_mysql'] == 0) {
$result = $this->serversModel->action($serverid, 'create_mysql');
if($result["status"] == "success") {
$this->serversModel->updateServer($serverid, array('server_mysql' => 2));
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали базу данных gs$serverid!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "База данных и так создана!";
}
break;
}
default: {
$this->data['status'] = "error";
$this->data['error'] = "Вы выбрали несуществующее действие!";
break;
}
}
return json_encode($this->data);
}
public function getData($serverid = null) {
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('servers');
$this->load->library('query');
$error = $this->validate($serverid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'servers/index');
}
$server = $this->serversModel->getServerById($serverid, array('games', 'locations'));
if($server['server_status'] == 2) {
$queryLib = new queryLibrary($server['game_query']);
$queryLib->connect($server['location_ip'], $server['server_port']);
$query = $queryLib->getInfo();
$queryLib->disconnect();
$sysload = $this->serversModel->getServerSystemLoad($serverid);
$ssd = round($sysload['ssd']);
$ssd_all = $server['game_ssd'];
$this->data['ssd'] = (int)(($ssd * 100) / $ssd_all);
$this->data['cpu'] = $sysload['cpu'] > 100 ? 100 : round($sysload['cpu']);
$this->data['ram'] = $sysload['ram'] > 100 ? 100 : round($sysload['ram']);
$this->data['players'] = $query['players'];
} else if($server['server_status'] == 3 || $server['server_status'] == 4) {
$this->data['ssd'] = 'N/A';
$this->data['cpu'] = 'N/A';
$this->data['ram'] = 'N/A';
$this->data['players'] = 'N/A';
} else {
$ssd = $this->serversModel->getHDD($serverid);
$ssd = round($ssd);
$ssd_all = $server['game_ssd'];
$this->data['ssd'] = (int)(($ssd * 100) / $ssd_all);
$this->data['cpu'] = 0;
$this->data['ram'] = 0;
$this->data['players'] = 0;
}
return json_encode($this->data);
}
}
?>
@@ -0,0 +1,234 @@
<?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 indexController extends Controller {
private $limit = 22;
public function index($page = 1) {
$this->document->setActiveSection('admin/servers');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('servers');
$userid = @$this->request->get['userid'];
$gameid = @$this->request->get['gameid'];
$locationid = @$this->request->get['locationid'];
$getData = array();
if(!empty($userid)) {
$getData['servers.user_id'] = (int)$userid;
}
if(!empty($gameid)) {
$getData['servers.game_id'] = (int)$gameid;
}
if(!empty($locationid)) {
$getData['servers.location_id'] = (int)$locationid;
}
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->serversModel->getTotalServers($getData);
$servers = $this->serversModel->getServers($getData, array('games', 'locations'), array(), $getOptions);
$paginationUrl = '/admin/servers/index/index/{page}';
if(!empty($userid)) {
$paginationUrl .= '&userid=' . $userid;
}
if(!empty($gameid)) {
$paginationUrl .= '&gameid=' . $gameid;
}
if(!empty($locationid)) {
$paginationUrl .= '&locationid=' . $locationid;
}
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['servers'] = $servers;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/servers/index', $this->data);
}
public function action($serverid = null, $action = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('servers');
$this->load->model('serverLog');
$error = $this->validate($serverid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
$server = $this->serversModel->getServerById($serverid, array('users', 'locations', 'games'));
if($server['server_status'] == 3) {
$this->data["status"] = "error";
$this->data["error"] = "Идет установка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 4) {
$this->data["status"] = "error";
$this->data["error"] = "Идет переустановка сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 5) {
$this->data["status"] = "error";
$this->data["error"] = "Идет создание BackUP сервера!";
return json_encode($this->data);
} else if($server['server_status'] == 6) {
$this->data["status"] = "error";
$this->data["error"] = "Идет восстанновление сервера из BackUP!";
return json_encode($this->data);
} else if($server['server_status'] == 7) {
$this->data["status"] = "error";
$this->data["error"] = "Идет обновление сервера!";
return json_encode($this->data);
} else if($server["server_status"] == 0) {
$this->data["status"] = "error";
$this->data["error"] = "Сервер заблокирован!";
return json_encode($this->data);
}
switch($action) {
case "start": {
if($server["server_status"] == 1) {
$stats = $this->serversModel->getHDD($server['server_id']);
if((int)$stats < $server['game_ssd']) {
$result = $this->serversModel->action($serverid, 'start');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'enable', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array("server_status" => 2));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешный запуск сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно запустили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Вы привысили ограничение размера директории на ". round($stats - $server['game_ssd'], 2) ."МБ, запуск сервера невозможен!";
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть выключен!";
}
break;
}
case "restart": {
if($server["server_status"] == 2) {
$stats = $this->serversModel->getHDD($server['server_id']);
if((int)$stats < $server['game_ssd']) {
$result = $this->serversModel->action($serverid, 'restart');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешный перезапуск сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно перезапустили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$result = $this->serversModel->action($serverid, 'stop');
if($result['status'] == "success") {
$this->serversModel->updateServer($serverid, array('server_status' => 1));
$this->data["status"] = "error";
$this->data["error"] = "Вы привысили ограничение размера директории на ". round($stats - $server['game_ssd'], 2) ."МБ, перезагрузка сервера невозможна!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
}
} else if($server["server_status"] == 2) {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть включен!";
}
break;
}
case "stop": {
if($server["server_status"] == 2) {
$result = $this->serversModel->action($serverid, 'stop');
if($result["status"] == "success") {
$this->serversModel->deleteTask(array('task_name' => 'disable', 'server_id' => $serverid));
$this->serversModel->deleteTask(array('task_name' => 'restart', 'server_id' => $serverid));
$this->serversModel->updateServer($serverid, array("server_status" => 1));
$logData = array(
'server_id' => $serverid,
'reason' => 'Успешное выключение сервера',
'status' => 1
);
$this->serversModel->createLog($logData);
$this->data["status"] = "success";
$this->data["success"] = "Вы успешно выключили сервер!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data["status"] = "error";
$this->data["error"] = "Сервер должен быть вылючен!";
}
break;
}
}
return json_encode($this->data);
}
private function validate($serverid) {
$result = null;
$userid = $this->user->getId();
if(!$this->serversModel->getTotalServers(array('server_id' => (int)$serverid, 'user_id' => (int)$userid))) {
$result = "Запрашиваемый сервер не существует или у ват нету доступа!";
}
return $result;
}
}
?>
@@ -0,0 +1,119 @@
<?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 settingsController extends Controller {
public function index() {
$this->document->setActiveSection('admin/settings');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$userid = $this->user->getId();
$this->load->model('users');
require(APPLICATION_DIR . 'config.php');
$this->data['settings'] = $config;
unset($config);
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/settings', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$userid = $this->user->getId();
$this->load->model('users');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$file = file_get_contents(APPLICATION_DIR . 'config.php');
$file = str_replace(",", "", $file);
$file = str_replace("<?php", "", $file);
$file = str_replace('$config = array(', "", $file);
$file = str_replace(');', "", $file);
$file = str_replace('?>', "", $file);
$file = explode("\n",$file);
$file2 = array();
foreach($file as $line){
if($line !== ''){
$file2[] = $line;
}
}
unset($line);
$file = $file2;
unset($file2);
$post = array();
foreach($this->request->post as $post_string => $post_value){
$post[$post_string] = $post_value;
if($post_string !== 'close'){
$post['close'] = 'off';
}
}
foreach($post as $string => $value) {
for ($i = 0; $i < count($file); $i++) {
if (strpos($file[$i], $string) !== FALSE) {
$search_line = $file[$i];
$file[$i] = "'".$string."' => '".$value."'";
break;
}
}
if($search_line == null) {
$file[] = "'".$string."' => '".$value."'";
}
unset($search_line);
}
foreach($file as $line => $line2){
if($line < count($file)-1 and $file[$line] != "\n"){
$file[$line] = $line2.',';
}
}
$file = implode("\n", $file);
$file = preg_replace('/([\r\n]){2,}/s', '\1', $file);
$file2 = '<?php';
$file2 .= "\n".'$config = array(';
$file2 .= "\n".$file;
$file2 .= "\n".');';
$file2 .= "\n".'?>';
file_put_contents(APPLICATION_DIR.'config.php', $file2);
$this->data['status'] = "success";
$this->data['success'] = "Настройки сохранены!";
}
return json_encode($this->data);
}
}
?>
@@ -0,0 +1,76 @@
<?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 indexController extends Controller {
public function index() {
$this->document->setActiveSection('admin/statistics');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$userid = $this->user->getId();
$this->load->model('users');
$this->getChild(array('common/admheader', 'common/footer'));
$this->load->model('invoices');
$this->load->model('servers');
$get_invoices = $this->invoicesModel->getStatisticsInvStatsById();
$get_registers = $this->usersModel->getStatisticsRegistersById();
$get_players = $this->serversModel->getStatisticsPlayers();
$get_loads = $this->serversModel->getStatisticsLoad();
$charts = 'var invoices = [ ';
foreach($get_invoices as $item){
$charts .= '['.(strtotime($item['invoice_date_add']))*1000 .', '.$item['SUM(`invoice_ammount`)'].'], ';
}
$charts .= '];';
$charts .= 'var registers = [ ';
foreach($get_registers as $item){
$charts .= '['.(strtotime($item['mydate']))*1000 .', '.(int)$item['count(user_id)'].'], ';
}
$charts .= '];';
$charts .= 'var players = [ ';
foreach($get_players as $item){
$charts .= '['.(strtotime($item['mydate']))*1000 .', '.(int)$item['sum(`server_stats_players`)'].'], ';
}
$charts .= '];';
$charts .= 'var loads1 = [ ';
foreach($get_loads as $item){
$charts .= '['.(strtotime($item['mydate']))*1000 .', '.(int)$item['sum(`server_stats_cpu`)'].'], ';
}
$charts .= '];';
$charts .= 'var loads2 = [ ';
foreach($get_loads as $item){
$charts .= '['.(strtotime($item['mydate']))*1000 .', '.(int)$item['sum(`server_stats_hdd`)'].'], ';
}
$charts .= '];';
$charts .= 'var loads3 = [ ';
foreach($get_loads as $item){
$charts .= '['.(strtotime($item['mydate']))*1000 .', '.(int)$item['sum(`server_stats_ram`)'].'], ';
}
$charts .= '];';
$this->data['charts'] = $charts;
return $this->load->view('admin/statistics/index', $this->data);
}
}
?>
@@ -0,0 +1,81 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/ticketcategory');
$this->document->setActiveItem('create');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/ticketcategory/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('ticketsCategory');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$status = @$this->request->post['status'];
$adapData = array(
'category_name' => $name,
'category_status' => $status
);
$this->ticketsCategoryModel->createTicketCategory($adapData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали категорию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название категории должно содержать от 2 до 32 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,138 @@
<?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 editController extends Controller {
public function index($categoryid = null) {
$this->document->setActiveSection('admin/ticketcategory');
$this->document->setActiveItem('edit');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('ticketsCategory');
$error = $this->validate($categoryid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/ticketcategory/index');
}
$category = $this->ticketsCategoryModel->getTicketCategoryById($categoryid);
$this->data['category'] = $category;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/ticketcategory/edit', $this->data);
}
public function ajax($categoryid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('ticketsCategory');
$error = $this->validate($categoryid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$status = @$this->request->post['status'];
$adapData = array(
'category_name' => $name,
'category_status' => (int)$status
);
$this->ticketsCategoryModel->updateTicketCategory($categoryid, $adapData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали категорию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($categoryid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('tickets');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('ticketsCategory');
$error = $this->validate($categoryid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/ticketcategory/index');
}
$this->ticketsCategoryModel->deleteTicketCategory($categoryid);
$this->session->data['success'] = "Вы успешно удалили дополнение!";
$this->response->redirect($this->config->url . 'admin/ticketcategory/index');
return null;
}
private function validate($categoryid) {
$result = null;
$this->load->model('ticketsCategory');
if(!$this->ticketsCategoryModel->getTotalTicketsCategory(array('category_id' => (int)$categoryid))) {
$result = "Запрашиваемая категория не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название категории должно содержать от 2 до 32 символов!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,48 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/ticketcategory');
$this->document->setActiveItem('index');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('ticketsCategory');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->ticketsCategoryModel->getTotalTicketsCategory();
$category = $this->ticketsCategoryModel->getTicketsCategory(array(),array(),array(), $options);
$paginationUrl = '/admin/ticketcategory/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['category'] = $category;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/ticketcategory/index', $this->data);
}
}
?>
@@ -0,0 +1,93 @@
<?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 createController extends Controller {
public function index($ticketid = null) {
$this->document->setActiveSection('admin/tickets');
$this->document->setActiveItem('create');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('users');
$userid = $this->user->getId();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/tickets/create', $this->data);
}
public function ajax($ticketid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 1) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('tickets');
$this->load->model('ticketsMessages');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$text = @$this->request->post['text'];
$pid = @$this->request->post['pid'];
$userid = $this->user->getId();
$ticketData = array(
'user_id' => $pid,
'ticket_name' => $name,
'ticket_status' => 2
);
$ticketid = $this->ticketsModel->createTicket($ticketData);
$messageData = array(
'ticket_id' => $ticketid,
'user_id' => $userid,
'ticket_message' => $text
);
$this->ticketsMessagesModel->createTicketMessage($messageData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отправили сообщение пользователю!";
$this->data['id'] = $ticketid;
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$result = null;
$name = @$this->request->post['name'];
$pid = @$this->request->post['pid'];
$text = @$this->request->post['text'];
if(mb_strlen($name) < 6 || mb_strlen($name) > 32) {
$result = "Название тикета должно содержать от 6 до 32 символов!";
}
elseif(mb_strlen($pid) < 1 || mb_strlen($pid) > 10) {
$result = "ID клиента должен быть от 1 до 10 символов!";
}
elseif(mb_strlen($text) < 1 || mb_strlen($text) > 350) {
$result = "Текст тикета должен содержать от 1 до 350 символов!";
}
return $result;
}
}
@@ -0,0 +1,74 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/tickets');
$this->document->setActiveItem('index');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('tickets');
$this->load->model('users');
$userid = $this->user->getId();
$userid = @$this->request->get['userid'];
$status = @$this->request->get['status'];
$getData = array();
if(!empty($userid)) {
$getData['tickets.user_id'] = (int)$userid;
}
if(!empty($status)) {
$getData['tickets.ticket_status'] = (int)$status;
}
$getSort = array(
'ticket_status' => 'DESC',
'ticket_date_add' => 'DESC'
);
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->ticketsModel->getTotalTickets($getData);
$tickets = $this->ticketsModel->getTickets($getData, array('users','tickets_category'), $getSort, $getOptions);
$paginationUrl = '/admin/tickets/index/index/{page}';
if(!empty($userid)) {
$paginationUrl .= '&userid=' . $userid;
}
if(!empty($status)) {
$paginationUrl .= '&status=' . $status;
}
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['tickets'] = $tickets;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/tickets/index', $this->data);
}
}
?>
@@ -0,0 +1,254 @@
<?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 viewController extends Controller {
public function index($ticketid = null) {
$this->document->setActiveSection('admin/tickets');
$this->document->setActiveItem('view');
$this->data['url'] = $this->config->url;
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('tickets');
$this->load->model('users');
$error = $this->validate($ticketid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/tickets/index');
}
$ticket = $this->ticketsModel->getTicketById($ticketid, array('users'));
$this->data['ticket'] = $ticket;
$this->data['user_img'] = $this->user->getUser_img();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/tickets/view', $this->data);
}
public function ajax($ticketid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('tickets');
$this->load->model('ticketsMessages');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST($ticketid);
if(!$errorPOST) {
$userid = $this->user->getId();
$text = @$this->request->post['text'];
$ticket = $this->ticketsModel->getTicketById($ticketid, array('users'));
if($ticket['ticket_status'] != 0) {
$messageData = array(
'ticket_id' => $ticketid,
'user_id' => $userid,
'ticket_message' => $text
);
$this->ticketsModel->updateTicket($ticketid, array('ticket_status' => 2));
$this->ticketsMessagesModel->createTicketMessage($messageData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отправили сообщение!";
} else {
$this->data['status'] = "error";
$this->data['error'] = "Данный запрос закрыт, оставить новое сообщение невозможно!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function action($ticketid = null, $action = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 0) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('tickets');
$this->load->model('ticketsMessages');
switch($action) {
case 'closed': {
$this->ticketsModel->updateTicket($ticketid, array('ticket_status' => 0));
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно закрыли запрос!";
break;
}
default: {
$this->data['status'] = "error";
$this->data['error'] = "Вы выбрали несуществующее действие!";
break;
}
}
return json_encode($this->data);
}
public function uploadFile($ticketid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('tickets');
$this->load->model('ticketsMessages');
$this->load->model('users');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$uploaddir = "tmp/tickets_img/";
$apend=date('YmdHis').rand(100,1000).'.jpg';
$uploadfile = "$uploaddir$apend";
if(move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
if($_FILES['userfile']['type'] == 'image/gif' || $_FILES['userfile']['type'] == 'image/jpeg' || $_FILES['userfile']['type'] == 'image/png') {
if($_FILES['userfile']['size'] != 0 and $_FILES['userfile']['size'] <= 5120000) {
$size = getimagesize($uploadfile);
if ($size[0] < 2560 && $size[1] < 1440) {
if(round(($_FILES['userfile']['size'] / 1024), 2) > 1500.00) {
$message = 'Изображение: ' . $apend . '<br>Размер: ' . round(($_FILES['userfile']['size'] / 1024), 2) . 'КБ<br><a href="/' . $uploadfile . ' target="_blank">Открыть</a>';
} else {
$message = '<a href="/' . $uploadfile . '" target="_blank"><img height="150" src="/' . $uploadfile . '"></a>';
}
$userid = $this->user->getId();
$messageData = array(
'ticket_id' => $ticketid,
'user_id' => $userid,
'ticket_message' => $message
);
$this->ticketsModel->updateTicket($ticketid, array('ticket_status' => 1));
$this->ticketsMessagesModel->createTicketMessage($messageData);
$this->data['status'] = 'success';
$this->data['success'] = 'Изображение загружено!';
} else {
$this->data['error'] = 'Загружаемое изображение превышает допустимые нормы!';
$this->data['status'] = "error";
unlink($uploadfile);
}
} else {
$this->data['error'] = 'Размер изображения не должено превышать 5120Кб';
$this->data['status'] = "error";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Можно загружать только изображения в форматах jpg, jpeg и png";
}
} else {
$this->data['error'] = 'Изображение не загружено!';
$this->data['status'] = "error";
}
}
return json_encode($this->data);
}
public function getMessagess() {
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$this->load->model('tickets');
$this->load->model('ticketsMessages');
$id = $this->request->post['tid'];
$url = $this->config->url;
$messages = $this->ticketsMessagesModel->getTicketsMessages(array('ticket_id' => $id), array('users'));
foreach($messages as $item) {
$item['ticket_message'] = preg_replace("#(https?|ftp)://\S+[^\s.,>)\];'\"!?]#",'<a href="\\0" target="_blank">\\0</a>', $item['ticket_message']);
if($item['user_access_level'] == '1') {
echo '<div class="d-flex flex-column mb-5 align-items-start">
<div class="d-flex align-items-center">
<div class="symbol symbol-circle symbol-40 mr-3">
<img alt="Pic" src="'.$url.''.$item['user_img'].'" />
</div>
<div>
<a href="/admin/users/edit/index/'.$item['user_id'] .'" class="text-dark-75 text-hover-primary font-weight-bold font-size-h6">'. $item['user_firstname'] .' '. $item['user_lastname'] .'</a>
<span class="text-muted font-size-sm">'. date("d.m.Y в H:i", strtotime($item['ticket_message_date_add'])) .'</span>
</div>
</div>
<div class="mt-2 rounded p-5 bg-light-success text-dark-50 font-weight-bold font-size-lg text-left max-w-400px">'. nl2br($item['ticket_message']) .'
</div></div>';
}
if($item['user_access_level'] >= '2') {
echo '<div class="d-flex flex-column mb-5 align-items-end">
<div class="d-flex align-items-center">
<div class="symbol symbol-circle symbol-40 mr-3">
<img alt="Pic" src="'.$url.''.$item['user_img'].'" />
</div>
<div>
<a href="/admin/users/edit/index/'.$item['user_id'] .'" class="text-dark-75 text-hover-primary font-weight-bold font-size-h6">'. $item['user_firstname'] .' '. $item['user_lastname'] .'</a>
<span class="text-muted font-size-sm">'. date("d.m.Y в H:i", strtotime($item['ticket_message_date_add'])) .'</span>
</div>
</div>
<div class="mt-2 rounded p-5 bg-light-primary text-dark-50 font-weight-bold font-size-lg text-left max-w-400px">'. nl2br($item['ticket_message']) .'<br>
</div></div>';
}
}
}
}
private function validate($ticketid) {
$result = null;
if(!$this->ticketsModel->getTotalTickets(array('ticket_id' => (int)$ticketid))) {
$result = "Запрашиваемый тикет не существует!";
}
return $result;
}
private function validatePOST($ticketid) {
$result = null;
$userid = $this->user->getId();
$text = @$this->request->post['text'];
$closeticket = @$this->request->post['closeticket'];
if(!$closeticket) {
if (5 <= $this->ticketsModel->spam($userid)) {
$result = 'Пожалуйста, подождите 10 секунд.';
}
else if(mb_strlen($text) < 1 || mb_strlen($text) > 350) {
$result = "Текст сообщения должен содержать от 1 до 350 символов.";
}
}
return $result;
}
}
@@ -0,0 +1,196 @@
<?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 editController extends Controller {
public function index($userid = null) {
$this->data['url'] = $this->config->url;
$this->document->setActiveSection('admin/users');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('users');
$this->load->model('servers');
$error = $this->validate($userid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/users/index');
}
$user = $this->usersModel->getUserById($userid);
$this->data['user'] = $user;
$servers = $this->serversModel->getServers(array('user_id' => (int)$userid), array('games', 'locations'), array(), array());
$visitors = $this->usersModel->getAuthLog($userid);
$this->data['servers'] = $servers;
$this->data['visitors'] = $visitors;
$this->data['user_img'] = $this->user->getUser_img();
$this->data['user_access_level'] = $this->user->getAccessLevel();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/users/edit', $this->data);
}
public function ajax($userid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('users');
$error = $this->validate($userid);
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();
if(!$errorPOST) {
$lastname = @$this->request->post['lastname'];
$firstname = @$this->request->post['firstname'];
$email = @$this->request->post['email'];
$status = @$this->request->post['status'];
$balance = @$this->request->post['balance'];
$vk_id = @$this->request->post['vk_id'];
$test_server = @$this->request->post['test_server'];
$user_activate = @$this->request->post['user_activate'];
$accesslevel = @$this->request->post['accesslevel'];
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
if (@$firstname) {
$firstname = @strtoupper($firstname[0]) . substr($firstname, 1);
}
if (@$lastname) {
$lastname = @strtoupper($lastname[0]) . substr($lastname, 1);
}
$userData = array(
'user_firstname' => $firstname,
'user_lastname' => $lastname,
'user_email' => $email,
'user_status' => (int)$status,
'user_balance' => (float)$balance,
'user_vk_id' => (float)$vk_id,
'test_server' => (float)$test_server,
'user_access_level' => (float)$accesslevel,
'user_activate' => (float)$user_activate,
);
if($editpassword) {
$userData['user_password'] = md5($password);
}
$this->usersModel->updateUser($userid, $userData);
$this->data['status'] = "success";
$this->data['success'] = "Изменения сохранены!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($user_id = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('users');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('users');
$this->usersModel->deleteUser($user_id);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно удалили пользователя!";
return json_encode($this->data);
}
private function validate($userid) {
$result = null;
if(!$this->usersModel->getTotalUsers(array('user_id' => (int)$userid))) {
$result = "Запрашиваемый пользователь не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$lastname = @$this->request->post['lastname'];
$firstname = @$this->request->post['firstname'];
$status = @$this->request->post['status'];
$balance = @$this->request->post['balance'];
$accesslevel = @$this->request->post['accesslevel'];
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
if (@$firstname) {
$firstname = @strtoupper($firstname[0]) . substr($firstname, 1);
}
if (@$lastname) {
$lastname = @strtoupper($lastname[0]) . substr($lastname, 1);
}
if(!$validateLib->check_for_number($lastname)) {
$result = "Укажите свою реальную фамилию!";
}
elseif(!$validateLib->check_for_number($firstname)) {
$result = "Укажите свое реальное имя!";
}
elseif(!$validateLib->userstatus($status)) {
$result = "Укажите допустимый статус!";
}
elseif(!$validateLib->money($balance)) {
$result = "Укажите допустимый баланс!";
}
elseif(!$validateLib->accesslevel($accesslevel)) {
$result = "Укажите допустимый уровень доступа!";
}
elseif($editpassword) {
if(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
}
return $result;
}
}
?>
@@ -0,0 +1,232 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/users');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('users');
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->usersModel->getTotalUsers();
$users = $this->usersModel->getUsers(array(), array(), $getOptions);
$paginationUrl = '/admin/users/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['users'] = $users;
$this->data['pagination'] = $pagination;
$this->data['user_access_level'] = $this->user->getAccessLevel();
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/users/index', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('users');
$this->load->model('news');
$users = $this->usersModel->getUsers(array(), array(), array());
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$minsum = @$this->request->post['minsum'];
$maxsum = @$this->request->post['maxsum'];
$typesum = @$this->request->post['typesum'];
$oneuser = @$this->request->post['oneuser'];
$oneuserID = @$this->request->post['oneuserID'];
$createnews = @$this->request->post['createnews'];
if($typesum) {
if($oneuser) {
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserBalance($oneuserID, $rsum);
$this->data['status'] = "info";
$this->data['info'] = "".$rsum." - Реальные деньги выданы пользователю!";
} else {
if($createnews) {
foreach($users as $item) {
if($item['user_status'] == 1) {
$userid = $item['user_id'];
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserBalance($oneuserID, $rsum);
}
}
if(empty($users)) {
$this->data['status'] = "error";
$this->data['error'] = "Критическая ошибка";
}
$today = date("Y-m-d H:i");
$name = "Выдача бонусных монет всем";
$text = "Сегодня ".$today." администрацией была проведена раздача реальных денег, их получили все активированные пользователи! ";
$category = "1";
$img_preview = "1";
$userid = $this->user->getId();
$newsData = array(
'user_id' => $userid,
'news_title' => $name,
'news_text' => $text,
'category_id' => $category,
'place' => $place
);
$this->newsModel->createNews($newsData);
$this->data['status'] = "success";
$this->data['success'] = "Реальные деньги выданы!";
} else {
foreach($users as $item) {
if($item['user_status'] == 1) {
$userid = $item['user_id'];
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserBalance($oneuserID, $rsum);
}
}
if(empty($users)) {
$this->data['status'] = "error";
$this->data['error'] = "Критическая ошибка";
}
$this->data['status'] = "success";
$this->data['success'] = "Реальные деньги выданы!";
}
}
} else {
if($oneuser) {
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserRMoney($oneuserID, $rsum);
$this->data['status'] = "info";
$this->data['info'] = "".$rsum." - Бонусные монеты выданы пользователю!";
} else {
if($createnews) {
foreach($users as $item) {
if($item['user_status'] == 1) {
$userid = $item['user_id'];
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserRMoney($userid, $rsum);
}
}
if(empty($users)) {
$this->data['status'] = "error";
$this->data['error'] = "Критическая ошибка";
}
$today = date("Y-m-d H:i");
$name = "Выдача бонусных монет всем";
$text = "Сегодня ".$today." администрацией была проведена раздача бонусных монет, их получили все активированные пользователи! ";
$category = "1";
$place = "1";
$userid = $this->user->getId();
$newsData = array(
'user_id' => $userid,
'news_title' => $name,
'news_text' => $text,
'category_id' => $category,
'place' => $place
);
$this->newsModel->createNews($newsData);
$this->data['status'] = "success";
$this->data['success'] = "Бонусные монеты выданы!";
} else {
foreach($users as $item) {
if($item['user_status'] == 1) {
$userid = $item['user_id'];
$rsum = rand($minsum, $maxsum);
$this->usersModel->upUserRMoney($userid, $rsum);
}
}
if(empty($users)) {
$this->data['status'] = "error";
$this->data['error'] = "Критическая ошибка";
}
$this->data['status'] = "success";
$this->data['success'] = "Бонусные монеты выданы!";
}
}
}
// Сюда можно логирование
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$minsum = @$this->request->post['minsum'];
$maxsum = @$this->request->post['maxsum'];
$oneuser = @$this->request->post['oneuser'];
$oneuserID = @$this->request->post['oneuserID'];
if(!$validateLib->money($maxsum)) {
$result = "Укажите сумму в допустимом формате!";
}
elseif(1 > $minsum || $minsum > 5000) {
$result = "Укажите сумму от 1 до 5000";
}
if($oneuser) {
if(!$this->usersModel->getTotalUsers(array('user_id' => (int)$oneuserID))) {
$result = "Запрашиваемый пользователь не существует!";
}
}
return $result;
}
}
?>
@@ -0,0 +1,61 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/waste');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('waste');
$userid = @$this->request->get['userid'];
$getData = array();
if(!empty($userid)) {
$getData['waste.user_id'] = (int)$userid;
}
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->wasteModel->getTotalWaste($getData);
$waste = $this->wasteModel->getWaste($getData, array('users'), array(), $getOptions);
$wastes = $this->wasteModel->getWaste(array(), array('users'), array(), array());
$paginationUrl = '/admin/waste/index/index/{page}';
if(!empty($userid)) {
$paginationUrl .= '&userid=' . $userid;
}
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['waste'] = $waste;
$this->data['wastes'] = $wastes;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/waste/index', $this->data);
}
}
?>
@@ -0,0 +1,185 @@
<?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 controlController extends Controller {
public function index($webid = null) {
$this->document->setActiveSection('admin/webhost');
$this->document->setActiveItem('control');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webhost');
$error = $this->validate($webid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/webhost/index');
}
$webhost = $this->webhostModel->getWebhostById($webid, array('users','web_tarifs','web_locations'));
$this->data['webhost'] = $webhost;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/webhost/control', $this->data);
}
public function ajax($webid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('webhost');
$error = $this->validate($webid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
$webhost = $this->webhostModel->getWebhostById($webid, array('users', 'web_tarifs'));
if($webhost['web_status'] == 0) {
$this->data['status'] = "error";
$this->data['error'] = "Веб-хостинг заблокирован!";
return json_encode($this->data);
}
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
if($editpassword) {
$result = $this->webhostModel->updatepassUser($webid, $password);
if($result["status"] == "success") {
$this->webhostModel->updateWebhost($webid, array('web_password' => $password));
$this->data['status'] = "success";
$this->data['success'] = "Пароль доступа успешно изменен!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
} else {
$this->data['status'] = "error";
$this->data['error'] = "Ошибка!";
}
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function action($webid = null, $action = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webhost');
$error = $this->validate($webid);
if($error) {
$this->data['status'] = "error";
$this->data['error'] = $error;
return json_encode($this->data);
}
$webhost = $this->webhostModel->getWebhostById($webid, array('users', 'web_tarifs'));
switch($action) {
case 'block': {
$result = $this->webhostModel->blockWebhost($webid);
if($result["status"] == "success") {
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно заблокировали веб-хостинг!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
break;
}
case 'unblock': {
$result = $this->webhostModel->unblockWebhost($webid);
if($result["status"] == "success") {
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно разблокировали веб-хостинг!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
break;
}
case 'detele_web': {
$result = $this->webhostModel->deleteWebhost($webid);
if($result["status"] == "success") {
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно удалили веб-хостинг!";
} else {
$this->data["status"] = "error";
$this->data["error"] = $result["description"];
}
break;
}
default: {
$this->data['status'] = "error";
$this->data['error'] = "Вы выбрали несуществующее действие!";
break;
}
}
return json_encode($this->data);
}
private function validate($webid) {
$result = null;
if(!$this->webhostModel->getTotalWebhosts(array('web_id' => (int)$webid))) {
$result = "Запрашиваемый веб-хостинг не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$editpassword = @$this->request->post['editpassword'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
if($editpassword) {
if(!$validateLib->password_web($password)) {
$result = "Пароль должен содержать от 8 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
}
return $result;
}
}
?>
@@ -0,0 +1,74 @@
<?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 indexController extends Controller {
private $limit = 22;
public function index($page = 1) {
$this->document->setActiveSection('admin/webhost');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 2) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('webhost');
$userid = $this->user->getId();
$userid = @$this->request->get['userid'];
$tarifid = @$this->request->get['tarifid'];
$locationid = @$this->request->get['locationid'];
$getData = array();
if(!empty($userid)) {
$getData['webhost.user_id'] = (int)$userid;
}
if(!empty($tarifid)) {
$getData['webhost.tarif_id'] = (int)$tarifid;
}
if(!empty($locationid)) {
$getData['webhost.location_id'] = (int)$locationid;
}
$getOptions = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->webhostModel->getTotalWebhosts($getData);
$webhosts = $this->webhostModel->getWebhosts($getData, array('web_tarifs', 'web_locations'), array(), $getOptions);
$paginationUrl = '/admin/webhost/index/index/{page}';
if(!empty($userid)) {
$paginationUrl .= '&userid=' . $userid;
}
if(!empty($tarifid)) {
$paginationUrl .= '&tarifid=' . $tarifid;
}
if(!empty($locationid)) {
$paginationUrl .= '&locationid=' . $locationid;
}
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['webhosts'] = $webhosts;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/webhost/index', $this->data);
}
}
?>
@@ -0,0 +1,116 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/weblocations');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/weblocations/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('webLocations');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$url = @$this->request->post['url'];
$ns_servers = @$this->request->post['ns_servers'];
$user = @$this->request->post['user'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
$locationData = array(
'location_name' => $name,
'location_ip' => $ip,
'location_url' => $url,
'location_user' => $user,
'location_password' => $password,
'ns_servers' => $ns_servers,
'location_status' => (int)$status
);
$this->webLocationsModel->createLocation($locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали локацию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$url = @$this->request->post['url'];
$user = @$this->request->post['user'];
$ns_servers = @$this->request->post['ns_servers'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название локации должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($ns_servers) < 2 || mb_strlen($ns_servers) > 78) {
$result = "NS Сервера локации должны содержать от 2 до 78 символов!";
}
elseif(!$validateLib->ip($ip)) {
$result = "Укажите допустимый IP!";
}
elseif(mb_strlen($url) < 2 || mb_strlen($url) > 32) {
$result = "Домен должен содержать от 2 до 32 символов!";
}
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,180 @@
<?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 editController extends Controller {
public function index($locationid = null) {
$this->document->setActiveSection('admin/weblocations');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webLocations');
$error = $this->validate($locationid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/weblocations/index');
}
$location = $this->webLocationsModel->getLocationById($locationid);
$this->data['location'] = $location;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/weblocations/edit', $this->data);
}
public function ajax($locationid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('webLocations');
$error = $this->validate($locationid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$url = @$this->request->post['url'];
$user = @$this->request->post['user'];
$ns_servers = @$this->request->post['ns_servers'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$editpassword = @$this->request->post['editpassword'];
$status = @$this->request->post['status'];
$location_tarifs = @$this->request->post['location_tarifs'];
$locationData = array(
'location_name' => $name,
'location_ip' => $ip,
'location_url' => $url,
'ns_servers' => $ns_servers,
'location_user' => $user,
'location_status' => (int)$status,
'location_tarifs' => $location_tarifs
);
if($editpassword) {
$locationData['location_password'] = $password;
}
$this->webLocationsModel->updateLocation($locationid, $locationData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали локацию!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($locationid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('weblocations');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webLocations');
$error = $this->validate($locationid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/weblocations/index');
}
$this->webLocationsModel->deleteLocation($locationid);
$this->session->data['success'] = "Вы успешно удалили локацию!";
$this->response->redirect($this->config->url . 'admin/weblocations/index');
return null;
}
private function validate($locationid) {
$result = null;
if(!$this->webLocationsModel->getTotalLocations(array('location_id' => (int)$locationid))) {
$result = "Запрашиваемая локация не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$ip = @$this->request->post['ip'];
$url = @$this->request->post['url'];
$user = @$this->request->post['user'];
$ns_servers = @$this->request->post['ns_servers'];
$password = @$this->request->post['password'];
$password2 = @$this->request->post['password2'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название локации должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($ns_servers) < 2 || mb_strlen($ns_servers) > 78) {
$result = "NS Сервера локации должны содержать от 2 до 78 символов!";
}
elseif(!$validateLib->ip($ip)) {
$result = "Укажите допустимый IP!";
}
elseif(mb_strlen($url) < 2 || mb_strlen($url) > 32) {
$result = "Домен должен содержать от 2 до 32 символов!";
}
elseif(mb_strlen($user) < 2 || mb_strlen($user) > 32) {
$result = "Имя пользователя должно содержать от 2 до 32 символов!";
}
elseif($editpassword) {
if(!$validateLib->password($password)) {
$result = "Пароль должен содержать от 6 до 32 латинских букв, цифр и знаков <i>,.!?_-</i>!";
}
elseif($password != $password2) {
$result = "Введенные вами пароли не совпадают!";
}
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/weblocations');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('webLocations');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->webLocationsModel->getTotalLocations();
$locations = $this->webLocationsModel->getLocations(array(), array(), $options);
$paginationUrl = '/admin/weblocations/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['locations'] = $locations;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/weblocations/index', $this->data);
}
}
?>
@@ -0,0 +1,93 @@
<?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 createController extends Controller {
public function index() {
$this->document->setActiveSection('admin/webtarifs');
$this->document->setActiveItem('create');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/webtarifs/create', $this->data);
}
public function ajax() {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('webhostTarifs');
if($this->request->server['REQUEST_METHOD'] == 'POST') {
$errorPOST = $this->validatePOST();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$package = @$this->request->post['package'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$tarifData = array(
'tarif_name' => $name,
'package' => $package,
'tarif_price' => (float)$price,
'tarif_status' => (int)$status
);
$this->webhostTarifsModel->createTarif($tarifData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно создали тариф!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$package = @$this->request->post['package'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название тарифа должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($package) < 1 || mb_strlen($package) > 32) {
$result = "Название пакета должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->money($price)) {
$result = "Укажите допустимую стоимость!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,149 @@
<?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 editController extends Controller {
public function index($tarifid = null) {
$this->document->setActiveSection('admin/webtarifs');
$this->document->setActiveItem('edit');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webhostTarifs');
$error = $this->validate($tarifid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/webtarifs/index');
}
$tarif = $this->webhostTarifsModel->getTarifById($tarifid);
$this->data['tarif'] = $tarif;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/webtarifs/edit', $this->data);
}
public function ajax($tarifid = null) {
if(!$this->user->isLogged()) {
$this->data['status'] = "error";
$this->data['error'] = "Вы не авторизированы!";
return json_encode($this->data);
}
if($this->user->getAccessLevel() < 3) {
$this->data['status'] = "error";
$this->data['error'] = "У вас нет доступа к данному разделу!";
return json_encode($this->data);
}
$this->load->model('webhostTarifs');
$error = $this->validate($tarifid);
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();
if(!$errorPOST) {
$name = @$this->request->post['name'];
$package = @$this->request->post['package'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
$tarifData = array(
'tarif_name' => $name,
'package' => $package,
'tarif_price' => (float)$price,
'tarif_status' => (int)$status
);
$this->webhostTarifsModel->updateTarif($tarifid, $tarifData);
$this->data['status'] = "success";
$this->data['success'] = "Вы успешно отредактировали тариф!";
} else {
$this->data['status'] = "error";
$this->data['error'] = $errorPOST;
}
}
return json_encode($this->data);
}
public function delete($tarifid = null) {
$this->document->setActiveSection('admin');
$this->document->setActiveItem('tarifid');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->model('webhostTarifs');
$error = $this->validate($tarifid);
if($error) {
$this->session->data['error'] = $error;
$this->response->redirect($this->config->url . 'admin/tarifid/index');
}
$this->webhostTarifsModel->deleteTarif($tarifid);
$this->session->data['success'] = "Вы успешно удалили тариф!";
$this->response->redirect($this->config->url . 'admin/tarifid/index');
return null;
}
private function validate($tarifid) {
$result = null;
if(!$this->webhostTarifsModel->getTotalTarifs(array('tarif_id' => (int)$tarifid))) {
$result = "Запрашиваеммый тариф не существует!";
}
return $result;
}
private function validatePOST() {
$this->load->library('validate');
$validateLib = new validateLibrary();
$result = null;
$name = @$this->request->post['name'];
$package = @$this->request->post['package'];
$price = @$this->request->post['price'];
$status = @$this->request->post['status'];
if(mb_strlen($name) < 2 || mb_strlen($name) > 32) {
$result = "Название тарифа должно содержать от 2 до 32 символов!";
}
elseif(mb_strlen($package) < 1 || mb_strlen($package) > 32) {
$result = "Название пакета должно содержать от 2 до 32 символов!";
}
elseif(!$validateLib->money($price)) {
$result = "Укажите допустимую стоимость!";
}
elseif($status < 0 || $status > 1) {
$result = "Укажите допустимый статус!";
}
return $result;
}
}
?>
@@ -0,0 +1,47 @@
<?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 indexController extends Controller {
private $limit = 20;
public function index($page = 1) {
$this->document->setActiveSection('admin/webtarifs');
$this->document->setActiveItem('index');
if(!$this->user->isLogged()) {
$this->session->data['error'] = "Вы не авторизированы!";
$this->response->redirect($this->config->url . 'account/login');
}
if($this->user->getAccessLevel() < 3) {
$this->session->data['error'] = "У вас нет доступа к данному разделу!";
$this->response->redirect($this->config->url);
}
$this->load->library('pagination');
$this->load->model('webhostTarifs');
$options = array(
'start' => ($page - 1) * $this->limit,
'limit' => $this->limit
);
$total = $this->webhostTarifsModel->getTotalTarifs();
$tarifs = $this->webhostTarifsModel->getTarifs(array(), array(), $options);
$paginationUrl = '/admin/webtarifs/index/index/{page}';
$paginationLib = new paginationLibrary();
$paginationLib->total = $total;
$paginationLib->page = $page;
$paginationLib->limit = $this->limit;
$paginationLib->url = $paginationUrl;
$pagination = $paginationLib->render();
$this->data['tarifs'] = $tarifs;
$this->data['pagination'] = $pagination;
$this->getChild(array('common/admheader', 'common/footer'));
return $this->load->view('admin/webtarifs/index', $this->data);
}
}
?>