瀏覽代碼

add files

Sergey 2 年之前
父節點
當前提交
8063f16b0d
共有 100 個文件被更改,包括 6253 次插入0 次删除
  1. 53 0
      .htaccess
  2. 58 0
      403.html
  3. 59 0
      404.html
  4. 2 0
      README.md
  5. 45 0
      acp/index.php
  6. 43 0
      cron.php
  7. 724 0
      enginegp.sql
  8. 27 0
      fail.html
  9. 二進制
      favicon.ico
  10. 0 0
      files/pages/.htaccess
  11. 0 0
      files/plugins/delete/.htaccess
  12. 0 0
      files/plugins/install/.htaccess
  13. 0 0
      files/plugins/update/.htaccess
  14. 62 0
      index.php
  15. 二進制
      notice.wav
  16. 6 0
      robots.txt
  17. 27 0
      success.html
  18. 133 0
      system/acp/distributor.php
  19. 38 0
      system/acp/engine/addons.php
  20. 41 0
      system/acp/engine/boost.php
  21. 61 0
      system/acp/engine/cashback.php
  22. 37 0
      system/acp/engine/control.php
  23. 9 0
      system/acp/engine/hosting.php
  24. 91 0
      system/acp/engine/index.php
  25. 32 0
      system/acp/engine/jobs.php
  26. 27 0
      system/acp/engine/letter.php
  27. 33 0
      system/acp/engine/logs.php
  28. 31 0
      system/acp/engine/news.php
  29. 32 0
      system/acp/engine/notice.php
  30. 28 0
      system/acp/engine/pages.php
  31. 36 0
      system/acp/engine/promo.php
  32. 69 0
      system/acp/engine/servers.php
  33. 57 0
      system/acp/engine/system.php
  34. 33 0
      system/acp/engine/tarifs.php
  35. 33 0
      system/acp/engine/units.php
  36. 44 0
      system/acp/engine/users.php
  37. 62 0
      system/acp/engine/web.php
  38. 31 0
      system/acp/engine/wiki.php
  39. 45 0
      system/acp/sections/addons/addcat.php
  40. 373 0
      system/acp/sections/addons/addpl.php
  41. 26 0
      system/acp/sections/addons/cats.php
  42. 60 0
      system/acp/sections/addons/delete.php
  43. 68 0
      system/acp/sections/addons/index.php
  44. 337 0
      system/acp/sections/addons/plugin.php
  45. 75 0
      system/acp/sections/addons/search.php
  46. 322 0
      system/acp/sections/addons/update.php
  47. 78 0
      system/acp/sections/addons/updmp.php
  48. 81 0
      system/acp/sections/boost/index.php
  49. 77 0
      system/acp/sections/boost/search.php
  50. 81 0
      system/acp/sections/boost/service.php
  51. 8 0
      system/acp/sections/control/delete.php
  52. 54 0
      system/acp/sections/control/index.php
  53. 35 0
      system/acp/sections/control/overdue.php
  54. 103 0
      system/acp/sections/control/search.php
  55. 109 0
      system/acp/sections/control/server.php
  56. 28 0
      system/acp/sections/jobs/add.php
  57. 39 0
      system/acp/sections/jobs/edit.php
  58. 38 0
      system/acp/sections/jobs/index.php
  59. 64 0
      system/acp/sections/jobs/request.php
  60. 25 0
      system/acp/sections/letter/index.php
  61. 54 0
      system/acp/sections/letter/send.php
  62. 32 0
      system/acp/sections/logs/buy.php
  63. 32 0
      system/acp/sections/logs/cashout.php
  64. 32 0
      system/acp/sections/logs/extend.php
  65. 40 0
      system/acp/sections/logs/index.php
  66. 32 0
      system/acp/sections/logs/part.php
  67. 32 0
      system/acp/sections/logs/replenish.php
  68. 80 0
      system/acp/sections/logs/search.php
  69. 84 0
      system/acp/sections/logs/sysearch.php
  70. 37 0
      system/acp/sections/news/add.php
  71. 8 0
      system/acp/sections/news/delete.php
  72. 40 0
      system/acp/sections/news/index.php
  73. 44 0
      system/acp/sections/news/news.php
  74. 64 0
      system/acp/sections/news/search.php
  75. 55 0
      system/acp/sections/notice/add.php
  76. 8 0
      system/acp/sections/notice/delete.php
  77. 52 0
      system/acp/sections/notice/end.php
  78. 52 0
      system/acp/sections/notice/index.php
  79. 79 0
      system/acp/sections/notice/notice.php
  80. 75 0
      system/acp/sections/notice/search.php
  81. 31 0
      system/acp/sections/pages/add.php
  82. 13 0
      system/acp/sections/pages/delete.php
  83. 36 0
      system/acp/sections/pages/index.php
  84. 37 0
      system/acp/sections/pages/page.php
  85. 88 0
      system/acp/sections/promo/add.php
  86. 9 0
      system/acp/sections/promo/delete.php
  87. 46 0
      system/acp/sections/promo/end.php
  88. 46 0
      system/acp/sections/promo/index.php
  89. 92 0
      system/acp/sections/promo/promo.php
  90. 68 0
      system/acp/sections/promo/search.php
  91. 38 0
      system/acp/sections/promo/stats.php
  92. 77 0
      system/acp/sections/servers/crmp.php
  93. 77 0
      system/acp/sections/servers/cs.php
  94. 77 0
      system/acp/sections/servers/csgo.php
  95. 77 0
      system/acp/sections/servers/css.php
  96. 77 0
      system/acp/sections/servers/cssold.php
  97. 8 0
      system/acp/sections/servers/delete.php
  98. 80 0
      system/acp/sections/servers/index.php
  99. 77 0
      system/acp/sections/servers/mc.php
  100. 77 0
      system/acp/sections/servers/mta.php

+ 53 - 0
.htaccess

@@ -0,0 +1,53 @@
+AddDefaultCharset utf-8
+
+RewriteBase /
+Options -Indexes +FollowSymLinks +MultiViews
+
+RewriteEngine on
+RewriteBase /acp/
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_URI} !=/favicon.ico
+RewriteRule ^acp /acp/index.php [L]
+
+RewriteBase /
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_URI} !=/favicon.ico
+RewriteRule ^(?!acp).* index.php [L]
+
+ErrorDocument 403 /403.html
+ErrorDocument 404 /404.html
+
+#***Раскодировать, если не загружаются большие файлы:
+php_value max_execution_time 500
+php_value max_input_time 500
+php_value upload_max_filesize 30M
+php_value post_max_size 30M
+
+#***Раскодировать, если белый экран:
+#php_flag short_open_tag = On
+
+php_flag display_startup_errors on
+php_flag display_errors on
+php_flag html_errors on
+
+<ifModule mod_expires.c>
+
+ ExpiresActive On
+ #кэшировать флэш и изображения на одну неделю
+ ExpiresByType image/x-icon "access plus 7 days"
+ ExpiresByType image/jpeg "access plus 7 days"
+ ExpiresByType image/png "access plus 7 days"
+ ExpiresByType image/gif "access plus 7 days"
+ ExpiresByType application/x-shockwave-flash "access plus 7 days"
+ #кэшировать css, javascript и текстовые файлы на одну неделю
+ ExpiresByType text/css "access plus 7 days"
+ ExpiresByType text/javascript "access plus 7 days"
+ ExpiresByType application/javascript "access plus 7 days"
+ ExpiresByType application/x-javascript "access plus 7 days"
+ #кэшировать html и htm файлы на один день
+ ExpiresByType text/html "access plus 1 day"
+ #кэшировать xml файлы на десять минут
+ ExpiresByType application/xhtml+xml "access plus 10 minutes"
+</ifModule>

+ 58 - 0
403.html

@@ -0,0 +1,58 @@
+<!DOCTYPE html>
+<html lang="ru">
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+		<title>Доступ запрещен</title>
+		<link rel="icon" href="/favicon.ico">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+		<meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов." />
+		<meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера" />
+<style>
+@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700&subset=cyrillic');
+* {margin:0px; padding:0px; border:none; outline:none; box-sizing:border-box;}
+a {color:#fff; text-decoration:none; border-bottom:1px dashed #fff;}
+a:hover {border-bottom:transparent;}
+body {min-height:100vh; background:url('/template/images/error/403.png') center no-repeat; background-size:cover; color:#fff; font-size:16px; font-family:'Roboto Condensed', sans-serif;;}
+.container {width:650px; margin:0 auto; padding:200px 0 20px;}
+.content {display:inline-block; width:100%; background:rgba(204, 51, 51, 0.1); padding:15px 5px; text-align:center; font-size:20px; border:4px double rgba(255, 255, 255, 0.25); text-transform: uppercase;}
+.content span {display:block; margin:0 auto; padding:15px 0; font-size:75px; font-weight:bold; text-shadow:0 0 80px rgba(255, 255, 255, 0.5);}
+.links ul {display:table; margin:20px auto;}
+.links ul li {float:left; list-style-type:none; margin:0 20px; text-transform:uppercase;}
+.copy {padding:5px 10px; color:#eee; text-align:center;}
+
+@media screen and (max-width: 768px) {
+    body {font-size:14px;}
+    .container {width:100%; padding:100px 20px 20px;}
+    .content {font-size:16px;}
+    .content span {font-size:50px;}
+    .links ul li {width:100px; margin:5px 20px; text-align:center;}
+    .links ul li:nth-child(4) {clear:both;}
+}
+
+@media screen and (max-width: 468px) {
+    .container {padding-top:30px;}
+    .content span {font-size:36px;}
+    .links ul li {width:70px;}
+    .links ul li:nth-child(2n+3) {clear:both;}
+    .links ul li:nth-child(4) {clear:none;}
+}
+</style>
+	</head>
+	<body>
+		<div class="container">
+			<div class="content">
+				У вас нет прав для просмотра данной страницы
+				<span>Ошибка 403</span> Вы можете посетить другие страницы хостинга
+			</div>
+			<div class="links">
+				<ul>
+				<li><a href="/">Главная</a></li>
+				<li><a href="/news">Новости</a></li>
+				<li><a href="/services">Услуги</a></li>
+				<li><a href="/contacts">Контакты</a></li>
+				</ul>
+			</div>
+		</div>
+	</body>
+</html>

+ 59 - 0
404.html

@@ -0,0 +1,59 @@
+<!DOCTYPE html>
+<html lang="ru">
+	<head>
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+		<title>Страница не найдена</title>
+		<link rel="icon" href="/favicon.ico">
+		<meta name="viewport" content="width=device-width, initial-scale=1.0">
+
+		<meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов." />
+		<meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера" />
+
+<style>
+@import url('https://fonts.googleapis.com/css?family=Roboto+Condensed:400,700&subset=cyrillic');
+* {margin:0px; padding:0px; border:none; outline:none; box-sizing:border-box;}
+a {color:#fff; text-decoration:none; border-bottom:1px dashed #fff;}
+a:hover {border-bottom:transparent;}
+body {min-height:100vh; background:url('/template/images/error/404.png') center no-repeat; background-size:cover; color:#fff; font-size:16px; font-family:'Roboto Condensed', sans-serif;;}
+.container {width:650px; margin:0 auto; padding:200px 0 20px;}
+.content {display:inline-block; width:100%; background:rgba(204, 51, 51, 0.1); padding:15px 5px; text-align:center; font-size:20px; border:4px double rgba(255, 255, 255, 0.25); text-transform: uppercase;}
+.content span {display:block; margin:0 auto; padding:15px 0; font-size:75px; font-weight:bold; text-shadow:0 0 80px rgba(255, 255, 255, 0.5);}
+.links ul {display:table; margin:20px auto;}
+.links ul li {float:left; list-style-type:none; margin:0 20px; text-transform:uppercase;}
+.copy {padding:5px 10px; color:#eee; text-align:center;}
+
+@media screen and (max-width: 768px) {
+    body {font-size:14px;}
+    .container {width:100%; padding:100px 20px 20px;}
+    .content {font-size:16px;}
+    .content span {font-size:50px;}
+    .links ul li {width:100px; margin:5px 20px; text-align:center;}
+    .links ul li:nth-child(4) {clear:both;}
+}
+
+@media screen and (max-width: 468px) {
+    .container {padding-top:30px;}
+    .content span {font-size:36px;}
+    .links ul li {width:70px;}
+    .links ul li:nth-child(2n+3) {clear:both;}
+    .links ul li:nth-child(4) {clear:none;}
+}
+</style>
+	</head>
+	<body>
+		<div class="container">
+			<div class="content">
+				К сожалению, страница не найдена
+				<span>Ошибка 404</span> Вы можете посетить другие страницы хостинга
+			</div>
+			<div class="links">
+				<ul>
+				<li><a href="/">Главная</a></li>
+				<li><a href="/news">Новости</a></li>
+				<li><a href="/services">Услуги</a></li>
+				<li><a href="/contacts">Контакты</a></li>
+				</ul>
+			</div>
+		</div>
+	</body>
+</html>

+ 2 - 0
README.md

@@ -0,0 +1,2 @@
+# enginegp
+EngineGP

+ 45 - 0
acp/index.php

@@ -0,0 +1,45 @@
+<?php
+	header('Content-Type: text/html; charset=utf-8');
+
+	date_default_timezone_set('Europe/Moscow');
+
+	@ini_set('display_errors', FALSE);
+	@ini_set('html_errors', FALSE);
+	@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE ^ E_STRICT);
+
+	DEFINE('EGP', TRUE);
+	DEFINE('ROOT', '../');
+	DEFINE('SYS', ROOT.'system/');
+	DEFINE('ACP', ROOT.'system/acp/');
+	DEFINE('TPL', ROOT.'template/acp/');
+	DEFINE('TEMP', ROOT.'temp/');
+	DEFINE('FILES', ROOT.'files/');
+	DEFINE('DATA', SYS.'data/');
+	DEFINE('LIB', SYS.'library/');
+	DEFINE('ENG', SYS.'acp/engine/');
+	DEFINE('SEC', SYS.'acp/sections/');
+
+	$start_point = $_SERVER['REQUEST_TIME'];
+
+	$mcache = new Memcache;
+	$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: #mc0, обновите страницу позже, если ошибка повторяется, обратитесь в тех.поддержку: <a href="https://enginegp.ru">EGPv3</a>');
+
+	// Настройки
+	include(DATA.'config.php');
+	include(DATA.'mysql.php');
+	include(DATA.'params.php');
+	include(DATA.'acpengine.php');
+
+	// Библиотеки
+	include(LIB.'sql.php');
+	include(LIB.'html.php');
+	include(LIB.'acpsystem.php');
+
+	$uip = sys::ip();
+
+	// Распределитель
+	include(ACP.'distributor.php');
+
+	// Выхлоп
+	echo $html->arr['all'];
+?>

+ 43 - 0
cron.php

@@ -0,0 +1,43 @@
+<?php
+	date_default_timezone_set('Europe/Moscow');
+
+	@ini_set('display_errors', TRUE);
+	@ini_set('html_errors', TRUE);
+	@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE ^ E_STRICT);
+
+	DEFINE('EGP', TRUE);
+	DEFINE('DIR', dirname('index.php'));
+	DEFINE('ROOT', DIR.'/');
+	DEFINE('SYS', ROOT.'system/');
+	DEFINE('TPL', ROOT.'template/');
+	DEFINE('TEMP', ROOT.'temp/');
+	DEFINE('FILES', ROOT.'files/');
+	DEFINE('DATA', SYS.'data/');
+	DEFINE('LIB', SYS.'library/');
+	DEFINE('ENG', SYS.'engine/');
+	DEFINE('SEC', SYS.'sections/');
+	DEFINE('CRON', LIB.'cron/');
+
+	$start_point = $_SERVER['REQUEST_TIME'];
+
+	$mcache = new Memcache;
+	$mcache->connect('127.0.0.1', 11211) OR exit('Ошибка: не удалось создать связь с Memcache.'.PHP_EOL);
+
+	// Настройки
+	include(DATA.'config.php');
+
+	/*if($argv[1] != $cfg['cron_key'])
+		exit('error key.'.PHP_EOL);
+*/
+	$task = $argv[2];
+
+	include(DATA.'engine.php');
+	include(DATA.'mysql.php');
+	include(DATA.'params.php');
+
+	// Библиотеки
+	include(LIB.'sql.php');
+	include(LIB.'html.php');
+	include(LIB.'system.php');
+	include(LIB.'cron.php');
+?>

文件差異過大導致無法顯示
+ 724 - 0
enginegp.sql


+ 27 - 0
fail.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="ru">
+	<head>
+		<title>EGPv3 - Ошибка при пополнении баланса</title>
+		<link rel="icon" href="/favicon.ico">
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+		
+		<meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов." />
+		<meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера" />
+
+		<!-- styles !-->
+		<link rel="stylesheet" type="text/css" href="/template/css/error.css" media="screen" />
+	</head>
+	<body>
+		<div class="error fail-replenish"></div>
+		<div class="content">
+			<h1 class="info-fail">Уважаемый клиент, к сожалению, произошла ошибка при пополнении</h1>
+
+			<ul>
+				<li><a href="/">Главная</a></li>
+				<li><a href="/news">Новости</a></li>
+				<li><a href="/services">Услуги</a></li>
+				<li><a href="/contacts">Контакты</a></li>
+			</ul>
+		</div>
+	</body>
+</html>

二進制
favicon.ico


+ 0 - 0
files/pages/.htaccess


+ 0 - 0
files/plugins/delete/.htaccess


+ 0 - 0
files/plugins/install/.htaccess


+ 0 - 0
files/plugins/update/.htaccess


+ 62 - 0
index.php

@@ -0,0 +1,62 @@
+<?php
+	header('Content-Type: text/html; charset=utf-8');
+	header('X-Powered-By: EGP');
+
+	date_default_timezone_set('Europe/Moscow');
+
+	@ini_set('display_errors', TRUE);
+	@ini_set('html_errors', TRUE);
+	@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE ^ E_STRICT);
+
+	DEFINE('EGP', TRUE);
+	DEFINE('DIR', dirname('index.php'));
+	DEFINE('ROOT', DIR.'/');
+	DEFINE('SYS', ROOT.'system/');
+	DEFINE('TPL', ROOT.'template/');
+	DEFINE('TEMP', ROOT.'temp/');
+	DEFINE('FILES', ROOT.'files/');
+	DEFINE('DATA', SYS.'data/');
+	DEFINE('LIB', SYS.'library/');
+	DEFINE('ENG', SYS.'engine/');
+	DEFINE('SEC', SYS.'sections/');
+
+	$device = isset($_COOKIE['egp_device']) ? $_COOKIE['egp_device'] : '!mobile';
+	$start_point = $_SERVER['REQUEST_TIME'];
+
+	$mcache = new Memcache;
+	$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: #mc0, обновите страницу позже, если ошибка повторяется, обратитесь в тех.поддержку: <a href="https://enginegp.ru">EGPv3</a>');
+
+	// Настройки
+	include(DATA.'config.php');
+	include(DATA.'engine.php');
+	include(DATA.'mysql.php');
+	include(DATA.'params.php');
+
+	// Библиотеки
+	include(LIB.'sql.php');
+	include(LIB.'html.php');
+	include(LIB.'system.php');
+
+	$uip = sys::ip();
+
+	/* if(!isset($_COOKIE['egp_device']))
+	{
+		include(LIB.'megp.php');
+
+		$device = $megp->isMobile() ? 'mobile' : '!mobile';
+
+		sys::cookie('egp_device', $device, 14);
+
+		if($device == 'mobile')
+			sys::back();
+	} */
+
+	// Распределитель
+	if($device == '!mobile')
+		include(SYS.'distributor.php');
+	/* else
+		include(SYS.'mdistributor.php'); */
+
+	// Выхлоп
+	echo $html->arr['all'];
+?>

二進制
notice.wav


+ 6 - 0
robots.txt

@@ -0,0 +1,6 @@
+User-agent: *
+Disallow: /acp
+Disallow: /system
+Disallow: /temp
+Disallow: /template
+Disallow: /upload

+ 27 - 0
success.html

@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html lang="ru">
+	<head>
+		<title>EGPv3 - Успешное пополение баланса</title>
+		<link rel="icon" href="/favicon.ico">
+		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+		
+		<meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов." />
+		<meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера" />
+
+		<!-- styles !-->
+		<link rel="stylesheet" type="text/css" href="/template/css/replenish.css" media="screen" />
+	</head>
+	<body>
+		<div class="success success-replenish"></div>
+		<div class="content">
+			<h1 class="info-success">Уважаемый клиент, Вы успешо пополнили свой баланс</h1>
+
+			<ul>
+				<li><a href="/">Главная</a></li>
+				<li><a href="/news">Новости</a></li>
+				<li><a href="/services">Услуги</a></li>
+				<li><a href="/contacts">Контакты</a></li>
+			</ul>
+		</div>
+	</body>
+</html>

+ 133 - 0
system/acp/distributor.php

@@ -0,0 +1,133 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$device = '!mobile';
+
+    // Парсинг адреса
+    $url = is_array(sys::url()) ? sys::url() : array();
+    $route = sys::url(false);
+    $section = isset($url['section']) ? $url['section'] : false;
+
+    $id = array_key_exists('id', $url) ? sys::int($url['id']) : false;
+    $go = array_key_exists('go', $url);
+    $page = array_key_exists('page', $url) ? sys::int($url['page']) : 1;
+    $route = $route == '' ? 'index' : $route;
+
+	$auth = false;
+
+    // Проверка cookie на авторизацию
+    $aAuth = array();
+
+    $aAuth['login'] = isset($_COOKIE['egp_login']) ? $_COOKIE['egp_login'] : '';
+    $aAuth['passwd'] = isset($_COOKIE['egp_passwd']) ? $_COOKIE['egp_passwd'] : '';
+    $aAuth['authkeycheck'] = isset($_COOKIE['egp_authkeycheck']) ? $_COOKIE['egp_authkeycheck'] : '';
+
+    $authkey = md5($aAuth['login'].$uip.$aAuth['passwd']);
+
+    if(!in_array('', $aAuth) AND $authkey == $aAuth['authkeycheck'])
+    {
+        if((!sys::valid($aAuth['login'], 'other', $aValid['login'])) AND !sys::valid($aAuth['passwd'], 'md5'))
+        {
+            $sql->query('SELECT `id` FROM `users` WHERE `login`="'.$aAuth['login'].'" AND `passwd`="'.$aAuth['passwd'].'" AND `group`="admin" LIMIT 1');
+            if($sql->num())
+            {
+                $sql->query('SELECT `id`, `login`, `balance`, `group`, `time` FROM `users` WHERE `login`="'.$aAuth['login'].'" AND `passwd`="'.$aAuth['passwd'].'" LIMIT 1');
+                $user = $sql->get();
+
+                // Обновление активности
+                if($user['time']+10 < $start_point)
+                    $sql->query('UPDATE `users` set `time`="'.$start_point.'" WHERE `id`="'.$user['id'].'" LIMIT 1');
+
+                $auth = true;
+            }
+        }
+    }
+
+	if(!$auth)
+		exit(header('Refresh: 0; URL=http://'.$cfg['url'].'/403'));
+
+    // Подключение файла
+    if(in_array($route, $aRoute))
+        include(ENG.$route.'.php');
+    else{
+		$route = 'index';
+        include(ENG.'index.php');
+	}
+
+    // Обновление ссылок
+	if(isset($html->arr['main']))
+    {
+		$html->upd(
+			array(
+				'[cur]',
+				'[acp]',
+				'[home]',
+				'[js]',
+				'[css]',
+				'[img]'
+			),
+
+			array(
+				$cfg['currency'],
+				$cfg['http'].'acp/',
+				$cfg['http'],
+				$cfg['http'].'template/acp/js/',
+				$cfg['http'].'template/acp/css/',
+				$cfg['http'].'template/acp/images/'
+			),
+			'main'
+		);
+	}
+
+	if(isset($html->arr['menu']))
+    {
+		$html->upd(
+			array(
+				'[acp]',
+				'[home]',
+				'[js]',
+				'[css]',
+				'[img]'
+			),
+
+			array(
+				$cfg['http'].'acp/',
+				$cfg['http'],
+				$cfg['http'].'template/acp/js/',
+				$cfg['http'].'template/acp/css/',
+				$cfg['http'].'template/acp/images/'
+			),
+			'menu'
+		);
+	}
+
+    // Заготовка выхлопа
+    $html->get('all');
+
+        $html->set('acp', $cfg['http'].'acp/');
+        $html->set('admin', $user['id']);
+        $html->set('home', $cfg['http']);
+        $html->set('js', $cfg['http'].'template/acp/js/');
+        $html->set('css', $cfg['http'].'template/acp/css/');
+        $html->set('img', $cfg['http'].'template/acp/images/');
+
+		if(isset($html->arr['menu']))
+		{
+			$html->unit('section', true);
+			$html->set('info', $info);
+			$html->set('menu', $html->arr['menu']);
+		}else
+			$html->unit('section');
+
+		$html->unit('p_'.$route, true);
+
+		unset($aRoute[array_search($route, $aRoute)]);
+
+		foreach($aRoute as $route)
+			$html->unit('p_'.$route);
+
+        $html->set('main', isset($html->arr['main']) ? $html->arr['main'] : '', true);
+
+    $html->pack('all');
+?>

+ 38 - 0
system/acp/engine/addons.php

@@ -0,0 +1,38 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-cubes"></i> Управление дополнениями';
+
+	$aSection = array(
+		'index',
+		'update',
+		'addcat',
+		'addpl',
+		'cats',
+		'updmp',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/addons');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `plugins_category`');
+		$html->set('cats', $sql->num());
+
+		$sql->query('SELECT `id` FROM `plugins`');
+		$html->set('plugins', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'addons/'.$section.'.php');
+?>

+ 41 - 0
system/acp/engine/boost.php

@@ -0,0 +1,41 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	include(DATA.'boost.php');
+
+	$info = '<i class="fa fa-cloud"></i> Статистика BOOST CS: 1.6';
+
+	$aSection = $aBoost['cs']['boost'];
+
+	if($section == 'search')
+		include(SEC.'boost/search.php');
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/boost');
+
+		$boosts = '';
+
+		if($section != 'index')
+			$html->unit('s_index');
+		else
+			$html->unit('s_index', true);
+
+		foreach($aSection as $service)
+		{
+			if($section == $service)
+				$boosts .= '<li><a href="[acp]boost/section/'.$section.'" class="active"><i class="fa fa-list-ol"></i> '.$aBoost['cs'][$section]['site'].'</a></li>';
+			else
+				$boosts .= '<li><a href="[acp]boost/section/'.$service.'"><i class="fa fa-list-ol"></i> '.$aBoost['cs'][$service]['site'].'</a></li>';
+		}
+
+		$html->set('boosts', $boosts);
+
+	$html->pack('menu');
+
+	$inc = $section != 'index' ? 'service' : 'index';
+
+	include(SEC.'boost/'.$inc.'.php');
+?>

+ 61 - 0
system/acp/engine/cashback.php

@@ -0,0 +1,61 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	@ini_set('display_errors', TRUE);
+	@ini_set('html_errors', TRUE);
+	@ini_set('error_reporting', E_ALL ^ E_WARNING ^ E_NOTICE ^ E_STRICT);
+
+	$nmc = 'cashback_'.$id;
+
+	// Проверка сессии
+	if($mcache->get($nmc))
+		sys::outjs(array('e' => $text['mcache']), $nmc);
+
+	// Создание сессии
+	$mcache->set($nmc, 1, false, 10);
+
+	if($id)
+	{
+		$sql->query('SELECT `user`, `money`, `purse`, `status` FROM `cashback` WHERE `id`="'.$id.'" LIMIT 1');
+		$cb = $sql->get();
+
+		if(!$cb['status'])
+			sys::outjs(array('e' => 'Данная заявка уже была обработана'), $nmc);
+
+		$purse = $cb['purse']{0} == 'R' ?  'webmoney' : 'qiwi';
+
+		// Запрос на шлюз
+		if($cfg['part_gateway'] == 'unitpay')
+		{
+			$sum = $cb['money']-($cb['money']/100*$cfg['part_output_proc']);
+
+			$json = file_get_contents('https://unitpay.ru/api?method=massPayment&params[sum]='.$sum.'&params[purse]='.$cb['purse'].'&params[login]='.$cfg['unitpay_mail'].'&params[transactionId]='.$id.' &params[secretKey]='.$cfg['unitpay_api'].'&params[paymentType]='.$purse);
+
+			$array = json_decode($json, true);
+
+			// Упешный вывод средств
+			if(is_array($array) AND isset($array['result']) AND in_array($array['result']['status'], array('success', 'not_completed ')))
+			{
+				$sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1');
+				$sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'),
+				array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"');
+
+				sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен'), $nmc);
+			}
+
+			if(!is_array($array))
+				sys::outjs(array('e' => 'Неудалось выполнить запрос'), $nmc);
+
+			sys::outjs(array('e' => $array['error']['message']), $nmc);
+		}
+
+		$sql->query('UPDATE `cashback` set `status`="0" WHERE `id`="'.$id.'" LIMIT 1');
+		$sql->query('INSERT INTO `logs` set `user`="'.$cb['user'].'", `text`="'.sys::updtext(sys::text('logs', 'cashback'),
+			array('purse' => $purse, 'money' => $cb['money'])).'", `date`="'.$start_point.'", `type`="cashback", `money`="'.$cb['money'].'"');
+
+		sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен в ручном режиме'), $nmc);
+	}
+
+	sys::outjs(array('e' => 'Не передан идентификатор заявки'), $nmc);
+?>

+ 37 - 0
system/acp/engine/control.php

@@ -0,0 +1,37 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-dropbox"></i> Контроль';
+
+	$aSection = array(
+		'index',
+		'overdue',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$del = $cfg['server_delete']*86400;
+	$time = $start_point-$del;
+
+	$html->get('menu', 'sections/control');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"');
+		$html->set('all', $sql->num());
+
+		$sql->query('SELECT `id` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"');
+		$html->set('overdue', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'control/'.$section.'.php');
+?>

+ 9 - 0
system/acp/engine/hosting.php

@@ -0,0 +1,9 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-globe"></i> Список вирт. хостингов';
+
+	$html->get('menu', 'sections/hosting');
+	$html->pack('menu');
+?>

+ 91 - 0
system/acp/engine/index.php

@@ -0,0 +1,91 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$mcache_name = 'acp_main';
+
+	$html->arr['main'] = $mcache->get($mcache_name);
+
+	$cbs = $sql->query('SELECT * FROM `cashback` WHERE `status`="1" ORDER BY `date` ASC');
+	while($cb = $sql->get($cbs))
+	{
+		$sql->query('SELECT `mail` FROM `users` WHERE `id`="'.$cb['user'].'" LIMIT 1');
+		$us = $sql->get();
+
+		$html->get('cashback');
+
+			$html->set('id', $cb['id']);
+			$html->set('user', $cb['user']);
+			$html->set('mail', $us['mail']);
+			$html->set('money', $cb['money'].' '.$cfg['currency']);
+			$html->set('cashback', ($cb['money']-($cb['money']/100*$cfg['part_output_proc'])).' '.$cfg['currency']);
+			$html->set('type', $cb['purse']{0} == 'R' ? '<span class="text-blue">WebMoney</span>' : '<span class="text-orange">Qiwi</span>');
+			$html->set('purse', $cb['purse']);
+			$html->set('gateway', empty($cfg['part_gateway']) ? 'mm' : 'auto');
+			$html->set('date', sys::today($cb['date']));
+
+		$html->pack('cashback');
+	}
+
+	$html->arr['cashback'] = isset($html->arr['cashback']) ? $html->arr['cashback'] : '';
+
+	if($html->arr['main'] == '')
+	{
+		$sql->query('SELECT `id` FROM `users`');
+		$users = $sql->num();
+
+		$sql->query('SELECT `id`, `game`, `slots` FROM `servers`');
+		$servers = $sql->num();
+
+		$aSlots = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0);
+		$aServers = array('cs' => 0, 'cssold' => 0, 'css' => 0, 'csgo' => 0, 'samp' => 0, 'crmp' => 0, 'mta' => 0, 'mc' => 0);
+
+		while($server = $sql->get())
+		{
+			$aSlots[$server['game']] += $server['slots'];
+			$aServers[$server['game']] += 1;
+		}
+
+		$sql->query('SELECT SUM(`money`) FROM `logs` WHERE `type`="replenish"');
+		$replenish = $sql->get();
+
+		$sf_list = '';
+
+		$sql->query('SELECT `id`, `name`, `group`, `lastname`, `ip`, `browser`, `time` FROM `users` WHERE `group`!="user" ORDER BY `id` ASC LIMIT 20');
+		while($staff = $sql->get())
+		{
+			$online = $staff['time']+15 > $start_point ? 'text-green">Онлайн' : 'text-red">Офлайн';
+
+			$group = $staff['group'] == 'admin' ? 'text-red">Администратор' : '">Тех. Поддержка';
+
+			$sf_list .= '<tr>';
+				$sf_list .= '<td>'.$staff['id'].'</td>';
+				$sf_list .= '<td><a href="'.$cfg['http'].'acp/users/id/'.$staff['id'].'">'.$staff['lastname'].' '.$staff['name'].'</a></td>';
+				$sf_list .= '<td class="text-center '.$group.'</td>';
+				$sf_list .= '<td class="text-center">'.$staff['ip'].'</td>';
+				$sf_list .= '<td class="text-center">'.$staff['browser'].'</td>';
+				$sf_list .= '<td class="text-center '.$online.'</td>';
+				$sf_list .= '<td class="text-right">'.sys::today($staff['time']).'</td>';
+			$sf_list .= '</tr>';
+		}
+
+		$html->get('main');
+
+			$html->set('cashback', $html->arr['cashback']);
+			$html->set('users', $users);
+			$html->set('servers', $servers);
+			$html->set('replenish', $replenish['SUM(`money`)']);
+			$html->set('staff', $sf_list);
+
+			foreach($aSlots as $game => $slots)
+				$html->set('slots_'.$game, $slots);
+
+			foreach($aServers as $game => $num)
+				$html->set($game, $num);
+
+		$html->pack('main');
+
+		$mcache->set($mcache_name, $html->arr['main'], false, 10);
+	}else
+		$html->arr['main'] = str_replace('[cashback]', $html->arr['cashback'], $html->arr['main']);
+?>

+ 32 - 0
system/acp/engine/jobs.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-envelope-open"></i> Вакансии';
+
+	$aSection = array(
+		'index',
+		'add',
+		'request'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/jobs');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `jobs`');
+		$html->set('jobs', $sql->num());
+		$sql->query('SELECT `id` FROM `jobs_app`');
+		$html->set('jobs_app', $sql->num());
+	$html->pack('menu');
+
+	include(SEC.'jobs/'.$section.'.php');
+?>

+ 27 - 0
system/acp/engine/letter.php

@@ -0,0 +1,27 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-envelope-open"></i> Рассылка новостей';
+
+	$aSection = array(
+		'index',
+		'send'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/letter');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+	$html->pack('menu');
+
+	include(SEC.'letter/'.$section.'.php');
+?>

+ 33 - 0
system/acp/engine/logs.php

@@ -0,0 +1,33 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-clipboard"></i> Логи операций';
+
+	$aSection = array(
+		'index',
+		'buy',
+		'extend',
+		'boost',
+		'cashout',
+		'part',
+		'search',
+		'replenish'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/logs');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+	$html->pack('menu');
+
+	include(SEC.'logs/'.$section.'.php');
+?>

+ 31 - 0
system/acp/engine/news.php

@@ -0,0 +1,31 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-newspaper-o"></i> Управление новостями';
+
+	$aSection = array(
+		'index',
+		'add',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/news');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `news`');
+		$html->set('news', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'news/'.$section.'.php');
+?>

+ 32 - 0
system/acp/engine/notice.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-bullhorn"></i> Управление уведомлениями';
+
+	$aSection = array(
+		'index',
+		'add',
+		'end',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/notice');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `notice` WHERE `time`>"'.$start_point.'"');
+		$html->set('active', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'notice/'.$section.'.php');
+?>

+ 28 - 0
system/acp/engine/pages.php

@@ -0,0 +1,28 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-file-text-o"></i> Управление старницами';
+
+	$aSection = array(
+		'index',
+		'add',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/pages');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+	$html->pack('menu');
+
+	include(SEC.'pages/'.$section.'.php');
+?>

+ 36 - 0
system/acp/engine/promo.php

@@ -0,0 +1,36 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-gift"></i> Управление акциями';
+
+	$aSection = array(
+		'index',
+		'add',
+		'end',
+		'stats',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/promo');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `promo` WHERE `time`>"'.$start_point.'"');
+		$html->set('active', $sql->num());
+
+		$sql->query('SELECT `id` FROM `promo` WHERE `time`<"'.$start_point.'"');
+		$html->set('end', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'promo/'.$section.'.php');
+?>

+ 69 - 0
system/acp/engine/servers.php

@@ -0,0 +1,69 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-gamepad"></i> Список серверов';
+
+	$aSection = array(
+		'index',
+		'cs',
+		'cssold',
+		'css',
+		'csgo',
+		'samp',
+		'crmp',
+		'mta',
+		'mc',
+		'overdue',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$del = $cfg['server_delete']*86400;
+	$time = $start_point-$del;
+
+	$html->get('menu', 'sections/servers');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1"');
+		$html->set('all', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cs"');
+		$html->set('cs', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="cssold"');
+		$html->set('cssold', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="css"');
+		$html->set('css', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="csgo"');
+		$html->set('csgo', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="samp"');
+		$html->set('samp', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="crmp"');
+		$html->set('crmp', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mta"');
+		$html->set('mta', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `game`="mc"');
+		$html->set('mc', $sql->num());
+
+		$sql->query('SELECT `id` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$time.'"');
+		$html->set('overdue', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'servers/'.$section.'.php');
+?>

+ 57 - 0
system/acp/engine/system.php

@@ -0,0 +1,57 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1');
+		$unit = $sql->get();
+
+		include(LIB.'ssh.php');
+
+		if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit')))
+		{
+			if(!$ssh->auth($unit['passwd'], $unit['address']))
+				sys::outjs(array('e' => 'Не удалось создать связь с сервером'));
+
+			if($url['service'] == 'unit')
+				$ssh->set('screen -dmS reboot reboot');
+			else
+				$ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart');
+
+			sys::outjs(array('s' => 'ok'));
+		}
+
+		$aData = array(
+			'cpu' => '0%',
+			'ram' => '0%',
+			'hdd' => '0%',
+			'apache' => '<a href="#" onclick="return system_restart(\'apache\')">Перезагрузить</a>',
+			'nginx' => '<a href="#" onclick="return system_restart(\'nginx\')">Перезагрузить</a>',
+			'mysql' => '<a href="#" onclick="return system_restart(\'mysql\')">Перезагрузить</a>',
+			'uptime' => 'unknown',
+			'ssh' => 'error'
+		);
+
+		if(!$ssh->auth($unit['passwd'], $unit['address']))
+			sys::outjs($aData);
+
+		$aData['ssh'] = '<i class="fa fa-retweet pointer" id="system_restart(\'unit\')" onclick="return system_restart(\'unit\')"></i>';
+
+		$stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`');
+		$aData['ram'] = ceil(sys::ram_load($stat_ram)).'%';
+
+		$aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1');
+
+		$time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\''));
+		$aData['uptime'] = sys::uptime_load($time);
+
+		$aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%';
+
+		sys::outjs($aData);
+	}
+
+	$html->get('index', 'sections/system');
+
+	$html->pack('main');
+?>

+ 33 - 0
system/acp/engine/tarifs.php

@@ -0,0 +1,33 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-shopping-bag"></i> Управление тарифами';
+
+	$aSection = array(
+		'index',
+		'add',
+		'copy',
+		'stats',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/tarifs');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `tarifs`');
+		$html->set('tarifs', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'tarifs/'.$section.'.php');
+?>

+ 33 - 0
system/acp/engine/units.php

@@ -0,0 +1,33 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-server"></i> Управление локациями';
+
+	$aSection = array(
+		'index',
+		'add',
+		'loading',
+		'stats',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/units');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `units`');
+		$html->set('units', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'units/'.$section.'.php');
+?>

+ 44 - 0
system/acp/engine/users.php

@@ -0,0 +1,44 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-users"></i> Управление пользователями';
+
+	$aSection = array(
+		'index',
+		'online',
+		'offline',
+		'signup',
+		'stats',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/users');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `users`');
+		$all = $sql->num();
+
+		$sql->query('SELECT `id` FROM `users` WHERE `time`>"'.($start_point-180).'"');
+		$online = $sql->num();
+
+		$html->set('all', $all);
+		$html->set('online', $online);
+		$html->set('offline', $all-$online);
+
+		$sql->query('SELECT `id` FROM `signup`');
+		$html->set('signup', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'users/'.$section.'.php');
+?>

+ 62 - 0
system/acp/engine/web.php

@@ -0,0 +1,62 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-cloud"></i> Список бесплатных услуг';
+
+	$aSection = array(
+		'index',
+		'csbans',
+		'csstats',
+		'astats',
+		'sourcebans',
+		'mysql',
+		'hosting'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/web');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+		$sql->query('SELECT `id` FROM `web`');
+		$html->set('all', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="amxbans"');
+		$html->set('amxbans', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="csbans"');
+		$html->set('csbans', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="psychostats"');
+		$html->set('psychostats', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="csstats"');
+		$html->set('csstats', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="astats"');
+		$html->set('astats', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="sourcebans"');
+		$html->set('sourcebans', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="rankme"');
+		$html->set('rankme', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="mysql"');
+		$html->set('mysql', $sql->num());
+
+		$sql->query('SELECT `id` FROM `web` WHERE `type`="hosting"');
+		$html->set('hosting', $sql->num());
+
+	$html->pack('menu');
+
+	include(SEC.'web/'.$section.'.php');
+?>

+ 31 - 0
system/acp/engine/wiki.php

@@ -0,0 +1,31 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$info = '<i class="fa fa-cubes"></i> Управление википедией';
+
+	$aSection = array(
+		'addcat',
+		'cat',
+		'cats',
+		'index',
+		'add',
+		'delete'
+	);
+
+	if(!in_array($section, $aSection))
+		$section = 'index';
+
+	$html->get('menu', 'sections/wiki');
+
+		$html->unit('s_'.$section, true);
+
+		unset($aSection[array_search($section, $aSection)]);
+
+		foreach($aSection as $noactive)
+			$html->unit('s_'.$noactive);
+
+	$html->pack('menu');
+
+	include(SEC.'wiki/'.$section.'.php');
+?>

+ 45 - 0
system/acp/sections/addons/addcat.php

@@ -0,0 +1,45 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$aGames = array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc');
+
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
+		$aData['cs'] = isset($_POST['cs']) ? trim($_POST['cs']) : 0;
+		$aData['cssold'] = isset($_POST['cssold']) ? $_POST['cssold'] : 0;
+		$aData['css'] = isset($_POST['css']) ? $_POST['css'] : 0;
+		$aData['csgo'] = isset($_POST['csgo']) ? $_POST['csgo'] : 0;
+		$aData['samp'] = isset($_POST['samp']) ? $_POST['samp'] : 0;
+		$aData['crmp'] = isset($_POST['crmp']) ? $_POST['crmp'] : 0;
+		$aData['mta'] = isset($_POST['mta']) ? $_POST['mta'] : 0;
+		$aData['mc'] = isset($_POST['mc']) ? $_POST['mc'] : 0;
+		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : 0;
+
+		foreach($aGames as $game)
+			$aData[$game] = (string) $aData[$game] == 'on' ? '1' : '0';
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+		foreach($aGames as $game)
+		{
+			if(!$aData[$game])
+				continue;
+
+			$sql->query('INSERT INTO `plugins_category` set '
+				.'`game`="'.$game.'",'
+				.'`name`="'.htmlspecialchars($aData['name']).'",'
+				.'`sort`="'.$aData['sort'].'"');
+		}
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('addcat', 'sections/addons');
+
+	$html->pack('main');
+?>

+ 373 - 0
system/acp/sections/addons/addpl.php

@@ -0,0 +1,373 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$aGames = array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc');
+	$types = array('cfg', 'txt', 'ini', 'js');
+
+	if(isset($url['get']))
+	{
+		if($url['get'] == 'cat')
+		{
+			$game = isset($url['game']) ? $url['game'] : sys::out();
+
+			if(!in_array($game, $aGames))
+				sys::out();
+
+			$cats = '';
+
+			$sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$game.'" ORDER BY `sort` ASC');
+			while($cat = $sql->get())
+				$cats .= '<option value="'.$cat['id'].'">'.$cat['name'].'</option>';
+
+			sys::out($cats);
+		}
+	}
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
+		$aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : '';
+		$aData['cat'] = isset($_POST['category']) ? ceil($_POST['category']) : 0;
+		$aData['status'] = isset($_POST['status']) ? ceil($_POST['status']) : 0;
+		$aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : '';
+		$aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : '';
+		$aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : '';
+		$aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : '';
+		$aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : '';
+		$aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : '';
+		$aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : '';
+		$aData['update'] = isset($_POST['update']) ? ceil($_POST['update']) : 0;
+		$aData['delete'] = isset($_POST['delete']) ? ceil($_POST['delete']) : 0;
+		$aData['aecfg'] = isset($_POST['aecfg']) ? $_POST['aecfg'] : 0;
+		$aData['sort'] = isset($_POST['sort']) ? ceil($_POST['sort']) : 0;
+		$aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : 0;
+
+		$aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array();
+		$aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array();
+		$aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array();
+		$aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array();
+		$aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array();
+		$aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array();
+		$aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array();
+		$aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array();
+		$aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array();
+		$aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array();
+		$aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array();
+
+		$aData['cfg'] = 0;
+
+		if($aData['name'] == '')
+			sys::outjs(array('e' => 'Необходимо указать название'));
+
+		if(sys::strlen($aData['name']) > 50)
+			sys::outjs(array('e' => 'Длина названия не должна превышать 50 символов.'));
+
+		if(!in_array($aData['game'], $aGames))
+			sys::outjs(array('e' => 'Необходимо выбрать игру'));
+
+		include(LIB.'zip.php');
+
+		$sql->query('SELECT `id` FROM `plugins` WHERE `id`="'.$aData['update'].'" LIMIT 1');
+		if($sql->num())
+		{
+			$sql->query('INSERT INTO `plugins_update` set `plugin`="0", `name`="'.htmlspecialchars($aData['name']).'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0"');
+
+			$id = $aData['update'];
+			$aData['update'] = $sql->id();
+		}else{
+			$sql->query('INSERT INTO `plugins` set `name`="'.htmlspecialchars($aData['name']).'", `cat`="'.$aData['cat'].'", `game`="'.$aData['game'].'", `status`="'.$aData['status'].'", `cfg`="0", `upd`="0", `sort`="'.$aData['sort'].'"');
+
+			$id = $sql->id();
+			$aData['update'] = 0;
+		}
+
+		$edit = array();
+
+		if(!$aData['update'])
+		{
+			if(!move_uploaded_file($_FILES['file']['tmp_name'], FILES.'plugins/install/'.$id.'.zip'))
+			{
+				$sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1');
+
+				sys::outjs(array('e' => 'Неудалось загрузить архив'));
+			}
+
+			$zip = new ZipArchive;
+
+			if($zip->open(FILES.'plugins/install/'.$id.'.zip') !== TRUE)
+			{
+				$sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1');
+
+				unlink(FILES.'plugins/install/'.$id.'.zip');
+
+				sys::outjs(array('e' => 'Неудалось открыть архив'));
+			}
+
+			$count = $zip->numFiles;
+
+			$rm = '';
+
+			for($i = 0; $i < $count; $i+=1)
+			{
+				$stat = $zip->statIndex($i);
+
+				$check = count(explode('.', $stat['name']));
+
+				if($check < 2)
+					continue;
+
+				$rm .= 'rm '.$stat['name'].';'.PHP_EOL;
+
+				$type = explode('.', $stat['name']);
+
+				if($aData['aecfg'] AND in_array(end($type), $types))
+					$edit[] = $stat['name'];
+			}
+
+			$file = fopen(FILES.'plugins/delete/'.$id.'.rm', "w");
+			fputs($file, $rm);
+			fclose($file);
+		}else{
+			if(!move_uploaded_file($_FILES['new_file']['tmp_name'], FILES.'plugins/install/u'.$aData['update'].'.zip'))
+			{
+				$sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1');
+
+				sys::outjs(array('e' => 'Неудалось загрузить архив'));
+			}
+
+			if(!move_uploaded_file($_FILES['upd_file']['tmp_name'], FILES.'plugins/update/'.$aData['update'].'.zip'))
+			{
+				$sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1');
+
+				unlink(FILES.'plugins/install/u'.$aData['update'].'.zip');
+
+				sys::outjs(array('e' => 'Неудалось загрузить архив обновления'));
+			}
+
+			$zip = new ZipArchive;
+
+			if($zip->open(FILES.'plugins/install/u'.$aData['update'].'.zip') !== TRUE)
+			{
+				$sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$aData['update'].'" LIMIT 1');
+
+				unlink(FILES.'plugins/install/u'.$aData['update'].'.zip');
+				unlink(FILES.'plugins/update/'.$aData['update'].'.zip');
+
+				sys::outjs(array('e' => 'Неудалось открыть архив'));
+			}
+
+			$count = $zip->numFiles;
+
+			$rm = '';
+
+			for($i = 0; $i < $count; $i+=1)
+			{
+				$stat = $zip->statIndex($i);
+
+				$check = count(explode('.', $stat['name']));
+
+				if($check < 2)
+					continue;
+
+				$rm .= 'rm '.$stat['name'].';'.PHP_EOL;
+
+				$type = explode('.', $stat['name']);
+
+				if($aData['aecfg'] AND in_array(end($type), $types))
+					$edit[] = $stat['name'];
+			}
+
+			$file = fopen(FILES.'plugins/delete/u'.$aData['update'].'.rm', "w");
+			fputs($file, $rm);
+			fclose($file);
+		}
+
+		$aPacks = explode(':', $aData['packs']);
+
+		$spacks = '';
+
+		foreach($aPacks as $packs)
+			$spacks .= trim($packs).':';
+
+		$spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
+
+		$aData['packs'] = $spacks == '' ? 'all' : $spacks;
+
+		$aIncom = explode(':', $aData['incompatible']);
+
+		$incoms = '';
+
+		foreach($aIncom as $incom)
+		{
+			$incom = trim($incom);
+
+			if(!is_numeric($incom))
+				continue;
+
+			$incoms .= intval($incom).':';
+		}
+
+		$incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
+
+		$aData['incompatible'] = $incoms;
+
+		$aChoice = explode(' ', $aData['choice']);
+
+		$choice = '';
+
+		foreach($aChoice as $chpl)
+		{
+			$aChpl = explode(':', $chpl);
+
+			foreach($aChpl as $idchpl)
+			{
+				$idchpl = trim($idchpl);
+
+				if(!is_numeric($idchpl))
+					continue;
+
+				$choice .= intval($idchpl).':';
+			}
+
+			$choice .= ' ';
+		}
+
+		$choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
+
+		$aData['choice'] = $choice;
+
+		$aRequi = explode(':', $aData['required']);
+
+		$requis = '';
+
+		foreach($aRequi as $requi)
+		{
+			$requi = trim($requi);
+
+			if(!is_numeric($requi))
+				continue;
+
+			$requis .= intval($requi).':';
+		}
+
+		$requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
+
+		$aData['required'] = $requis;
+
+		if(!$aData['aecfg'])
+		{
+			$n = 0;
+
+			foreach($aData['config_files_file'] as $i => $file)
+			{
+				if($file == '')
+					continue;
+
+				$n+=1;
+
+				$aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n;
+
+				$sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"');
+			}
+
+			if($n)
+				$aData['cfg'] = 1;
+		}else{
+			$n = 0;
+
+			foreach($edit as $file)
+			{
+				$n+=1;
+
+				$sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'", `sort`="'.$n.'"');
+			}
+
+			if($n)
+				$aData['cfg'] = 1;
+		}
+
+		foreach($aData['config_clear_file'] as $i => $file)
+		{
+			if($aData['config_clear_text'][$i] == '' || $file == '')
+				continue;
+
+			$regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_clear_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"');
+		}
+
+		foreach($aData['config_write_file'] as $i => $file)
+		{
+			if($aData['config_write_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		foreach($aData['config_write_del_file'] as $i => $file)
+		{
+			if($aData['config_write_del_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_del_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		foreach($aData['files_delete_file'] as $file)
+		{
+			if($file == '')
+				continue;
+
+			$sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$file.'"');
+		}
+
+		if($aData['delete'])
+			$sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="'.$aData['update'].'", `file`="'.$aData['delete'].'"');
+
+		if($aData['update'])
+		{
+			$sql->query('UPDATE `plugins_update` set '
+				.'`plugin`="'.$id.'",'
+				.'`desc`="'.htmlspecialchars($aData['desc']).'",'
+				.'`info`="'.htmlspecialchars($aData['info']).'",'
+				.'`images`="'.htmlspecialchars($aData['images']).'",'
+				.'`incompatible`="'.$aData['incompatible'].'",'
+				.'`choice`="'.$aData['choice'].'",'
+				.'`required`="'.$aData['required'].'",'
+				.'`cfg`="'.$aData['cfg'].'",'
+				.'`price`="'.$aData['price'].'",'
+				.'`packs`="'.$aData['packs'].'" WHERE `id`="'.$aData['update'].'"');
+
+			$sql->query('UPDATE `plugins` set `upd`="'.$aData['update'].'" WHERE `id`="'.$id.'" LIMIT 1');
+
+			$sql->query('UPDATE `plugins_update` set `upd`="'.$aData['update'].'" WHERE `id`!="'.$aData['update'].'" AND `plugin`="'.$id.'" AND `upd`="0" ORDER BY `id` DESC LIMIT 1');
+		}else
+			$sql->query('UPDATE `plugins` set'
+				.'`desc`="'.htmlspecialchars($aData['desc']).'",'
+				.'`info`="'.htmlspecialchars($aData['info']).'",'
+				.'`images`="'.htmlspecialchars($aData['images']).'",'
+				.'`incompatible`="'.$aData['incompatible'].'",'
+				.'`choice`="'.$aData['choice'].'",'
+				.'`required`="'.$aData['required'].'",'
+				.'`cfg`="'.$aData['cfg'].'",'
+				.'`price`="'.$aData['price'].'",'
+				.'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('addpl', 'sections/addons');
+	$html->pack('main');
+?>

+ 26 - 0
system/acp/sections/addons/cats.php

@@ -0,0 +1,26 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$cats = $sql->query('SELECT `id`, `game`, `name`, `sort` FROM `plugins_category` ORDER BY `game` ASC');
+	while($cat = $sql->get($cats))
+	{
+		$sql->query('SELECT `name` FROM `plugins` WHERE `cat`="'.$cat['id'].'"');
+		$plugins = $sql->num();
+
+		$list .= '<tr>';
+			$list .= '<td>'.$cat['id'].'</td>';
+			$list .= '<td>'.$cat['name'].'</td>';
+			$list .= '<td class="text-center">'.strtoupper($cat['game']).'</td>';
+			$list .= '<td class="text-center">'.$plugins.' шт.</td>';
+			$list .= '<td class="text-center">'.$cat['sort'].'</td>';
+			$list .= '<td><a href="#" onclick="return cats_delete(\''.$cat['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('cats', 'sections/addons');
+
+		$html->set('list', $list);
+
+	$html->pack('main');
+?>

+ 60 - 0
system/acp/sections/addons/delete.php

@@ -0,0 +1,60 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(!isset($url['type']))
+		exit;
+
+	if($url['type'] == 'plugin')
+	{
+		$sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" LIMIT 1');
+		$sql->query('DELETE FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1');
+
+		$sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'"');
+		while($update = $sql->get())
+		{
+			unlink(FILES.'plugins/delete/u'.$update['id'].'.rm');
+			unlink(FILES.'plugins/delete/'.$update['id'].'.rm');
+			unlink(FILES.'plugins/install/u'.$update['id'].'.zip');
+			unlink(FILES.'plugins/update/'.$update['id'].'.zip');
+		}
+
+		unlink(FILES.'plugins/delete/'.$id.'.rm');
+		unlink(FILES.'plugins/install/'.$id.'.zip');
+
+		$sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'"');
+	}elseif($url['type'] == 'update'){
+		$sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"');
+		$sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1');
+
+		unlink(FILES.'plugins/delete/u'.$id.'.rm');
+		unlink(FILES.'plugins/install/u'.$id.'.zip');
+		unlink(FILES.'plugins/update/'.$id.'.zip');
+
+		$sql->query('DELETE FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1');
+
+		$sql->query('SELECT `id` FROM `plugins_update` WHERE `plugin`="'.$plugin['plugin'].'" ORDER BY `id` DESC LIMIT 1');
+		if($sql->num())
+		{
+			$update = $sql->get();
+
+			$sql->query('UPDATE `plugins` set `upd`="'.$update['id'].'" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1');
+		}else
+			$sql->query('UPDATE `plugins` set `upd`="0" WHERE `id`="'.$plugin['plugin'].'" LIMIT 1');
+	}else{
+		$sql->query('SELECT `id` FROM `plugins` WHERE `cat`="'.$id.'" LIMIT 1');
+		if(!$sql->num())
+			$sql->query('DELETE FROM `plugins_category` WHERE `id`="'.$id.'" LIMIT 1');
+	}
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 68 - 0
system/acp/sections/addons/index.php

@@ -0,0 +1,68 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'addons/search.php');
+
+	if($id)
+		include(SEC.'addons/plugin.php');
+	else{
+		$sort_page = '';
+		$sort_sql = 'ORDER BY `id` ASC';
+
+		if(isset($url['sort']) AND in_array($url['sort'], array('id', 'cat', 'game')))
+		{
+			$sort = 'asc';
+
+			if(isset($url['sorting']))
+				$sort = $url['sorting'] == 'asc' ? 'asc' : 'desc';
+
+			$sort_page = '/sort/'.$url['sort'].'/sorting/'.$sort;
+			$sort_sql = 'ORDER BY `'.$url['sort'].'` '.$sort;
+
+			$sort_icon = array($url['sort'] => $sort);
+		}
+
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `plugins`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/addons'.$sort_page);
+
+		$status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый');
+
+		$plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` '.$sort_sql.' LIMIT '.$aPage['num'].', 20');
+		while($plugin = $sql->get($plugins))
+		{
+			$sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1');
+			$cat = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td>'.$plugin['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/addons/id/'.$plugin['id'].'">'.$plugin['name'].'</a></td>';
+				$list .= '<td>'.$cat['name'].'</td>';
+				$list .= '<td>'.$status[$plugin['status']].'</td>';
+				$list .= '<td>'.strtoupper($plugin['game']).'</td>';
+				$list .= '<td><a href="#" onclick="return plugins_delete(\''.$plugin['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/addons');
+
+			$html->set('sort_id', 'asc');
+			$html->set('sort_cat', 'asc');
+			$html->set('sort_game', 'asc');
+
+			if(isset($sort_icon))
+				$html->set('sort_'.key($sort_icon), array_shift($sort_icon));
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 337 - 0
system/acp/sections/addons/plugin.php

@@ -0,0 +1,337 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT * FROM `plugins` WHERE `id`="'.$id.'" LIMIT 1');
+	$plugin = $sql->get();
+
+	$aGames = array(
+		'cs' => 'Counter-Strike: 1.6',
+		'cssold' => 'Counter-Strike: Source v34',
+		'css' => 'Counter-Strike: Source',
+		'csgo' => 'Counter-Strike: Global Offensive',
+		'samp' => 'San Andreas Multiplayer',
+		'crmp' => 'GTA: Criminal Russia',
+		'mta' => 'Multi Theft Auto',
+		'mc' => 'Minecraft'
+	);
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name'];
+		$aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat'];
+		$aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status'];
+		$aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs'];
+		$aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc'];
+		$aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info'];
+		$aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images'];
+		$aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible'];
+		$aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice'];
+		$aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required'];
+		$aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update'];
+		$aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete'];
+		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort'];
+		$aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price'];
+
+		$aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array();
+		$aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array();
+		$aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array();
+		$aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array();
+		$aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array();
+		$aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array();
+		$aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array();
+		$aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array();
+		$aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array();
+		$aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array();
+		$aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array();
+
+		$aData['cfg'] = 0;
+
+		if($aData['name'] == '')
+			sys::outjs(array('e' => 'Необходимо указать название'));
+
+		$aPacks = explode(':', $aData['packs']);
+
+		$spacks = '';
+
+		foreach($aPacks as $packs)
+			$spacks .= trim($packs).':';
+
+		$spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
+
+		$aData['packs'] = $spacks == '' ? 'all' : $spacks;
+
+		$aIncom = explode(':', $aData['incompatible']);
+
+		$incoms = '';
+
+		foreach($aIncom as $incom)
+		{
+			$incom = trim($incom);
+
+			if(!is_numeric($incom))
+				continue;
+
+			$incoms .= intval($incom).':';
+		}
+
+		$incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
+
+		$aData['incompatible'] = $incoms;
+
+				$aChoice = explode(' ', $aData['choice']);
+
+		$choice = '';
+
+		foreach($aChoice as $chpl)
+		{
+			$aChpl = explode(':', $chpl);
+
+			foreach($aChpl as $idchpl)
+			{
+				$idchpl = trim($idchpl);
+
+				if(!is_numeric($idchpl))
+					continue;
+
+				$choice .= intval($idchpl).':';
+			}
+
+			$choice .= ' ';
+		}
+
+		$choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
+
+		$aData['choice'] = $choice;
+
+		$aRequi = explode(':', $aData['required']);
+
+		$requis = '';
+
+		foreach($aRequi as $requi)
+		{
+			$requi = trim($requi);
+
+			if(!is_numeric($requi))
+				continue;
+
+			$requis .= intval($requi).':';
+		}
+
+		$requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
+
+		$aData['required'] = $requis;
+
+		$n = 0;
+
+		$sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0"');
+
+		foreach($aData['config_files_file'] as $i => $file)
+		{
+			if($file == '')
+				continue;
+
+			$n+=1;
+
+			$aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n;
+
+			$sql->query('INSERT INTO `plugins_config` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'", `sort`="'.$n.'"');
+		}
+
+		if($n)
+			$aData['cfg'] = 1;
+
+		$sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0"');
+
+		foreach($aData['config_clear_file'] as $i => $file)
+		{
+			if($aData['config_clear_text'][$i] == '' || $file == '')
+				continue;
+
+			$regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_clear_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0"');
+
+		foreach($aData['config_write_file'] as $i => $file)
+		{
+			if($aData['config_write_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0"');
+
+		foreach($aData['config_write_del_file'] as $i => $file)
+		{
+			if($aData['config_write_del_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_del_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$id.'", `update`="0", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0"');
+
+		foreach($aData['files_delete_file'] as $file)
+		{
+			if($file == '')
+				continue;
+
+			$sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'"');
+		}
+
+		if($aData['delete'])
+		{
+			$sql->query('DELETE FROM `plugins_delete_ins` WHERE `plugin`="'.$id.'" AND `update`="0" LIMIT 1');
+
+			$sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$id.'", `update`="0", `file`="'.$aData['delete'].'"');
+		}
+
+		$sql->query('UPDATE `plugins` set '
+			.'`name`="'.htmlspecialchars($aData['name']).'",'
+			.'`cat`="'.$aData['cat'].'",'
+			.'`desc`="'.htmlspecialchars($aData['desc']).'",'
+			.'`info`="'.htmlspecialchars($aData['info']).'",'
+			.'`images`="'.htmlspecialchars($aData['images']).'",'
+			.'`incompatible`="'.$aData['incompatible'].'",'
+			.'`choice`="'.$aData['choice'].'",'
+			.'`status`="'.$aData['status'].'",'
+			.'`required`="'.$aData['required'].'",'
+			.'`cfg`="'.$aData['cfg'].'",'
+			.'`price`="'.$aData['price'].'",'
+			.'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('plugin', 'sections/addons');
+
+		$html->set('id', $plugin['id']);
+		$html->set('name', $plugin['name']);
+		$html->set('game', $aGames[$plugin['game']]);
+		$html->set('desc', htmlspecialchars_decode($plugin['desc']));
+		$html->set('info', htmlspecialchars_decode($plugin['info']));
+		$html->set('images', htmlspecialchars_decode($plugin['images']));
+
+		$html->set('incompatible', $plugin['incompatible']);
+		$html->set('choice', $plugin['choice']);
+		$html->set('required', $plugin['required']);
+		$html->set('packs', $plugin['packs']);
+		$html->set('sort', $plugin['sort']);
+		$html->set('price', $plugin['price']);
+
+		$status = '<option value="0">Стабильный</option><option value="1">Нестабильный</option><option value="2">Тестируемый</option>';
+
+		$html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status));
+
+		$cats = '';
+
+		$sql->query('SELECT `id`, `name` FROM `plugins_category` WHERE `game`="'.$plugin['game'].'" ORDER BY `sort` ASC');
+		while($cat = $sql->get())
+			$cats .= '<option value="'.$cat['id'].'">'.$cat['name'].'</option>';
+
+		$html->set('category', str_replace('"'.$plugin['cat'].'">', '"'.$plugin['cat'].'" selected>', $cats));
+
+		$config_files_all = '';
+		$config_clear_all = '';
+		$config_write_all = '';
+		$config_write_del_all = '';
+		$files_delete_all = '';
+
+		$sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `sort` ASC');
+		while($data = $sql->get())
+		{
+			$config_files_all .= '<tr id="cf_'.$data['id'].'">';
+				$config_files_all .= '<td><input name="config_files_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_files_all .= '<td><input name="config_files_sort['.$data['id'].']" value="'.$data['sort'].'" type="text"></td>';
+				$config_files_all .= '<td class="text-center"><a href="#" onclick="return config_files_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_files_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$regex = $data['regex'] ? 'checked' : '';
+
+			$config_clear_all .= '<tr id="cc_'.$data['id'].'">';
+				$config_clear_all .= '<td><input name="config_clear_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_clear_all .= '<td><input name="config_clear_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_clear_all .= '<td class="text-center"><input name="config_clear_regex['.$data['id'].']" type="checkbox" '.$regex.'></td>';
+				$config_clear_all .= '<td class="text-center"><a href="#" onclick="return config_clear_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_clear_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$top = $data['top'] ? 'checked' : '';
+
+			$config_write_all .= '<tr id="cw_'.$data['id'].'">';
+				$config_write_all .= '<td><input name="config_write_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_write_all .= '<td><input name="config_write_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_write_all .= '<td class="text-center"><input name="config_write_top['.$data['id'].']" type="checkbox" '.$top.'></td>';
+				$config_write_all .= '<td class="text-center"><a href="#" onclick="return config_write_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_write_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$top = $data['top'] ? 'checked' : '';
+
+			$config_write_del_all .= '<tr id="cwe_'.$data['id'].'">';
+				$config_write_del_all .= '<td><input name="config_write_del_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_write_del_all .= '<td><input name="config_write_del_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_write_del_all .= '<td class="text-center"><input name="config_write_del_top['.$data['id'].']" type="checkbox" '.$top.'></td>';
+				$config_write_del_all .= '<td class="text-center"><a href="#" onclick="return config_write_del_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_write_del_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `plugin`="'.$id.'" AND `update`="0" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$files_delete_all .= '<tr id="fd_'.$data['id'].'">';
+				$files_delete_all .= '<td><input name="files_delete_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$files_delete_all .= '<td class="text-center"><a href="#" onclick="return files_delete_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$files_delete_all .= '</tr>';
+		}
+
+		$html->set('config_files_all', $config_files_all);
+		$html->set('config_clear_all', $config_clear_all);
+		$html->set('config_write_all', $config_write_all);
+		$html->set('config_write_del_all', $config_write_del_all);
+		$html->set('files_delete_all', $files_delete_all);
+
+		$update = '';
+
+		$status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый');
+
+		$sql->query('SELECT `id`, `name`, `status` FROM `plugins_update` WHERE `plugin`="'.$id.'" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$update .= '<tr>';
+				$update .= '<td><a href="'.$cfg['http'].'acp/addons/section/update/id/'.$data['id'].'">'.$data['name'].'</a></td>';
+				$update .= '<td class="text-center">'.$status[$data['status']].'</td>';
+				$update .= '<td class="text-center"><a href="#" onclick="return plugins_update_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$update .= '</tr>';
+		}
+
+		$html->set('update', $update);
+
+	$html->pack('main');
+?>

+ 75 - 0
system/acp/sections/addons/search.php

@@ -0,0 +1,75 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	if(substr($text, 0, 5) == 'game=')
+	{
+		$game = trim(substr($text, 5));
+
+		if(in_array($game, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc')))
+			$plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `game`="'.$game.'" ORDER BY `id` ASC');
+	}elseif($text{0} == 'i' AND $text{1} == 'd')
+		$plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`desc` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`info` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`packs` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$plugins = $sql->query('SELECT `id`, `cat`, `game`, `name`, `status` FROM `plugins` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10');
+	}
+
+	if(!$sql->num($plugins))
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	$status = array(0 => 'Стабильный', 2 => 'Нестабильный', 1 => 'Тестируемый');
+
+	while($plugin = $sql->get($plugins))
+	{
+		$sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1');
+		$cat = $sql->get();
+
+		$list .= '<tr>';
+			$list .= '<td>'.$plugin['id'].'</td>';
+			$list .= '<td><a href="'.$cfg['http'].'acp/addons/id/'.$plugin['id'].'">'.$plugin['name'].'</a></td>';
+			$list .= '<td>'.$cat['name'].'</td>';
+			$list .= '<td>'.$status[$plugin['status']].'</td>';
+			$list .= '<td>'.strtoupper($plugin['game']).'</td>';
+			$list .= '<td><a href="#" onclick="return plugins_delete(\''.$plugin['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 322 - 0
system/acp/sections/addons/update.php

@@ -0,0 +1,322 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT * FROM `plugins_update` WHERE `id`="'.$id.'" LIMIT 1');
+	$plugin = $sql->get();
+
+	$aGames = array(
+		'cs' => 'Counter-Strike: 1.6',
+		'cssold' => 'Counter-Strike: Source v34',
+		'css' => 'Counter-Strike: Source',
+		'csgo' => 'Counter-Strike: Global Offensive',
+		'samp' => 'San Andreas Multiplayer',
+		'crmp' => 'GTA: Criminal Russia',
+		'mta' => 'Multi Theft Auto',
+		'mc' => 'Minecraft'
+	);
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $plugin['name'];
+		$aData['cat'] = isset($_POST['category']) ? sys::int($_POST['category']) : $plugin['cat'];
+		$aData['status'] = isset($_POST['status']) ? sys::int($_POST['status']) : $plugin['status'];
+		$aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $plugin['packs'];
+		$aData['desc'] = isset($_POST['desc']) ? trim($_POST['desc']) : $plugin['desc'];
+		$aData['info'] = isset($_POST['info']) ? trim($_POST['info']) : $plugin['info'];
+		$aData['images'] = isset($_POST['images']) ? trim($_POST['images']) : $plugin['images'];
+		$aData['incompatible'] = isset($_POST['incompatible']) ? trim($_POST['incompatible']) : $plugin['incompatible'];
+		$aData['choice'] = isset($_POST['choice']) ? trim($_POST['choice']) : $plugin['choice'];
+		$aData['required'] = isset($_POST['required']) ? trim($_POST['required']) : $plugin['required'];
+		$aData['update'] = isset($_POST['update']) ? sys::int($_POST['update']) : $plugin['update'];
+		$aData['delete'] = isset($_POST['delete']) ? sys::int($_POST['delete']) : $plugin['delete'];
+		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $plugin['sort'];
+		$aData['price'] = isset($_POST['price']) ? ceil($_POST['price']) : $plugin['price'];
+
+		$aData['config_files_file'] = isset($_POST['config_files_file']) ? $_POST['config_files_file'] : array();
+		$aData['config_files_sort'] = isset($_POST['config_files_sort']) ? $_POST['config_files_sort'] : array();
+		$aData['config_clear_file'] = isset($_POST['config_clear_file']) ? $_POST['config_clear_file'] : array();
+		$aData['config_clear_text'] = isset($_POST['config_clear_text']) ? $_POST['config_clear_text'] : array();
+		$aData['config_write_file'] = isset($_POST['config_write_file']) ? $_POST['config_write_file'] : array();
+		$aData['config_write_text'] = isset($_POST['config_write_text']) ? $_POST['config_write_text'] : array();
+		$aData['config_write_top'] = isset($_POST['config_write_top']) ? $_POST['config_write_top'] : array();
+		$aData['config_write_del_file'] = isset($_POST['config_write_del_file']) ? $_POST['config_write_del_file'] : array();
+		$aData['config_write_del_text'] = isset($_POST['config_write_del_text']) ? $_POST['config_write_del_text'] : array();
+		$aData['config_write_del_top'] = isset($_POST['config_write_del_top']) ? $_POST['config_write_del_top'] : array();
+		$aData['files_delete_file'] = isset($_POST['files_delete_file']) ? $_POST['files_delete_file'] : array();
+
+		$aData['cfg'] = 0;
+
+		if($aData['name'] == '')
+			sys::outjs(array('e' => 'Необходимо указать название'));
+
+		$aPacks = explode(':', $aData['packs']);
+
+		$spacks = '';
+
+		foreach($aPacks as $packs)
+		{
+			$packs = trim($packs);
+
+			$spacks .= intval($packs).':';
+		}
+
+		$spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
+
+		$aData['packs'] = $spacks == '' ? $spacks : 'all';
+
+		$aIncom = explode(':', $aData['incompatible']);
+
+		$incoms = '';
+
+		foreach($aIncom as $incom)
+		{
+			$incom = trim($incom);
+
+			if(!is_numeric($incom))
+				continue;
+
+			$incoms .= intval($incom).':';
+		}
+
+		$incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
+
+		$aData['incompatible'] = $incoms;
+
+				$aChoice = explode(' ', $aData['choice']);
+
+		$choice = '';
+
+		foreach($aChoice as $chpl)
+		{
+			$aChpl = explode(':', $chpl);
+
+			foreach($aChpl as $idchpl)
+			{
+				$idchpl = trim($idchpl);
+
+				if(!is_numeric($idchpl))
+					continue;
+
+				$choice .= intval($idchpl).':';
+			}
+
+			$choice .= ' ';
+		}
+
+		$choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
+
+		$aData['choice'] = $choice;
+
+		$aRequi = explode(':', $aData['required']);
+
+		$requis = '';
+
+		foreach($aRequi as $requi)
+		{
+			$requi = trim($requi);
+
+			if(!is_numeric($requi))
+				continue;
+
+			$requis .= intval($requi).':';
+		}
+
+		$requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
+
+		$aData['required'] = $requis;
+
+		$n = 0;
+
+		$sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"');
+
+		foreach($aData['config_files_file'] as $i => $file)
+		{
+			if($file == '')
+				continue;
+
+			$n+=1;
+
+			$aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n;
+
+			$sql->query('INSERT INTO `plugins_config` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'", `sort`="'.$n.'"');
+		}
+
+		if($n)
+			$aData['cfg'] = 1;
+
+		$sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"');
+
+		foreach($aData['config_clear_file'] as $i => $file)
+		{
+			if($aData['config_clear_text'][$i] == '' || $file == '')
+				continue;
+
+			$regex = (string) $aData['config_clear_regex'] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_clear_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_clear` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `regex`="'.$regex.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_write` WHERE `update`="'.$id.'"');
+
+		foreach($aData['config_write_file'] as $i => $file)
+		{
+			if($aData['config_write_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_write_del` WHERE `update`="'.$id.'"');
+
+		foreach($aData['config_write_del_file'] as $i => $file)
+		{
+			if($aData['config_write_del_text'][$i] == '' || $file == '')
+				continue;
+
+			$top = (string) $aData['config_write_del_top'][$i] == 'on' ? 1 : 0;
+
+			$text = htmlspecialchars(trim($aData['config_write_del_text'][$i]));
+
+			$sql->query('INSERT INTO `plugins_write_del` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `text`="'.$text.'", `file`="'.$file.'", `top`="'.$top.'"');
+		}
+
+		$sql->query('DELETE FROM `plugins_delete` WHERE `update`="'.$id.'"');
+
+		foreach($aData['files_delete_file'] as $file)
+		{
+			if($file == '')
+				continue;
+
+			$sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'"');
+		}
+
+		if($aData['delete'])
+		{
+			$sql->query('DELETE FROM `plugins_delete_ins` WHERE `update`="'.$id.'" LIMIT 1');
+
+			$sql->query('INSERT INTO `plugins_delete_ins` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$aData['delete'].'"');
+		}
+
+		$sql->query('UPDATE `plugins_update` set '
+			.'`name`="'.htmlspecialchars($aData['name']).'",'
+			.'`desc`="'.htmlspecialchars($aData['desc']).'",'
+			.'`info`="'.htmlspecialchars($aData['info']).'",'
+			.'`images`="'.htmlspecialchars($aData['images']).'",'
+			.'`incompatible`="'.$aData['incompatible'].'",'
+			.'`choice`="'.$aData['choice'].'",'
+			.'`required`="'.$aData['required'].'",'
+			.'`status`="'.$aData['status'].'",'
+			.'`cfg`="'.$aData['cfg'].'",'
+			.'`price`="'.$aData['price'].'",'
+			.'`packs`="'.$aData['packs'].'" WHERE `id`="'.$id.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('update', 'sections/addons');
+
+		$html->set('id', $plugin['id']);
+		$html->set('plugin', $plugin['plugin']);
+		$html->set('name', $plugin['name']);
+		$html->set('game', $aGames[$plugin['game']]);
+		$html->set('desc', htmlspecialchars_decode($plugin['desc']));
+		$html->set('info', htmlspecialchars_decode($plugin['info']));
+		$html->set('images', htmlspecialchars_decode($plugin['images']));
+
+		$html->set('incompatible', $plugin['incompatible']);
+		$html->set('choice', $plugin['choice']);
+		$html->set('required', $plugin['required']);
+		$html->set('packs', $plugin['packs']);
+		$html->set('sort', $plugin['sort']);
+		$html->set('price', $plugin['price']);
+
+		$status = '<option value="0">Стабильный</option><option value="1">Нестабильный</option><option value="2">Тестируемый</option>';
+
+		$html->set('status', str_replace('"'.$plugin['status'].'">', '"'.$plugin['status'].'" selected>', $status));
+
+		$sql->query('SELECT `name` FROM `plugins_category` WHERE `id`="'.$plugin['cat'].'" LIMIT 1');
+		$cat = $sql->get();
+
+		$html->set('category', $cat['name']);
+
+		$config_files_all = '';
+		$config_clear_all = '';
+		$config_write_all = '';
+		$config_write_del_all = '';
+		$files_delete_all = '';
+
+		$sql->query('SELECT `id`, `file`, `sort` FROM `plugins_config` WHERE `update`="'.$id.'" ORDER BY `sort` ASC');
+		while($data = $sql->get())
+		{
+			$config_files_all .= '<tr id="cf_'.$data['id'].'">';
+				$config_files_all .= '<td><input name="config_files_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_files_all .= '<td><input name="config_files_sort['.$data['id'].']" value="'.$data['sort'].'" type="text"></td>';
+				$config_files_all .= '<td class="text-center"><a href="#" onclick="return config_files_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_files_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `regex` FROM `plugins_clear` WHERE `update`="'.$id.'" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$regex = $data['regex'] ? 'checked' : '';
+
+			$config_clear_all .= '<tr id="cc_'.$data['id'].'">';
+				$config_clear_all .= '<td><input name="config_clear_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_clear_all .= '<td><input name="config_clear_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_clear_all .= '<td class="text-center"><input name="config_clear_regex['.$data['id'].']" type="checkbox" '.$regex.'></td>';
+				$config_clear_all .= '<td class="text-center"><a href="#" onclick="return config_clear_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_clear_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write` WHERE `update`="'.$id.'" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$top = $data['top'] ? 'checked' : '';
+
+			$config_write_all .= '<tr id="cw_'.$data['id'].'">';
+				$config_write_all .= '<td><input name="config_write_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_write_all .= '<td><input name="config_write_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_write_all .= '<td class="text-center"><input name="config_write_top['.$data['id'].']" type="checkbox" '.$top.'></td>';
+				$config_write_all .= '<td class="text-center"><a href="#" onclick="return config_write_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_write_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `text`, `file`, `top` FROM `plugins_write_del` WHERE `update`="'.$id.'" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$top = $data['top'] ? 'checked' : '';
+
+			$config_write_del_all .= '<tr id="cwe_'.$data['id'].'">';
+				$config_write_del_all .= '<td><input name="config_write_del_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$config_write_del_all .= '<td><input name="config_write_del_text['.$data['id'].']" value="'.$data['text'].'" type="text"></td>';
+				$config_write_del_all .= '<td class="text-center"><input name="config_write_del_top['.$data['id'].']" type="checkbox" '.$top.'></td>';
+				$config_write_del_all .= '<td class="text-center"><a href="#" onclick="return config_write_del_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$config_write_del_all .= '</tr>';
+		}
+
+		$sql->query('SELECT `id`, `file` FROM `plugins_delete` WHERE `update`="'.$id.'" ORDER BY `id` ASC');
+		while($data = $sql->get())
+		{
+			$files_delete_all .= '<tr id="fd_'.$data['id'].'">';
+				$files_delete_all .= '<td><input name="files_delete_file['.$data['id'].']" value="'.$data['file'].'" type="text"></td>';
+				$files_delete_all .= '<td class="text-center"><a href="#" onclick="return files_delete_del(\''.$data['id'].'\')" class="text-red">Удалить</a></td>';
+			$files_delete_all .= '</tr>';
+		}
+
+		$html->set('config_files_all', $config_files_all);
+		$html->set('config_clear_all', $config_clear_all);
+		$html->set('config_write_all', $config_write_all);
+		$html->set('config_write_del_all', $config_write_del_all);
+		$html->set('files_delete_all', $files_delete_all);
+
+	$html->pack('main');
+?>

+ 78 - 0
system/acp/sections/addons/updmp.php

@@ -0,0 +1,78 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['get']) AND $url['get'] == 'list')
+	{
+		$unit = isset($url['unit']) ? sys::int($url['unit']) : sys::out();
+		$game = isset($url['game']) ? $url['game'] : sys::out();
+
+		if(!in_array($game, array('cs', 'cssold', 'css', 'csgo')))
+			sys::out();
+
+		$maps = '';
+
+		$sql->query('SELECT `name` FROM `maps` WHERE `unit`="'.$unit.'" AND `game`="'.$game.'" ORDER BY `id` ASC');
+		
+		$all = 'Общее число карт: '.$sql->num().' шт.'.PHP_EOL;
+		
+		while($map = $sql->get())
+			$maps .= $map['name'].PHP_EOL;
+
+		$maps = $maps == '' ? 'В базе нет карт' : $all.$maps.$all;
+
+		sys::out($maps);
+	}
+
+	if($go)
+	{
+		$unit = isset($url['unit']) ? sys::int($url['unit']) : sys::outjs(array('e' => 'Необходимо выбрать локацию'));
+		$game = isset($url['game']) ? $url['game'] : sys::outjs(array('e' => 'Необходимо выбрать игру'));
+
+		if(!$unit)
+			sys::outjs(array('e' => 'Необходимо выбрать локацию'));
+
+		if(!in_array($game, array('cs', 'cssold', 'css', 'csgo')))
+			sys::outjs(array('e' => 'Необходимо выбрать игру'));
+
+		include(LIB.'ssh.php');
+
+		$sql->query('SELECT `id`, `passwd`, `address` FROM `units` WHERE `id`="'.$unit.'" LIMIT 1');
+		if(!$sql->num())
+			sys::outjs(array('e' => 'Локация не найдена'));
+
+		$unit = $sql->get();
+
+		if(!$ssh->auth($unit['passwd'], $unit['address']))
+			sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
+
+		$sql->query('DELETE FROM `maps` WHERE `unit`="'.$unit['id'].'" AND `game`="'.$game.'"');
+
+		$maps = $ssh->get('cd /path/maps/'.$game.' && ls | grep .bsp | grep -v .bsp.');
+
+		$aMaps = explode("\n", $maps);
+
+		array_pop($aMaps);
+
+		foreach($aMaps as $map)
+		{
+			$name = array_shift(explode('.', $map));
+
+			$sql->query('INSERT INTO `maps` set `unit`="'.$unit['id'].'", `game`="'.$game.'", `name`="'.$name.'"');
+		}
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$units = '';
+
+	$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+	while($unit = $sql->get())
+		$units .= '<option value="'.$unit['id'].'">'.$unit['name'].'</option>';
+
+	$html->get('updmp', 'sections/addons');
+
+		$html->set('units', $units);
+
+	$html->pack('main');
+?>

+ 81 - 0
system/acp/sections/boost/index.php

@@ -0,0 +1,81 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'boost/sysearch.php');
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `boost`');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost');
+
+	$sql->query('SELECT * FROM `boost` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/servers/id/'.$log['server'].'">SERVER_'.$log['server'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$month = date('n', $start_point)-1;
+
+	if(!$month)
+		$month = 12;
+
+	$aData = $mcache->get('data_boost_all');
+
+	if(!is_array($aData))
+	{
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost`');
+		$data = $sql->get();
+
+		$aData['all_num'] = (int) $data['SUM(`circles`)'];
+		$aData['all_sum'] = (int) $data['SUM(`money`)'];
+
+		$now = $start_point-(date('d', $start_point)*86400);
+
+		$old = $start_point-(params::$aDayMonth[$month]*86400);
+
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$old.'" AND date<"'.$now.'"');
+		$data = $sql->get();
+
+		$aData['old_num'] = (int) $data['SUM(`circles`)'];
+		$aData['old_sum'] = (int) $data['SUM(`money`)'];
+
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `date`>="'.$now.'"');
+		$data = $sql->get();
+
+		$aData['now_num'] = (int) $data['SUM(`circles`)'];
+		$aData['now_sum'] = (int) $data['SUM(`money`)'];
+
+		$mcache->set('data_boost_all', $aData, false, 60);
+	}
+
+	$html->get('index', 'sections/boost');
+
+		$html->set('list', $list);
+
+		$html->set('month_old', params::$aNameMonth[$month]);
+		$html->set('month_now', params::$aNameMonth[date('n', $start_point)]);
+
+		$html->set('all_num', $aData['all_num']);
+		$html->set('all_sum', $aData['all_sum']);
+		$html->set('old_num', $aData['old_num']);
+		$html->set('old_sum', $aData['old_sum']);
+		$html->set('now_num', $aData['now_num']);
+		$html->set('now_sum', $aData['now_sum']);
+
+		$html->set('cur', $cfg['currency']);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 77 - 0
system/acp/sections/boost/search.php

@@ -0,0 +1,77 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	$check = explode('=', $text);
+
+	if(in_array($check[0], array('server', 'user')))
+	{
+		$val = trim($check[1]);
+
+		switch($check[0])
+		{
+			case 'server':
+				$sql->query('SELECT * FROM `boost` WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC');
+			break;
+
+			case 'user':
+				$sql->query('SELECT * FROM `boost` WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC');
+		}
+	}elseif($text{0} == 'i' AND $text{1} == 'd')
+		$sql->query('SELECT * FROM `boost` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`site` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`circles` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$sql->query('SELECT * FROM `boost` WHERE '.$like.' ORDER BY `id` DESC LIMIT 40');
+	}
+
+	if(!$sql->num())
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/servers/id/'.$log['server'].'">SERVER_'.$log['server'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 81 - 0
system/acp/sections/boost/service.php

@@ -0,0 +1,81 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'boost/sysearch.php');
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `boost` WHERE `site`="'.$section.'"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost/section/'.$section);
+
+	$sql->query('SELECT * FROM `boost` WHERE `site`="'.$section.'" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>Покупка кругов: '.$log['circles'].' шт. на сайте: '.$aBoost['cs'][$log['site']]['site'].', списана сумма: '.$log['money'].' '.$cfg['currency'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/servers/id/'.$log['server'].'">SERVER_'.$log['server'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$month = date('n', $start_point)-1;
+
+	if(!$month)
+		$month = 12;
+
+	$aData = $mcache->get('data_boost_'.$section);
+
+	if(!is_array($aData))
+	{
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'"');
+		$data = $sql->get();
+
+		$aData['all_num'] = (int) $data['SUM(`circles`)'];
+		$aData['all_sum'] = (int) $data['SUM(`money`)'];
+
+		$now = $start_point-(date('d', $start_point)*86400);
+
+		$old = $start_point-(params::$aDayMonth[$month]*86400);
+
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$old.'" AND date<"'.$now.'"');
+		$data = $sql->get();
+
+		$aData['old_num'] = (int) $data['SUM(`circles`)'];
+		$aData['old_sum'] = (int) $data['SUM(`money`)'];
+
+		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost` WHERE `site`="'.$section.'" AND `date`>="'.$now.'"');
+		$data = $sql->get();
+
+		$aData['now_num'] = (int) $data['SUM(`circles`)'];
+		$aData['now_sum'] = (int) $data['SUM(`money`)'];
+
+		$mcache->set('data_boost_'.$section, $aData, false, 60);
+	}
+
+	$html->get('index', 'sections/boost');
+
+		$html->set('list', $list);
+
+		$html->set('month_old', params::$aNameMonth[$month]);
+		$html->set('month_now', params::$aNameMonth[date('n', $start_point)]);
+
+		$html->set('all_num', $aData['all_num']);
+		$html->set('all_sum', $aData['all_sum']);
+		$html->set('old_num', $aData['old_num']);
+		$html->set('old_sum', $aData['old_sum']);
+		$html->set('now_num', $aData['now_num']);
+		$html->set('now_sum', $aData['now_sum']);
+
+		$html->set('cur', $cfg['currency']);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 8 - 0
system/acp/sections/control/delete.php

@@ -0,0 +1,8 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('UPDATE `control` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 54 - 0
system/acp/sections/control/index.php

@@ -0,0 +1,54 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'control/search.php');
+
+	if($id)
+		include(SEC.'control/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'reboot' => 'перезагружается',
+			'error' => '<span class="text-red">Не отвечает</span>',
+			'install' => 'Настраивается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$sql->query('SELECT `id` FROM `control` WHERE `user`!="-1"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/control');
+
+		$sql->query('SELECT `id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($ctrl = $sql->get())
+		{
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$ctrl['id'].'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/control/id/'.$ctrl['id'].'">'.$ctrl['address'].'</a></td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $ctrl['date']).'</td>';
+				$list .= '<td class="text-center">'.$ctrl['limit'].' шт.</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'control/id/'.$ctrl['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$ctrl['user'].'">USER_'.$ctrl['user'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$ctrl['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $ctrl['time']).'</td>';
+				$list .= '<td class="text-center">'.$ctrl['price'].' '.$cfg['currency'].'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return control_delete(\''.$ctrl['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/control');
+			$html->set('list', $list);
+			$html->set('url_search', $url_search);
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+		$html->pack('main');
+	}
+?>

+ 35 - 0
system/acp/sections/control/overdue.php

@@ -0,0 +1,35 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'control/server.php');
+	else{
+		$list = '';
+
+		$servers = $sql->query('SELECT `id`, `user`, `address`, `overdue`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC');
+		while($ctrl = $sql->get())
+		{
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$ctrl['id'].'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/control/id/'.$ctrl['id'].'">'.$ctrl['address'].'</a></td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $ctrl['date']).'</td>';
+				$list .= '<td class="text-center">'.$ctrl['limit'].' шт.</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'control/id/'.$ctrl['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$ctrl['user'].'">USER_'.$ctrl['user'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$ctrl['status']].'</td>';
+				$list .= '<td class="text-center">Удаление через: '.sys::date('min', $ctrl['overdue']+$cfg['control_delete']*86400).'</td>';
+				$list .= '<td class="text-center">'.$ctrl['price'].' '.$cfg['currency'].'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return control_delete(\''.$ctrl['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/control');
+			$html->set('list', $list);
+			$html->set('pages', '');
+		$html->pack('main');
+	}
+?>

+ 103 - 0
system/acp/sections/control/search.php

@@ -0,0 +1,103 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.'control');
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	$select = '`id`, `user`, `address`, `time`, `date`, `status`, `limit`, `price` FROM `control` WHERE `user`!="-1" AND';
+
+	$check = explode('=', $text);
+
+	if(in_array($check[0], array('limit', 'price', 'user', 'status')))
+	{
+		$val = trim($check[1]);
+
+		switch($check[0])
+		{
+			case 'limit':
+				$ctrls = $sql->query('SELECT '.$select.' `limit`="'.sys::int($val).'" ORDER BY `id` ASC');
+			break;
+
+			case 'price':
+				$ctrls = $sql->query('SELECT '.$select.' `price`="'.sys::int($val).'" ORDER BY `id` ASC');
+			break;
+
+			case 'ctrls':
+				$ctrl = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC');
+			break;
+
+			case 'status':
+				if(in_array($val, array('working', 'error', 'reboot', 'overdue', 'blocked', 'install')))
+					$ctrls = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC');
+		}
+	}elseif($text{0} == 'i' AND $text{1} == 'd')
+		$ctrls = $sql->query('SELECT '.$select.' `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$ctrls = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC');
+	}
+
+	if(!$sql->num($ctrls))
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$status = array(
+		'working' => '<span class="text-green">Работает</span>',
+		'reboot' => 'перезагружается',
+		'error' => '<span class="text-red">Не отвечает</span>',
+		'install' => 'Настраивается',
+		'overdue' => 'Просрочен',
+		'blocked' => 'Заблокирован'
+	);
+
+	$list = '';
+
+	while($ctrl = $sql->get($ctrls))
+	{
+		$list .= '<tr>';
+			$list .= '<td class="text-center">'.$ctrl['id'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/control/id/'.$ctrl['id'].'">'.$ctrl['address'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $ctrl['date']).'</td>';
+			$list .= '<td class="text-center">'.$ctrl['limit'].' шт.</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'control/id/'.$ctrl['id'].'" target="_blank">Перейти</a></td>';
+		$list .= '</tr>';
+
+		$list .= '<tr>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$ctrl['user'].'">USER_'.$ctrl['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$status[$ctrl['status']].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $ctrl['time']).'</td>';
+			$list .= '<td class="text-center">'.$ctrl['price'].' '.$cfg['currency'].'</td>';
+			$list .= '<td class="text-center"><a href="#" onclick="return control_delete(\''.$ctrl['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 109 - 0
system/acp/sections/control/server.php

@@ -0,0 +1,109 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT `time`, `overdue` FROM `control` WHERE `id`="'.$id.'" LIMIT 1');
+	$ctrl = $sql->get();
+
+	if($ctrl['time'] > $start_point AND $ctrl['overdue'])
+		$sql->query('UPDATE `control` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1');
+
+	$sql->query('SELECT * FROM `control` WHERE `id`="'.$id.'" LIMIT 1');
+	$ctrl = $sql->get();
+
+	if($go)
+	{
+		if(isset($url['type']) AND in_array($url['type'], array('overdue', 'block', 'tarif')))
+		{
+			if($url['type'] != 'tarif')
+			{
+				$time = isset($_POST['time']) ? trim($_POST['time']) : sys::outjs(array('e' => 'Необходимо указать дату.'));
+
+				$date = sys::checkdate($time);
+			}
+
+			switch($url['type'])
+			{
+				case 'overdue':
+					if($ctrl['time'] > $start_point)
+						sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.'));
+
+					$sql->query('UPDATE `control` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1');
+				break;
+
+				case 'block':
+					if($ctrl['status'] != ('off' || 'overdue'))
+						sys::outjs(array('e' => 'Игровой сервер должен быть выключен.'));
+
+					if($date < $start_point)
+						$sql->query('UPDATE `control` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1');
+					else
+						$sql->query('UPDATE `control` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1');
+			}
+
+			sys::outjs(array('s' => 'ok'));
+		}
+
+		$aData = array();
+
+		$aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $ctrl['user'];
+		$aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $ctrl['address'];
+		$aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : $ctrl['passwd'];
+		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $ctrl['time'];
+		$aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : $ctrl['sql_passwd'];
+		$aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : $ctrl['sql_ftp'];
+		$aData['limit'] = isset($_POST['sql_ftp']) ? sys::int($_POST['limit']) : $ctrl['limit'];
+		$aData['price'] = isset($_POST['price']) ? sys::int($_POST['price']) : $ctrl['price'];
+
+		include(LIB.'ssh.php');
+
+		if(sys::valid($aData['address'].':22', 'other', $aValid['address']))
+			$aData['address'] = $ctrl['address'];
+
+		if(sys::valid($aData['sql_passwd'], 'en'))
+			$aData['sql_passwd'] = $ctrl['sql_passwd'];
+
+		if(sys::valid($aData['sql_ftp'], 'en'))
+			$aData['sql_ftp'] = $ctrl['sql_ftp'];
+
+		if(!$ssh->auth($aData['passwd'], $aData['address']))
+			sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
+
+		if($ctrl['user'] != $aData['user'])
+		{
+			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Пользователь не найден.'));
+		}
+
+		$aData['time'] = sys::checkdate($aData['time']);
+
+		$sql->query('UPDATE `control` set '
+			.'`user`="'.$aData['user'].'",'
+			.'`address`="'.$aData['address'].'",'
+			.'`passwd`="'.$aData['passwd'].'",'
+			.'`time`="'.$aData['time'].'",'
+			.'`sql_passwd`="'.$aData['sql_passwd'].'",'
+			.'`sql_ftp`="'.$aData['sql_ftp'].'",'
+			.'`limit`="'.$aData['limit'].'",'
+			.'`price`="'.$aData['price'].'" WHERE `id`="'.$id.'" LIMIT 1');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('server', 'sections/control');
+		$html->set('id', $id);
+		$html->set('user', $ctrl['user']);
+		$html->set('address', $ctrl['address']);
+		$html->set('passwd', $ctrl['passwd']);
+		$html->set('sql_passwd', $ctrl['sql_passwd']);
+		$html->set('sql_ftp', $ctrl['sql_ftp']);
+		$html->set('limit', $ctrl['limit']);
+		$html->set('price', $ctrl['price']);
+		$html->set('time', date('d/m/Y H:i', $ctrl['time']));
+		$html->set('date', date('d.m.Y - H:i:s', $ctrl['date']));
+		$html->set('overdue', $ctrl['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $ctrl['overdue']));
+		$html->set('block', $ctrl['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $ctrl['block']));
+
+	$html->pack('main');
+?>

+ 28 - 0
system/acp/sections/jobs/add.php

@@ -0,0 +1,28 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{	
+		$aData = [];
+
+		$data = ['name', 'job', 'desc', 'status'];
+		foreach($data as $idata)
+			$aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : '';
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля!'));
+		
+		$sql->query('INSERT INTO `jobs` set'
+			.'`name`="'.$aData['name'].'",'
+			.'`job`="'.$aData['job'].'",'
+			.'`desc`="'.$aData['desc'].'",'
+			.'`status`="'.$aData['status'].'",'
+			.'`date`="'.$start_point.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('add', 'sections/jobs');
+	$html->pack('main');
+?>

+ 39 - 0
system/acp/sections/jobs/edit.php

@@ -0,0 +1,39 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" LIMIT 1');
+	if(!$sql->num())
+		header('Location: '.$cfg['http'].'acp/jobs');
+	$jobs = $sql->get();
+
+	if($go)
+	{	
+		$aData = [];
+
+		$data = ['name', 'job', 'desc', 'status'];
+		foreach($data as $idata)
+			$aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : '';
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля!'));
+		
+		$sql->query('UPDATE `jobs` set'
+			.'`name`="'.$aData['name'].'",'
+			.'`job`="'.$aData['job'].'",'
+			.'`desc`="'.$aData['desc'].'",'
+			.'`status`="'.$aData['status'].'",'
+			.'`date`="'.$start_point.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('edit', 'sections/jobs');
+		$status = $jobs['status'] ? '<option value="1">Доступна</option><option value="0">Недоступна</option>' : '<option value="0">Недоступна</option><option value="1">Доступна</option>';
+		$html->set('status', $status);
+
+		$data = ['id', 'name', 'job', 'desc'];
+		foreach($data as $idata)
+			$html->set($idata, $jobs[$idata]);
+	$html->pack('main');
+?>

+ 38 - 0
system/acp/sections/jobs/index.php

@@ -0,0 +1,38 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($url['edit']){
+		include(SEC.'jobs/edit.php');
+	}else{
+		$sql->query('SELECT * FROM `jobs` ORDER BY `id` ASC');
+		while($jobs = $sql->get())
+		{
+			$status = [
+				'1' => 'Доступна',
+				'0' => 'Недоступна'
+			];
+
+			$list .= '<tr>';
+				$list .= '<td>'.$jobs['id'].'</td>';
+				$list .= '<td>'.$jobs['name'].'</td>';
+				$list .= '<td>'.$jobs['job'].'</td>';
+				$list .= '<td>'.$jobs['desc'].'</td>';
+				$list .= '<td>'.$status[$jobs['status']].'</td>';
+				$list .= '<td>'.sys::today($jobs['date']).'</td>';
+				$list .= '<td><div class="text-red" style="cursor: pointer;" onclick="del(\''.$jobs['id'].'\', \'confirm\')">удалить</div></td>';
+				$list .= '<td><a href="[acp]jobs/edit/section/id/'.$jobs['id'].'" class="green">Изменить</a></td>';
+			$list .= '</tr>';
+		}
+
+		if(isset($url['del']))
+		{
+			$sql->query('DELETE FROM `jobs` WHERE `id`="'.$url['del'].'" LIMIT 1');
+			sys::outjs(array('s' => 'ok'));
+		}
+
+		$html->get('index', 'sections/jobs');
+			$html->set('list', $list);
+		$html->pack('main');
+	}
+?>

+ 64 - 0
system/acp/sections/jobs/request.php

@@ -0,0 +1,64 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+	{
+		$sql->query('SELECT * FROM `jobs_app` WHERE `id`="'.$id.'" LIMIT 1');
+		$jobs_app = $sql->get();
+
+		if($go)
+		{
+			$aData = [];
+
+			$data = ['user', 'text', 'contact', 'job'];
+			foreach($data as $idata)
+				$aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : '';
+
+			$sql->query('UPDATE `jobs_app` set'
+				.'`user`="'.$aData['user'].'",'
+				.'`text`="'.$aData['text'].'",'
+				.'`contact`="'.$aData['contact'].'",'
+				.'`job`="'.$aData['job'].'"');
+
+			sys::outjs(array('s' => 'ok'));
+		}
+
+		$html->get('request_edit', 'sections/jobs');
+			$data = ['id', 'user', 'text', 'contact', 'job'];
+			foreach($data as $idata)
+				$html->set($idata, $jobs_app[$idata]);
+		$html->pack('main');
+	}else{
+		$sql->query('SELECT * FROM `jobs_app` ORDER BY `id` ASC');
+		while($jobs = $sql->get())
+		{
+			$status = [
+				'1' => 'Доступна',
+				'0' => 'Недоступна'
+			];
+
+			$list .= '<tr>';
+				$list .= '<td>'.$jobs['id'].'</td>';
+				$list .= '<td><a href="[acp]users/id/'.$jobs['user'].'">user_'.$jobs['user'].'</a></td>';
+				$list .= '<td>'.sys::strlen($jobs['text']) > 0 ? '<td>'.$jobs['text'].'</td>' : '<td><a href="[acp]jobs/section/request/id/'.$jobs['id'].'#text">Ответить</a></td>'.'</td>';
+				$list .= '<td>'.$jobs['contact'].'</td>';
+				$list .= '<td><a href="[acp]jobs/edit/section/id/'.$jobs['job'].'">job_'.$jobs['job'].'</a></td>';
+				$list .= '<td>'.sys::today($jobs['date']).'</td>';
+				$list .= '<td><div class="text-red" style="cursor: pointer;" onclick="del(\''.$jobs['id'].'\', \'confirm\')">удалить</div></td>';
+				$list .= '<td><a href="[acp]jobs/section/request/id/'.$jobs['id'].'" class="green">Изменить</a></td>';
+			$list .= '</tr>';
+			
+			if(isset($url['del']))
+			{
+				$sql->query('DELETE FROM `jobs_app` WHERE `id`="'.$url['del'].'" LIMIT 1');
+				sys::outjs(array('s' => 'ok'));
+
+			}
+		}
+
+		$html->get('request', 'sections/jobs');
+			$html->set('list', $list);
+		$html->pack('main');
+	}
+?>

+ 25 - 0
system/acp/sections/letter/index.php

@@ -0,0 +1,25 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$group = array('user' => 'Пользователь', 'support' => 'Тех.поддержка', 'admin' => 'Администратор');
+	$list = '';
+
+	$sql->query('SELECT `id`, `login`, `mail`, `group`, `name`, `lastname`, `patronymic`, `balance`, `time` FROM `users` WHERE `notice_news`="1" ORDER BY `id` ASC');
+	while($us = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td class="text-center"><input id="letter_'.$us['id'].'" class="letter" type="checkbox" name="users['.$us['id'].']"></td>';
+			$list .= '<td><label for="letter_'.$us['id'].'">'.$us['login'].' / '.$us['lastname'].' '.$us['name'].' '.$us['patronymic'].'</label></td>';
+			$list .= '<td>'.$us['mail'].'</td>';
+			$list .= '<td class="text-center">'.$us['balance'].' '.$cfg['currency'].'</td>';
+			$list .= '<td class="text-right">'.sys::today($us['time']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('index', 'sections/letter');
+
+		$html->set('list', $list);
+
+	$html->pack('main');
+?>

+ 54 - 0
system/acp/sections/letter/send.php

@@ -0,0 +1,54 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	set_time_limit(1200);
+
+	$aData = array();
+
+	$aData['title'] = isset($_POST['title']) ? trim($_POST['title']) : sys::outjs(array('e' => 'Необходимо указать заголовок'));
+	$aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : sys::outjs(array('e' => 'Необходимо указать сообщение'));
+
+	$aData['users'] = isset($_POST['users']) ? $_POST['users'] : sys::outjs(array('e' => 'Необходимо указать получателей'));
+
+	if($aData['title'] == '' || $aData['text'] == '')
+		sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+	if(!is_array($aData['users']) || !count($aData['users']))
+		sys::outjs(array('e' => 'Необходимо указать минимум одного получателя'));
+
+	$noletter = '';
+
+	include(LIB.'smtp.php');
+
+	foreach($aData['users'] as $id => $cheked)
+	{
+		if($cheked != 'on')
+			continue;
+
+		$sql->query('SELECT `mail` FROM `users` WHERE `id`="'.sys::int($id).'" LIMIT 1');
+		$us = $sql->get();
+
+		$tpl = file_get_contents(DATA.'mail.ini', "r");
+
+		$text = str_replace(
+			array('[name]', '[text]', '[http]', '[img]', '[css]'),
+			array($cfg['name'], $aData['text'], $cfg['http'], $cfg['http'].'template/images/', $cfg['http'].'template/css/'),
+			$tpl
+		);
+
+		$smtp = new smtp($cfg['smtp_login'], $cfg['smtp_passwd'], $cfg['smtp_url'], $cfg['smtp_mail'], 465);
+
+		$headers = "MIME-Version: 1.0\r\n";
+		$headers .= "Content-type: text/html; charset=utf-8\r\n";
+		$headers .= "From: ".$cfg['smtp_name']." <".$cfg['smtp_mail'].">\r\n";
+
+		if(!$smtp->send($us['mail'], strip_tags($aData['title']), $text, $headers))
+			$noletter .= '<p>'.$us['mail'].'</p>';
+	}
+
+	if($noletter == '')
+		$noletter = 'отправлено всем.';
+
+	sys::outjs(array('s' => $noletter));
+?>

+ 32 - 0
system/acp/sections/logs/buy.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs` WHERE `type`="buy"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs');
+
+	$sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="buy" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('logs', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 32 - 0
system/acp/sections/logs/cashout.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs` WHERE `type`="cashout"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/cashout');
+
+	$sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="cashout" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('logs', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 32 - 0
system/acp/sections/logs/extend.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs` WHERE `type`="extend"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/extend');
+
+	$sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="extend" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('logs', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 40 - 0
system/acp/sections/logs/index.php

@@ -0,0 +1,40 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'logs/sysearch.php');
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs_sys`');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs');
+
+	$sql->query('SELECT `id`, `user`, `server`, `text`, `time` FROM `logs_sys` ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+
+			if(!$log['user'])
+				$list .= '<td class="text-center">Система</td>';
+			else
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/servers/id/'.$log['server'].'">SERVER_'.$log['server'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['time']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('index', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 32 - 0
system/acp/sections/logs/part.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs` WHERE `type`="part"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/part');
+
+	$sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="part" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('logs', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 32 - 0
system/acp/sections/logs/replenish.php

@@ -0,0 +1,32 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$list = '';
+
+	$sql->query('SELECT `id` FROM `logs` WHERE `type`="replenish"');
+
+	$aPage = sys::page($page, $sql->num(), 40);
+
+	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/replenish');
+
+	$sql->query('SELECT `id`, `user`, `text`, `date`, `money` FROM `logs` WHERE `type`="replenish" ORDER BY `id` DESC LIMIT '.$aPage['num'].', 40');
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('logs', 'sections/logs');
+
+		$html->set('list', $list);
+
+		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+	$html->pack('main');
+?>

+ 80 - 0
system/acp/sections/logs/search.php

@@ -0,0 +1,80 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	$select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`';
+
+	$check = explode('=', $text);
+
+	if(in_array($check[0], array('server', 'user')))
+	{
+		$val = trim($check[1]);
+
+		switch($check[0])
+		{
+			case 'server':
+				$sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC');
+			break;
+
+			case 'user':
+				$sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC');
+		}
+	}elseif($text{0} == 'i' AND $text{1} == 'd')
+		$sql->query('SELECT `id`, `user`, `text`, `date`, `type`, `money` FROM `logs` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`type` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`money` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40');
+	}
+
+	if(!$sql->num())
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+			$list .= '<td class="text-center">'.$log['money'].' '.$cur['currency'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['date']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 84 - 0
system/acp/sections/logs/sysearch.php

@@ -0,0 +1,84 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	$select = '`id`, `user`, `server`, `text`, `time` FROM `logs_sys`';
+
+	$check = explode('=', $text);
+
+	if(in_array($check[0], array('server', 'user')))
+	{
+		$val = trim($check[1]);
+
+		switch($check[0])
+		{
+			case 'server':
+				$sql->query('SELECT '.$select.' WHERE `server`="'.sys::int($val).'" ORDER BY `id` DESC');
+			break;
+
+			case 'user':
+				$sql->query('SELECT '.$select.' WHERE `user`="'.sys::int($val).'" ORDER BY `id` DESC');
+		}
+	}elseif($text{0} == 'i' AND $text{1} == 'd')
+		$sql->query('SELECT '.$select.' WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`user` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$sql->query('SELECT '.$select.' WHERE '.$like.' ORDER BY `id` DESC LIMIT 40');
+	}
+
+	if(!$sql->num())
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($log = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$log['id'].'</td>';
+			$list .= '<td>'.$log['text'].'</td>';
+
+			if(!$log['user'])
+				$list .= '<td class="text-center">Система</td>';
+			else
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$log['user'].'">USER_'.$log['user'].'</a></td>';
+
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/server/id/'.$log['server'].'">SERVER_'.$log['server'].'</a></td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $log['time']).'</td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 37 - 0
system/acp/sections/news/add.php

@@ -0,0 +1,37 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
+		$aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : '';
+		$aData['full'] = isset($_POST['full']) ? sys::bbc(trim($_POST['full'])) : '';
+		$aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : '';
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+		if(sys::strlen($aData['name']) > 50)
+			sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.'));
+
+		if(sys::strlen($aData['tags']) > 100)
+			sys::outjs(array('e' => 'Теги не должен превышать 100 символов.'));
+
+		$sql->query('INSERT INTO `news` set '
+			.'`name`="'.htmlspecialchars($aData['name']).'",'
+			.'`text`="'.htmlspecialchars($aData['text']).'",'
+			.'`full_text`="'.htmlspecialchars($aData['full']).'",'
+			.'`tags`="'.htmlspecialchars($aData['tags']).'",'
+			.'`views`="0",'
+			.'`date`="'.$start_point.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('add', 'sections/news');
+
+	$html->pack('main');
+?>

+ 8 - 0
system/acp/sections/news/delete.php

@@ -0,0 +1,8 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('DELETE FROM `news` WHERE `id`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 40 - 0
system/acp/sections/news/index.php

@@ -0,0 +1,40 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'news/search.php');
+
+	if($id)
+		include(SEC.'news/news.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `news`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/news');
+
+		$sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($news = $sql->get())
+		{
+			$list .= '<tr>';
+				$list .= '<td>'.$news['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/news/id/'.$news['id'].'">'.$news['name'].'</a></td>';
+				$list .= '<td>'.$news['tags'].'</td>';
+				$list .= '<td class="text-center">'.$news['views'].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $news['date']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return news_delete(\''.$news['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/news');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 44 - 0
system/acp/sections/news/news.php

@@ -0,0 +1,44 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT `name`, `text`, `full_text`, `tags` FROM `news` WHERE `id`="'.$id.'" LIMIT 1');
+	$news = $sql->get();
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : htmlspecialchars_decode($news['name']);
+		$aData['text'] = isset($_POST['text']) ? sys::bbc(trim($_POST['text'])) : htmlspecialchars_decode($news['text']);
+		$aData['full'] = isset($_POST['full']) ? sys::bbc(trim($_POST['full'])) : htmlspecialchars_decode($news['full_text']);
+		$aData['tags'] = isset($_POST['tags']) ? trim($_POST['tags']) : htmlspecialchars_decode($news['tags']);
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+		if(sys::strlen($aData['name']) > 50)
+			sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.'));
+
+		if(sys::strlen($aData['tags']) > 100)
+			sys::outjs(array('e' => 'Теги не должен превышать 100 символов.'));
+
+		$sql->query('UPDATE `news` set '
+			.'`name`="'.htmlspecialchars($aData['name']).'",'
+			.'`text`="'.htmlspecialchars($aData['text']).'",'
+			.'`full_text`="'.htmlspecialchars($aData['full']).'",'
+			.'`tags`="'.htmlspecialchars($aData['tags']).'" WHERE `id`="'.$id.'" LIMIT 1');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('news', 'sections/news');
+
+		$html->set('id', $id);
+		$html->set('name', htmlspecialchars_decode($news['name']));
+		$html->set('text', htmlspecialchars_decode($news['text']));
+		$html->set('full', htmlspecialchars_decode($news['full_text']));
+		$html->set('tags', htmlspecialchars_decode($news['tags']));
+
+	$html->pack('main');
+?>

+ 64 - 0
system/acp/sections/news/search.php

@@ -0,0 +1,64 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	if($text{0} == 'i' AND $text{1} == 'd')
+		$sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`name` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`tags` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`full_text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$sql->query('SELECT `id`, `name`, `tags`, `views`, `date` FROM `news` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20');
+	}
+
+	if(!$sql->num())
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($news = $sql->get())
+	{
+		$list .= '<tr>';
+			$list .= '<td>'.$news['id'].'</td>';
+			$list .= '<td>'.$news['name'].'</td>';
+			$list .= '<td>'.$news['tags'].'</td>';
+			$list .= '<td class="text-center">'.$news['views'].'</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $news['date']).'</td>';
+			$list .= '<td class="text-center"><a href="#" onclick="return news_delete(\''.$news['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 55 - 0
system/acp/sections/notice/add.php

@@ -0,0 +1,55 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : '';
+		$aData['color'] = isset($_POST['color']) ? trim($_POST['color']) : '';
+		$aData['type'] = isset($_POST['type']) ? trim($_POST['type']) : '';
+		$aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : '';
+		$aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : '';
+		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : '';
+
+		$aData['time'] = sys::checkdate($aData['time']);
+
+		if($aData['type'] == 'unit')
+		{
+			$sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанная локация не найдена'));
+
+			$aData['server'] = 0;
+		}elseif($aData['type'] == 'server'){
+			$sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный сервер не найден'));
+
+			$aData['unit'] = 0;
+		}else
+			sys::outjs(array('e' => 'Выберете получателя уведомления'));
+
+		$sql->query('INSERT INTO `notice` set '
+			.'`unit`="'.$aData['unit'].'",'
+			.'`server`="'.$aData['server'].'",'
+			.'`text`="'.htmlspecialchars($aData['text']).'",'
+			.'`color`="'.$aData['color'].'",'
+			.'`time`="'.$aData['time'].'"');
+		
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$units = '';
+
+	$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+	while($unit = $sql->get())
+		$units .= '<option value="'.$unit['id'].'">'.$unit['name'].'</option>';
+
+	$html->get('add', 'sections/notice');
+
+		$html->set('units', $units);
+
+	$html->pack('main');
+?>

+ 8 - 0
system/acp/sections/notice/delete.php

@@ -0,0 +1,8 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('DELETE FROM `notice` WHERE `id`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 52 - 0
system/acp/sections/notice/end.php

@@ -0,0 +1,52 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'notice/search.php');
+
+	if($id)
+		include(SEC.'notice/notice.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `notice`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice');
+
+		$notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`<"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($notice = $sql->get($notices))
+		{
+			if($notice['unit'])
+			{
+				$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1');
+				$unit = $sql->get();
+
+				$name = $unit['name'];
+			}else
+				$name = '<a href="'.$cfg['http'].'acp/servers/id/'.$notice['server'].'">SERVER_'.$notice['server'].'</a>';
+
+			$list .= '<tr>';
+				$list .= '<td>'.$notice['id'].'</td>';
+				$list .= '<td class="w50p">Адресовано: '.$name.'</td>';
+				$list .= '<td>Завершен: '.date('d.m.Y - H:i:s', $notice['time']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/notice/id/'.$notice['id'].'">Редактировать</a></td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return notice_delete(\''.$notice['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td colspan="5">'.$notice['text'].'</td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/notice');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 52 - 0
system/acp/sections/notice/index.php

@@ -0,0 +1,52 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'notice/search.php');
+
+	if($id)
+		include(SEC.'notice/notice.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `notice`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice');
+
+		$notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($notice = $sql->get($notices))
+		{
+			if($notice['unit'])
+			{
+				$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1');
+				$unit = $sql->get();
+
+				$name = $unit['name'];
+			}else
+				$name = '<a href="'.$cfg['http'].'acp/servers/id/'.$notice['server'].'">SERVER_'.$notice['server'].'</a>';
+
+			$list .= '<tr>';
+				$list .= '<td>'.$notice['id'].'</td>';
+				$list .= '<td class="w50p">Адресовано: '.$name.'</td>';
+				$list .= '<td>Завершится: '.date('d.m.Y - H:i:s', $notice['time']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/notice/id/'.$notice['id'].'">Редактировать</a></td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return notice_delete(\''.$notice['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td colspan="5">'.$notice['text'].'</td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/notice');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 79 - 0
system/acp/sections/notice/notice.php

@@ -0,0 +1,79 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT * FROM `notice` WHERE `id`="'.$id.'" LIMIT 1');
+	$notice = $sql->get();
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : htmlspecialchars_decode($notice['text']);
+		$aData['color'] = isset($_POST['color']) ? trim($_POST['color']) : $notice['color'];
+		$aData['type'] = isset($_POST['type']) ? trim($_POST['type']) : $notice['type'];
+		$aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $notice['unit'];
+		$aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $notice['server'];
+		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : '';
+
+		$aData['time'] = sys::checkdate($aData['time']);
+
+		if($aData['type'] == 'unit')
+		{
+			$sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанная локация не найдена'));
+
+			$aData['server'] = 0;
+		}elseif($aData['type'] == 'server'){
+			$sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный сервер не найден'));
+
+			$aData['unit'] = 0;
+		}else
+			sys::outjs(array('e' => 'Выберете получателя уведомления'));
+
+		$sql->query('UPDATE `notice` set '
+			.'`unit`="'.$aData['unit'].'",'
+			.'`server`="'.$aData['server'].'",'
+			.'`text`="'.htmlspecialchars($aData['text']).'",'
+			.'`color`="'.$aData['color'].'",'
+			.'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1');
+		
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$units = '';
+
+	$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+	while($unit = $sql->get())
+		$units .= '<option value="'.$unit['id'].'">'.$unit['name'].'</option>';
+
+	$html->get('notice', 'sections/notice');
+
+		$html->set('id', $notice['id']);
+		$html->set('text', htmlspecialchars_decode($notice['text']));
+		$html->set('time', date('d/m/Y H:i', $notice['time']));
+
+		if($notice['unit'])
+		{
+			$html->set('type', '<option value="unit">Всем на локации</option><option value="server">Определенному серверу</option>');
+			$html->set('units', str_replace('"'.$notice['unit'].'"', '"'.$notice['unit'].'" selected', $units));
+			$html->set('server', '');
+
+			$html->unit('unit');
+			$html->unit('server', true);
+		}else{
+			$html->set('type', '<option value="server">Определенному серверу</option><option value="unit">Всем на локации</option>');
+			$html->set('units', $units);
+			$html->set('server', $notice['server']);
+
+			$html->unit('unit', true);
+			$html->unit('server');
+		}
+
+		$html->set('colors', str_replace('"'.$notice['color'].'"', '"'.$notice['color'].'" selected', '<option value="red">Красный</option><option value="green">Зеленый</option><option value="blue">Синий</option>'));
+
+	$html->pack('main');
+?>

+ 75 - 0
system/acp/sections/notice/search.php

@@ -0,0 +1,75 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	if($text{0} == 'i' AND $text{1} == 'd')
+		$notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`unit` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`server` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`text` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$notices = $sql->query('SELECT `id`, `unit`, `server`, `text`, `time` FROM `notice` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20');
+	}
+
+	if(!$sql->num($notices))
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($notice = $sql->get($notices))
+	{
+		if($notice['unit'])
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$name = $unit['name'];
+		}else
+			$name = '<a href="'.$cfg['http'].'acp/servers/id/'.$notice['server'].'">SERVER_'.$notice['server'].'</a>';
+
+		$list .= '<tr>';
+			$list .= '<td>'.$notice['id'].'</td>';
+			$list .= '<td class="w50p">Адресовано: '.$name.'</td>';
+			$list .= '<td>Завершится: '.date('d.m.Y - H:i:s', $notice['time']).'</td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/notice/id/'.$notice['id'].'">Редактировать</a></td>';
+			$list .= '<td class="text-center"><a href="#" onclick="return notice_delete(\''.$notice['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+
+		$list .= '<tr>';
+			$list .= '<td colspan="5">'.$notice['text'].'</td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 31 - 0
system/acp/sections/pages/add.php

@@ -0,0 +1,31 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
+		$aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+		$name = md5(time().rand(5, 100).rand(10, 20).rand(1, 20).rand(40, 80));
+
+		$file = fopen(FILES.'pages/'.$name, "w");
+
+		fputs($file, $aData['text']);
+
+		fclose($file);
+
+		$sql->query('INSERT INTO `pages` set `name`="'.htmlspecialchars($aData['name']).'", `file`="'.$name.'"');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('add', 'sections/pages');
+
+	$html->pack('main');
+?>

+ 13 - 0
system/acp/sections/pages/delete.php

@@ -0,0 +1,13 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1');
+	$page = $sql->get();
+
+	unlink(FILES.'pages/'.$page['file']);
+
+	$sql->query('DELETE FROM `pages` WHERE `id`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 36 - 0
system/acp/sections/pages/index.php

@@ -0,0 +1,36 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'pages/page.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `pages`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/pages');
+
+		$sql->query('SELECT * FROM `pages` ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($page = $sql->get())
+		{
+			$list .= '<tr>';
+				$list .= '<td>'.$page['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/pages/id/'.$page['id'].'">'.$page['name'].'</a></td>';
+				$list .= '<td>'.$page['file'].'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'pages/id/'.$page['id'].'" target="_blank">Перейти</a></td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return page_delete(\''.$page['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/pages');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 37 - 0
system/acp/sections/pages/page.php

@@ -0,0 +1,37 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT `name`, `file` FROM `pages` WHERE `id`="'.$id.'" LIMIT 1');
+	$page = $sql->get();
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $page['name'];
+		$aData['text'] = isset($_POST['text']) ? trim($_POST['text']) : file_get_contents(FILES.'pages/'.$page['file']);
+
+		if(in_array('', $aData))
+			sys::outjs(array('e' => 'Необходимо заполнить все поля'));
+
+		$file = fopen(FILES.'pages/'.$page['file'], "w");
+
+		fputs($file, $aData['text']);
+
+		fclose($file);
+
+		$sql->query('UPDATE `pages` set `name`="'.htmlspecialchars($aData['name']).'" WHERE `id`="'.$id.'" LIMIT 1');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$html->get('page', 'sections/pages');
+		
+		$html->set('id', $id);
+		$html->set('name', htmlspecialchars_decode($page['name']));
+
+		$html->set('text', htmlspecialchars(file_get_contents(FILES.'pages/'.$page['file'])));
+
+	$html->pack('main');
+?>

+ 88 - 0
system/acp/sections/promo/add.php

@@ -0,0 +1,88 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['cod'] = isset($_POST['cod']) ? trim($_POST['cod']) : '';
+		$aData['value'] = isset($_POST['value']) ? trim($_POST['value']) : '';
+		$aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : 0;
+		$aData['hits'] = isset($_POST['hits']) ? sys::int($_POST['hits']) : '';
+		$aData['use'] = isset($_POST['use']) ? sys::int($_POST['use']) : '';
+		$aData['extend'] = isset($_POST['extend']) ? sys::int($_POST['extend']) : 0;
+		$aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : '';
+		$aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : '';
+		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : '';
+		$aData['data'] = isset($_POST['data']) ? trim($_POST['data']) : '';
+		$aData['tarifs'] = isset($_POST['tarifs']) ? $_POST['tarifs'] : '';
+
+		$aData['time'] = sys::checkdate($aData['time']);
+
+		if(sys::valid($aData['cod'], 'promo'))
+			sys::outjs(array('e' => 'Неправильный формат промо-кода'));
+
+		if($aData['user'])
+		{
+			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный пользователь не найден'));
+		}else
+			$aData['user'] = 0;
+
+		if($aData['server'])
+		{
+			$sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный сервер не найден'));
+		}else
+			$aData['server'] = 0;
+
+		if(!is_array($aData['tarifs']) || !count($aData['tarifs']))
+			sys::outjs(array('e' => 'Необходимо указать минимум один тариф'));
+
+		if($aData['discount'])
+			$proc = strpos($aData['value'], '%') ? '%' : '';
+
+		$aData['value'] = sys::int($aData['value']).$proc;
+
+		foreach($aData['tarifs'] as $id => $on)
+		{
+			$sql->query('SELECT `id` FROM `promo` WHERE `cod`="'.$aData['cod'].'" AND `tarif`="'.$id.'" LIMIT 1');
+			if($sql->num())
+				continue;
+
+			$sql->query('INSERT INTO `promo` set '
+				.'`cod`="'.$aData['cod'].'",'
+				.'`value`="'.$aData['value'].'",'
+				.'`discount`="'.$aData['discount'].'",'
+				.'`data`="'.base64_encode('{'.$aData['data'].'}').'",'
+				.'`hits`="'.$aData['hits'].'",'
+				.'`use`="'.$aData['use'].'",'
+				.'`extend`="'.$aData['extend'].'",'
+				.'`tarif`="'.$id.'",'
+				.'`user`="'.$aData['user'].'",'
+				.'`server`="'.$aData['server'].'",'
+				.'`time`="'.$aData['time'].'"');
+		}
+		
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$tarifs = '';
+
+	$units = $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+	while($unit = $sql->get($units))
+	{
+		$sql->query('SELECT `id`, `name`, `game` FROM `tarifs` WHERE `unit`="'.$unit['id'].'" ORDER BY `id` ASC');
+		while($tarif = $sql->get())
+			$tarifs .= '<label> '.$unit['name'].' / #'.$tarif['id'].' '.$tarif['name'].' ('.strtoupper($tarif['game']).') <input type="checkbox" name="tarifs['.$tarif['id'].']"></label>';
+	}
+
+	$html->get('add', 'sections/promo');
+
+		$html->set('tarifs', $tarifs);
+
+	$html->pack('main');
+?>

+ 9 - 0
system/acp/sections/promo/delete.php

@@ -0,0 +1,9 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('DELETE FROM `promo` WHERE `id`="'.$id.'" LIMIT 1');
+	$sql->query('DELETE FROM `promo_use` WHERE `promo`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 46 - 0
system/acp/sections/promo/end.php

@@ -0,0 +1,46 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'promo/search.php');
+
+	if($id)
+		include(SEC.'promo/promo.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `promo`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo');
+
+		$promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`<"'.$start_point.'"ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($promo = $sql->get($promos))
+		{
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td>'.$promo['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/promo/id/'.$promo['id'].'">'.$promo['cod'].'</a></td>';
+				$list .= '<td class="text-center">'.$promo['value'].'</td>';
+				$list .= '<td class="text-center">#'.$promo['tarif'].' '.$tarif['name'].'</td>';
+				$list .= '<td class="text-center">'.($promo['discount'] ? 'Скидка' : 'Подарочные дни').'</td>';
+				$list .= '<td class="text-center">'.($promo['extend'] ? 'Продление' : 'Аренда').'</td>';
+				$list .= '<td class="text-center">'.$promo['use'].' шт.</td>';
+				$list .= '<td class="text-center">Завершена</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return promo_delete(\''.$promo['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/promo');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 46 - 0
system/acp/sections/promo/index.php

@@ -0,0 +1,46 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'promo/search.php');
+
+	if($id)
+		include(SEC.'promo/promo.php');
+	else{
+		$list = '';
+
+		$sql->query('SELECT `id` FROM `promo`');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo');
+
+		$promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `time`>"'.$start_point.'" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($promo = $sql->get($promos))
+		{
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td>'.$promo['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/promo/id/'.$promo['id'].'">'.$promo['cod'].'</a></td>';
+				$list .= '<td class="text-center">'.$promo['value'].'</td>';
+				$list .= '<td class="text-center">#'.$promo['tarif'].' '.$tarif['name'].'</td>';
+				$list .= '<td class="text-center">'.($promo['discount'] ? 'Скидка' : 'Подарочные дни').'</td>';
+				$list .= '<td class="text-center">'.($promo['extend'] ? 'Продление' : 'Аренда').'</td>';
+				$list .= '<td class="text-center">'.$promo['use'].' шт.</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $promo['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return promo_delete(\''.$promo['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/promo');
+
+			$html->set('list', $list);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 92 - 0
system/acp/sections/promo/promo.php

@@ -0,0 +1,92 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('SELECT * FROM `promo` WHERE `id`="'.$id.'" LIMIT 1');
+	$promo = $sql->get();
+
+	if($go)
+	{
+		$aData = array();
+
+		$aData['cod'] = isset($_POST['cod']) ? trim($_POST['cod']) : $promo['cod'];
+		$aData['value'] = isset($_POST['value']) ? trim($_POST['value']) : $promo['value'];
+		$aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $promo['discount'];
+		$aData['hits'] = isset($_POST['hits']) ? sys::int($_POST['hits']) : $promo['hits'];
+		$aData['use'] = isset($_POST['use']) ? sys::int($_POST['use']) : $promo['use'];
+		$aData['extend'] = isset($_POST['extend']) ? sys::int($_POST['extend']) : $promo['extend'];
+		$aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $promo['user'];
+		$aData['server'] = isset($_POST['server']) ? sys::int($_POST['server']) : $promo['server'];
+		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : date('d/m/Y H:i', $promo['time']);
+		$aData['data'] = isset($_POST['data']) ? trim($_POST['data']) : $promo['data'];
+
+		$aData['time'] = sys::checkdate($aData['time']);
+
+		if(sys::valid($aData['cod'], 'promo'))
+			sys::outjs(array('e' => 'Неправильный формат промо-кода'));
+
+		$sql->query('SELECT `id` FROM `promo` WHERE `id`!="'.$id.'" AND `cod`="'.$aData['cod'].'" AND `tarif`="'.$promo['tarif'].'" LIMIT 1');
+		if($sql->num())
+			sys::outjs(array('e' => 'Указанный код используется в другой акции'));
+
+		if($aData['user'])
+		{
+			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный пользователь не найден'));
+		}else
+			$aData['user'] = 0;
+
+		if($aData['server'])
+		{
+			$sql->query('SELECT `id` FROM `servers` WHERE `id`="'.$aData['server'].'" LIMIT 1');
+			if(!$sql->num())
+				sys::outjs(array('e' => 'Указанный сервер не найден'));
+		}else
+			$aData['server'] = 0;
+
+		if($aData['discount'])
+			$proc = strpos($aData['value'], '%') ? '%' : '';
+
+		$aData['value'] = sys::int($aData['value']).$proc;
+
+		$sql->query('UPDATE `promo` set '
+			.'`cod`="'.$aData['cod'].'",'
+			.'`value`="'.$aData['value'].'",'
+			.'`discount`="'.$aData['discount'].'",'
+			.'`data`="'.base64_encode('{'.$aData['data'].'}').'",'
+			.'`hits`="'.$aData['hits'].'",'
+			.'`use`="'.$aData['use'].'",'
+			.'`extend`="'.$aData['extend'].'",'
+			.'`user`="'.$aData['user'].'",'
+			.'`server`="'.$aData['server'].'",'
+			.'`time`="'.$aData['time'].'" WHERE `id`="'.$id.'" LIMIT 1');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$sql->query('SELECT `id`, `unit`, `name`, `game` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1');
+	$tarif = $sql->get();
+
+	$sql->query('SELECT `id`, `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1');
+	$unit = $sql->get();
+
+	$html->get('promo', 'sections/promo');
+
+		$html->set('id', $promo['id']);
+		$html->set('cod', $promo['cod']);
+		$html->set('value', $promo['value']);
+		$html->set('data', str_replace(array('{', '}'), '', base64_decode($promo['data'])));
+		$html->set('hits', $promo['hits']);
+		$html->set('use', $promo['use']);
+		$html->set('user', $promo['user']);
+		$html->set('server', $promo['server']);
+		$html->set('time', date('d/m/Y H:i', $promo['time']));
+
+		$html->set('discount', $promo['discount'] ? '<option value="1">Скидка</option><option value="0">Подарочные дни</option>' : '<option value="0">Подарочные дни</option><option value="1">Скидка</option>');
+		$html->set('extend', $promo['extend'] ? '<option value="1">Для продления</option><option value="0">Для аренды</option>' : '<option value="0">Для аренды</option><option value="1">Для продления</option>');
+
+		$html->set('tarif', $unit['name'].' / #'.$tarif['id'].' '.$tarif['name'].' ('.strtoupper($tarif['game']).')');
+
+	$html->pack('main');
+?>

+ 68 - 0
system/acp/sections/promo/search.php

@@ -0,0 +1,68 @@
+<?php
+    if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+
+	$mkey = md5($text.$id);
+
+	$cache = $mcache->get($mkey);
+
+	if(is_array($cache))
+	{
+		if($go)
+			sys::outjs($cache, $nmch);
+
+		sys::outjs($cache);
+	}
+
+	if(!isset($text{2}))
+	{
+		if($go)
+			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+
+		sys::outjs(array('e' => ''));
+	}
+
+	if($text{0} == 'i' AND $text{1} == 'd')
+		$promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE `id`="'.sys::int($text).'" LIMIT 1');
+	else{
+		$like = '`id` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`cod` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
+				.'`value` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
+
+		$promos = $sql->query('SELECT `id`, `cod`, `value`, `discount`, `use`, `extend`, `tarif`, `time` FROM `promo` WHERE '.$like.' ORDER BY `id` ASC LIMIT 20');
+	}
+
+	if(!$sql->num($promos))
+	{
+		if($go)
+			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+	}
+
+	$list = '';
+
+	while($promo = $sql->get($promos))
+	{
+		$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1');
+		$tarif = $sql->get();
+
+		$list .= '<tr>';
+			$list .= '<td>'.$promo['id'].'</td>';
+			$list .= '<td><a href="'.$cfg['http'].'acp/promo/id/'.$promo['id'].'">'.$promo['cod'].'</a></td>';
+			$list .= '<td class="text-center">'.$promo['value'].'</td>';
+			$list .= '<td class="text-center">#'.$promo['tarif'].' '.$tarif['name'].'</td>';
+			$list .= '<td class="text-center">'.($promo['discount'] ? 'Скидка' : 'Подарочные дни').'</td>';
+			$list .= '<td class="text-center">'.($promo['extend'] ? 'Продление' : 'Аренда').'</td>';
+			$list .= '<td class="text-center">'.$promo['use'].' шт.</td>';
+			$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $promo['time']).'</td>';
+			$list .= '<td class="text-center"><a href="#" onclick="return promo_delete(\''.$tarif['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$mcache->set($mkey, array('s' => $list), false, 15);
+
+	sys::outjs(array('s' => $list));
+?>

+ 38 - 0
system/acp/sections/promo/stats.php

@@ -0,0 +1,38 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['delete']))
+	{
+		$sql->query('DELETE FROM `promo_use` WHERE `id`="'.sys::int($url['delete']).'" LIMIT 1');
+
+		sys::outjs(array('s' => 'ok'));
+	}
+
+	$list = '';
+
+	$all_use = $sql->query('SELECT * FROM `promo_use` ORDER BY `id` ASC LIMIT 100');
+	while($promo_use = $sql->get($all_use))
+	{
+		$sql->query('SELECT `text` FROM `logs` WHERE `user`="'.$promo_use['user'].'" AND `date`="'.$promo_use['time'].'" LIMIT 1');
+		$log = $sql->get();
+
+		$sql->query('SELECT `cod` FROM `promo` WHERE `id`="'.$promo_use['promo'].'" LIMIT 1');
+		$promo = $sql->get();
+
+		$list .= '<tr>';
+			$list .= '<td>'.$promo_use['id'].'</td>';
+			$list .= '<td><a href="'.$cfg['http'].'acp/promo/id/'.$promo_use['id'].'">'.$promo['cod'].'</a></td>';
+			$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$promo_use['user'].'">USER_'.$promo_use['user'].'</a></td>';
+			$list .= '<td>'.$log['text'].'</td>';
+			$list .= '<td class="text-center">'.sys::today($promo_use['time']).'</td>';
+			$list .= '<td class="text-center"><a href="#" onclick="return promo_use_delete(\''.$promo_use['id'].'\')" class="text-red">Удалить</a></td>';
+		$list .= '</tr>';
+	}
+
+	$html->get('stats', 'sections/promo');
+
+		$html->set('list', $list);
+
+	$html->pack('main');
+?>

+ 77 - 0
system/acp/sections/servers/crmp.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="crmp"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/crmp'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="crmp" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/cs.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cs"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cs'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cs" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/csgo.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="csgo"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/csgo'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="csgo" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/css.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="css"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/css'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="css" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/cssold.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="cssold"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/cssold'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="cssold" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 8 - 0
system/acp/sections/servers/delete.php

@@ -0,0 +1,8 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	$sql->query('UPDATE `servers` set `user`="-1", `status`="overdue", `time`="0", `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1');
+
+	sys::outjs(array('s' => 'ok'));
+?>

+ 80 - 0
system/acp/sections/servers/index.php

@@ -0,0 +1,80 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if(isset($url['subsection']) AND $url['subsection'] == 'search')
+		include(SEC.'servers/search.php');
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select);
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/mc.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mc"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mc'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mc" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

+ 77 - 0
system/acp/sections/servers/mta.php

@@ -0,0 +1,77 @@
+<?php
+	if(!DEFINED('EGP'))
+		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+	if($id)
+		include(SEC.'servers/server.php');
+	else{
+		$list = '';
+
+		$status = array(
+			'working' => '<span class="text-green">Работает</span>',
+			'off' => '<span class="text-red">Выключен</span>',
+			'start' => 'Запускается',
+			'restart' => 'Перезапускается',
+			'change' => 'Смена карты',
+			'install' => 'Устанавливается',
+			'reinstall' => 'Переустанавливается',
+			'update' => 'Обновляется',
+			'recovery' => 'Восстанавливается',
+			'overdue' => 'Просрочен',
+			'blocked' => 'Заблокирован'
+		);
+
+		$select = 'WHERE `user`!="-1"';
+		$url_search = '';
+
+		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
+		{
+			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
+			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
+		}
+
+		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="mta"');
+
+		$aPage = sys::page($page, $sql->num(), 20);
+
+		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/mta'.$url_search);
+
+		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="mta" ORDER BY `id` ASC LIMIT '.$aPage['num'].', 20');
+		while($server = $sql->get($servers))
+		{
+			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
+			$unit = $sql->get();
+
+			$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
+			$tarif = $sql->get();
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center">'.$server['id'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/id/'.$server['id'].'">'.$server['name'].'</a></td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/unit/unit/'.$server['unit'].'">#'.$server['unit'].' '.$unit['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$server['slots'].' шт.</td>';
+				$list .= '<td class="text-center">'.strtoupper($server['game']).'</td>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'servers/id/'.$server['id'].'" target="_blank">Перейти</a></td>';
+			$list .= '</tr>';
+
+			$list .= '<tr>';
+				$list .= '<td class="text-center"><a href="'.$cfg['http'].'acp/users/id/'.$server['user'].'">USER_'.$server['user'].'</a></td>';
+				$list .= '<td>'.$server['address'].'</td>';
+				$list .= '<td><a href="'.$cfg['http'].'acp/servers/search/tarif/tarif/'.$server['tarif'].'">#'.$server['tarif'].' '.$tarif['name'].'</a></td>';
+				$list .= '<td class="text-center">'.$status[$server['status']].'</td>';
+				$list .= '<td class="text-center">'.date('d.m.Y - H:i:s', $server['time']).'</td>';
+				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</a></td>';
+			$list .= '</tr>';
+		}
+
+		$html->get('index', 'sections/servers');
+
+			$html->set('list', $list);
+
+			$html->set('url_search', $url_search);
+
+			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+
+		$html->pack('main');
+	}
+?>

部分文件因文件數量過多而無法顯示