Przeglądaj źródła

Reformat code

This update contains code reformatting to meet PHP standards.
Sergei Solovev 1 rok temu
rodzic
commit
b59003e559
100 zmienionych plików z 5621 dodań i 5318 usunięć
  1. 150 55
      403.html
  2. 151 56
      404.html
  3. 35 35
      acp/index.php
  4. 356 0
      composer.lock
  5. 38 38
      cron.php
  6. 22 22
      fail.html
  7. 48 48
      index.php
  8. 22 22
      success.html
  9. 113 119
      system/acp/distributor.php
  10. 25 25
      system/acp/engine/addons.php
  11. 25 26
      system/acp/engine/boost.php
  12. 39 42
      system/acp/engine/cashback.php
  13. 23 23
      system/acp/engine/control.php
  14. 5 5
      system/acp/engine/hosting.php
  15. 63 67
      system/acp/engine/index.php
  16. 21 21
      system/acp/engine/jobs.php
  17. 16 16
      system/acp/engine/letter.php
  18. 22 22
      system/acp/engine/logs.php
  19. 19 19
      system/acp/engine/news.php
  20. 20 20
      system/acp/engine/notice.php
  21. 17 17
      system/acp/engine/pages.php
  22. 23 23
      system/acp/engine/promo.php
  23. 47 47
      system/acp/engine/servers.php
  24. 38 40
      system/acp/engine/system.php
  25. 21 21
      system/acp/engine/tarifs.php
  26. 21 21
      system/acp/engine/units.php
  27. 29 29
      system/acp/engine/users.php
  28. 41 41
      system/acp/engine/web.php
  29. 20 20
      system/acp/engine/wiki.php
  30. 31 33
      system/acp/sections/addons/addcat.php
  31. 243 267
      system/acp/sections/addons/addpl.php
  32. 18 19
      system/acp/sections/addons/cats.php
  33. 55 58
      system/acp/sections/addons/delete.php
  34. 45 47
      system/acp/sections/addons/index.php
  35. 252 269
      system/acp/sections/addons/plugin.php
  36. 50 55
      system/acp/sections/addons/search.php
  37. 236 253
      system/acp/sections/addons/update.php
  38. 48 51
      system/acp/sections/addons/updmp.php
  39. 52 54
      system/acp/sections/boost/index.php
  40. 51 57
      system/acp/sections/boost/search.php
  41. 52 54
      system/acp/sections/boost/service.php
  42. 4 4
      system/acp/sections/control/delete.php
  43. 51 52
      system/acp/sections/control/index.php
  44. 28 29
      system/acp/sections/control/overdue.php
  45. 95 101
      system/acp/sections/control/search.php
  46. 102 107
      system/acp/sections/control/server.php
  47. 20 21
      system/acp/sections/jobs/add.php
  48. 36 37
      system/acp/sections/jobs/edit.php
  49. 30 32
      system/acp/sections/jobs/index.php
  50. 58 62
      system/acp/sections/jobs/request.php
  51. 17 18
      system/acp/sections/letter/index.php
  52. 34 35
      system/acp/sections/letter/send.php
  53. 20 21
      system/acp/sections/logs/buy.php
  54. 20 21
      system/acp/sections/logs/cashout.php
  55. 20 21
      system/acp/sections/logs/extend.php
  56. 25 26
      system/acp/sections/logs/index.php
  57. 20 21
      system/acp/sections/logs/part.php
  58. 20 21
      system/acp/sections/logs/replenish.php
  59. 53 59
      system/acp/sections/logs/search.php
  60. 55 61
      system/acp/sections/logs/sysearch.php
  61. 25 26
      system/acp/sections/news/add.php
  62. 4 4
      system/acp/sections/news/delete.php
  63. 27 28
      system/acp/sections/news/index.php
  64. 30 31
      system/acp/sections/news/news.php
  65. 43 47
      system/acp/sections/news/search.php
  66. 51 53
      system/acp/sections/notice/add.php
  67. 4 4
      system/acp/sections/notice/delete.php
  68. 35 37
      system/acp/sections/notice/end.php
  69. 35 37
      system/acp/sections/notice/index.php
  70. 74 77
      system/acp/sections/notice/notice.php
  71. 50 55
      system/acp/sections/notice/search.php
  72. 17 18
      system/acp/sections/pages/add.php
  73. 7 7
      system/acp/sections/pages/delete.php
  74. 24 25
      system/acp/sections/pages/index.php
  75. 22 23
      system/acp/sections/pages/page.php
  76. 81 86
      system/acp/sections/promo/add.php
  77. 5 5
      system/acp/sections/promo/delete.php
  78. 32 33
      system/acp/sections/promo/end.php
  79. 32 33
      system/acp/sections/promo/index.php
  80. 87 90
      system/acp/sections/promo/promo.php
  81. 46 50
      system/acp/sections/promo/search.php
  82. 25 27
      system/acp/sections/promo/stats.php
  83. 73 75
      system/acp/sections/servers/crmp.php
  84. 73 75
      system/acp/sections/servers/cs.php
  85. 73 75
      system/acp/sections/servers/csgo.php
  86. 73 75
      system/acp/sections/servers/css.php
  87. 73 75
      system/acp/sections/servers/cssold.php
  88. 4 4
      system/acp/sections/servers/delete.php
  89. 76 78
      system/acp/sections/servers/index.php
  90. 73 75
      system/acp/sections/servers/mc.php
  91. 73 75
      system/acp/sections/servers/mta.php
  92. 34 35
      system/acp/sections/servers/overdue.php
  93. 73 75
      system/acp/sections/servers/samp.php
  94. 130 136
      system/acp/sections/servers/search.php
  95. 267 279
      system/acp/sections/servers/server.php
  96. 283 299
      system/acp/sections/tarifs/add.php
  97. 54 56
      system/acp/sections/tarifs/copy.php
  98. 7 7
      system/acp/sections/tarifs/delete.php
  99. 46 48
      system/acp/sections/tarifs/index.php
  100. 69 74
      system/acp/sections/tarifs/search.php

+ 150 - 55
403.html

@@ -1,58 +1,153 @@
 <!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>
+<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>

+ 151 - 56
404.html

@@ -1,59 +1,154 @@
 <!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>
+<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>

+ 35 - 35
acp/index.php

@@ -1,51 +1,51 @@
 <?php
-	header('Content-Type: text/html; charset=utf-8');
+header('Content-Type: text/html; charset=utf-8');
 
-	date_default_timezone_set('Europe/Moscow');
+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);
+@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/');
+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'];
+$start_point = $_SERVER['REQUEST_TIME'];
 
-	$mcache = new Memcache;
-	$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
+$mcache = new Memcache;
+$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
 
 // Composer
-if (!file_exists(ROOT.'vendor/autoload.php')) {
+if (!file_exists(ROOT . 'vendor/autoload.php')) {
     die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
 }
-require(ROOT.'vendor/autoload.php');
+require(ROOT . 'vendor/autoload.php');
 
-	// Настройки
-	include(DATA.'config.php');
-	include(DATA.'mysql.php');
-	include(DATA.'params.php');
-	include(DATA.'acpengine.php');
+// Настройки
+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');
+// Библиотеки
+include(LIB . 'sql.php');
+include(LIB . 'html.php');
+include(LIB . 'acpsystem.php');
 
-	$uip = sys::ip();
+$uip = sys::ip();
 
-	// Распределитель
-	include(ACP.'distributor.php');
+// Распределитель
+include(ACP . 'distributor.php');
 
-	// Выхлоп
-	echo $html->arr['all'];
+// Выхлоп
+echo $html->arr['all'];
 ?>

+ 356 - 0
composer.lock

@@ -0,0 +1,356 @@
+{
+    "_readme": [
+        "This file locks the dependencies of your project to a known state",
+        "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+        "This file is @generated automatically"
+    ],
+    "content-hash": "e729e310e2cc298a9957e1ae8869db7f",
+    "packages": [
+        {
+            "name": "filp/whoops",
+            "version": "2.15.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/filp/whoops.git",
+                "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/filp/whoops/zipball/a139776fa3f5985a50b509f2a02ff0f709d2a546",
+                "reference": "a139776fa3f5985a50b509f2a02ff0f709d2a546",
+                "shasum": ""
+            },
+            "require": {
+                "php": "^5.5.9 || ^7.0 || ^8.0",
+                "psr/log": "^1.0.1 || ^2.0 || ^3.0"
+            },
+            "require-dev": {
+                "mockery/mockery": "^0.9 || ^1.0",
+                "phpunit/phpunit": "^4.8.36 || ^5.7.27 || ^6.5.14 || ^7.5.20 || ^8.5.8 || ^9.3.3",
+                "symfony/var-dumper": "^2.6 || ^3.0 || ^4.0 || ^5.0"
+            },
+            "suggest": {
+                "symfony/var-dumper": "Pretty print complex values better with var-dumper available",
+                "whoops/soap": "Formats errors as SOAP responses"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "2.7-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Whoops\\": "src/Whoops/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Filipe Dobreira",
+                    "homepage": "https://github.com/filp",
+                    "role": "Developer"
+                }
+            ],
+            "description": "php error handling for cool kids",
+            "homepage": "https://filp.github.io/whoops/",
+            "keywords": [
+                "error",
+                "exception",
+                "handling",
+                "library",
+                "throwable",
+                "whoops"
+            ],
+            "support": {
+                "issues": "https://github.com/filp/whoops/issues",
+                "source": "https://github.com/filp/whoops/tree/2.15.4"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/denis-sokolov",
+                    "type": "github"
+                }
+            ],
+            "time": "2023-11-03T12:00:00+00:00"
+        },
+        {
+            "name": "monolog/monolog",
+            "version": "2.9.2",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/Seldaek/monolog.git",
+                "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/Seldaek/monolog/zipball/437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
+                "reference": "437cb3628f4cf6042cc10ae97fc2b8472e48ca1f",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.2",
+                "psr/log": "^1.0.1 || ^2.0 || ^3.0"
+            },
+            "provide": {
+                "psr/log-implementation": "1.0.0 || 2.0.0 || 3.0.0"
+            },
+            "require-dev": {
+                "aws/aws-sdk-php": "^2.4.9 || ^3.0",
+                "doctrine/couchdb": "~1.0@dev",
+                "elasticsearch/elasticsearch": "^7 || ^8",
+                "ext-json": "*",
+                "graylog2/gelf-php": "^1.4.2 || ^2@dev",
+                "guzzlehttp/guzzle": "^7.4",
+                "guzzlehttp/psr7": "^2.2",
+                "mongodb/mongodb": "^1.8",
+                "php-amqplib/php-amqplib": "~2.4 || ^3",
+                "phpspec/prophecy": "^1.15",
+                "phpstan/phpstan": "^0.12.91",
+                "phpunit/phpunit": "^8.5.14",
+                "predis/predis": "^1.1 || ^2.0",
+                "rollbar/rollbar": "^1.3 || ^2 || ^3",
+                "ruflin/elastica": "^7",
+                "swiftmailer/swiftmailer": "^5.3|^6.0",
+                "symfony/mailer": "^5.4 || ^6",
+                "symfony/mime": "^5.4 || ^6"
+            },
+            "suggest": {
+                "aws/aws-sdk-php": "Allow sending log messages to AWS services like DynamoDB",
+                "doctrine/couchdb": "Allow sending log messages to a CouchDB server",
+                "elasticsearch/elasticsearch": "Allow sending log messages to an Elasticsearch server via official client",
+                "ext-amqp": "Allow sending log messages to an AMQP server (1.0+ required)",
+                "ext-curl": "Required to send log messages using the IFTTTHandler, the LogglyHandler, the SendGridHandler, the SlackWebhookHandler or the TelegramBotHandler",
+                "ext-mbstring": "Allow to work properly with unicode symbols",
+                "ext-mongodb": "Allow sending log messages to a MongoDB server (via driver)",
+                "ext-openssl": "Required to send log messages using SSL",
+                "ext-sockets": "Allow sending log messages to a Syslog server (via UDP driver)",
+                "graylog2/gelf-php": "Allow sending log messages to a GrayLog2 server",
+                "mongodb/mongodb": "Allow sending log messages to a MongoDB server (via library)",
+                "php-amqplib/php-amqplib": "Allow sending log messages to an AMQP server using php-amqplib",
+                "rollbar/rollbar": "Allow sending log messages to Rollbar",
+                "ruflin/elastica": "Allow sending log messages to an Elastic Search server"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-main": "2.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Monolog\\": "src/Monolog"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Jordi Boggiano",
+                    "email": "j.boggiano@seld.be",
+                    "homepage": "https://seld.be"
+                }
+            ],
+            "description": "Sends your logs to files, sockets, inboxes, databases and various web services",
+            "homepage": "https://github.com/Seldaek/monolog",
+            "keywords": [
+                "log",
+                "logging",
+                "psr-3"
+            ],
+            "support": {
+                "issues": "https://github.com/Seldaek/monolog/issues",
+                "source": "https://github.com/Seldaek/monolog/tree/2.9.2"
+            },
+            "funding": [
+                {
+                    "url": "https://github.com/Seldaek",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/monolog/monolog",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2023-10-27T15:25:26+00:00"
+        },
+        {
+            "name": "psr/log",
+            "version": "1.1.4",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11",
+                "reference": "d49695b909c3b7628b6289db5479a1c204601f11",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.1.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Log\\": "Psr/Log/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "https://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "homepage": "https://github.com/php-fig/log",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "support": {
+                "source": "https://github.com/php-fig/log/tree/1.1.4"
+            },
+            "time": "2021-05-03T11:20:27+00:00"
+        },
+        {
+            "name": "symfony/polyfill",
+            "version": "v1.28.0",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/polyfill.git",
+                "reference": "33def419104fb3cf14be4e8638683eb9845c2522"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/polyfill/zipball/33def419104fb3cf14be4e8638683eb9845c2522",
+                "reference": "33def419104fb3cf14be4e8638683eb9845c2522",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=7.1"
+            },
+            "replace": {
+                "symfony/polyfill-apcu": "self.version",
+                "symfony/polyfill-ctype": "self.version",
+                "symfony/polyfill-iconv": "self.version",
+                "symfony/polyfill-intl-grapheme": "self.version",
+                "symfony/polyfill-intl-icu": "self.version",
+                "symfony/polyfill-intl-idn": "self.version",
+                "symfony/polyfill-intl-messageformatter": "self.version",
+                "symfony/polyfill-intl-normalizer": "self.version",
+                "symfony/polyfill-mbstring": "self.version",
+                "symfony/polyfill-php72": "self.version",
+                "symfony/polyfill-php73": "self.version",
+                "symfony/polyfill-php74": "self.version",
+                "symfony/polyfill-php80": "self.version",
+                "symfony/polyfill-php81": "self.version",
+                "symfony/polyfill-php82": "self.version",
+                "symfony/polyfill-php83": "self.version",
+                "symfony/polyfill-util": "self.version",
+                "symfony/polyfill-uuid": "self.version",
+                "symfony/polyfill-xml": "self.version"
+            },
+            "require-dev": {
+                "symfony/intl": "^4.4|^5.0|^6.0",
+                "symfony/phpunit-bridge": "^5.3|^6.0",
+                "symfony/var-dumper": "^4.4|^5.1|^6.0"
+            },
+            "type": "library",
+            "autoload": {
+                "files": [
+                    "src/bootstrap.php",
+                    "src/Apcu/bootstrap.php",
+                    "src/Ctype/bootstrap.php",
+                    "src/Uuid/bootstrap.php",
+                    "src/Iconv/bootstrap.php",
+                    "src/Intl/Grapheme/bootstrap.php",
+                    "src/Intl/Idn/bootstrap.php",
+                    "src/Intl/Icu/bootstrap.php",
+                    "src/Intl/MessageFormatter/bootstrap.php",
+                    "src/Intl/Normalizer/bootstrap.php",
+                    "src/Mbstring/bootstrap.php"
+                ],
+                "psr-4": {
+                    "Symfony\\Polyfill\\": "src/"
+                },
+                "classmap": [
+                    "src/Intl/Icu/Resources/stubs",
+                    "src/Intl/MessageFormatter/Resources/stubs",
+                    "src/Intl/Normalizer/Resources/stubs",
+                    "src/Php83/Resources/stubs",
+                    "src/Php82/Resources/stubs",
+                    "src/Php81/Resources/stubs",
+                    "src/Php80/Resources/stubs",
+                    "src/Php73/Resources/stubs"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Nicolas Grekas",
+                    "email": "p@tchwork.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony polyfills backporting features to lower PHP versions",
+            "homepage": "https://symfony.com",
+            "keywords": [
+                "compat",
+                "compatibility",
+                "polyfill",
+                "shim"
+            ],
+            "support": {
+                "issues": "https://github.com/symfony/polyfill/issues",
+                "source": "https://github.com/symfony/polyfill/tree/v1.28.0"
+            },
+            "funding": [
+                {
+                    "url": "https://symfony.com/sponsor",
+                    "type": "custom"
+                },
+                {
+                    "url": "https://github.com/fabpot",
+                    "type": "github"
+                },
+                {
+                    "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+                    "type": "tidelift"
+                }
+            ],
+            "time": "2023-08-25T17:27:34+00:00"
+        }
+    ],
+    "packages-dev": [],
+    "aliases": [],
+    "minimum-stability": "stable",
+    "stability-flags": [],
+    "prefer-stable": false,
+    "prefer-lowest": false,
+    "platform": [],
+    "platform-dev": [],
+    "plugin-api-version": "2.3.0"
+}

+ 38 - 38
cron.php

@@ -1,43 +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);
+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];
+$task = $argv[2];
 
-	include(DATA.'engine.php');
-	include(DATA.'mysql.php');
-	include(DATA.'params.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');
-	include(LIB.'cron.php');
+// Библиотеки
+include(LIB . 'sql.php');
+include(LIB . 'html.php');
+include(LIB . 'system.php');
+include(LIB . 'cron.php');
 ?>

+ 22 - 22
fail.html

@@ -1,27 +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="Панель управления, хостинг игровых севреров, аренда сервера" />
+<head>
+    <title>EGPv3 - Ошибка при пополнении баланса</title>
+    <link rel="icon" href="/favicon.ico">
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
-		<!-- 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>
+    <meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов."/>
+    <meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера"/>
 
-			<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>
+    <!-- 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>

+ 48 - 48
index.php

@@ -1,68 +1,68 @@
 <?php
-	header('Content-Type: text/html; charset=utf-8');
-	header('X-Powered-By: EGP');
+header('Content-Type: text/html; charset=utf-8');
+header('X-Powered-By: EGP');
 
-	date_default_timezone_set('Europe/Moscow');
+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);
+@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('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'];
+$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('Ошибка подключения Memcache');
+$mcache = new Memcache;
+$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
 
 // Composer
-if (!file_exists(ROOT.'vendor/autoload.php')) {
+if (!file_exists(ROOT . 'vendor/autoload.php')) {
     die('Please <a href="https://getcomposer.org/download/" target="_blank" rel="noreferrer" style="color:#0a25bb;">install composer</a> and run <code style="background:#222;color:#00e01f;padding:2px 6px;border-radius:3px;">composer install</code>');
 }
-require(ROOT.'vendor/autoload.php');
+require(ROOT . 'vendor/autoload.php');
 
-	// Настройки
-	include(DATA.'config.php');
-	include(DATA.'engine.php');
-	include(DATA.'mysql.php');
-	include(DATA.'params.php');
+// Настройки
+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');
+// Библиотеки
+include(LIB . 'sql.php');
+include(LIB . 'html.php');
+include(LIB . 'system.php');
 
-	$uip = sys::ip();
+$uip = sys::ip();
 
-	/* if(!isset($_COOKIE['egp_device']))
-	{
-		include(LIB.'megp.php');
+/* if(!isset($_COOKIE['egp_device']))
+{
+    include(LIB.'megp.php');
 
-		$device = $megp->isMobile() ? 'mobile' : '!mobile';
+    $device = $megp->isMobile() ? 'mobile' : '!mobile';
 
-		sys::cookie('egp_device', $device, 14);
+    sys::cookie('egp_device', $device, 14);
 
-		if($device == 'mobile')
-			sys::back();
-	} */
+    if($device == 'mobile')
+        sys::back();
+} */
 
-	// Распределитель
-	if($device == '!mobile')
-		include(SYS.'distributor.php');
-	/* else
-		include(SYS.'mdistributor.php'); */
+// Распределитель
+if ($device == '!mobile')
+    include(SYS . 'distributor.php');
+/* else
+    include(SYS.'mdistributor.php'); */
 
-	// Выхлоп
-	echo $html->arr['all'];
+// Выхлоп
+echo $html->arr['all'];
 ?>

+ 22 - 22
success.html

@@ -1,27 +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="Панель управления, хостинг игровых севреров, аренда сервера" />
+<head>
+    <title>EGPv3 - Успешное пополение баланса</title>
+    <link rel="icon" href="/favicon.ico">
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
 
-		<!-- 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>
+    <meta name="description" content="EGPv3 - Панель управления для хостинга игровых серверов."/>
+    <meta name="keywords" content="Панель управления, хостинг игровых севреров, аренда сервера"/>
 
-			<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>
+    <!-- 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>

+ 113 - 119
system/acp/distributor.php

@@ -1,6 +1,6 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
 // Подключение filp/whoops
 $whoops = new \Whoops\Run;
@@ -17,132 +17,126 @@ $loggingInFile->loggerOnly(true);
 $loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
 $whoops->pushHandler($loggingInFile);
 
-	$device = '!mobile';
+$device = '!mobile';
 
-    // Парсинг адреса
-    $url = is_array(sys::url()) ? sys::url() : array();
-    $route = sys::url(false);
-    $section = isset($url['section']) ? $url['section'] : false;
+// Парсинг адреса
+$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;
+$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;
+$auth = false;
 
-    // Проверка cookie на авторизацию
-    $aAuth = array();
+// Проверка 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'] : '';
+$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']);
+$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 (!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');
+            // Обновление активности
+            if ($user['time'] + 10 < $start_point)
+                $sql->query('UPDATE `users` set `time`="' . $start_point . '" WHERE `id`="' . $user['id'] . '" LIMIT 1');
 
-                $auth = true;
-            }
+            $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');
+}
+
+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');
 ?>

+ 25 - 25
system/acp/engine/addons.php

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

+ 25 - 26
system/acp/engine/boost.php

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

+ 39 - 42
system/acp/engine/cashback.php

@@ -1,61 +1,58 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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);
+@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;
+$nmc = 'cashback_' . $id;
 
-	// Проверка сессии
-	if($mcache->get($nmc))
-		sys::outjs(array('e' => $text['mcache']), $nmc);
+// Проверка сессии
+if ($mcache->get($nmc))
+    sys::outjs(array('e' => $text['mcache']), $nmc);
 
-	// Создание сессии
-	$mcache->set($nmc, 1, false, 10);
+// Создание сессии
+$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 ($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);
+    if (!$cb['status'])
+        sys::outjs(array('e' => 'Данная заявка уже была обработана'), $nmc);
 
-		$purse = $cb['purse']{0} == 'R' ?  'webmoney' : 'qiwi';
+    $purse = $cb['purse']{0} == 'R' ? 'webmoney' : 'qiwi';
 
-		// Запрос на шлюз
-		if($cfg['part_gateway'] == 'unitpay')
-		{
-			$sum = $cb['money']-($cb['money']/100*$cfg['part_output_proc']);
+    // Запрос на шлюз
+    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);
+        $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);
+        $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'].'"');
+        // Упешный вывод средств
+        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);
-			}
+            sys::outjs(array('s' => 'Запрос на вывод средств был успешно выполнен'), $nmc);
+        }
 
-			if(!is_array($array))
-				sys::outjs(array('e' => 'Неудалось выполнить запрос'), $nmc);
+        if (!is_array($array))
+            sys::outjs(array('e' => 'Неудалось выполнить запрос'), $nmc);
 
-			sys::outjs(array('e' => $array['error']['message']), $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'].'"');
+    $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('s' => 'Запрос на вывод средств был успешно выполнен в ручном режиме'), $nmc);
+}
 
-	sys::outjs(array('e' => 'Не передан идентификатор заявки'), $nmc);
+sys::outjs(array('e' => 'Не передан идентификатор заявки'), $nmc);
 ?>

+ 23 - 23
system/acp/engine/control.php

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

+ 5 - 5
system/acp/engine/hosting.php

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

+ 63 - 67
system/acp/engine/index.php

@@ -1,91 +1,87 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$mcache_name = 'acp_main';
+$mcache_name = 'acp_main';
 
-	$html->arr['main'] = $mcache->get($mcache_name);
+$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();
+$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->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->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->pack('cashback');
+}
 
-	$html->arr['cashback'] = isset($html->arr['cashback']) ? $html->arr['cashback'] : '';
+$html->arr['cashback'] = isset($html->arr['cashback']) ? $html->arr['cashback'] : '';
 
-	if($html->arr['main'] == '')
-	{
-		$sql->query('SELECT `id` FROM `users`');
-		$users = $sql->num();
+if ($html->arr['main'] == '') {
+    $sql->query('SELECT `id` FROM `users`');
+    $users = $sql->num();
 
-		$sql->query('SELECT `id`, `game`, `slots` FROM `servers`');
-		$servers = $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);
+    $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;
-		}
+    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();
+    $sql->query('SELECT SUM(`money`) FROM `logs` WHERE `type`="replenish"');
+    $replenish = $sql->get();
 
-		$sf_list = '';
+    $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">Офлайн';
+    $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">Администратор' : '">Тех. Поддержка';
+        $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>';
-		}
+        $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->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);
+    $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 ($aSlots as $game => $slots)
+        $html->set('slots_' . $game, $slots);
 
-			foreach($aServers as $game => $num)
-				$html->set($game, $num);
+    foreach ($aServers as $game => $num)
+        $html->set($game, $num);
 
-		$html->pack('main');
+    $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']);
+    $mcache->set($mcache_name, $html->arr['main'], false, 10);
+} else
+    $html->arr['main'] = str_replace('[cashback]', $html->arr['cashback'], $html->arr['main']);
 ?>

+ 21 - 21
system/acp/engine/jobs.php

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

+ 16 - 16
system/acp/engine/letter.php

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

+ 22 - 22
system/acp/engine/logs.php

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

+ 19 - 19
system/acp/engine/news.php

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

+ 20 - 20
system/acp/engine/notice.php

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

+ 17 - 17
system/acp/engine/pages.php

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

+ 23 - 23
system/acp/engine/promo.php

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

+ 47 - 47
system/acp/engine/servers.php

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

+ 38 - 40
system/acp/engine/system.php

@@ -1,57 +1,55 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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();
+if ($go) {
+    $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1');
+    $unit = $sql->get();
 
-		include(LIB.'ssh.php');
+    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 (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');
+        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'));
-		}
+        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'
-		);
+    $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);
+    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>';
+    $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)).'%';
+    $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');
+    $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);
+    $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}\'`"')).'%';
+    $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);
-	}
+    sys::outjs($aData);
+}
 
-	$html->get('index', 'sections/system');
+$html->get('index', 'sections/system');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 21 - 21
system/acp/engine/tarifs.php

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

+ 21 - 21
system/acp/engine/units.php

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

+ 29 - 29
system/acp/engine/users.php

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

+ 41 - 41
system/acp/engine/web.php

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

+ 20 - 20
system/acp/engine/wiki.php

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

+ 31 - 33
system/acp/sections/addons/addcat.php

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

+ 243 - 267
system/acp/sections/addons/addpl.php

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

+ 18 - 19
system/acp/sections/addons/cats.php

@@ -1,26 +1,25 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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();
+$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>';
-	}
+    $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->get('cats', 'sections/addons');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 55 - 58
system/acp/sections/addons/delete.php

@@ -1,60 +1,57 @@
 <?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'));
+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'));
 ?>

+ 45 - 47
system/acp/sections/addons/index.php

@@ -1,68 +1,66 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (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 ($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['sort']) and in_array($url['sort'], array('id', 'cat', 'game'))) {
+        $sort = 'asc';
 
-			if(isset($url['sorting']))
-				$sort = $url['sorting'] == 'asc' ? 'asc' : 'desc';
+        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_page = '/sort/' . $url['sort'] . '/sorting/' . $sort;
+        $sort_sql = 'ORDER BY `' . $url['sort'] . '` ' . $sort;
 
-			$sort_icon = array($url['sort'] => $sort);
-		}
+        $sort_icon = array($url['sort'] => $sort);
+    }
 
-		$list = '';
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `plugins`');
+    $sql->query('SELECT `id` FROM `plugins`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/addons'.$sort_page);
+    sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/addons' . $sort_page);
 
-		$status = array(0 => 'Стабильный', 1 => 'Нестабильный', 2 => 'Тестируемый');
+    $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();
+    $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>';
-		}
+        $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->get('index', 'sections/addons');
 
-			$html->set('sort_id', 'asc');
-			$html->set('sort_cat', 'asc');
-			$html->set('sort_game', 'asc');
+    $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));
+    if (isset($sort_icon))
+        $html->set('sort_' . key($sort_icon), array_shift($sort_icon));
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 252 - 269
system/acp/sections/addons/plugin.php

@@ -1,337 +1,320 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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();
+$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'
-	);
+$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();
+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['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['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;
+    $aData['cfg'] = 0;
 
-		if($aData['name'] == '')
-			sys::outjs(array('e' => 'Необходимо указать название'));
+    if ($aData['name'] == '')
+        sys::outjs(array('e' => 'Необходимо указать название'));
 
-		$aPacks = explode(':', $aData['packs']);
+    $aPacks = explode(':', $aData['packs']);
 
-		$spacks = '';
+    $spacks = '';
 
-		foreach($aPacks as $packs)
-			$spacks .= trim($packs).':';
+    foreach ($aPacks as $packs)
+        $spacks .= trim($packs) . ':';
 
-		$spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
+    $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
 
-		$aData['packs'] = $spacks == '' ? 'all' : $spacks;
+    $aData['packs'] = $spacks == '' ? 'all' : $spacks;
 
-		$aIncom = explode(':', $aData['incompatible']);
+    $aIncom = explode(':', $aData['incompatible']);
 
-		$incoms = '';
+    $incoms = '';
 
-		foreach($aIncom as $incom)
-		{
-			$incom = trim($incom);
+    foreach ($aIncom as $incom) {
+        $incom = trim($incom);
 
-			if(!is_numeric($incom))
-				continue;
+        if (!is_numeric($incom))
+            continue;
 
-			$incoms .= intval($incom).':';
-		}
+        $incoms .= intval($incom) . ':';
+    }
 
-		$incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
+    $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
 
-		$aData['incompatible'] = $incoms;
+    $aData['incompatible'] = $incoms;
 
-				$aChoice = explode(' ', $aData['choice']);
+    $aChoice = explode(' ', $aData['choice']);
 
-		$choice = '';
+    $choice = '';
 
-		foreach($aChoice as $chpl)
-		{
-			$aChpl = explode(':', $chpl);
+    foreach ($aChoice as $chpl) {
+        $aChpl = explode(':', $chpl);
 
-			foreach($aChpl as $idchpl)
-			{
-				$idchpl = trim($idchpl);
+        foreach ($aChpl as $idchpl) {
+            $idchpl = trim($idchpl);
 
-				if(!is_numeric($idchpl))
-					continue;
+            if (!is_numeric($idchpl))
+                continue;
 
-				$choice .= intval($idchpl).':';
-			}
+            $choice .= intval($idchpl) . ':';
+        }
 
-			$choice .= ' ';
-		}
+        $choice .= ' ';
+    }
 
-		$choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
+    $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
 
-		$aData['choice'] = $choice;
+    $aData['choice'] = $choice;
 
-		$aRequi = explode(':', $aData['required']);
+    $aRequi = explode(':', $aData['required']);
 
-		$requis = '';
+    $requis = '';
 
-		foreach($aRequi as $requi)
-		{
-			$requi = trim($requi);
+    foreach ($aRequi as $requi) {
+        $requi = trim($requi);
 
-			if(!is_numeric($requi))
-				continue;
+        if (!is_numeric($requi))
+            continue;
 
-			$requis .= intval($requi).':';
-		}
+        $requis .= intval($requi) . ':';
+    }
 
-		$requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
+    $requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
 
-		$aData['required'] = $requis;
+    $aData['required'] = $requis;
 
-		$n = 0;
+    $n = 0;
 
-		$sql->query('DELETE FROM `plugins_config` WHERE `plugin`="'.$id.'" AND `update`="0"');
+    $sql->query('DELETE FROM `plugins_config` WHERE `plugin`="' . $id . '" AND `update`="0"');
 
-		foreach($aData['config_files_file'] as $i => $file)
-		{
-			if($file == '')
-				continue;
+    foreach ($aData['config_files_file'] as $i => $file) {
+        if ($file == '')
+            continue;
 
-			$n+=1;
+        $n += 1;
 
-			$aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n;
+        $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.'"');
-		}
+        $sql->query('INSERT INTO `plugins_config` set `plugin`="' . $id . '", `update`="0", `file`="' . $file . '", `sort`="' . $n . '"');
+    }
 
-		if($n)
-			$aData['cfg'] = 1;
+    if ($n)
+        $aData['cfg'] = 1;
 
-		$sql->query('DELETE FROM `plugins_clear` WHERE `plugin`="'.$id.'" AND `update`="0"');
+    $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;
+    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;
+        $regex = (string)$aData['config_clear_regex'] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_clear_text'][$i]));
+        $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('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"');
+    $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;
+    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;
+        $top = (string)$aData['config_write_top'][$i] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_write_text'][$i]));
+        $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('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"');
+    $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;
+    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;
+        $top = (string)$aData['config_write_del_top'][$i] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_write_del_text'][$i]));
+        $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('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"');
+    $sql->query('DELETE FROM `plugins_delete` WHERE `plugin`="' . $id . '" AND `update`="0"');
 
-		foreach($aData['files_delete_file'] as $file)
-		{
-			if($file == '')
-				continue;
+    foreach ($aData['files_delete_file'] as $file) {
+        if ($file == '')
+            continue;
 
-			$sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$id.'", `update`="0", `file`="'.$file.'"');
-		}
+        $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');
+    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('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.'"');
+    $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'));
-	}
+    sys::outjs(array('s' => 'ok'));
+}
 
-	$html->get('plugin', 'sections/addons');
+$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');
+$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');
 ?>

+ 50 - 55
system/acp/sections/addons/search.php

@@ -1,75 +1,70 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    sys::outjs(array('e' => ''));
+}
 
-	if(substr($text, 0, 5) == 'game=')
-	{
-		$game = trim(substr($text, 5));
+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).'%').'\')';
+    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');
-	}
+    $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);
+if (!$sql->num($plugins)) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$list = '';
 
-	$status = array(0 => 'Стабильный', 2 => 'Нестабильный', 1 => 'Тестируемый');
+$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();
+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>';
-	}
+    $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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 236 - 253
system/acp/sections/addons/update.php

@@ -1,322 +1,305 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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();
+$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'
-	);
+$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();
+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['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['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;
+    $aData['cfg'] = 0;
 
-		if($aData['name'] == '')
-			sys::outjs(array('e' => 'Необходимо указать название'));
+    if ($aData['name'] == '')
+        sys::outjs(array('e' => 'Необходимо указать название'));
 
-		$aPacks = explode(':', $aData['packs']);
+    $aPacks = explode(':', $aData['packs']);
 
-		$spacks = '';
+    $spacks = '';
 
-		foreach($aPacks as $packs)
-		{
-			$packs = trim($packs);
+    foreach ($aPacks as $packs) {
+        $packs = trim($packs);
 
-			$spacks .= intval($packs).':';
-		}
+        $spacks .= intval($packs) . ':';
+    }
 
-		$spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
+    $spacks = isset($spacks{0}) ? substr($spacks, 0, -1) : '';
 
-		$aData['packs'] = $spacks == '' ? $spacks : 'all';
+    $aData['packs'] = $spacks == '' ? $spacks : 'all';
 
-		$aIncom = explode(':', $aData['incompatible']);
+    $aIncom = explode(':', $aData['incompatible']);
 
-		$incoms = '';
+    $incoms = '';
 
-		foreach($aIncom as $incom)
-		{
-			$incom = trim($incom);
+    foreach ($aIncom as $incom) {
+        $incom = trim($incom);
 
-			if(!is_numeric($incom))
-				continue;
+        if (!is_numeric($incom))
+            continue;
 
-			$incoms .= intval($incom).':';
-		}
+        $incoms .= intval($incom) . ':';
+    }
 
-		$incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
+    $incoms = isset($incoms{0}) ? substr($incoms, 0, -1) : '';
 
-		$aData['incompatible'] = $incoms;
+    $aData['incompatible'] = $incoms;
 
-				$aChoice = explode(' ', $aData['choice']);
+    $aChoice = explode(' ', $aData['choice']);
 
-		$choice = '';
+    $choice = '';
 
-		foreach($aChoice as $chpl)
-		{
-			$aChpl = explode(':', $chpl);
+    foreach ($aChoice as $chpl) {
+        $aChpl = explode(':', $chpl);
 
-			foreach($aChpl as $idchpl)
-			{
-				$idchpl = trim($idchpl);
+        foreach ($aChpl as $idchpl) {
+            $idchpl = trim($idchpl);
 
-				if(!is_numeric($idchpl))
-					continue;
+            if (!is_numeric($idchpl))
+                continue;
 
-				$choice .= intval($idchpl).':';
-			}
+            $choice .= intval($idchpl) . ':';
+        }
 
-			$choice .= ' ';
-		}
+        $choice .= ' ';
+    }
 
-		$choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
+    $choice = isset($choice{0}) ? substr(trim($choice), 0, -1) : '';
 
-		$aData['choice'] = $choice;
+    $aData['choice'] = $choice;
 
-		$aRequi = explode(':', $aData['required']);
+    $aRequi = explode(':', $aData['required']);
 
-		$requis = '';
+    $requis = '';
 
-		foreach($aRequi as $requi)
-		{
-			$requi = trim($requi);
+    foreach ($aRequi as $requi) {
+        $requi = trim($requi);
 
-			if(!is_numeric($requi))
-				continue;
+        if (!is_numeric($requi))
+            continue;
 
-			$requis .= intval($requi).':';
-		}
+        $requis .= intval($requi) . ':';
+    }
 
-		$requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
+    $requis = isset($requis{0}) ? substr($requis, 0, -1) : '';
 
-		$aData['required'] = $requis;
+    $aData['required'] = $requis;
 
-		$n = 0;
+    $n = 0;
 
-		$sql->query('DELETE FROM `plugins_config` WHERE `update`="'.$id.'"');
+    $sql->query('DELETE FROM `plugins_config` WHERE `update`="' . $id . '"');
 
-		foreach($aData['config_files_file'] as $i => $file)
-		{
-			if($file == '')
-				continue;
+    foreach ($aData['config_files_file'] as $i => $file) {
+        if ($file == '')
+            continue;
 
-			$n+=1;
+        $n += 1;
 
-			$aData['config_files_sort'][$i] = $aData['config_files_sort'][$i] ? intval($aData['config_files_sort'][$i]) : $n;
+        $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.'"');
-		}
+        $sql->query('INSERT INTO `plugins_config` set `plugin`="' . $plugin['plugin'] . '", `update`="' . $id . '", `file`="' . $file . '", `sort`="' . $n . '"');
+    }
 
-		if($n)
-			$aData['cfg'] = 1;
+    if ($n)
+        $aData['cfg'] = 1;
 
-		$sql->query('DELETE FROM `plugins_clear` WHERE `update`="'.$id.'"');
+    $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;
+    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;
+        $regex = (string)$aData['config_clear_regex'] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_clear_text'][$i]));
+        $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('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.'"');
+    $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;
+    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;
+        $top = (string)$aData['config_write_top'][$i] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_write_text'][$i]));
+        $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('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.'"');
+    $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;
+    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;
+        $top = (string)$aData['config_write_del_top'][$i] == 'on' ? 1 : 0;
 
-			$text = htmlspecialchars(trim($aData['config_write_del_text'][$i]));
+        $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('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.'"');
+    $sql->query('DELETE FROM `plugins_delete` WHERE `update`="' . $id . '"');
 
-		foreach($aData['files_delete_file'] as $file)
-		{
-			if($file == '')
-				continue;
+    foreach ($aData['files_delete_file'] as $file) {
+        if ($file == '')
+            continue;
 
-			$sql->query('INSERT INTO `plugins_delete` set `plugin`="'.$plugin['plugin'].'", `update`="'.$id.'", `file`="'.$file.'"');
-		}
+        $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');
+    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('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.'"');
+    $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'));
-	}
+    sys::outjs(array('s' => 'ok'));
+}
 
-	$html->get('update', 'sections/addons');
+$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');
+$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');
 ?>

+ 48 - 51
system/acp/sections/addons/updmp.php

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

+ 52 - 54
system/acp/sections/boost/index.php

@@ -1,81 +1,79 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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');
+if (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'boost/sysearch.php');
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `boost`');
+$sql->query('SELECT `id` FROM `boost`');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost');
+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>';
-	}
+$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;
+$month = date('n', $start_point) - 1;
 
-	if(!$month)
-		$month = 12;
+if (!$month)
+    $month = 12;
 
-	$aData = $mcache->get('data_boost_all');
+$aData = $mcache->get('data_boost_all');
 
-	if(!is_array($aData))
-	{
-		$sql->query('SELECT SUM(`circles`), SUM(`money`) FROM `boost`');
-		$data = $sql->get();
+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`)'];
+    $aData['all_num'] = (int)$data['SUM(`circles`)'];
+    $aData['all_sum'] = (int)$data['SUM(`money`)'];
 
-		$now = $start_point-(date('d', $start_point)*86400);
+    $now = $start_point - (date('d', $start_point) * 86400);
 
-		$old = $start_point-(params::$aDayMonth[$month]*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();
+    $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`)'];
+    $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();
+    $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`)'];
+    $aData['now_num'] = (int)$data['SUM(`circles`)'];
+    $aData['now_sum'] = (int)$data['SUM(`money`)'];
 
-		$mcache->set('data_boost_all', $aData, false, 60);
-	}
+    $mcache->set('data_boost_all', $aData, false, 60);
+}
 
-	$html->get('index', 'sections/boost');
+$html->get('index', 'sections/boost');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('month_old', params::$aNameMonth[$month]);
-		$html->set('month_now', params::$aNameMonth[date('n', $start_point)]);
+$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('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('cur', $cfg['currency']);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 51 - 57
system/acp/sections/boost/search.php

@@ -1,77 +1,71 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    sys::outjs(array('e' => ''));
+}
 
-	$check = explode('=', $text);
+$check = explode('=', $text);
 
-	if(in_array($check[0], array('server', 'user')))
-	{
-		$val = trim($check[1]);
+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;
+    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).'%').'\')';
+        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');
-	}
+    $sql->query('SELECT * FROM `boost` WHERE ' . $like . ' ORDER BY `id` DESC LIMIT 40');
+}
 
-	if(!$sql->num())
-	{
-		if($go)
-			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+if (!$sql->num()) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$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>';
-	}
+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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 52 - 54
system/acp/sections/boost/service.php

@@ -1,81 +1,79 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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');
+if (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'boost/sysearch.php');
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `boost` WHERE `site`="'.$section.'"');
+$sql->query('SELECT `id` FROM `boost` WHERE `site`="' . $section . '"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/boost/section/'.$section);
+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>';
-	}
+$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;
+$month = date('n', $start_point) - 1;
 
-	if(!$month)
-		$month = 12;
+if (!$month)
+    $month = 12;
 
-	$aData = $mcache->get('data_boost_'.$section);
+$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();
+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`)'];
+    $aData['all_num'] = (int)$data['SUM(`circles`)'];
+    $aData['all_sum'] = (int)$data['SUM(`money`)'];
 
-		$now = $start_point-(date('d', $start_point)*86400);
+    $now = $start_point - (date('d', $start_point) * 86400);
 
-		$old = $start_point-(params::$aDayMonth[$month]*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();
+    $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`)'];
+    $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();
+    $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`)'];
+    $aData['now_num'] = (int)$data['SUM(`circles`)'];
+    $aData['now_sum'] = (int)$data['SUM(`money`)'];
 
-		$mcache->set('data_boost_'.$section, $aData, false, 60);
-	}
+    $mcache->set('data_boost_' . $section, $aData, false, 60);
+}
 
-	$html->get('index', 'sections/boost');
+$html->get('index', 'sections/boost');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('month_old', params::$aNameMonth[$month]);
-		$html->set('month_now', params::$aNameMonth[date('n', $start_point)]);
+$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('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('cur', $cfg['currency']);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 4 - 4
system/acp/sections/control/delete.php

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

+ 51 - 52
system/acp/sections/control/index.php

@@ -1,54 +1,53 @@
 <?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');
-	}
+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');
+}
 ?>

+ 28 - 29
system/acp/sections/control/overdue.php

@@ -1,35 +1,34 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	if($id)
-		include(SEC.'control/server.php');
-	else{
-		$list = '';
+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>';
+    $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>';
-		}
+        $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');
-	}
+    $html->get('index', 'sections/control');
+    $html->set('list', $list);
+    $html->set('pages', '');
+    $html->pack('main');
+}
 ?>

+ 95 - 101
system/acp/sections/control/search.php

@@ -1,103 +1,97 @@
 <?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));
+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));
 ?>

+ 102 - 107
system/acp/sections/control/server.php

@@ -1,109 +1,104 @@
 <?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');
+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');
 ?>

+ 20 - 21
system/acp/sections/jobs/add.php

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

+ 36 - 37
system/acp/sections/jobs/edit.php

@@ -1,39 +1,38 @@
 <?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');
+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');
 ?>

+ 30 - 32
system/acp/sections/jobs/index.php

@@ -1,38 +1,36 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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' => 'Недоступна'
-			];
+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>';
-		}
+        $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'));
-		}
+    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');
-	}
+    $html->get('index', 'sections/jobs');
+    $html->set('list', $list);
+    $html->pack('main');
+}
 ?>

+ 58 - 62
system/acp/sections/jobs/request.php

@@ -1,64 +1,60 @@
 <?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');
-	}
+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');
+}
 ?>

+ 17 - 18
system/acp/sections/letter/index.php

@@ -1,25 +1,24 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$group = array('user' => 'Пользователь', 'support' => 'Тех.поддержка', 'admin' => 'Администратор');
-	$list = '';
+$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>';
-	}
+$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->get('index', 'sections/letter');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 34 - 35
system/acp/sections/letter/send.php

@@ -1,54 +1,53 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	set_time_limit(1200);
+set_time_limit(1200);
 
-	$aData = array();
+$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['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' => 'Необходимо указать получателей'));
+$aData['users'] = isset($_POST['users']) ? $_POST['users'] : sys::outjs(array('e' => 'Необходимо указать получателей'));
 
-	if($aData['title'] == '' || $aData['text'] == '')
-		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' => 'Необходимо указать минимум одного получателя'));
+if (!is_array($aData['users']) || !count($aData['users']))
+    sys::outjs(array('e' => 'Необходимо указать минимум одного получателя'));
 
-	$noletter = '';
+$noletter = '';
 
-	include(LIB.'smtp.php');
+include(LIB . 'smtp.php');
 
-	foreach($aData['users'] as $id => $cheked)
-	{
-		if($cheked != 'on')
-			continue;
+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();
+    $sql->query('SELECT `mail` FROM `users` WHERE `id`="' . sys::int($id) . '" LIMIT 1');
+    $us = $sql->get();
 
-		$tpl = file_get_contents(DATA.'mail.ini', "r");
+    $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
-		);
+    $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);
+    $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";
+    $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 (!$smtp->send($us['mail'], strip_tags($aData['title']), $text, $headers))
+        $noletter .= '<p>' . $us['mail'] . '</p>';
+}
 
-	if($noletter == '')
-		$noletter = 'отправлено всем.';
+if ($noletter == '')
+    $noletter = 'отправлено всем.';
 
-	sys::outjs(array('s' => $noletter));
+sys::outjs(array('s' => $noletter));
 ?>

+ 20 - 21
system/acp/sections/logs/buy.php

@@ -1,32 +1,31 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs` WHERE `type`="buy"');
+$sql->query('SELECT `id` FROM `logs` WHERE `type`="buy"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs');
+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>';
-	}
+$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->get('logs', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 20 - 21
system/acp/sections/logs/cashout.php

@@ -1,32 +1,31 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs` WHERE `type`="cashout"');
+$sql->query('SELECT `id` FROM `logs` WHERE `type`="cashout"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/cashout');
+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>';
-	}
+$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->get('logs', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 20 - 21
system/acp/sections/logs/extend.php

@@ -1,32 +1,31 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs` WHERE `type`="extend"');
+$sql->query('SELECT `id` FROM `logs` WHERE `type`="extend"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/extend');
+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>';
-	}
+$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->get('logs', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 25 - 26
system/acp/sections/logs/index.php

@@ -1,40 +1,39 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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');
+if (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'logs/sysearch.php');
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs_sys`');
+$sql->query('SELECT `id` FROM `logs_sys`');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs');
+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>';
+$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>';
+    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>';
-	}
+    $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->get('index', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 20 - 21
system/acp/sections/logs/part.php

@@ -1,32 +1,31 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs` WHERE `type`="part"');
+$sql->query('SELECT `id` FROM `logs` WHERE `type`="part"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/part');
+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>';
-	}
+$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->get('logs', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 20 - 21
system/acp/sections/logs/replenish.php

@@ -1,32 +1,31 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$list = '';
+$list = '';
 
-	$sql->query('SELECT `id` FROM `logs` WHERE `type`="replenish"');
+$sql->query('SELECT `id` FROM `logs` WHERE `type`="replenish"');
 
-	$aPage = sys::page($page, $sql->num(), 40);
+$aPage = sys::page($page, $sql->num(), 40);
 
-	sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/logs/section/replenish');
+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>';
-	}
+$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->get('logs', 'sections/logs');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-		$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 53 - 59
system/acp/sections/logs/search.php

@@ -1,80 +1,74 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    sys::outjs(array('e' => ''));
+}
 
-	$select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`';
+$select = '`id`, `user`, `text`, `date`, `type`, `money` FROM `logs`';
 
-	$check = explode('=', $text);
+$check = explode('=', $text);
 
-	if(in_array($check[0], array('server', 'user')))
-	{
-		$val = trim($check[1]);
+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;
+    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).'%').'\')';
+        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');
-	}
+    $sql->query('SELECT ' . $select . ' WHERE ' . $like . ' ORDER BY `id` DESC LIMIT 40');
+}
 
-	if(!$sql->num())
-	{
-		if($go)
-			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+if (!$sql->num()) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$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>';
-	}
+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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 55 - 61
system/acp/sections/logs/sysearch.php

@@ -1,84 +1,78 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    sys::outjs(array('e' => ''));
+}
 
-	$select = '`id`, `user`, `server`, `text`, `time` FROM `logs_sys`';
+$select = '`id`, `user`, `server`, `text`, `time` FROM `logs_sys`';
 
-	$check = explode('=', $text);
+$check = explode('=', $text);
 
-	if(in_array($check[0], array('server', 'user')))
-	{
-		$val = trim($check[1]);
+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;
+    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).'%').'\')';
+        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');
-	}
+    $sql->query('SELECT ' . $select . ' WHERE ' . $like . ' ORDER BY `id` DESC LIMIT 40');
+}
 
-	if(!$sql->num())
-	{
-		if($go)
-			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+if (!$sql->num()) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$list = '';
 
-	while($log = $sql->get())
-	{
-		$list .= '<tr>';
-			$list .= '<td>'.$log['id'].'</td>';
-			$list .= '<td>'.$log['text'].'</td>';
+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>';
+    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>';
-	}
+    $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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 25 - 26
system/acp/sections/news/add.php

@@ -1,37 +1,36 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	if($go)
-	{
-		$aData = array();
+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']) : '';
+    $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 (in_array('', $aData))
+        sys::outjs(array('e' => 'Необходимо заполнить все поля'));
 
-		if(sys::strlen($aData['name']) > 50)
-			sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.'));
+    if (sys::strlen($aData['name']) > 50)
+        sys::outjs(array('e' => 'Заголовок не должен превышать 50 символов.'));
 
-		if(sys::strlen($aData['tags']) > 100)
-			sys::outjs(array('e' => 'Теги не должен превышать 100 символов.'));
+    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.'"');
+    $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'));
-	}
+    sys::outjs(array('s' => 'ok'));
+}
 
-	$html->get('add', 'sections/news');
+$html->get('add', 'sections/news');
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 4 - 4
system/acp/sections/news/delete.php

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

+ 27 - 28
system/acp/sections/news/index.php

@@ -1,40 +1,39 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'news/search.php');
 
-	if($id)
-		include(SEC.'news/news.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'news/news.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `news`');
+    $sql->query('SELECT `id` FROM `news`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/news');
+    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>';
-		}
+    $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->get('index', 'sections/news');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 30 - 31
system/acp/sections/news/news.php

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

+ 43 - 47
system/acp/sections/news/search.php

@@ -1,64 +1,60 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    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).'%').'\')';
+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');
-	}
+    $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);
+if (!$sql->num()) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$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>';
-	}
+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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 51 - 53
system/acp/sections/notice/add.php

@@ -1,55 +1,53 @@
 <?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');
+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');
 ?>

+ 4 - 4
system/acp/sections/notice/delete.php

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

+ 35 - 37
system/acp/sections/notice/end.php

@@ -1,52 +1,50 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'notice/search.php');
 
-	if($id)
-		include(SEC.'notice/notice.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'notice/notice.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `notice`');
+    $sql->query('SELECT `id` FROM `notice`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice');
+    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();
+    $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>';
+            $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>' . $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>';
-		}
+        $list .= '<tr>';
+        $list .= '<td colspan="5">' . $notice['text'] . '</td>';
+        $list .= '</tr>';
+    }
 
-		$html->get('index', 'sections/notice');
+    $html->get('index', 'sections/notice');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 35 - 37
system/acp/sections/notice/index.php

@@ -1,52 +1,50 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'notice/search.php');
 
-	if($id)
-		include(SEC.'notice/notice.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'notice/notice.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `notice`');
+    $sql->query('SELECT `id` FROM `notice`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/notice');
+    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();
+    $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>';
+            $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>' . $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>';
-		}
+        $list .= '<tr>';
+        $list .= '<td colspan="5">' . $notice['text'] . '</td>';
+        $list .= '</tr>';
+    }
 
-		$html->get('index', 'sections/notice');
+    $html->get('index', 'sections/notice');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 74 - 77
system/acp/sections/notice/notice.php

@@ -1,79 +1,76 @@
 <?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');
+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');
 ?>

+ 50 - 55
system/acp/sections/notice/search.php

@@ -1,75 +1,70 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    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).'%').'\')';
+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');
-	}
+    $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);
+if (!$sql->num($notices)) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$list = '';
 
-	while($notice = $sql->get($notices))
-	{
-		if($notice['unit'])
-		{
-			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$notice['unit'].'" LIMIT 1');
-			$unit = $sql->get();
+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>';
+        $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>' . $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>';
-	}
+    $list .= '<tr>';
+    $list .= '<td colspan="5">' . $notice['text'] . '</td>';
+    $list .= '</tr>';
+}
 
-	$mcache->set($mkey, array('s' => $list), false, 15);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 17 - 18
system/acp/sections/pages/add.php

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

+ 7 - 7
system/acp/sections/pages/delete.php

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

+ 24 - 25
system/acp/sections/pages/index.php

@@ -1,36 +1,35 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	if($id)
-		include(SEC.'pages/page.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'pages/page.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `pages`');
+    $sql->query('SELECT `id` FROM `pages`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/pages');
+    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>';
-		}
+    $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->get('index', 'sections/pages');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 22 - 23
system/acp/sections/pages/page.php

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

+ 81 - 86
system/acp/sections/promo/add.php

@@ -1,88 +1,83 @@
 <?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');
+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');
 ?>

+ 5 - 5
system/acp/sections/promo/delete.php

@@ -1,9 +1,9 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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');
+$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'));
+sys::outjs(array('s' => 'ok'));
 ?>

+ 32 - 33
system/acp/sections/promo/end.php

@@ -1,46 +1,45 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'promo/search.php');
 
-	if($id)
-		include(SEC.'promo/promo.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'promo/promo.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `promo`');
+    $sql->query('SELECT `id` FROM `promo`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo');
+    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();
+    $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>';
-		}
+        $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->get('index', 'sections/promo');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 32 - 33
system/acp/sections/promo/index.php

@@ -1,46 +1,45 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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 (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'promo/search.php');
 
-	if($id)
-		include(SEC.'promo/promo.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'promo/promo.php');
+else {
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `promo`');
+    $sql->query('SELECT `id` FROM `promo`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/promo');
+    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();
+    $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>';
-		}
+        $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->get('index', 'sections/promo');
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 87 - 90
system/acp/sections/promo/promo.php

@@ -1,92 +1,89 @@
 <?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');
+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');
 ?>

+ 46 - 50
system/acp/sections/promo/search.php

@@ -1,68 +1,64 @@
 <?php
-    if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$text = isset($_POST['text']) ? trim($_POST['text']) : '';
+$text = isset($_POST['text']) ? trim($_POST['text']) : '';
 
-	$mkey = md5($text.$id);
+$mkey = md5($text . $id);
 
-	$cache = $mcache->get($mkey);
+$cache = $mcache->get($mkey);
 
-	if(is_array($cache))
-	{
-		if($go)
-			sys::outjs($cache, $nmch);
+if (is_array($cache)) {
+    if ($go)
+        sys::outjs($cache, $nmch);
 
-		sys::outjs($cache);
-	}
+    sys::outjs($cache);
+}
 
-	if(!isset($text{2}))
-	{
-		if($go)
-			sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
+if (!isset($text{2})) {
+    if ($go)
+        sys::outjs(array('e' => 'Для выполнения поиска, необходимо больше данных'), $nmch);
 
-		sys::outjs(array('e' => ''));
-	}
+    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).'%').'\')';
+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');
-	}
+    $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);
+if (!$sql->num($promos)) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
 
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
 
-	$list = '';
+$list = '';
 
-	while($promo = $sql->get($promos))
-	{
-		$sql->query('SELECT `name` FROM `tarifs` WHERE `id`="'.$promo['tarif'].'" LIMIT 1');
-		$tarif = $sql->get();
+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>';
-	}
+    $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);
+$mcache->set($mkey, array('s' => $list), false, 15);
 
-	sys::outjs(array('s' => $list));
+sys::outjs(array('s' => $list));
 ?>

+ 25 - 27
system/acp/sections/promo/stats.php

@@ -1,38 +1,36 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+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');
+if (isset($url['delete'])) {
+    $sql->query('DELETE FROM `promo_use` WHERE `id`="' . sys::int($url['delete']) . '" LIMIT 1');
 
-		sys::outjs(array('s' => 'ok'));
-	}
+    sys::outjs(array('s' => 'ok'));
+}
 
-	$list = '';
+$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();
+$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();
+    $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>';
-	}
+    $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->get('stats', 'sections/promo');
 
-		$html->set('list', $list);
+$html->set('list', $list);
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 73 - 75
system/acp/sections/servers/crmp.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/cs.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/csgo.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/css.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/cssold.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 4 - 4
system/acp/sections/servers/delete.php

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

+ 76 - 78
system/acp/sections/servers/index.php

@@ -1,80 +1,78 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/mc.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/mta.php

@@ -1,77 +1,75 @@
 <?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');
-	}
+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');
+}
 ?>

+ 34 - 35
system/acp/sections/servers/overdue.php

@@ -1,43 +1,42 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	if($id)
-		include(SEC.'servers/server.php');
-	else{
-		$list = '';
+if ($id)
+    include(SEC . 'servers/server.php');
+else {
+    $list = '';
 
-		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `slots`, `name`, `overdue` FROM `servers` WHERE `user`!="-1" AND `time`<"'.$start_point.'" AND `overdue`>"'.$start_point.'" ORDER BY `id` ASC');
-		while($server = $sql->get($servers))
-		{
-			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
-			$unit = $sql->get();
+    $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `slots`, `name`, `overdue` FROM `servers` WHERE `user`!="-1" AND `time`<"' . $start_point . '" AND `overdue`>"' . $start_point . '" ORDER BY `id` ASC');
+    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();
+        $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>#'.$server['unit'].' '.$unit['name'].'</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">' . $server['id'] . '</td>';
+        $list .= '<td><a href="' . $cfg['http'] . 'acp/servers/id/' . $server['id'] . '">' . $server['name'] . '</a></td>';
+        $list .= '<td>#' . $server['unit'] . ' ' . $unit['name'] . '</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>#'.$server['tarif'].' '.$tarif['name'].'</td>';
-				$list .= '<td class="text-center">Просрочен</td>';
-				$list .= '<td class="text-center">Удаление через: '.sys::date('min', $server['overdue']+$cfg['server_delete']*86400).'</td>';
-				$list .= '<td class="text-center"><a href="#" onclick="return servers_delete(\''.$server['id'].'\')" class="text-red">Удалить</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>#' . $server['tarif'] . ' ' . $tarif['name'] . '</td>';
+        $list .= '<td class="text-center">Просрочен</td>';
+        $list .= '<td class="text-center">Удаление через: ' . sys::date('min', $server['overdue'] + $cfg['server_delete'] * 86400) . '</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('pages', '');
-		$html->pack('main');
-	}
+    $html->get('index', 'sections/servers');
+    $html->set('list', $list);
+    $html->set('pages', '');
+    $html->pack('main');
+}
 ?>

+ 73 - 75
system/acp/sections/servers/samp.php

@@ -1,77 +1,75 @@
 <?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`="samp"');
-
-		$aPage = sys::page($page, $sql->num(), 20);
-
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/samp'.$url_search);
-
-		$servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` '.$select.' AND `game`="samp" 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');
-	}
+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`="samp"');
+
+    $aPage = sys::page($page, $sql->num(), 20);
+
+    sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/servers/section/samp' . $url_search);
+
+    $servers = $sql->query('SELECT `id`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` ' . $select . ' AND `game`="samp" 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');
+}
 ?>

+ 130 - 136
system/acp/sections/servers/search.php

@@ -1,138 +1,132 @@
 <?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`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` WHERE `user`!="-1" AND';
-
-	if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
-		$select .= ' `'.$url['search'].'`='.sys::int($url[$url['search']]).' AND';
-
-	$check = explode('=', $text);
-
-	if(in_array($check[0], array('game', 'unit', 'core', 'tarif', 'user', 'status', 'slots')))
-	{
-		$val = trim($check[1]);
-
-		switch($check[0])
-		{
-			case 'game':
-				if(in_array($val, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc')))
-					$servers = $sql->query('SELECT '.$select.' FROM `servers` WHERE `user`!="-1" AND `game`="'.$val.'" ORDER BY `id` ASC');
-			break;
-
-			case 'unit':
-				$servers = $sql->query('SELECT '.$select.' `unit`="'.sys::int($val).'" ORDER BY `id` ASC');
-			break;
-
-			case 'core':
-				$servers = $sql->query('SELECT '.$select.' `core_use`="'.sys::int($val).'" ORDER BY `id` ASC');
-			break;
-
-			case 'tarif':
-				$servers = $sql->query('SELECT '.$select.' `tarif`="'.sys::int($val).'" ORDER BY `id` ASC');
-			break;
-
-			case 'user':
-				$servers = $sql->query('SELECT '.$select.' `user`="'.sys::int($val).'" ORDER BY `id` ASC');
-			break;
-
-			case 'status':
-				if(in_array($val, array('working', 'start', 'change', 'restart', 'off', 'overdue', 'blocked', 'recovery', 'reinstall', 'update', 'install')))
-					$servers = $sql->query('SELECT '.$select.' `status`="'.$val.'" ORDER BY `id` ASC');
-			break;
-
-			case 'slots':
-				$servers = $sql->query('SELECT '.$select.' `slots`="'.sys::int($val).'" ORDER BY `id` ASC');
-			break;
-		}
-	}elseif($text{0} == 'i' AND $text{1} == 'd')
-		$servers = $sql->query('SELECT '.$select.' `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'
-				.'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`slots` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`status` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`address` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`port` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
-
-		$servers = $sql->query('SELECT '.$select.' ('.$like.') ORDER BY `id` ASC');
-	}
-
-	if(!$sql->num($servers))
-	{
-		if($go)
-			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
-
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
-
-	$status = array(
-		'working' => '<span class="text-green">Работает</span>',
-		'off' => '<span class="text-red">Выключен</span>',
-		'start' => 'Запускается',
-		'restart' => 'Перезапускается',
-		'change' => 'Смена карты',
-		'install' => 'Устанавливается',
-		'reinstall' => 'Переустанавливается',
-		'update' => 'Обновляется',
-		'recovery' => 'Восстанавливается',
-		'overdue' => 'Просрочен',
-		'blocked' => 'Заблокирован'
-	);
-
-	$list = '';
-
-	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>';
-	}
-
-	$mcache->set($mkey, array('s' => $list), false, 15);
-
-	sys::outjs(array('s' => $list));
+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`, `unit`, `tarif`, `user`, `address`, `game`, `status`, `slots`, `name`, `time` FROM `servers` WHERE `user`!="-1" AND';
+
+if (isset($url['search']) and in_array($url['search'], array('unit', 'tarif')))
+    $select .= ' `' . $url['search'] . '`=' . sys::int($url[$url['search']]) . ' AND';
+
+$check = explode('=', $text);
+
+if (in_array($check[0], array('game', 'unit', 'core', 'tarif', 'user', 'status', 'slots'))) {
+    $val = trim($check[1]);
+
+    switch ($check[0]) {
+        case 'game':
+            if (in_array($val, array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc')))
+                $servers = $sql->query('SELECT ' . $select . ' FROM `servers` WHERE `user`!="-1" AND `game`="' . $val . '" ORDER BY `id` ASC');
+            break;
+
+        case 'unit':
+            $servers = $sql->query('SELECT ' . $select . ' `unit`="' . sys::int($val) . '" ORDER BY `id` ASC');
+            break;
+
+        case 'core':
+            $servers = $sql->query('SELECT ' . $select . ' `core_use`="' . sys::int($val) . '" ORDER BY `id` ASC');
+            break;
+
+        case 'tarif':
+            $servers = $sql->query('SELECT ' . $select . ' `tarif`="' . sys::int($val) . '" ORDER BY `id` ASC');
+            break;
+
+        case 'user':
+            $servers = $sql->query('SELECT ' . $select . ' `user`="' . sys::int($val) . '" ORDER BY `id` ASC');
+            break;
+
+        case 'status':
+            if (in_array($val, array('working', 'start', 'change', 'restart', 'off', 'overdue', 'blocked', 'recovery', 'reinstall', 'update', 'install')))
+                $servers = $sql->query('SELECT ' . $select . ' `status`="' . $val . '" ORDER BY `id` ASC');
+            break;
+
+        case 'slots':
+            $servers = $sql->query('SELECT ' . $select . ' `slots`="' . sys::int($val) . '" ORDER BY `id` ASC');
+            break;
+    }
+} elseif ($text{0} == 'i' and $text{1} == 'd')
+    $servers = $sql->query('SELECT ' . $select . ' `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'
+        . '`game` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`slots` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`status` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`address` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`port` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\')';
+
+    $servers = $sql->query('SELECT ' . $select . ' (' . $like . ') ORDER BY `id` ASC');
+}
+
+if (!$sql->num($servers)) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
+
+$status = array(
+    'working' => '<span class="text-green">Работает</span>',
+    'off' => '<span class="text-red">Выключен</span>',
+    'start' => 'Запускается',
+    'restart' => 'Перезапускается',
+    'change' => 'Смена карты',
+    'install' => 'Устанавливается',
+    'reinstall' => 'Переустанавливается',
+    'update' => 'Обновляется',
+    'recovery' => 'Восстанавливается',
+    'overdue' => 'Просрочен',
+    'blocked' => 'Заблокирован'
+);
+
+$list = '';
+
+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>';
+}
+
+$mcache->set($mkey, array('s' => $list), false, 15);
+
+sys::outjs(array('s' => $list));
 ?>

+ 267 - 279
system/acp/sections/servers/server.php

@@ -1,282 +1,270 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$sql->query('SELECT `time`, `overdue` FROM `servers` WHERE `id`="'.$id.'" LIMIT 1');
-	$server = $sql->get();
-
-	if($server['time'] > $start_point AND $server['overdue'])
-		$sql->query('UPDATE `servers` set `overdue`="0" WHERE `id`="'.$id.'" LIMIT 1');
-
-	$sql->query('SELECT * FROM `servers` WHERE `id`="'.$id.'" LIMIT 1');
-	$server = $sql->get();
-
-	$sql->query('SELECT `address` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
-	$unit = $sql->get();
-
-	$sql->query('SELECT `name`, `slots_min`, `slots_max`, `packs` FROM `tarifs` WHERE `id`="'.$server['tarif'].'" LIMIT 1');
-	$tarif = $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($server['time'] > $start_point)
-						sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.'));
-
-					$sql->query('UPDATE `servers` set `overdue`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1');
-				break;
-
-				case 'block':
-					if($server['status'] != ('off' || 'overdue'))
-						sys::outjs(array('e' => 'Игровой сервер должен быть выключен.'));
-
-					if($date < $start_point)
-						$sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="'.$id.'" LIMIT 1');
-					else
-						$sql->query('UPDATE `servers` set `status`="blocked", `block`="'.$date.'" WHERE `id`="'.$id.'" LIMIT 1');
-				break;
-
-				case 'tarif':
-					$tid = isset($url['tarif']) ? sys::int($url['tarif']) : sys::outjs(array('e' => 'Необходимо указать тариф.'));
-
-					if($tid == $server['tarif'])
-						sys::outjs(array('s' => 'ok'));
-
-					$sql->query('SELECT `id`, `slots_min`, `slots_max`, `packs`, `fps`, `tickrate`, `ram` FROM `tarifs` WHERE `id`="'.$tid.'" AND `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" LIMIT 1');
-					if(!$sql->num())
-						sys::outjs(array('e' => 'Укажите тариф из списка.'));
-
-					$tarif = $sql->get();
-
-					if($server['slots'] < $tarif['slots_min'] || $server['slots'] > $tarif['slots_max'])
-						sys::outjs(array('e' => 'Данный тариф не совместим по слотам.'));
-
-					if($server['fps'])
-					{
-						if(!in_array($server['fps'], explode(':', $tarif['fps'])))
-							sys::outjs(array('e' => 'Данный тариф не совместим по FPS.'));
-					}
-
-					if($server['tickrate'])
-					{
-						if(!in_array($server['tickrate'], explode(':', $tarif['tickrate'])))
-							sys::outjs(array('e' => 'Данный тариф не совместим по TickRate.'));
-					}
-
-					if($server['game'] == 'mc')
-					{
-						$ram = $server['ram']/$server['slots'];
-
-						if(!in_array($ram, explode(':', $tarif['ram'])))
-							sys::outjs(array('e' => 'Данный тариф не совместим по RAM.'));
-					}
-
-					if(!array_key_exists($server['pack'], sys::b64djs($tarif['packs'])))
-						sys::outjs(array('e' => 'На данном тарифном плане нет сборки игрового сервера.'));
-
-					$sql->query('UPDATE `servers` set `tarif`="'.$tid.'" WHERE `id`="'.$id.'" LIMIT 1');
-				break;
-			}
-
-			sys::outjs(array('s' => 'ok'));
-		}
-
-		$aData = array();
-
-		$aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $server['user'];
-		$aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $server['address'];
-		$aData['port'] = isset($_POST['port']) ? sys::int($_POST['port']) : $server['port'];
-		$aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $server['hdd'];
-		$aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $server['slots'];
-		$aData['pack'] = isset($_POST['pack']) ? trim($_POST['pack']) : $server['pack'];
-		$aData['fps'] = isset($_POST['fps']) ? sys::int($_POST['fps']) : $server['fps'];
-		$aData['tickrate'] = isset($_POST['tickrate']) ? sys::int($_POST['tickrate']) : $server['tickrate'];
-		$aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $server['ram'];
-		$aData['core_fix_one'] = isset($_POST['core_fix_one']) ? sys::int($_POST['core_fix_one']) : $server['core_fix_one'];
-		$aData['core_fix'] = isset($_POST['core_fix']) ? sys::int($_POST['core_fix']) : $server['core_fix'];
-		$aData['cpu_use_max'] = isset($_POST['cpu_use_max']) ? sys::int($_POST['cpu_use_max']) : $server['cpu_use_max'];
-		$aData['pingboost'] = isset($_POST['pingboost']) ? sys::int($_POST['pingboost']) : $server['pingboost'];
-		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $server['time'];
-
-		$aData['ftp_use'] = isset($_POST['ftp_use']) ? $_POST['ftp_use'] : $server['ftp_use'];
-		$aData['ftp_root'] = isset($_POST['ftp_root']) ? sys::int($_POST['ftp_root']) : $server['ftp_root'];
-		$aData['plugins_use'] = isset($_POST['plugins_use']) ? $_POST['plugins_use'] : $server['plugins_use'];
-		$aData['console_use'] = isset($_POST['console_use']) ? $_POST['console_use'] : $server['console_use'];
-		$aData['stats_use'] = isset($_POST['stats_use']) ? $_POST['stats_use'] : $server['stats_use'];
-		$aData['copy_use'] = isset($_POST['copy_use']) ? $_POST['copy_use'] : $server['copy_use'];
-		$aData['web_use'] = isset($_POST['web_use']) ? $_POST['web_use'] : $server['web_use'];
-
-		if($server['user'] != $aData['user'])
-		{
-			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$aData['user'].'" LIMIT 1');
-			if(!$sql->num())
-				sys::outjs(array('e' => 'Пользователь не найден.'));
-			else{
-				$sql->query('SELECT `id` FROM `web` WHERE `user`!="'.$aData['user'].'" AND `server`="'.$id.'" LIMIT 1');
-				if($sql->num())
-					sys::outjs(array('e' => 'Невозможно установить пользователя владельцем данного сервера<br>Из-за возможной несовместимости с бесплатными услугами.<br>Удалите у данного сервера бесплатные услуги.'));
-			}
-		}
-
-		if(sys::valid($aData['address'], 'other', $aValid['address']))
-			$aData['address'] = $server['address'];
-
-		$sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address`="'.$aData['address'].'" LIMIT 1');
-		if($sql->num())
-			sys::outjs(array('e' => 'Данный адрес занят другим сервером.'));
-
-		$sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `address` LIKE \'%'.sys::first(explode(':', $unit['address'])).'\' AND `port`="'.$aData['port'].'" LIMIT 1');
-		if($sql->num())
-			sys::outjs(array('e' => 'Данный порт занят другим сервером.'));
-
-		$slots = explode(':', $aData['slots']);
-
-		if(!isset($slots[0]) AND !isset($slots[1]))
-			sys::outjs(array('e' => 'Слоты указаны не правильно.'));
-
-		if($slots[0] < 2 || $slots[1] < 2)
-			sys::outjs(array('e' => 'Слоты указаны не правильно.'));
-
-		if($slots[0] > $tarif['slots_max'] || $slots[0] < $tarif['slots_min'])
-			sys::outjs(array('e' => 'Слоты указаны не правильно.'));
-
-		$slots[1] = $slots[1] > $slots[0] ? $slots[0] : $slots[1];
-
-		$aPacks = sys::b64djs($tarif['packs']);
-
-		if(!array_key_exists($aData['pack'], $aPacks))
-			sys::outjs(array('e' => 'Указанная сборка не найдена.'));
-
-		if($aData['core_fix_one'])
-		{
-			if($aData['core_fix'])
-			{
-				$sql->query('SELECT `id` FROM `servers` WHERE `id`!="'.$id.'" AND `unit`="'.$server['unit'].'" AND `core_fix`="'.$aData['core_fix'].'" AND `core_fix_one`="1"');
-				if($sql->num())
-					sys::outjs(array('e' => 'Указанное ядро занято другим сервером.'));
-			}else
-				$aData['core_fix_one'] = 0;
-		}
-
-		if(!in_array($aData['pingboost'], array(1,2,3)))
-			$aData['pingboost'] = 0;
-
-		$aData['time'] = sys::checkdate($aData['time']);
-
-		foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section)
-			$aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0';
-
-		$sql->query('UPDATE `servers` set '
-			.'`user`="'.$aData['user'].'",'
-			.'`address`="'.$aData['address'].'",'
-			.'`port`="'.$aData['port'].'",'
-			.'`slots`="'.$slots[0].'",'
-			.'`slots_start`="'.$slots[1].'",'
-			.'`fps`="'.$aData['fps'].'",'
-			.'`tickrate`="'.$aData['tickrate'].'",'
-			.'`ram`="'.$aData['ram'].'",'
-			.'`core_fix`="'.$aData['core_fix'].'",'
-			.'`core_fix_one`="'.$aData['core_fix_one'].'",'
-			.'`cpu_use_max`="'.$aData['cpu_use_max'].'",'
-			.'`pingboost`="'.$aData['pingboost'].'",'
-			.'`time`="'.$aData['time'].'",'
-			.'`ftp_use`="'.$aData['ftp_use'].'",'
-			.'`ftp_root`="'.$aData['ftp_root'].'",'
-			.'`plugins_use`="'.$aData['plugins_use'].'",'
-			.'`console_use`="'.$aData['console_use'].'",'
-			.'`stats_use`="'.$aData['stats_use'].'",'
-			.'`copy_use`="'.$aData['copy_use'].'",'
-			.'`web_use`="'.$aData['web_use'].'",'
-			.'`pack`="'.$aData['pack'].'",'
-			.'`hdd`="'.$aData['hdd'].'" WHERE `id`="'.$id.'" LIMIT 1');
-
-		$sql->query('UPDATE `web` set `user`="'.$aData['user'].'" WHERE `server`="'.$id.'"');
-
-		$mcache->delete('server_index_'.$id);
-		$mcache->delete('server_resources_'.$id);
-		$mcache->delete('server_status_'.$id);
-
-		sys::outjs(array('s' => 'ok'));
-	}
-
-	$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$server['unit'].'" LIMIT 1');
-	$unit = $sql->get();
-
-	$packs = '';
-
-	$aPacks = sys::b64djs($tarif['packs']);
-
-	foreach($aPacks as $name => $fullname)
-		$packs .= '<option value="'.$name.'">'.$fullname.'</option>';
-
-	$packs = str_replace('"'.$server['pack'].'"', '"'.$server['pack'].'" selected', $packs);
-
-	$cfo = $server['core_fix_one'] ? '<option value="1">Личное</option><option value="0">Общее</option>' : '<option value="0">Общее</option><option value="1">Личное</option>';
-	$pingboost = str_replace('="'.$server['pingboost'].'"', '="'.$server['pingboost'].'" selected', '<option value="0">По умолчанию</option><option value="1">PINGBOOST 1</option><option value="2">PINGBOOST 2</option><option value="3">PINGBOOST 3</option>');
-	$ftp_root = $server['ftp_root'] ? '<option value="1">Корневой каталог</option><option value="0">Обычный (cstrike)</option>' : '<option value="0">Обычный (cstrike)</option><option value="1">Корневой каталог</option>';
-
-	$tarifs = '';
-
-	$sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `unit`="'.$server['unit'].'" AND `game`="'.$server['game'].'" AND `id`!="'.$server['tarif'].'"');
-	while($tarif_list = $sql->get())
-		$tarifs .= '<option value="'.$tarif_list['id'].'">'.$tarif_list['name'].'</option>';
-
-	$copys = $sql->query('SELECT `id`, `user` FROM `copy` WHERE `server`="'.$id.'" LIMIT 10');
-	while($copy = $sql->get($copys))
-	{
-		$aCP = explode('_', $copy['user']);
-
-		if($aCP[0] != $aData['user'])
-			$sql->query('UPDATE `copy` set `user`="'.$aData['user'].'_'.$aCP[1].'" WHERE `id`="'.$copy['id'].' LIMIT 1');
-	}
-
-	$html->get('server', 'sections/servers');
-		$html->set('id', $id);
-		$html->set('name', $server['name']);
-		$html->set('address', $server['address']);
-		$html->set('port', $server['port']);
-		$html->set('slots', $server['slots']);
-		$html->set('slots_start', $server['slots_start']);
-		$html->set('user', $server['user']);
-		$html->set('game', $server['game']);
-		$html->set('unit', $unit['name']);
-		$html->set('tarif', '#'.$server['tarif'].' '.$tarif['name']);
-		$html->set('hdd', $server['hdd']);
-		$html->set('fps', $server['fps']);
-		$html->set('tickrate', $server['tickrate']);
-		$html->set('ram', $server['ram']);
-		$html->set('ftp_on', $server['ftp_on'] ? 'Использовался' : 'Не использовался');
-		$html->set('tarifs', $tarifs);
-		$html->set('pingboost', $pingboost);
-		$html->set('ftp_root', $ftp_root);
-		$html->set('core_fix', $server['core_fix']);
-		$html->set('cpu_use_max', $server['cpu_use_max']);
-		$html->set('cpu_limi', $cfg['cpu_use_max'][$server['game']]);
-		$html->set('core_fix_one', $cfo);
-		$html->set('packs', $packs);
-		$html->set('time', date('d/m/Y H:i', $server['time']));
-		$html->set('date', date('d.m.Y - H:i:s', $server['date']));
-		$html->set('overdue', $server['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $server['overdue']));
-		$html->set('block', $server['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $server['block']));
-
-		foreach(array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section)
-		{
-			if($server[$section])
-				$html->unit($section, 1);
-			else
-				$html->unit($section);
-		}
-
-	$html->pack('main');
+$sql->query('SELECT `time`, `overdue` FROM `servers` WHERE `id`="' . $id . '" LIMIT 1');
+$server = $sql->get();
+
+if ($server['time'] > $start_point and $server['overdue'])
+    $sql->query('UPDATE `servers` set `overdue`="0" WHERE `id`="' . $id . '" LIMIT 1');
+
+$sql->query('SELECT * FROM `servers` WHERE `id`="' . $id . '" LIMIT 1');
+$server = $sql->get();
+
+$sql->query('SELECT `address` FROM `units` WHERE `id`="' . $server['unit'] . '" LIMIT 1');
+$unit = $sql->get();
+
+$sql->query('SELECT `name`, `slots_min`, `slots_max`, `packs` FROM `tarifs` WHERE `id`="' . $server['tarif'] . '" LIMIT 1');
+$tarif = $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 ($server['time'] > $start_point)
+                    sys::outjs(array('e' => 'Игровой сервер должен быть просрочен.'));
+
+                $sql->query('UPDATE `servers` set `overdue`="' . $date . '" WHERE `id`="' . $id . '" LIMIT 1');
+                break;
+
+            case 'block':
+                if ($server['status'] != ('off' || 'overdue'))
+                    sys::outjs(array('e' => 'Игровой сервер должен быть выключен.'));
+
+                if ($date < $start_point)
+                    $sql->query('UPDATE `servers` set `status`="off", `block`="0" WHERE `id`="' . $id . '" LIMIT 1');
+                else
+                    $sql->query('UPDATE `servers` set `status`="blocked", `block`="' . $date . '" WHERE `id`="' . $id . '" LIMIT 1');
+                break;
+
+            case 'tarif':
+                $tid = isset($url['tarif']) ? sys::int($url['tarif']) : sys::outjs(array('e' => 'Необходимо указать тариф.'));
+
+                if ($tid == $server['tarif'])
+                    sys::outjs(array('s' => 'ok'));
+
+                $sql->query('SELECT `id`, `slots_min`, `slots_max`, `packs`, `fps`, `tickrate`, `ram` FROM `tarifs` WHERE `id`="' . $tid . '" AND `unit`="' . $server['unit'] . '" AND `game`="' . $server['game'] . '" LIMIT 1');
+                if (!$sql->num())
+                    sys::outjs(array('e' => 'Укажите тариф из списка.'));
+
+                $tarif = $sql->get();
+
+                if ($server['slots'] < $tarif['slots_min'] || $server['slots'] > $tarif['slots_max'])
+                    sys::outjs(array('e' => 'Данный тариф не совместим по слотам.'));
+
+                if ($server['fps']) {
+                    if (!in_array($server['fps'], explode(':', $tarif['fps'])))
+                        sys::outjs(array('e' => 'Данный тариф не совместим по FPS.'));
+                }
+
+                if ($server['tickrate']) {
+                    if (!in_array($server['tickrate'], explode(':', $tarif['tickrate'])))
+                        sys::outjs(array('e' => 'Данный тариф не совместим по TickRate.'));
+                }
+
+                if ($server['game'] == 'mc') {
+                    $ram = $server['ram'] / $server['slots'];
+
+                    if (!in_array($ram, explode(':', $tarif['ram'])))
+                        sys::outjs(array('e' => 'Данный тариф не совместим по RAM.'));
+                }
+
+                if (!array_key_exists($server['pack'], sys::b64djs($tarif['packs'])))
+                    sys::outjs(array('e' => 'На данном тарифном плане нет сборки игрового сервера.'));
+
+                $sql->query('UPDATE `servers` set `tarif`="' . $tid . '" WHERE `id`="' . $id . '" LIMIT 1');
+                break;
+        }
+
+        sys::outjs(array('s' => 'ok'));
+    }
+
+    $aData = array();
+
+    $aData['user'] = isset($_POST['user']) ? sys::int($_POST['user']) : $server['user'];
+    $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : $server['address'];
+    $aData['port'] = isset($_POST['port']) ? sys::int($_POST['port']) : $server['port'];
+    $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $server['hdd'];
+    $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $server['slots'];
+    $aData['pack'] = isset($_POST['pack']) ? trim($_POST['pack']) : $server['pack'];
+    $aData['fps'] = isset($_POST['fps']) ? sys::int($_POST['fps']) : $server['fps'];
+    $aData['tickrate'] = isset($_POST['tickrate']) ? sys::int($_POST['tickrate']) : $server['tickrate'];
+    $aData['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : $server['ram'];
+    $aData['core_fix_one'] = isset($_POST['core_fix_one']) ? sys::int($_POST['core_fix_one']) : $server['core_fix_one'];
+    $aData['core_fix'] = isset($_POST['core_fix']) ? sys::int($_POST['core_fix']) : $server['core_fix'];
+    $aData['cpu_use_max'] = isset($_POST['cpu_use_max']) ? sys::int($_POST['cpu_use_max']) : $server['cpu_use_max'];
+    $aData['pingboost'] = isset($_POST['pingboost']) ? sys::int($_POST['pingboost']) : $server['pingboost'];
+    $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $server['time'];
+
+    $aData['ftp_use'] = isset($_POST['ftp_use']) ? $_POST['ftp_use'] : $server['ftp_use'];
+    $aData['ftp_root'] = isset($_POST['ftp_root']) ? sys::int($_POST['ftp_root']) : $server['ftp_root'];
+    $aData['plugins_use'] = isset($_POST['plugins_use']) ? $_POST['plugins_use'] : $server['plugins_use'];
+    $aData['console_use'] = isset($_POST['console_use']) ? $_POST['console_use'] : $server['console_use'];
+    $aData['stats_use'] = isset($_POST['stats_use']) ? $_POST['stats_use'] : $server['stats_use'];
+    $aData['copy_use'] = isset($_POST['copy_use']) ? $_POST['copy_use'] : $server['copy_use'];
+    $aData['web_use'] = isset($_POST['web_use']) ? $_POST['web_use'] : $server['web_use'];
+
+    if ($server['user'] != $aData['user']) {
+        $sql->query('SELECT `id` FROM `users` WHERE `id`="' . $aData['user'] . '" LIMIT 1');
+        if (!$sql->num())
+            sys::outjs(array('e' => 'Пользователь не найден.'));
+        else {
+            $sql->query('SELECT `id` FROM `web` WHERE `user`!="' . $aData['user'] . '" AND `server`="' . $id . '" LIMIT 1');
+            if ($sql->num())
+                sys::outjs(array('e' => 'Невозможно установить пользователя владельцем данного сервера<br>Из-за возможной несовместимости с бесплатными услугами.<br>Удалите у данного сервера бесплатные услуги.'));
+        }
+    }
+
+    if (sys::valid($aData['address'], 'other', $aValid['address']))
+        $aData['address'] = $server['address'];
+
+    $sql->query('SELECT `id` FROM `servers` WHERE `id`!="' . $id . '" AND `address`="' . $aData['address'] . '" LIMIT 1');
+    if ($sql->num())
+        sys::outjs(array('e' => 'Данный адрес занят другим сервером.'));
+
+    $sql->query('SELECT `id` FROM `servers` WHERE `id`!="' . $id . '" AND `address` LIKE \'%' . sys::first(explode(':', $unit['address'])) . '\' AND `port`="' . $aData['port'] . '" LIMIT 1');
+    if ($sql->num())
+        sys::outjs(array('e' => 'Данный порт занят другим сервером.'));
+
+    $slots = explode(':', $aData['slots']);
+
+    if (!isset($slots[0]) and !isset($slots[1]))
+        sys::outjs(array('e' => 'Слоты указаны не правильно.'));
+
+    if ($slots[0] < 2 || $slots[1] < 2)
+        sys::outjs(array('e' => 'Слоты указаны не правильно.'));
+
+    if ($slots[0] > $tarif['slots_max'] || $slots[0] < $tarif['slots_min'])
+        sys::outjs(array('e' => 'Слоты указаны не правильно.'));
+
+    $slots[1] = $slots[1] > $slots[0] ? $slots[0] : $slots[1];
+
+    $aPacks = sys::b64djs($tarif['packs']);
+
+    if (!array_key_exists($aData['pack'], $aPacks))
+        sys::outjs(array('e' => 'Указанная сборка не найдена.'));
+
+    if ($aData['core_fix_one']) {
+        if ($aData['core_fix']) {
+            $sql->query('SELECT `id` FROM `servers` WHERE `id`!="' . $id . '" AND `unit`="' . $server['unit'] . '" AND `core_fix`="' . $aData['core_fix'] . '" AND `core_fix_one`="1"');
+            if ($sql->num())
+                sys::outjs(array('e' => 'Указанное ядро занято другим сервером.'));
+        } else
+            $aData['core_fix_one'] = 0;
+    }
+
+    if (!in_array($aData['pingboost'], array(1, 2, 3)))
+        $aData['pingboost'] = 0;
+
+    $aData['time'] = sys::checkdate($aData['time']);
+
+    foreach (array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section)
+        $aData[$section] = (string)$aData[$section] == 'on' ? '1' : '0';
+
+    $sql->query('UPDATE `servers` set '
+        . '`user`="' . $aData['user'] . '",'
+        . '`address`="' . $aData['address'] . '",'
+        . '`port`="' . $aData['port'] . '",'
+        . '`slots`="' . $slots[0] . '",'
+        . '`slots_start`="' . $slots[1] . '",'
+        . '`fps`="' . $aData['fps'] . '",'
+        . '`tickrate`="' . $aData['tickrate'] . '",'
+        . '`ram`="' . $aData['ram'] . '",'
+        . '`core_fix`="' . $aData['core_fix'] . '",'
+        . '`core_fix_one`="' . $aData['core_fix_one'] . '",'
+        . '`cpu_use_max`="' . $aData['cpu_use_max'] . '",'
+        . '`pingboost`="' . $aData['pingboost'] . '",'
+        . '`time`="' . $aData['time'] . '",'
+        . '`ftp_use`="' . $aData['ftp_use'] . '",'
+        . '`ftp_root`="' . $aData['ftp_root'] . '",'
+        . '`plugins_use`="' . $aData['plugins_use'] . '",'
+        . '`console_use`="' . $aData['console_use'] . '",'
+        . '`stats_use`="' . $aData['stats_use'] . '",'
+        . '`copy_use`="' . $aData['copy_use'] . '",'
+        . '`web_use`="' . $aData['web_use'] . '",'
+        . '`pack`="' . $aData['pack'] . '",'
+        . '`hdd`="' . $aData['hdd'] . '" WHERE `id`="' . $id . '" LIMIT 1');
+
+    $sql->query('UPDATE `web` set `user`="' . $aData['user'] . '" WHERE `server`="' . $id . '"');
+
+    $mcache->delete('server_index_' . $id);
+    $mcache->delete('server_resources_' . $id);
+    $mcache->delete('server_status_' . $id);
+
+    sys::outjs(array('s' => 'ok'));
+}
+
+$sql->query('SELECT `name` FROM `units` WHERE `id`="' . $server['unit'] . '" LIMIT 1');
+$unit = $sql->get();
+
+$packs = '';
+
+$aPacks = sys::b64djs($tarif['packs']);
+
+foreach ($aPacks as $name => $fullname)
+    $packs .= '<option value="' . $name . '">' . $fullname . '</option>';
+
+$packs = str_replace('"' . $server['pack'] . '"', '"' . $server['pack'] . '" selected', $packs);
+
+$cfo = $server['core_fix_one'] ? '<option value="1">Личное</option><option value="0">Общее</option>' : '<option value="0">Общее</option><option value="1">Личное</option>';
+$pingboost = str_replace('="' . $server['pingboost'] . '"', '="' . $server['pingboost'] . '" selected', '<option value="0">По умолчанию</option><option value="1">PINGBOOST 1</option><option value="2">PINGBOOST 2</option><option value="3">PINGBOOST 3</option>');
+$ftp_root = $server['ftp_root'] ? '<option value="1">Корневой каталог</option><option value="0">Обычный (cstrike)</option>' : '<option value="0">Обычный (cstrike)</option><option value="1">Корневой каталог</option>';
+
+$tarifs = '';
+
+$sql->query('SELECT `id`, `name` FROM `tarifs` WHERE `unit`="' . $server['unit'] . '" AND `game`="' . $server['game'] . '" AND `id`!="' . $server['tarif'] . '"');
+while ($tarif_list = $sql->get())
+    $tarifs .= '<option value="' . $tarif_list['id'] . '">' . $tarif_list['name'] . '</option>';
+
+$copys = $sql->query('SELECT `id`, `user` FROM `copy` WHERE `server`="' . $id . '" LIMIT 10');
+while ($copy = $sql->get($copys)) {
+    $aCP = explode('_', $copy['user']);
+
+    if ($aCP[0] != $aData['user'])
+        $sql->query('UPDATE `copy` set `user`="' . $aData['user'] . '_' . $aCP[1] . '" WHERE `id`="' . $copy['id'] . ' LIMIT 1');
+}
+
+$html->get('server', 'sections/servers');
+$html->set('id', $id);
+$html->set('name', $server['name']);
+$html->set('address', $server['address']);
+$html->set('port', $server['port']);
+$html->set('slots', $server['slots']);
+$html->set('slots_start', $server['slots_start']);
+$html->set('user', $server['user']);
+$html->set('game', $server['game']);
+$html->set('unit', $unit['name']);
+$html->set('tarif', '#' . $server['tarif'] . ' ' . $tarif['name']);
+$html->set('hdd', $server['hdd']);
+$html->set('fps', $server['fps']);
+$html->set('tickrate', $server['tickrate']);
+$html->set('ram', $server['ram']);
+$html->set('ftp_on', $server['ftp_on'] ? 'Использовался' : 'Не использовался');
+$html->set('tarifs', $tarifs);
+$html->set('pingboost', $pingboost);
+$html->set('ftp_root', $ftp_root);
+$html->set('core_fix', $server['core_fix']);
+$html->set('cpu_use_max', $server['cpu_use_max']);
+$html->set('cpu_limi', $cfg['cpu_use_max'][$server['game']]);
+$html->set('core_fix_one', $cfo);
+$html->set('packs', $packs);
+$html->set('time', date('d/m/Y H:i', $server['time']));
+$html->set('date', date('d.m.Y - H:i:s', $server['date']));
+$html->set('overdue', $server['overdue'] == 0 ? 'Установить' : date('d/m/Y H:i', $server['overdue']));
+$html->set('block', $server['block'] == 0 ? 'Заблокировать' : date('d/m/Y H:i', $server['block']));
+
+foreach (array('ftp_use', 'plugins_use', 'console_use', 'stats_use', 'copy_use', 'web_use') as $section) {
+    if ($server[$section])
+        $html->unit($section, 1);
+    else
+        $html->unit($section);
+}
+
+$html->pack('main');
 ?>

+ 283 - 299
system/acp/sections/tarifs/add.php

@@ -1,416 +1,400 @@
 <?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['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : '';
-		$aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : '';
-		$aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : '';
-		$aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : '';
-		$aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : '';
-		$aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : '';
-		$aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : '';
-		$aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : '';
-		$aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : '';
-		$aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : '';
-		$aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : '';
-		$aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : '';
-		$aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : '';
-		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : '';
-		$aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : '';
-		$aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : '';
-		$aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : '';
-		$aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : '';
-		$aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : '';
-		$aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : '';
-		$aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : '';
-		$aData['console'] = isset($_POST['console']) ? $_POST['console'] : '';
-		$aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : '';
-		$aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : '';
-		$aData['web'] = isset($_POST['web']) ? $_POST['web'] : '';
-		$aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : '';
-		$aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : '';
-		$aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : '';
-		$aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : '';
-		$aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : '';
-		$aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : '';
-		$aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : '';
-		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : '';
+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['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : '';
+    $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : '';
+    $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : '';
+    $aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : '';
+    $aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : '';
+    $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : '';
+    $aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : '';
+    $aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : '';
+    $aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : '';
+    $aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : '';
+    $aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : '';
+    $aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : '';
+    $aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : '';
+    $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : '';
+    $aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : '';
+    $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : '';
+    $aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : '';
+    $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : '';
+    $aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : '';
+    $aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : '';
+    $aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : '';
+    $aData['console'] = isset($_POST['console']) ? $_POST['console'] : '';
+    $aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : '';
+    $aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : '';
+    $aData['web'] = isset($_POST['web']) ? $_POST['web'] : '';
+    $aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : '';
+    $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : '';
+    $aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : '';
+    $aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : '';
+    $aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : '';
+    $aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : '';
+    $aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : '';
+    $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : '';
 
-		if($aData['name'] == '')
-			sys::outjs(array('e' => 'Необходимо указать название'));
+    if ($aData['name'] == '')
+        sys::outjs(array('e' => 'Необходимо указать название'));
 
-		$sql->query('SELECT `id` FROM `units` WHERE `id`="'.$aData['unit'].'" LIMIT 1');
-		if(!$sql->num())
-			sys::outjs(array('e' => 'Необходимо указать локацию'));
+    $sql->query('SELECT `id` FROM `units` WHERE `id`="' . $aData['unit'] . '" LIMIT 1');
+    if (!$sql->num())
+        sys::outjs(array('e' => 'Необходимо указать локацию'));
 
-		if(!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc')))
-			sys::outjs(array('e' => 'Необходимо указать игру'));
+    if (!in_array($aData['game'], array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc')))
+        sys::outjs(array('e' => 'Необходимо указать игру'));
 
-		$aSlots = explode('-', $aData['slots']);
+    $aSlots = explode('-', $aData['slots']);
 
-		if(!isset($aSlots[0]) || !isset($aSlots[1]))
-			sys::outjs(array('e' => 'Необходимо указать слоты'));
+    if (!isset($aSlots[0]) || !isset($aSlots[1]))
+        sys::outjs(array('e' => 'Необходимо указать слоты'));
 
-		$aSlots[0] = trim($aSlots[0]);
-		$aSlots[1] = trim($aSlots[1]);
+    $aSlots[0] = trim($aSlots[0]);
+    $aSlots[1] = trim($aSlots[1]);
 
-		$aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты'));
-		$aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты'));
+    $aData['slots_min'] = $aSlots[0] > 1 ? $aSlots[0] : sys::outjs(array('e' => 'Неправильно указаны слоты'));
+    $aData['slots_max'] = $aSlots[1] >= $aSlots[0] ? $aSlots[1] : sys::outjs(array('e' => 'Неправильно указаны слоты'));
 
-		$aPorts = explode('-', $aData['posts']);
+    $aPorts = explode('-', $aData['posts']);
 
-		if(!isset($aPorts[0]) || !isset($aPorts[1]))
-			sys::outjs(array('e' => 'Необходимо указать порты'));
+    if (!isset($aPorts[0]) || !isset($aPorts[1]))
+        sys::outjs(array('e' => 'Необходимо указать порты'));
 
-		$aPorts[0] = trim($aPorts[0]);
-		$aPorts[1] = trim($aPorts[1]);
+    $aPorts[0] = trim($aPorts[0]);
+    $aPorts[1] = trim($aPorts[1]);
 
-		$aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты'));
-		$aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты'));
+    $aData['port_min'] = $aPorts[0] > 1 ? $aPorts[0] : sys::outjs(array('e' => 'Неправильно указаны порты'));
+    $aData['port_max'] = $aPorts[1] >= $aPorts[0] ? $aPorts[1] : sys::outjs(array('e' => 'Неправильно указаны порты'));
 
-		if($aData['hostname'] == '')
-			sys::outjs(array('e' => 'Необходимо указать название сервера'));
+    if ($aData['hostname'] == '')
+        sys::outjs(array('e' => 'Необходимо указать название сервера'));
 
-		if($aData['path'] == '')
-			sys::outjs(array('e' => 'Необходимо указать путь до сборок'));
+    if ($aData['path'] == '')
+        sys::outjs(array('e' => 'Необходимо указать путь до сборок'));
 
-		if($aData['install'] == '')
-			sys::outjs(array('e' => 'Необходимо указать путь для установки серверов'));
+    if ($aData['install'] == '')
+        sys::outjs(array('e' => 'Необходимо указать путь для установки серверов'));
 
-		if($aData['update'] == '')
-			sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки'));
+    if ($aData['update'] == '')
+        sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки'));
 
-		if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || substr($aData['update'], -1) != '/')
-			sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"'));
+    if (substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || substr($aData['update'], -1) != '/')
+        sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"'));
 
-		$int = array(
-			'Тестов' => 'tests',
-			'Положение' => 'sort',
-			'Диск' => 'hdd'
-		);
+    $int = array(
+        'Тестов' => 'tests',
+        'Положение' => 'sort',
+        'Диск' => 'hdd'
+    );
 
-		foreach($int as $name => $input)
-		{
-			if($aData[$input] == '')
-				sys::outjs(array('e' => 'Необходимо указать поле "'.$name.'"'));
-		}
+    foreach ($int as $name => $input) {
+        if ($aData[$input] == '')
+            sys::outjs(array('e' => 'Необходимо указать поле "' . $name . '"'));
+    }
 
-		$aPacks = explode(',', $aData['packs']);
+    $aPacks = explode(',', $aData['packs']);
 
-		$packs = array();
+    $packs = array();
 
-		foreach($aPacks as $pack)
-		{
-			$aPack = explode(':', trim($pack));
+    foreach ($aPacks as $pack) {
+        $aPack = explode(':', trim($pack));
 
-			if(!isset($aPack[0]) || !isset($aPack[1]))
-				continue;
+        if (!isset($aPack[0]) || !isset($aPack[1]))
+            continue;
 
-			$name = str_replace('"', '', $aPack[0]);
-			$fullname = str_replace('"', '', $aPack[1]);
+        $name = str_replace('"', '', $aPack[0]);
+        $fullname = str_replace('"', '', $aPack[1]);
 
-			$packs[trim($name)] = trim($fullname);
-		}
+        $packs[trim($name)] = trim($fullname);
+    }
 
-		if(!count($packs))
-			sys::outjs(array('e' => 'Необходимо указать минимум одну сборку'));
+    if (!count($packs))
+        sys::outjs(array('e' => 'Необходимо указать минимум одну сборку'));
 
-		$aData['packs'] = sys::b64js($packs);
+    $aData['packs'] = sys::b64js($packs);
 
-		$aIp = explode(':', $aData['ip']);
+    $aIp = explode(':', $aData['ip']);
 
-		$ips = '';
+    $ips = '';
 
-		foreach($aIp as $ip)
-		{
-			$ip = trim($ip);
+    foreach ($aIp as $ip) {
+        $ip = trim($ip);
 
-			if(sys::valid($ip, 'ip'))
-				continue;
+        if (sys::valid($ip, 'ip'))
+            continue;
 
-			$ips .= $ip.':';
-		}
+        $ips .= $ip . ':';
+    }
 
-		$ips = isset($ips{0}) ? substr($ips, 0, -1) : '';
+    $ips = isset($ips{0}) ? substr($ips, 0, -1) : '';
 
-		$aData['ip'] = $ips;
+    $aData['ip'] = $ips;
 
-		$aPlugins = explode('","', $aData['plugins_install']);
+    $aPlugins = explode('","', $aData['plugins_install']);
 
-		$plugins = array();
+    $plugins = array();
 
-		foreach($aPlugins as $plugin)
-		{
-			$aPlugin = explode(':', trim($plugin));
+    foreach ($aPlugins as $plugin) {
+        $aPlugin = explode(':', trim($plugin));
 
-			if(!isset($aPlugin[0]) || !isset($aPlugin[1]))
-				continue;
+        if (!isset($aPlugin[0]) || !isset($aPlugin[1]))
+            continue;
 
-			$name = trim(str_replace('"', '', $aPlugin[0]));
+        $name = trim(str_replace('"', '', $aPlugin[0]));
 
-			if(!isset($packs[$name]))
-				continue;
+        if (!isset($packs[$name]))
+            continue;
 
-			$aList = explode(',', str_replace('"', '', $aPlugin[1]));
+        $aList = explode(',', str_replace('"', '', $aPlugin[1]));
 
-			$list = '';
+        $list = '';
 
-			foreach($aList as $pid)
-			{
-				$pid = trim($pid);
+        foreach ($aList as $pid) {
+            $pid = trim($pid);
 
-				if(!is_numeric($pid))
-					continue;
+            if (!is_numeric($pid))
+                continue;
 
-				$list .= intval($pid).',';
-			}
+            $list .= intval($pid) . ',';
+        }
 
-			$list = isset($list{0}) ? substr($list, 0, -1) : '';
+        $list = isset($list{0}) ? substr($list, 0, -1) : '';
 
-			if($list == '')
-				continue;
+        if ($list == '')
+            continue;
 
-			$plugins[$name] = $list;
-		}
+        $plugins[$name] = $list;
+    }
 
-		$aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : ''; 
+    $aData['plugins_install'] = count($plugins) ? sys::b64js($plugins) : '';
 
-		$aCores = explode(',', $aData['core_fix']);
+    $aCores = explode(',', $aData['core_fix']);
 
-		$cores = '';
+    $cores = '';
 
-		foreach($aCores as $core)
-		{
-			$core = trim($core);
+    foreach ($aCores as $core) {
+        $core = trim($core);
 
-			if(!is_numeric($core))
-				continue;
+        if (!is_numeric($core))
+            continue;
 
-			if($core < 1)
-				continue;
+        if ($core < 1)
+            continue;
 
-			$cores .= intval($core).',';
-		}
+        $cores .= intval($core) . ',';
+    }
 
-		$cores = isset($cores{0}) ? substr($cores, 0, -1) : '';
+    $cores = isset($cores{0}) ? substr($cores, 0, -1) : '';
 
-		$aData['core_fix'] = $cores;
+    $aData['core_fix'] = $cores;
 
-		$aTime = explode(':', $aData['time']);
+    $aTime = explode(':', $aData['time']);
 
-		$times = '';
+    $times = '';
 
-		foreach($aTime as $time)
-		{
-			$time = trim($time);
+    foreach ($aTime as $time) {
+        $time = trim($time);
 
-			if(!is_numeric($time))
-				continue;
+        if (!is_numeric($time))
+            continue;
 
-			$times .= intval($time).':';
-		}
+        $times .= intval($time) . ':';
+    }
 
-		$times = isset($times{0}) ? substr($times, 0, -1) : '';
+    $times = isset($times{0}) ? substr($times, 0, -1) : '';
 
-		$aData['time'] = $times;
+    $aData['time'] = $times;
 
-		$aTimext = explode(':', $aData['timext']);
+    $aTimext = explode(':', $aData['timext']);
 
-		$timexts = '';
+    $timexts = '';
 
-		foreach($aTimext as $timext)
-		{
-			$timext = trim($timext);
+    foreach ($aTimext as $timext) {
+        $timext = trim($timext);
 
-			if(!is_numeric($timext))
-				continue;
+        if (!is_numeric($timext))
+            continue;
 
-			$timexts .= intval($timext).':';
-		}
+        $timexts .= intval($timext) . ':';
+    }
 
-		$timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : '';
+    $timexts = isset($timexts{0}) ? substr($timexts, 0, -1) : '';
 
-		$aData['timext'] = $timexts;
+    $aData['timext'] = $timexts;
 
-		$aFps = explode(':', $aData['fps']);
+    $aFps = explode(':', $aData['fps']);
 
-		$sfps = '';
+    $sfps = '';
 
-		foreach($aFps as $fps)
-		{
-			$fps = trim($fps);
+    foreach ($aFps as $fps) {
+        $fps = trim($fps);
 
-			if(!is_numeric($fps))
-				continue;
+        if (!is_numeric($fps))
+            continue;
 
-			$sfps .= intval($fps).':';
-		}
+        $sfps .= intval($fps) . ':';
+    }
 
-		$sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : '';
+    $sfps = isset($sfps{0}) ? substr($sfps, 0, -1) : '';
 
-		$aData['fps'] = $sfps;
+    $aData['fps'] = $sfps;
 
-		$aTick = explode(':', $aData['tickrate']);
+    $aTick = explode(':', $aData['tickrate']);
 
-		$stick = '';
+    $stick = '';
 
-		foreach($aTick as $tick)
-		{
-			$tick = trim($tick);
+    foreach ($aTick as $tick) {
+        $tick = trim($tick);
 
-			if(!is_numeric($tick))
-				continue;
+        if (!is_numeric($tick))
+            continue;
 
-			$stick .= intval($tick).':';
-		}
+        $stick .= intval($tick) . ':';
+    }
 
-		$stick = isset($stick{0}) ? substr($stick, 0, -1) : '';
+    $stick = isset($stick{0}) ? substr($stick, 0, -1) : '';
 
-		$aData['tickrate'] = $stick;
+    $aData['tickrate'] = $stick;
 
-		$aRam = explode(':', $aData['ram']);
+    $aRam = explode(':', $aData['ram']);
 
-		$sram = '';
+    $sram = '';
 
-		foreach($aRam as $ram)
-		{
-			$ram = trim($ram);
+    foreach ($aRam as $ram) {
+        $ram = trim($ram);
 
-			if(!is_numeric($ram))
-				continue;
+        if (!is_numeric($ram))
+            continue;
 
-			$sram .= intval($ram).':';
-		}
+        $sram .= intval($ram) . ':';
+    }
 
-		$sram = isset($sram{0}) ? substr($sram, 0, -1) : '';
+    $sram = isset($sram{0}) ? substr($sram, 0, -1) : '';
 
-		$aData['ram'] = $sram;
+    $aData['ram'] = $sram;
 
-		$aPrice = explode(':', $aData['price']);
+    $aPrice = explode(':', $aData['price']);
 
-		$sprice = '';
+    $sprice = '';
 
-		foreach($aPrice as $price)
-		{
-			$price = trim($price);
+    foreach ($aPrice as $price) {
+        $price = trim($price);
 
-			if(!is_numeric($price))
-				continue;
+        if (!is_numeric($price))
+            continue;
 
-			$sprice .= $price.':';
-		}
+        $sprice .= $price . ':';
+    }
 
-		$sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
+    $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
 
-		$aData['price'] = $sprice;
+    $aData['price'] = $sprice;
 
-		switch($aData['game'])
-		{
-			case 'cs':
-				if(count(explode(':', $aData['fps'])) != count(explode(':', $aData['price'])))
-					sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
+    switch ($aData['game']) {
+        case 'cs':
+            if (count(explode(':', $aData['fps'])) != count(explode(':', $aData['price'])))
+                sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
 
-				break;
+            break;
 
-			case 'cssold':
-				$afps = explode(':', $aData['fps']);
-				$atick = explode(':', $aData['tickrate']);
-				$aprice = explode(':', $aData['price']);
+        case 'cssold':
+            $afps = explode(':', $aData['fps']);
+            $atick = explode(':', $aData['tickrate']);
+            $aprice = explode(':', $aData['price']);
 
-				if((count($afps)*count($atick)) != count($aprice))
-					sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
+            if ((count($afps) * count($atick)) != count($aprice))
+                sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
 
-				$price = array();
+            $price = array();
 
-				$i = 0;
+            $i = 0;
 
-				foreach($afps as $fps)
-				{
-					foreach($atick as $tick)
-					{
-						$price[$tick.'_'.$fps] = $aprice[$i];
+            foreach ($afps as $fps) {
+                foreach ($atick as $tick) {
+                    $price[$tick . '_' . $fps] = $aprice[$i];
 
-						$i+=1;
-					}
-				}
+                    $i += 1;
+                }
+            }
 
-				$aData['price'] = sys::b64js($price);
+            $aData['price'] = sys::b64js($price);
 
-				break;
+            break;
 
-			case 'css':
-			case 'csgo':
-				if(count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price'])))
-					sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
+        case 'css':
+        case 'csgo':
+            if (count(explode(':', $aData['tickrate'])) != count(explode(':', $aData['price'])))
+                sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
 
-				break;
+            break;
 
-			case 'mc':
-				if(count(explode(':', $aData['ram'])) != count(explode(':', $aData['price'])))
-					sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
+        case 'mc':
+            if (count(explode(':', $aData['ram'])) != count(explode(':', $aData['price'])))
+                sys::outjs(array('e' => 'Неправильно указано поле "Цена"'));
 
-		}
+    }
 
-		$access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web');
+    $access = array('ftp', 'plugins', 'console', 'stats', 'copy', 'web');
 
-		foreach($access as $section)
-			$aData[$section] = (string) $aData[$section] == 'on' ? '1' : '0';
+    foreach ($access as $section)
+        $aData[$section] = (string)$aData[$section] == 'on' ? '1' : '0';
 
-		$sql->query('INSERT INTO `tarifs` set'
-			.'`unit`="'.$aData['unit'].'",'
-			.'`game`="'.$aData['game'].'",'
-			.'`name`="'.htmlspecialchars($aData['name']).'",'
-			.'`slots_min`="'.$aData['slots_min'].'",'
-			.'`slots_max`="'.$aData['slots_max'].'",'
-			.'`port_min`="'.$aData['port_min'].'",'
-			.'`port_max`="'.$aData['port_max'].'",'
-			.'`hostname`="'.htmlspecialchars($aData['hostname']).'",'
-			.'`packs`="'.$aData['packs'].'",'
-			.'`path`="'.addslashes($aData['path']).'",'
-			.'`install`="'.addslashes($aData['install']).'",'
-			.'`update`="'.addslashes($aData['update']).'",'
-			.'`fps`="'.$aData['fps'].'",'
-			.'`tickrate`="'.$aData['tickrate'].'",'
-			.'`ram`="'.$aData['ram'].'",'
-			.'`param_fix`="'.$aData['param_fix'].'",'
-			.'`time`="'.$aData['time'].'",'
-			.'`timext`="'.$aData['timext'].'",'
-			.'`test`="'.$aData['test'].'",'
-			.'`tests`="'.$aData['tests'].'",'
-			.'`discount`="'.$aData['discount'].'",'
-			.'`map`="'.addslashes($aData['map']).'",'
-			.'`ftp`="'.$aData['ftp'].'",'
-			.'`plugins`="'.$aData['plugins'].'",'
-			.'`console`="'.$aData['console'].'",'
-			.'`stats`="'.$aData['stats'].'",'
-			.'`copy`="'.$aData['copy'].'",'
-			.'`web`="'.$aData['web'].'",'
-			.'`plugins_install`="'.$aData['plugins_install'].'",'
-			.'`hdd`="'.$aData['hdd'].'",'
-			.'`autostop`="'.$aData['autostop'].'",'
-			.'`price`="'.$aData['price'].'",'
-			.'`core_fix`="'.$aData['core_fix'].'",'
-			.'`ip`="'.$aData['ip'].'",'
-			.'`show`="'.$aData['show'].'",'
-			.'`sort`="'.$aData['sort'].'"');
-
-		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['id'].' '.$unit['name'].'</option>';
-
-	$html->get('add', 'sections/tarifs');
-
-		$html->set('units', $units);
-
-	$html->pack('main');
+    $sql->query('INSERT INTO `tarifs` set'
+        . '`unit`="' . $aData['unit'] . '",'
+        . '`game`="' . $aData['game'] . '",'
+        . '`name`="' . htmlspecialchars($aData['name']) . '",'
+        . '`slots_min`="' . $aData['slots_min'] . '",'
+        . '`slots_max`="' . $aData['slots_max'] . '",'
+        . '`port_min`="' . $aData['port_min'] . '",'
+        . '`port_max`="' . $aData['port_max'] . '",'
+        . '`hostname`="' . htmlspecialchars($aData['hostname']) . '",'
+        . '`packs`="' . $aData['packs'] . '",'
+        . '`path`="' . addslashes($aData['path']) . '",'
+        . '`install`="' . addslashes($aData['install']) . '",'
+        . '`update`="' . addslashes($aData['update']) . '",'
+        . '`fps`="' . $aData['fps'] . '",'
+        . '`tickrate`="' . $aData['tickrate'] . '",'
+        . '`ram`="' . $aData['ram'] . '",'
+        . '`param_fix`="' . $aData['param_fix'] . '",'
+        . '`time`="' . $aData['time'] . '",'
+        . '`timext`="' . $aData['timext'] . '",'
+        . '`test`="' . $aData['test'] . '",'
+        . '`tests`="' . $aData['tests'] . '",'
+        . '`discount`="' . $aData['discount'] . '",'
+        . '`map`="' . addslashes($aData['map']) . '",'
+        . '`ftp`="' . $aData['ftp'] . '",'
+        . '`plugins`="' . $aData['plugins'] . '",'
+        . '`console`="' . $aData['console'] . '",'
+        . '`stats`="' . $aData['stats'] . '",'
+        . '`copy`="' . $aData['copy'] . '",'
+        . '`web`="' . $aData['web'] . '",'
+        . '`plugins_install`="' . $aData['plugins_install'] . '",'
+        . '`hdd`="' . $aData['hdd'] . '",'
+        . '`autostop`="' . $aData['autostop'] . '",'
+        . '`price`="' . $aData['price'] . '",'
+        . '`core_fix`="' . $aData['core_fix'] . '",'
+        . '`ip`="' . $aData['ip'] . '",'
+        . '`show`="' . $aData['show'] . '",'
+        . '`sort`="' . $aData['sort'] . '"');
+
+    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['id'] . ' ' . $unit['name'] . '</option>';
+
+$html->get('add', 'sections/tarifs');
+
+$html->set('units', $units);
+
+$html->pack('main');
 ?>

+ 54 - 56
system/acp/sections/tarifs/copy.php

@@ -1,84 +1,82 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$sql->query('SELECT * FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1');
-	$tarif = $sql->get();
+$sql->query('SELECT * FROM `tarifs` WHERE `id`="' . $id . '" LIMIT 1');
+$tarif = $sql->get();
 
-	$games = '<option value="cs">Counter-Strike: 1.6</option><option value="cssold">Counter-Strike: Source v34</option><option value="css">Counter-Strike: Source</option>'
-		.'<option value="csgo">Counter-Strike: Global Offensive</option><option value="samp">San Andreas Multiplayer</option><option value="crmp">GTA: Criminal Russia</option>'
-		.'<option value="mta">Multi Theft Auto</option><option value="mc">Minecraft</option>';
+$games = '<option value="cs">Counter-Strike: 1.6</option><option value="cssold">Counter-Strike: Source v34</option><option value="css">Counter-Strike: Source</option>'
+    . '<option value="csgo">Counter-Strike: Global Offensive</option><option value="samp">San Andreas Multiplayer</option><option value="crmp">GTA: Criminal Russia</option>'
+    . '<option value="mta">Multi Theft Auto</option><option value="mc">Minecraft</option>';
 
-	$fix = $tarif['param_fix'] ? '<option value="1">Фиксированные параметры</option><option value="0">Не фиксированные параметры</option>' : '<option value="0">Не фиксированные параметры</option><option value="1">Фиксированные параметры</option>';
-	$test = $tarif['test'] ? '<option value="1">Доступно</option><option value="0">Недоступно</option>' : '<option value="0">Недоступно</option><option value="1">Доступно</option>';
-	$discount = $tarif['discount'] ? '<option value="1">Включены</option><option value="0">Без скидок</option>' : '<option value="0">Без скидок</option><option value="1">Включены</option>';
-	$autostop = $tarif['autostop'] ? '<option value="1">Включено</option><option value="0">Выключено</option>' : '<option value="0">Выключено</option><option value="1">Включено</option>';
-	$show = $tarif['show'] ? '<option value="1">Доступна</option><option value="0">Недоступна</option>' : '<option value="0">Недоступна</option><option value="1">Доступна</option>';
+$fix = $tarif['param_fix'] ? '<option value="1">Фиксированные параметры</option><option value="0">Не фиксированные параметры</option>' : '<option value="0">Не фиксированные параметры</option><option value="1">Фиксированные параметры</option>';
+$test = $tarif['test'] ? '<option value="1">Доступно</option><option value="0">Недоступно</option>' : '<option value="0">Недоступно</option><option value="1">Доступно</option>';
+$discount = $tarif['discount'] ? '<option value="1">Включены</option><option value="0">Без скидок</option>' : '<option value="0">Без скидок</option><option value="1">Включены</option>';
+$autostop = $tarif['autostop'] ? '<option value="1">Включено</option><option value="0">Выключено</option>' : '<option value="0">Выключено</option><option value="1">Включено</option>';
+$show = $tarif['show'] ? '<option value="1">Доступна</option><option value="0">Недоступна</option>' : '<option value="0">Недоступна</option><option value="1">Доступна</option>';
 
-	$units = '<option value="0">Выберете локацию</option>';
+$units = '<option value="0">Выберете локацию</option>';
 
-	$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
-	while($unit = $sql->get())
-		$units .= '<option value="'.$unit['id'].'">#'.$unit['id'].' '.$unit['name'].'</option>';
+$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+while ($unit = $sql->get())
+    $units .= '<option value="' . $unit['id'] . '">#' . $unit['id'] . ' ' . $unit['name'] . '</option>';
 
-	$games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games);
+$games = str_replace('"' . $tarif['game'] . '"', '"' . $tarif['game'] . '" selected="select"', $games);
 
-	$html->get('copy', 'sections/tarifs');
+$html->get('copy', 'sections/tarifs');
 
-		if($tarif['game'] == 'cssold')
-		{
-			$sprice = '';
+if ($tarif['game'] == 'cssold') {
+    $sprice = '';
 
-			$aPrice = sys::b64djs($tarif['price']);
+    $aPrice = sys::b64djs($tarif['price']);
 
-			foreach($aPrice as $price)
-				$sprice .= $price.':';
+    foreach ($aPrice as $price)
+        $sprice .= $price . ':';
 
-			$sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
+    $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
 
-			$tarif['price'] = $sprice;
-		}
+    $tarif['price'] = $sprice;
+}
 
-		foreach($tarif as $field => $val)
-			$html->set($field, $val);
+foreach ($tarif as $field => $val)
+    $html->set($field, $val);
 
-		$html->set('units', $units);
-		$html->set('games', $games);
-		$html->set('param_fix', $fix);
-		$html->set('test', $test);
-		$html->set('discount', $discount);
-		$html->set('autostop', $autostop);
-		$html->set('show', $show);
+$html->set('units', $units);
+$html->set('games', $games);
+$html->set('param_fix', $fix);
+$html->set('test', $test);
+$html->set('discount', $discount);
+$html->set('autostop', $autostop);
+$html->set('show', $show);
 
-		foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section)
-		{
-			if($tarif[$section])
-				$html->unit($section, 1);
-			else
-				$html->unit($section);
-		}
+foreach (array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section) {
+    if ($tarif[$section])
+        $html->unit($section, 1);
+    else
+        $html->unit($section);
+}
 
-		$packs = '';
+$packs = '';
 
-		$aPacks = sys::b64djs($tarif['packs']);
+$aPacks = sys::b64djs($tarif['packs']);
 
-		foreach($aPacks as $name => $fullname)
-			$packs .= '"'.$name.'":"'.$fullname.'",';
+foreach ($aPacks as $name => $fullname)
+    $packs .= '"' . $name . '":"' . $fullname . '",';
 
-		$packs = isset($packs{0}) ? substr($packs, 0, -1) : '';
+$packs = isset($packs{0}) ? substr($packs, 0, -1) : '';
 
-		$html->set('packs', $packs);
+$html->set('packs', $packs);
 
-		$plugins = '';
+$plugins = '';
 
-		$aPlugins = sys::b64djs($tarif['plugins_install']);
+$aPlugins = sys::b64djs($tarif['plugins_install']);
 
-		foreach($aPlugins as $pack => $list)
-			$plugins .= '"'.$pack.'":"'.$list.'",';
+foreach ($aPlugins as $pack => $list)
+    $plugins .= '"' . $pack . '":"' . $list . '",';
 
-		$plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : '';
+$plugins = isset($plugins{0}) ? substr($plugins, 0, -1) : '';
 
-		$html->set('plugins_install', $plugins);
+$html->set('plugins_install', $plugins);
 
-	$html->pack('main');
+$html->pack('main');
 ?>

+ 7 - 7
system/acp/sections/tarifs/delete.php

@@ -1,12 +1,12 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	$sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$id.'" LIMIT 1');
-	if($sql->num())
-		sys::outjs(array('e' => 'Нельзя удалить тариф с серверами.'));
+$sql->query('SELECT `id` FROM `servers` WHERE `tarif`="' . $id . '" LIMIT 1');
+if ($sql->num())
+    sys::outjs(array('e' => 'Нельзя удалить тариф с серверами.'));
 
-	$sql->query('DELETE FROM `tarifs` WHERE `id`="'.$id.'" LIMIT 1');
+$sql->query('DELETE FROM `tarifs` WHERE `id`="' . $id . '" LIMIT 1');
 
-	sys::outjs(array('s' => 'ok'));
+sys::outjs(array('s' => 'ok'));
 ?>

+ 46 - 48
system/acp/sections/tarifs/index.php

@@ -1,68 +1,66 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+if (!DEFINED('EGP'))
+    exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
 
-	if(isset($url['subsection']) AND $url['subsection'] == 'search')
-		include(SEC.'tarifs/search.php');
+if (isset($url['subsection']) and $url['subsection'] == 'search')
+    include(SEC . 'tarifs/search.php');
 
-	if($id)
-		include(SEC.'tarifs/tarif.php');
-	else{
-		$sort_page = '';
-		$sort_sql = 'ORDER BY `id` ASC';
+if ($id)
+    include(SEC . 'tarifs/tarif.php');
+else {
+    $sort_page = '';
+    $sort_sql = 'ORDER BY `id` ASC';
 
-		if(isset($url['sort']) AND in_array($url['sort'], array('id', 'unit', 'game')))
-		{
-			$sort = 'asc';
+    if (isset($url['sort']) and in_array($url['sort'], array('id', 'unit', 'game'))) {
+        $sort = 'asc';
 
-			if(isset($url['sorting']))
-				$sort = $url['sorting'] == 'asc' ? 'asc' : 'desc';
+        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_page = '/sort/' . $url['sort'] . '/sorting/' . $sort;
+        $sort_sql = 'ORDER BY `' . $url['sort'] . '` ' . $sort;
 
-			$sort_icon = array($url['sort'] => $sort);
-		}
+        $sort_icon = array($url['sort'] => $sort);
+    }
 
-		$list = '';
+    $list = '';
 
-		$sql->query('SELECT `id` FROM `tarifs`');
+    $sql->query('SELECT `id` FROM `tarifs`');
 
-		$aPage = sys::page($page, $sql->num(), 20);
+    $aPage = sys::page($page, $sql->num(), 20);
 
-		sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/tarif'.$sort_page);
+    sys::page_gen($aPage['ceil'], $page, $aPage['page'], 'acp/tarif' . $sort_page);
 
-		$tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` '.$sort_sql.' LIMIT '.$aPage['num'].', 20');
-		while($tarif = $sql->get($tarifs))
-		{
-			$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1');
-			$unit = $sql->get();
+    $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` ' . $sort_sql . ' LIMIT ' . $aPage['num'] . ', 20');
+    while ($tarif = $sql->get($tarifs)) {
+        $sql->query('SELECT `name` FROM `units` WHERE `id`="' . $tarif['unit'] . '" LIMIT 1');
+        $unit = $sql->get();
 
-			$list .= '<tr>';
-				$list .= '<td>'.$tarif['id'].'</td>';
-				$list .= '<td><a href="'.$cfg['http'].'acp/tarifs/id/'.$tarif['id'].'">'.$tarif['name'].'</a></td>';
-				$list .= '<td>#'.$tarif['unit'].' '.$unit['name'].'</td>';
-				$list .= '<td>'.$tarif['slots_min'].'-'.$tarif['slots_max'].'</td>';
-				$list .= '<td>'.$tarif['port_min'].'-'.$tarif['port_max'].'</td>';
-				$list .= '<td>'.strtoupper($tarif['game']).'</td>';
-				$list .= '<td><a href="'.$cfg['http'].'acp/tarifs/section/copy/id/'.$tarif['id'].'">Копировать</a></td>';
-				$list .= '<td><a href="#" onclick="return tarifs_delete(\''.$tarif['id'].'\')" class="text-red">Удалить</a></td>';
-			$list .= '</tr>';
-		}
+        $list .= '<tr>';
+        $list .= '<td>' . $tarif['id'] . '</td>';
+        $list .= '<td><a href="' . $cfg['http'] . 'acp/tarifs/id/' . $tarif['id'] . '">' . $tarif['name'] . '</a></td>';
+        $list .= '<td>#' . $tarif['unit'] . ' ' . $unit['name'] . '</td>';
+        $list .= '<td>' . $tarif['slots_min'] . '-' . $tarif['slots_max'] . '</td>';
+        $list .= '<td>' . $tarif['port_min'] . '-' . $tarif['port_max'] . '</td>';
+        $list .= '<td>' . strtoupper($tarif['game']) . '</td>';
+        $list .= '<td><a href="' . $cfg['http'] . 'acp/tarifs/section/copy/id/' . $tarif['id'] . '">Копировать</a></td>';
+        $list .= '<td><a href="#" onclick="return tarifs_delete(\'' . $tarif['id'] . '\')" class="text-red">Удалить</a></td>';
+        $list .= '</tr>';
+    }
 
-		$html->get('index', 'sections/tarifs');
+    $html->get('index', 'sections/tarifs');
 
-			$html->set('sort_id', 'asc');
-			$html->set('sort_unit', 'asc');
-			$html->set('sort_game', 'asc');
+    $html->set('sort_id', 'asc');
+    $html->set('sort_unit', 'asc');
+    $html->set('sort_game', 'asc');
 
-			if(isset($sort_icon))
-				$html->set('sort_'.key($sort_icon), array_shift($sort_icon));
+    if (isset($sort_icon))
+        $html->set('sort_' . key($sort_icon), array_shift($sort_icon));
 
-			$html->set('list', $list);
+    $html->set('list', $list);
 
-			$html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
+    $html->set('pages', isset($html->arr['pages']) ? $html->arr['pages'] : '');
 
-		$html->pack('main');
-	}
+    $html->pack('main');
+}
 ?>

+ 69 - 74
system/acp/sections/tarifs/search.php

@@ -1,76 +1,71 @@
 <?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')))
-			$tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `game`="'.$game.'" ORDER BY `id` ASC');
-	}elseif($text{0} == 'i' AND $text{1} == 'd')
-		$tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` 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'
-				.'`game` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`slots_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`slots_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`port_min` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\') OR'
-				.'`port_max` LIKE FROM_BASE64(\''.base64_encode('%'.str_replace('_', '\_', $text).'%').'\')';
-
-		$tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE '.$like.' ORDER BY `id` ASC LIMIT 10');
-	}
-
-	if(!$sql->num($tarifs))
-	{
-		if($go)
-			sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
-
-		sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
-	}
-
-	$list = '';
-
-	while($tarif = $sql->get($tarifs))
-	{
-		$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1');
-		$unit = $sql->get();
-
-		$list .= '<tr>';
-			$list .= '<td>'.$tarif['id'].'</td>';
-			$list .= '<td><a href="'.$cfg['http'].'acp/tarif/id/'.$tarif['id'].'">'.$tarif['name'].'</a></td>';
-			$list .= '<td>'.$unit['name'].'</td>';
-			$list .= '<td>'.$tarif['slots_min'].'-'.$tarif['slots_max'].'</td>';
-			$list .= '<td>'.$tarif['port_min'].'-'.$tarif['port_max'].'</td>';
-			$list .= '<td>'.strtoupper($tarif['game']).'</td>';
-			$list .= '<td><a href="#" onclick="return tarifs_delete(\''.$tarif['id'].'\')" class="text-red">Удалить</a></td>';
-		$list .= '</tr>';
-	}
-
-	$mcache->set($mkey, array('s' => $list), false, 15);
-
-	sys::outjs(array('s' => $list));
+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')))
+        $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE `game`="' . $game . '" ORDER BY `id` ASC');
+} elseif ($text{0} == 'i' and $text{1} == 'd')
+    $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` 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'
+        . '`game` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`slots_min` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`slots_max` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`port_min` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\') OR'
+        . '`port_max` LIKE FROM_BASE64(\'' . base64_encode('%' . str_replace('_', '\_', $text) . '%') . '\')';
+
+    $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name`, `slots_min`, `slots_max`, `port_min`, `port_max` FROM `tarifs` WHERE ' . $like . ' ORDER BY `id` ASC LIMIT 10');
+}
+
+if (!$sql->num($tarifs)) {
+    if ($go)
+        sys::outjs(array('e' => 'По вашему запросу ничего не найдено'), $nmch);
+
+    sys::outjs(array('e' => 'По вашему запросу ничего не найдено'));
+}
+
+$list = '';
+
+while ($tarif = $sql->get($tarifs)) {
+    $sql->query('SELECT `name` FROM `units` WHERE `id`="' . $tarif['unit'] . '" LIMIT 1');
+    $unit = $sql->get();
+
+    $list .= '<tr>';
+    $list .= '<td>' . $tarif['id'] . '</td>';
+    $list .= '<td><a href="' . $cfg['http'] . 'acp/tarif/id/' . $tarif['id'] . '">' . $tarif['name'] . '</a></td>';
+    $list .= '<td>' . $unit['name'] . '</td>';
+    $list .= '<td>' . $tarif['slots_min'] . '-' . $tarif['slots_max'] . '</td>';
+    $list .= '<td>' . $tarif['port_min'] . '-' . $tarif['port_max'] . '</td>';
+    $list .= '<td>' . strtoupper($tarif['game']) . '</td>';
+    $list .= '<td><a href="#" onclick="return tarifs_delete(\'' . $tarif['id'] . '\')" class="text-red">Удалить</a></td>';
+    $list .= '</tr>';
+}
+
+$mcache->set($mkey, array('s' => $list), false, 15);
+
+sys::outjs(array('s' => $list));
 ?>

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików