Sergey před 2 roky
rodič
revize
32a9bc0305
100 změnil soubory, kde provedl 5640 přidání a 5640 odebrání
  1. 33 33
      acp/index.php
  2. 28 28
      system/acp/distributor.php
  3. 25 25
      system/acp/engine/addons.php
  4. 26 26
      system/acp/engine/boost.php
  5. 42 42
      system/acp/engine/cashback.php
  6. 23 23
      system/acp/engine/control.php
  7. 5 5
      system/acp/engine/hosting.php
  8. 67 67
      system/acp/engine/index.php
  9. 21 21
      system/acp/engine/jobs.php
  10. 16 16
      system/acp/engine/letter.php
  11. 22 22
      system/acp/engine/logs.php
  12. 19 19
      system/acp/engine/news.php
  13. 20 20
      system/acp/engine/notice.php
  14. 17 17
      system/acp/engine/pages.php
  15. 23 23
      system/acp/engine/promo.php
  16. 47 47
      system/acp/engine/servers.php
  17. 40 40
      system/acp/engine/system.php
  18. 21 21
      system/acp/engine/tarifs.php
  19. 21 21
      system/acp/engine/units.php
  20. 29 29
      system/acp/engine/users.php
  21. 41 41
      system/acp/engine/web.php
  22. 20 20
      system/acp/engine/wiki.php
  23. 33 33
      system/acp/sections/addons/addcat.php
  24. 267 267
      system/acp/sections/addons/addpl.php
  25. 19 19
      system/acp/sections/addons/cats.php
  26. 58 58
      system/acp/sections/addons/delete.php
  27. 47 47
      system/acp/sections/addons/index.php
  28. 269 269
      system/acp/sections/addons/plugin.php
  29. 54 54
      system/acp/sections/addons/search.php
  30. 253 253
      system/acp/sections/addons/update.php
  31. 51 51
      system/acp/sections/addons/updmp.php
  32. 54 54
      system/acp/sections/boost/index.php
  33. 56 56
      system/acp/sections/boost/search.php
  34. 54 54
      system/acp/sections/boost/service.php
  35. 4 4
      system/acp/sections/control/delete.php
  36. 52 52
      system/acp/sections/control/index.php
  37. 29 29
      system/acp/sections/control/overdue.php
  38. 100 100
      system/acp/sections/control/search.php
  39. 107 107
      system/acp/sections/control/server.php
  40. 21 21
      system/acp/sections/jobs/add.php
  41. 30 30
      system/acp/sections/jobs/edit.php
  42. 32 32
      system/acp/sections/jobs/index.php
  43. 53 53
      system/acp/sections/jobs/request.php
  44. 18 18
      system/acp/sections/letter/index.php
  45. 35 35
      system/acp/sections/letter/send.php
  46. 21 21
      system/acp/sections/logs/buy.php
  47. 21 21
      system/acp/sections/logs/cashout.php
  48. 21 21
      system/acp/sections/logs/extend.php
  49. 26 26
      system/acp/sections/logs/index.php
  50. 21 21
      system/acp/sections/logs/part.php
  51. 21 21
      system/acp/sections/logs/replenish.php
  52. 58 58
      system/acp/sections/logs/search.php
  53. 60 60
      system/acp/sections/logs/sysearch.php
  54. 26 26
      system/acp/sections/news/add.php
  55. 4 4
      system/acp/sections/news/delete.php
  56. 28 28
      system/acp/sections/news/index.php
  57. 31 31
      system/acp/sections/news/news.php
  58. 46 46
      system/acp/sections/news/search.php
  59. 53 53
      system/acp/sections/notice/add.php
  60. 4 4
      system/acp/sections/notice/delete.php
  61. 37 37
      system/acp/sections/notice/end.php
  62. 37 37
      system/acp/sections/notice/index.php
  63. 77 77
      system/acp/sections/notice/notice.php
  64. 54 54
      system/acp/sections/notice/search.php
  65. 18 18
      system/acp/sections/pages/add.php
  66. 7 7
      system/acp/sections/pages/delete.php
  67. 25 25
      system/acp/sections/pages/index.php
  68. 23 23
      system/acp/sections/pages/page.php
  69. 86 86
      system/acp/sections/promo/add.php
  70. 5 5
      system/acp/sections/promo/delete.php
  71. 33 33
      system/acp/sections/promo/end.php
  72. 33 33
      system/acp/sections/promo/index.php
  73. 90 90
      system/acp/sections/promo/promo.php
  74. 49 49
      system/acp/sections/promo/search.php
  75. 27 27
      system/acp/sections/promo/stats.php
  76. 75 75
      system/acp/sections/servers/crmp.php
  77. 75 75
      system/acp/sections/servers/cs.php
  78. 75 75
      system/acp/sections/servers/csgo.php
  79. 75 75
      system/acp/sections/servers/css.php
  80. 75 75
      system/acp/sections/servers/cssold.php
  81. 4 4
      system/acp/sections/servers/delete.php
  82. 78 78
      system/acp/sections/servers/index.php
  83. 75 75
      system/acp/sections/servers/mc.php
  84. 75 75
      system/acp/sections/servers/mta.php
  85. 35 35
      system/acp/sections/servers/overdue.php
  86. 75 75
      system/acp/sections/servers/samp.php
  87. 135 135
      system/acp/sections/servers/search.php
  88. 279 279
      system/acp/sections/servers/server.php
  89. 299 299
      system/acp/sections/tarifs/add.php
  90. 56 56
      system/acp/sections/tarifs/copy.php
  91. 7 7
      system/acp/sections/tarifs/delete.php
  92. 48 48
      system/acp/sections/tarifs/index.php
  93. 73 73
      system/acp/sections/tarifs/search.php
  94. 51 51
      system/acp/sections/tarifs/stats.php
  95. 353 353
      system/acp/sections/tarifs/tarif.php
  96. 57 57
      system/acp/sections/units/add.php
  97. 51 51
      system/acp/sections/units/delete.php
  98. 22 22
      system/acp/sections/units/index.php
  99. 101 101
      system/acp/sections/units/loading.php
  100. 47 47
      system/acp/sections/units/stats.php

+ 33 - 33
acp/index.php

@@ -1,28 +1,28 @@
 <?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')) {
@@ -30,22 +30,22 @@
     }
     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'];
 ?>

+ 28 - 28
system/acp/distributor.php

@@ -1,8 +1,8 @@
 <?php
     if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+        exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
 
-	$device = '!mobile';
+    $device = '!mobile';
 
     // Парсинг адреса
     $url = is_array(sys::url()) ? sys::url() : array();
@@ -14,7 +14,7 @@
     $page = array_key_exists('page', $url) ? sys::int($url['page']) : 1;
     $route = $route == '' ? 'index' : $route;
 
-	$auth = false;
+    $auth = false;
 
     // Проверка cookie на авторизацию
     $aAuth = array();
@@ -44,22 +44,22 @@
         }
     }
 
-	if(!$auth)
-		exit(header('Refresh: 0; URL=http://'.$cfg['url'].'/403'));
+    if(!$auth)
+        exit(header('Refresh: 0; URL=http://'.$cfg['url'].'/403'));
 
     // Подключение файла
     if(in_array($route, $aRoute))
         include(ENG.$route.'.php');
     else{
-		$route = 'index';
+        $route = 'index';
         include(ENG.'index.php');
-	}
+    }
 
     // Обновление ссылок
-	if(isset($html->arr['main']))
+    if(isset($html->arr['main']))
     {
-		$html->upd(
-			'main',
+        $html->upd(
+            'main',
 
             array(
                 '[cur]',
@@ -78,13 +78,13 @@
                 $cfg['http'].'template/acp/css/',
                 $cfg['http'].'template/acp/images/'
             ),
-		);
-	}
+        );
+    }
 
-	if(isset($html->arr['menu']))
+    if(isset($html->arr['menu']))
     {
-		$html->upd(
-			'menu',
+        $html->upd(
+            'menu',
 
             array(
                 '[acp]',
@@ -101,8 +101,8 @@
                 $cfg['http'].'template/acp/css/',
                 $cfg['http'].'template/acp/images/'
             ),
-		);
-	}
+        );
+    }
 
     // Заготовка выхлопа
     $html->get('all');
@@ -114,20 +114,20 @@
         $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');
+        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);
+        $html->unit('p_'.$route, true);
 
-		unset($aRoute[array_search($route, $aRoute)]);
+        unset($aRoute[array_search($route, $aRoute)]);
 
-		foreach($aRoute as $route)
-			$html->unit('p_'.$route);
+        foreach($aRoute as $route)
+            $html->unit('p_'.$route);
 
         $html->set('main', isset($html->arr['main']) ? $html->arr['main'] : '', true);
 

+ 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');
 ?>

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

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

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

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

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

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

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

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

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

@@ -1,45 +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($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');
 ?>

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

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

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

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

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

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

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

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

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

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

+ 54 - 54
system/acp/sections/addons/search.php

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

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

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

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

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

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

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

+ 56 - 56
system/acp/sections/boost/search.php

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

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

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

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

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

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

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

+ 100 - 100
system/acp/sections/control/search.php

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

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

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

+ 21 - 21
system/acp/sections/jobs/add.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'));
 
-	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' => 'Необходимо заполнить все поля!'));
+        
+        $sql->query('INSERT INTO `jobs` set'
+            .'`name`="'.$aData['name'].'",'
+            .'`job`="'.$aData['job'].'",'
+            .'`desc`="'.$aData['desc'].'",'
+            .'`status`="'.$aData['status'].'",'
+            .'`date`="'.$start_point.'"');
 
-		sys::outjs(array('s' => 'ok'));
-	}
+        sys::outjs(array('s' => 'ok'));
+    }
 
-	$html->get('add', 'sections/jobs');
-	$html->pack('main');
+    $html->get('add', 'sections/jobs');
+    $html->pack('main');
 ?>

+ 30 - 30
system/acp/sections/jobs/edit.php

@@ -1,39 +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'));
 
-	$sql->query('SELECT * FROM `jobs` WHERE `id`="'.$id.'" LIMIT 1');
-	if(!$sql->num())
-		header('Location: '.$cfg['http'].'acp/jobs');
-	$jobs = $sql->get();
+    $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 = [];
+    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('UPDATE `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' => 'Необходимо заполнить все поля!'));
+        
+        $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'));
-	}
+        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);
+    $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');
+        $data = ['id', 'name', 'job', 'desc'];
+        foreach($data as $idata)
+            $html->set($idata, $jobs[$idata]);
+    $html->pack('main');
 ?>

+ 32 - 32
system/acp/sections/jobs/index.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'));
 
-	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');
+    }
 ?>

+ 53 - 53
system/acp/sections/jobs/request.php

@@ -1,64 +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'));
 
-	if($id)
-	{
-		$sql->query('SELECT * FROM `jobs_app` WHERE `id`="'.$id.'" LIMIT 1');
-		$jobs_app = $sql->get();
+    if($id)
+    {
+        $sql->query('SELECT * FROM `jobs_app` WHERE `id`="'.$id.'" LIMIT 1');
+        $jobs_app = $sql->get();
 
-		if($go)
-		{
-			$aData = [];
+        if($go)
+        {
+            $aData = [];
 
-			$data = ['user', 'text', 'contact', 'job'];
-			foreach($data as $idata)
-				$aData[$idata] = isset($_POST[$idata]) ? $_POST[$idata] : '';
+            $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'].'"');
+            $sql->query('UPDATE `jobs_app` set'
+                .'`user`="'.$aData['user'].'",'
+                .'`text`="'.$aData['text'].'",'
+                .'`contact`="'.$aData['contact'].'",'
+                .'`job`="'.$aData['job'].'"');
 
-			sys::outjs(array('s' => 'ok'));
-		}
+            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' => 'Недоступна'
-			];
+        $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'));
+            $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');
-	}
+        $html->get('request', 'sections/jobs');
+            $html->set('list', $list);
+        $html->pack('main');
+    }
 ?>

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

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

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

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

+ 21 - 21
system/acp/sections/logs/buy.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'));
 
-	$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');
 ?>

+ 21 - 21
system/acp/sections/logs/cashout.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'));
 
-	$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');
 ?>

+ 21 - 21
system/acp/sections/logs/extend.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'));
 
-	$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');
 ?>

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

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

+ 21 - 21
system/acp/sections/logs/part.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'));
 
-	$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');
 ?>

+ 21 - 21
system/acp/sections/logs/replenish.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'));
 
-	$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');
 ?>

+ 58 - 58
system/acp/sections/logs/search.php

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

+ 60 - 60
system/acp/sections/logs/sysearch.php

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

+ 26 - 26
system/acp/sections/news/add.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'));
 
-	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'));
 ?>

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

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

+ 31 - 31
system/acp/sections/news/news.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'));
 
-	$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');
 ?>

+ 46 - 46
system/acp/sections/news/search.php

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

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

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

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

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

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

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

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

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

+ 54 - 54
system/acp/sections/notice/search.php

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

+ 18 - 18
system/acp/sections/pages/add.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'));
 
-	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'));
 ?>

+ 25 - 25
system/acp/sections/pages/index.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'));
 
-	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');
+    }
 ?>

+ 23 - 23
system/acp/sections/pages/page.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'));
 
-	$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('id', $id);
+        $html->set('name', htmlspecialchars_decode($page['name']));
 
-		$html->set('text', htmlspecialchars(file_get_contents(FILES.'pages/'.$page['file'])));
+        $html->set('text', htmlspecialchars(file_get_contents(FILES.'pages/'.$page['file'])));
 
-	$html->pack('main');
+    $html->pack('main');
 ?>

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

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

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

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

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

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

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

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

+ 49 - 49
system/acp/sections/promo/search.php

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

+ 27 - 27
system/acp/sections/promo/stats.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'));
 
-	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');
 ?>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@@ -1,43 +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($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');
+    }
 ?>

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

@@ -1,77 +1,77 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
-
-	if($id)
-		include(SEC.'servers/server.php');
-	else{
-		$list = '';
-
-		$status = array(
-			'working' => '<span class="text-green">Работает</span>',
-			'off' => '<span class="text-red">Выключен</span>',
-			'start' => 'Запускается',
-			'restart' => 'Перезапускается',
-			'change' => 'Смена карты',
-			'install' => 'Устанавливается',
-			'reinstall' => 'Переустанавливается',
-			'update' => 'Обновляется',
-			'recovery' => 'Восстанавливается',
-			'overdue' => 'Просрочен',
-			'blocked' => 'Заблокирован'
-		);
-
-		$select = 'WHERE `user`!="-1"';
-		$url_search = '';
-
-		if(isset($url['search']) AND in_array($url['search'], array('unit', 'tarif')))
-		{
-			$select = 'WHERE `'.$url['search'].'`="'.sys::int($url[$url['search']]).'" AND `user`!="-1"';
-			$url_search = '/search/'.$url['search'].'/'.$url['search'].'/'.$url[$url['search']];
-		}
-
-		$sql->query('SELECT `id` FROM `servers` '.$select.' AND `game`="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');
+    }
 ?>

+ 135 - 135
system/acp/sections/servers/search.php

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

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

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

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

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

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

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

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

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

+ 73 - 73
system/acp/sections/tarifs/search.php

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

+ 51 - 51
system/acp/sections/tarifs/stats.php

@@ -1,71 +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'));
 
-	$list = '';
+    $list = '';
 
-	$all_money = 0;
-	$all_money_month = 0;
+    $all_money = 0;
+    $all_money_month = 0;
 
-	$tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name` FROM `tarifs` ORDER BY `id` ASC');
-	while($tarif = $sql->get($tarifs))
-	{
-		$servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `tarif`="'.$tarif['id'].'"');
-		$all_servers = $sql->num($servers);
+    $tarifs = $sql->query('SELECT `id`, `unit`, `game`, `name` FROM `tarifs` ORDER BY `id` ASC');
+    while($tarif = $sql->get($tarifs))
+    {
+        $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `tarif`="'.$tarif['id'].'"');
+        $all_servers = $sql->num($servers);
 
-		$money_all = 0;
-		$money_month = 0;
+        $money_all = 0;
+        $money_month = 0;
 
-		$time = date('j', $start_point)*86400;
+        $time = date('j', $start_point)*86400;
 
-		while($server = $sql->get($servers))
-		{
-			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1');
-			if(!$sql->num())
-				continue;
+        while($server = $sql->get($servers))
+        {
+            $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1');
+            if(!$sql->num())
+                continue;
 
-			$sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\'');
-			while($logs = $sql->get())
-			{
-				$money_all += $logs['money'];
+            $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\'');
+            while($logs = $sql->get())
+            {
+                $money_all += $logs['money'];
 
-				if($logs['date'] >= ($start_point-$time))
-					$money_month += $logs['money'];
-			}
-		}
+                if($logs['date'] >= ($start_point-$time))
+                    $money_month += $logs['money'];
+            }
+        }
 
-		if($money_all < 1)
-			continue;
+        if($money_all < 1)
+            continue;
 
-		$all_money += $money_all;
-		$all_money_month += $money_month;
+        $all_money += $money_all;
+        $all_money_month += $money_month;
 
-		$sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$tarif['id'].'" AND `time`<"'.$start_point.'"');
-		$overdue_servers = $sql->num();
+        $sql->query('SELECT `id` FROM `servers` WHERE `tarif`="'.$tarif['id'].'" AND `time`<"'.$start_point.'"');
+        $overdue_servers = $sql->num();
 
-		$sql->query('SELECT `name` FROM `units` WHERE `id`="'.$tarif['unit'].'" LIMIT 1');
-		$unit = $sql->get();
+        $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>'.$unit['name'].'</td>';
-			$list .= '<td class="text-center">'.$all_servers.' шт./'.$overdue_servers.' шт.</td>';
-			$list .= '<td class="text-center">'.$money_all.' '.$cfg['currency'].'</td>';
-			$list .= '<td class="text-center">'.$money_month.' '.$cfg['currency'].'</td>';
-			$list .= '<td class="text-center">'.strtoupper($tarif['game']).'</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>'.$unit['name'].'</td>';
+            $list .= '<td class="text-center">'.$all_servers.' шт./'.$overdue_servers.' шт.</td>';
+            $list .= '<td class="text-center">'.$money_all.' '.$cfg['currency'].'</td>';
+            $list .= '<td class="text-center">'.$money_month.' '.$cfg['currency'].'</td>';
+            $list .= '<td class="text-center">'.strtoupper($tarif['game']).'</td>';
+        $list .= '</tr>';
+    }
 
-	$html->get('stats', 'sections/tarifs');
+    $html->get('stats', 'sections/tarifs');
 
-		$html->set('list', $list);
+        $html->set('list', $list);
 
-		$html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8'));
+        $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8'));
 
-		$html->set('all_money', $all_money);
-		$html->set('all_money_month', $all_money_month);
-		$html->set('cur', $cfg['currency']);
+        $html->set('all_money', $all_money);
+        $html->set('all_money_month', $all_money_month);
+        $html->set('cur', $cfg['currency']);
 
-	$html->pack('main');
+    $html->pack('main');
 ?>

+ 353 - 353
system/acp/sections/tarifs/tarif.php

@@ -1,485 +1,485 @@
 <?php
-	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();
-
-	if($go)
-	{
-		$aData = array();
-
-		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $tarif['name'];
-		$aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $tarif['unit'];
-		$aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : $tarif['game'];
-		$aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $tarif['slots'];
-		$aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : $tarif['posts'];
-		$aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : $tarif['hostname'];
-		$aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $tarif['packs'];
-		$aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : $tarif['path'];
-		$aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : $tarif['install'];
-		$aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : $tarif['update'];
-		$aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : $tarif['fps'];
-		$aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : $tarif['tickrate'];
-		$aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : $tarif['ram'];
-		$aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : $tarif['param_fix'];
-		$aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $tarif['time'];
-		$aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : $tarif['timext'];
-		$aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $tarif['test'];
-		$aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : $tarif['tests'];
-		$aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $tarif['discount'];
-		$aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : $tarif['map'];
-		$aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : $tarif['ftp'];
-		$aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : $tarif['plugins'];
-		$aData['console'] = isset($_POST['console']) ? $_POST['console'] : $tarif['console'];
-		$aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : $tarif['stats'];
-		$aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : $tarif['copy'];
-		$aData['web'] = isset($_POST['web']) ? $_POST['web'] : $tarif['web'];
-		$aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : $tarif['plugins_install'];
-		$aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $tarif['hdd'];
-		$aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : $tarif['autostop'];
-		$aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : $tarif['price'];
-		$aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : $tarif['core_fix'];
-		$aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : $tarif['ip'];
-		$aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : $tarif['show'];
-		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $tarif['sort'];
+    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();
+
+    if($go)
+    {
+        $aData = array();
+
+        $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : $tarif['name'];
+        $aData['unit'] = isset($_POST['unit']) ? sys::int($_POST['unit']) : $tarif['unit'];
+        $aData['game'] = isset($_POST['game']) ? trim($_POST['game']) : $tarif['game'];
+        $aData['slots'] = isset($_POST['slots']) ? trim($_POST['slots']) : $tarif['slots'];
+        $aData['posts'] = isset($_POST['posts']) ? trim($_POST['posts']) : $tarif['posts'];
+        $aData['hostname'] = isset($_POST['hostname']) ? trim($_POST['hostname']) : $tarif['hostname'];
+        $aData['packs'] = isset($_POST['packs']) ? trim($_POST['packs']) : $tarif['packs'];
+        $aData['path'] = isset($_POST['path']) ? trim($_POST['path']) : $tarif['path'];
+        $aData['install'] = isset($_POST['install']) ? trim($_POST['install']) : $tarif['install'];
+        $aData['update'] = isset($_POST['update']) ? trim($_POST['update']) : $tarif['update'];
+        $aData['fps'] = isset($_POST['fps']) ? trim($_POST['fps']) : $tarif['fps'];
+        $aData['tickrate'] = isset($_POST['tickrate']) ? trim($_POST['tickrate']) : $tarif['tickrate'];
+        $aData['ram'] = isset($_POST['ram']) ? trim($_POST['ram']) : $tarif['ram'];
+        $aData['param_fix'] = isset($_POST['param_fix']) ? trim($_POST['param_fix']) : $tarif['param_fix'];
+        $aData['time'] = isset($_POST['time']) ? trim($_POST['time']) : $tarif['time'];
+        $aData['timext'] = isset($_POST['timext']) ? trim($_POST['timext']) : $tarif['timext'];
+        $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : $tarif['test'];
+        $aData['tests'] = isset($_POST['tests']) ? sys::int($_POST['tests']) : $tarif['tests'];
+        $aData['discount'] = isset($_POST['discount']) ? sys::int($_POST['discount']) : $tarif['discount'];
+        $aData['map'] = isset($_POST['map']) ? trim($_POST['map']) : $tarif['map'];
+        $aData['ftp'] = isset($_POST['ftp']) ? $_POST['ftp'] : $tarif['ftp'];
+        $aData['plugins'] = isset($_POST['plugins']) ? $_POST['plugins'] : $tarif['plugins'];
+        $aData['console'] = isset($_POST['console']) ? $_POST['console'] : $tarif['console'];
+        $aData['stats'] = isset($_POST['stats']) ? $_POST['stats'] : $tarif['stats'];
+        $aData['copy'] = isset($_POST['copy']) ? $_POST['copy'] : $tarif['copy'];
+        $aData['web'] = isset($_POST['web']) ? $_POST['web'] : $tarif['web'];
+        $aData['plugins_install'] = isset($_POST['plugins_install']) ? trim($_POST['plugins_install']) : $tarif['plugins_install'];
+        $aData['hdd'] = isset($_POST['hdd']) ? sys::int($_POST['hdd']) : $tarif['hdd'];
+        $aData['autostop'] = isset($_POST['autostop']) ? sys::int($_POST['autostop']) : $tarif['autostop'];
+        $aData['price'] = isset($_POST['price']) ? trim($_POST['price']) : $tarif['price'];
+        $aData['core_fix'] = isset($_POST['core_fix']) ? trim($_POST['core_fix']) : $tarif['core_fix'];
+        $aData['ip'] = isset($_POST['ip']) ? trim($_POST['ip']) : $tarif['ip'];
+        $aData['show'] = isset($_POST['show']) ? sys::int($_POST['show']) : $tarif['show'];
+        $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : $tarif['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'] == '' AND !in_array($aData['game'], array('css', 'csgo')))
-			sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки'));
+        if($aData['update'] == '' AND !in_array($aData['game'], array('css', 'csgo')))
+            sys::outjs(array('e' => 'Необходимо указать путь до обновления сборки'));
 
-		if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || (substr($aData['update'], -1) != '/' AND !in_array($aData['game'], array('css', 'csgo'))))
-			sys::outjs(array('e' => 'Пути должны заканчиваться символом "/"'));
+        if(substr($aData['path'], -1) != '/' || substr($aData['install'], -1) != '/' || (substr($aData['update'], -1) != '/' AND !in_array($aData['game'], array('css', 'csgo'))))
+            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('UPDATE `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'].'" WHERE `id`="'.$id.'" LIMIT 1');
+        $sql->query('UPDATE `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'].'" WHERE `id`="'.$id.'" LIMIT 1');
 
-		sys::outjs(array('s' => 'ok'));
-	}
+        sys::outjs(array('s' => 'ok'));
+    }
 
-	$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>';
 
-	$units = str_replace('"'.$tarif['unit'].'"', '"'.$tarif['unit'].'" selected="select"', $units);
-	$games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games);
+    $units = str_replace('"'.$tarif['unit'].'"', '"'.$tarif['unit'].'" selected="select"', $units);
+    $games = str_replace('"'.$tarif['game'].'"', '"'.$tarif['game'].'" selected="select"', $games);
 
-	$html->get('tarif', 'sections/tarifs');
+    $html->get('tarif', '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.':';
-
-			$sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
+            foreach($aPrice as $price)
+                $sprice .= $price.':';
+
+            $sprice = isset($sprice{0}) ? substr($sprice, 0, -1) : '';
 
-			$tarif['price'] = $sprice;
-		}
+            $tarif['price'] = $sprice;
+        }
 
-		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);
-
-		foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section)
-		{
-			if($tarif[$section])
-				$html->unit($section, 1);
-			else
-				$html->unit($section);
-		}
-
-		$packs = '';
-
-		$aPacks = sys::b64djs($tarif['packs']);
-
-		foreach($aPacks as $name => $fullname)
-			$packs .= '"'.$name.'":"'.$fullname.'",';
-
-		$packs = isset($packs{0}) ? substr($packs, 0, -1) : '';
-
-		$html->set('packs', $packs);
-
-		$plugins = '';
-
-		$aPlugins = sys::b64djs($tarif['plugins_install']);
-
-		foreach($aPlugins as $pack => $list)
-			$plugins .= '"'.$pack.'":"'.$list.'",';
+        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);
+
+        foreach(array('ftp', 'plugins', 'console', 'stats', 'copy', 'web') as $section)
+        {
+            if($tarif[$section])
+                $html->unit($section, 1);
+            else
+                $html->unit($section);
+        }
+
+        $packs = '';
+
+        $aPacks = sys::b64djs($tarif['packs']);
+
+        foreach($aPacks as $name => $fullname)
+            $packs .= '"'.$name.'":"'.$fullname.'",';
+
+        $packs = isset($packs{0}) ? substr($packs, 0, -1) : '';
+
+        $html->set('packs', $packs);
+
+        $plugins = '';
+
+        $aPlugins = sys::b64djs($tarif['plugins_install']);
+
+        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');
 ?>

+ 57 - 57
system/acp/sections/units/add.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'));
 
-	if($go)
-	{
-		$aData = array();
+    if($go)
+    {
+        $aData = array();
 
-		$aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
-		$aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : '';
-		$aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : '';
-		$aData['sql_login'] = isset($_POST['sql_login']) ? trim($_POST['sql_login']) : '';
-		$aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : '';
-		$aData['sql_port'] = isset($_POST['sql_port']) ? sys::int($_POST['sql_port']) : 3306;
-		$aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : '';
-		$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['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : 0;
-		$aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : 0;
-		$aData['show'] = isset($_POST['show']) ? $_POST['show'] : 0;
-		$aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : 0;
-		$aData['domain'] = isset($_POST['domain']) ? trim($_POST['domain']) : '';
+        $aData['name'] = isset($_POST['name']) ? trim($_POST['name']) : '';
+        $aData['address'] = isset($_POST['address']) ? trim($_POST['address']) : '';
+        $aData['passwd'] = isset($_POST['passwd']) ? trim($_POST['passwd']) : '';
+        $aData['sql_login'] = isset($_POST['sql_login']) ? trim($_POST['sql_login']) : '';
+        $aData['sql_passwd'] = isset($_POST['sql_passwd']) ? trim($_POST['sql_passwd']) : '';
+        $aData['sql_port'] = isset($_POST['sql_port']) ? sys::int($_POST['sql_port']) : 3306;
+        $aData['sql_ftp'] = isset($_POST['sql_ftp']) ? trim($_POST['sql_ftp']) : '';
+        $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['ram'] = isset($_POST['ram']) ? sys::int($_POST['ram']) : 0;
+        $aData['test'] = isset($_POST['test']) ? sys::int($_POST['test']) : 0;
+        $aData['show'] = isset($_POST['show']) ? $_POST['show'] : 0;
+        $aData['sort'] = isset($_POST['sort']) ? sys::int($_POST['sort']) : 0;
+        $aData['domain'] = isset($_POST['domain']) ? trim($_POST['domain']) : '';
 
-		foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') as $game)
-			$aData[$game] = (string) $aData[$game] == 'on' ? '1' : '0';
+        foreach(array('cs', 'cssold', 'css', 'csgo', 'samp', 'crmp', 'mta', 'mc') 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' => 'Необходимо заполнить все поля'));
 
-		include(LIB.'ssh.php');
+        include(LIB.'ssh.php');
 
-		if(!$ssh->auth($aData['passwd'], $aData['address']))
-			sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
+        if(!$ssh->auth($aData['passwd'], $aData['address']))
+            sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
 
-		$sql->query('INSERT INTO `units` set '
-			.'`name`="'.htmlspecialchars($aData['name']).'",'
-			.'`address`="'.$aData['address'].'",'
-			.'`passwd`="'.$aData['passwd'].'",'
-			.'`sql_login`="'.$aData['sql_login'].'",'
-			.'`sql_passwd`="'.$aData['sql_passwd'].'",'
-			.'`sql_port`="'.$aData['sql_port'].'",'
-			.'`sql_ftp`="'.$aData['sql_ftp'].'",'
-			.'`cs`="'.$aData['cs'].'",'
-			.'`cssold`="'.$aData['cssold'].'",'
-			.'`css`="'.$aData['css'].'",'
-			.'`csgo`="'.$aData['csgo'].'",'
-			.'`samp`="'.$aData['samp'].'",'
-			.'`crmp`="'.$aData['crmp'].'",'
-			.'`mta`="'.$aData['mta'].'",'
-			.'`mc`="'.$aData['mc'].'",'
-			.'`ram`="'.$aData['ram'].'",'
-			.'`test`="'.$aData['test'].'",'
-			.'`show`="'.$aData['show'].'",'
-			.'`sort`="'.$aData['sort'].'",'
-			.'`domain`="'.$aData['domain'].'"');
+        $sql->query('INSERT INTO `units` set '
+            .'`name`="'.htmlspecialchars($aData['name']).'",'
+            .'`address`="'.$aData['address'].'",'
+            .'`passwd`="'.$aData['passwd'].'",'
+            .'`sql_login`="'.$aData['sql_login'].'",'
+            .'`sql_passwd`="'.$aData['sql_passwd'].'",'
+            .'`sql_port`="'.$aData['sql_port'].'",'
+            .'`sql_ftp`="'.$aData['sql_ftp'].'",'
+            .'`cs`="'.$aData['cs'].'",'
+            .'`cssold`="'.$aData['cssold'].'",'
+            .'`css`="'.$aData['css'].'",'
+            .'`csgo`="'.$aData['csgo'].'",'
+            .'`samp`="'.$aData['samp'].'",'
+            .'`crmp`="'.$aData['crmp'].'",'
+            .'`mta`="'.$aData['mta'].'",'
+            .'`mc`="'.$aData['mc'].'",'
+            .'`ram`="'.$aData['ram'].'",'
+            .'`test`="'.$aData['test'].'",'
+            .'`show`="'.$aData['show'].'",'
+            .'`sort`="'.$aData['sort'].'",'
+            .'`domain`="'.$aData['domain'].'"');
 
-		sys::outjs(array('s' => $sql->id()));
-	}
+        sys::outjs(array('s' => $sql->id()));
+    }
 
-	$html->get('add', 'sections/units');
+    $html->get('add', 'sections/units');
 
-	$html->pack('main');
+    $html->pack('main');
 ?>

+ 51 - 51
system/acp/sections/units/delete.php

@@ -1,67 +1,67 @@
 <?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']) AND $url['delete'] == 'all')
-	{
-		$sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1');
-		$panel = $sql->get();
+    if(isset($url['delete']) AND $url['delete'] == 'all')
+    {
+        $sql->query('SELECT `address`, `passwd` FROM `panel` LIMIT 1');
+        $panel = $sql->get();
 
-		include(LIB.'ssh.php');
+        include(LIB.'ssh.php');
 
-		if(!$ssh->auth($panel['passwd'], $panel['address']))
-			sys::outjs(array('e' => 'PANEL не удалось создать связь.'));
+        if(!$ssh->auth($panel['passwd'], $panel['address']))
+            sys::outjs(array('e' => 'PANEL не удалось создать связь.'));
 
-		$servers = $sql->query('SELECT `id`, `user`, `game` FROM `servers` WHERE `unit`="'.$id.'"');
-		while($server = $sql->get($servers))
-		{
-			$crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"');
-			while($cron = $sql->get($crons))
-			{
-				$ssh->set('echo "" >> /etc/crontab && cat /etc/crontab');
-				$crontab = str_replace($cron['cron'], '', $ssh->get());
+        $servers = $sql->query('SELECT `id`, `user`, `game` FROM `servers` WHERE `unit`="'.$id.'"');
+        while($server = $sql->get($servers))
+        {
+            $crons = $sql->query('SELECT `id`, `cron` FROM `crontab` WHERE `server`="'.$server['id'].'"');
+            while($cron = $sql->get($crons))
+            {
+                $ssh->set('echo "" >> /etc/crontab && cat /etc/crontab');
+                $crontab = str_replace($cron['cron'], '', $ssh->get());
 
-				// Временный файл
-				$temp = sys::temp($crontab);
+                // Временный файл
+                $temp = sys::temp($crontab);
 
-				$ssh->setfile($temp, '/etc/crontab', 0644);
+                $ssh->setfile($temp, '/etc/crontab', 0644);
 
-				$ssh->set("sed -i '/^$/d' /etc/crontab");
-				$ssh->set('crontab -u root /etc/crontab');
+                $ssh->set("sed -i '/^$/d' /etc/crontab");
+                $ssh->set('crontab -u root /etc/crontab');
 
-				unlink($temp);
+                unlink($temp);
 
-				$sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1');
-			}
+                $sql->query('DELETE FROM `crontab` WHERE `id`="'.$cron['id'].'" LIMIT 1');
+            }
 
-			$helps = $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$server['id'].'"');
-			while($help = $sql->get($helps))
-			{
-				$sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"');
-				$sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1');
-			}
+            $helps = $sql->query('SELECT `id` FROM `help` WHERE `type`="server" AND `service`="'.$server['id'].'"');
+            while($help = $sql->get($helps))
+            {
+                $sql->query('DELETE FROM `help_dialogs` WHERE `help`="'.$help['id'].'"');
+                $sql->query('DELETE FROM `help` WHERE `id`="'.$help['id'].'" LIMIT 1');
+            }
 
-			$sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1');
-			$sql->query('DELETE FROM `address_buy` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `logs_sys` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `copy` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'" LIMIT 1');
-			$sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"');
-			$sql->query('DELETE FROM `web` WHERE `server`="'.$server['id'].'"');
-		}
+            $sql->query('DELETE FROM `admins_'.$server['game'].'` WHERE `server`="'.$server['id'].'" LIMIT 1');
+            $sql->query('DELETE FROM `address_buy` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `logs_sys` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `owners` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `copy` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `plugins_install` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `graph` WHERE `server`="'.$server['id'].'" LIMIT 1');
+            $sql->query('DELETE FROM `graph_day` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `graph_hour` WHERE `server`="'.$server['id'].'"');
+            $sql->query('DELETE FROM `web` WHERE `server`="'.$server['id'].'"');
+        }
 
-		$sql->query('DELETE FROM `address` WHERE `unit`="'.$id.'"');
-		$sql->query('DELETE FROM `tarifs` WHERE `unit`="'.$id.'"');
-	}else{
-		$sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$id.'" LIMIT 1');
-		if($sql->num())
-			sys::outjs(array('e' => 'Нельзя удалить локацию с серверами.'));
-	}
+        $sql->query('DELETE FROM `address` WHERE `unit`="'.$id.'"');
+        $sql->query('DELETE FROM `tarifs` WHERE `unit`="'.$id.'"');
+    }else{
+        $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$id.'" LIMIT 1');
+        if($sql->num())
+            sys::outjs(array('e' => 'Нельзя удалить локацию с серверами.'));
+    }
 
-	$sql->query('DELETE FROM `units` WHERE `id`="'.$id.'" LIMIT 1');
+    $sql->query('DELETE FROM `units` WHERE `id`="'.$id.'" LIMIT 1');
 
-	sys::outjs(array('s' => 'ok'));
+    sys::outjs(array('s' => 'ok'));
 ?>

+ 22 - 22
system/acp/sections/units/index.php

@@ -1,29 +1,29 @@
 <?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.'units/unit.php');
-	else{
-		$list = '';
+    if($id)
+        include(SEC.'units/unit.php');
+    else{
+        $list = '';
 
-		$sql->query('SELECT `id`, `name`, `address`, `show`, `domain` FROM `units` ORDER BY `id` ASC');
-		while($unit = $sql->get())
-		{
-			$list .= '<tr>';
-				$list .= '<td>'.$unit['id'].'</td>';
-				$list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
-				$list .= '<td>'.$unit['address'].'</td>';
-				$list .= '<td>'.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').'</td>';
-				$list .= '<td>'.$unit['domain'].'</td>';
-				$list .= '<td><a href="#" onclick="return units_delete(\''.$unit['id'].'\')" class="text-red">Удалить</a></td>';
-			$list .= '</tr>';
-		}
+        $sql->query('SELECT `id`, `name`, `address`, `show`, `domain` FROM `units` ORDER BY `id` ASC');
+        while($unit = $sql->get())
+        {
+            $list .= '<tr>';
+                $list .= '<td>'.$unit['id'].'</td>';
+                $list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
+                $list .= '<td>'.$unit['address'].'</td>';
+                $list .= '<td>'.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').'</td>';
+                $list .= '<td>'.$unit['domain'].'</td>';
+                $list .= '<td><a href="#" onclick="return units_delete(\''.$unit['id'].'\')" class="text-red">Удалить</a></td>';
+            $list .= '</tr>';
+        }
 
-		$html->get('index', 'sections/units');
+        $html->get('index', 'sections/units');
 
-			$html->set('list', $list);
+            $html->set('list', $list);
 
-		$html->pack('main');
-	}
+        $html->pack('main');
+    }
 ?>

+ 101 - 101
system/acp/sections/units/loading.php

@@ -1,103 +1,103 @@
 <?php
-	if(!DEFINED('EGP'))
-		exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
-
-	if($id)
-	{
-		$sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1');
-		$unit = $sql->get();
-
-		include(LIB.'ssh.php');
-
-		if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit', 'geo', 'ungeo')))
-		{
-			if(!$ssh->auth($unit['passwd'], $unit['address']))
-				sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
-
-			switch($url['service'])
-			{
-				case 'unit':
-					$ssh->set('screen -dmS reboot reboot');
-				break;
-
-				case 'geo':
-					$ssh->set('iptables-restore < /etc/firewall/geo.conf; iptables-restore << '.$cfg['iptables']);
-
-					$sql->query('UPDATE `units` set `ddos`="1" WHERE `id`="'.$id.'" LIMIT 1');
-				break;
-
-				case 'ungeo':
-					$ssh->set('iptables-restore < /etc/firewall/ungeo.conf; iptables-restore << '.$cfg['iptables'].'; iptables-restore << /root/'.$cfg['iptables'].'_geo');
-
-					$sql->query('UPDATE `units` set `ddos`="0" WHERE `id`="'.$id.'" LIMIT 1');
-				break;
-
-				default:
-					$ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart');
-			}
-
-			sys::outjs(array('s' => 'ok'));
-		}
-
-		$aData = array(
-			'cpu' => '0%',
-			'ram' => '0%',
-			'hdd' => '0%',
-			'apache' => 'unknown',
-			'nginx' => 'unknown',
-			'mysql' => 'unknown',
-			'uptime' => 'unknown',
-			'ssh' => 'error'
-		);
-
-		if(!$ssh->auth($unit['passwd'], $unit['address']))
-			sys::outjs($aData);
-
-		$aData['ssh'] = '<i class="fa fa-retweet pointer" id="units_restart(\'unit\')" onclick="return units_restart(\''.$id.'\', \'unit\')"></i>';
-
-		$stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`');
-		$aData['ram'] = ceil(sys::ram_load($stat_ram)).'%';
-
-		$aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1');
-
-		$aData['apache'] = sys::status($ssh->get('service apache2 status')) ? 'Работает' : '<a href="#" onclick="return units_restart(\''.$id.'\', \'apache2\')">Поднять</a>';
-		$aData['nginx'] = sys::status($ssh->get('service nginx status')) ? 'Работает' : '<a href="#" onclick="return units_restart(\''.$id.'\', \'nginx\')">Поднять</a>';
-		$aData['mysql'] = sys::status($ssh->get('service mysql status')) ? 'Работает' : '<a href="#" onclick="return units_restart\''.$id.'\', (\'mysql\')">Поднять</a>';
-		
-		$time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\''));
-		$aData['uptime'] = sys::uptime_load($time);
-
-		$aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%';
-
-		sys::outjs($aData);
-	}
-
-	$loads = '';
-	$list = '';
-
-	$sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
-	while($unit = $sql->get())
-	{
-		$list .= '<tr>';
-			$list .= '<td>'.$unit['id'].'</td>';
-			$list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
-			$list .= '<td id="cpu_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="ram_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="hdd_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="apache_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="nginx_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="mysql_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="uptime_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-			$list .= '<td id="ssh_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
-		$list .= '</tr>';
-
-		$loads .= 'units_load(\''.$unit['id'].'\', false);';
-	}
-
-	$html->get('loading', 'sections/units');
-
-		$html->set('list', $list);
-		$html->set('loads', $loads);
-
-	$html->pack('main');
+    if(!DEFINED('EGP'))
+        exit(header('Refresh: 0; URL=http://'.$_SERVER['SERVER_NAME'].'/404'));
+
+    if($id)
+    {
+        $sql->query('SELECT `address`, `passwd` FROM `units` WHERE `id`="'.$id.'" LIMIT 1');
+        $unit = $sql->get();
+
+        include(LIB.'ssh.php');
+
+        if(isset($url['service']) AND in_array($url['service'], array('apache2', 'nginx', 'mysql', 'unit', 'geo', 'ungeo')))
+        {
+            if(!$ssh->auth($unit['passwd'], $unit['address']))
+                sys::outjs(array('e' => 'Не удалось создать связь с локацией'));
+
+            switch($url['service'])
+            {
+                case 'unit':
+                    $ssh->set('screen -dmS reboot reboot');
+                break;
+
+                case 'geo':
+                    $ssh->set('iptables-restore < /etc/firewall/geo.conf; iptables-restore << '.$cfg['iptables']);
+
+                    $sql->query('UPDATE `units` set `ddos`="1" WHERE `id`="'.$id.'" LIMIT 1');
+                break;
+
+                case 'ungeo':
+                    $ssh->set('iptables-restore < /etc/firewall/ungeo.conf; iptables-restore << '.$cfg['iptables'].'; iptables-restore << /root/'.$cfg['iptables'].'_geo');
+
+                    $sql->query('UPDATE `units` set `ddos`="0" WHERE `id`="'.$id.'" LIMIT 1');
+                break;
+
+                default:
+                    $ssh->set('screen -dmS sr_'.$url['service'].' service '.$url['service'].' restart');
+            }
+
+            sys::outjs(array('s' => 'ok'));
+        }
+
+        $aData = array(
+            'cpu' => '0%',
+            'ram' => '0%',
+            'hdd' => '0%',
+            'apache' => 'unknown',
+            'nginx' => 'unknown',
+            'mysql' => 'unknown',
+            'uptime' => 'unknown',
+            'ssh' => 'error'
+        );
+
+        if(!$ssh->auth($unit['passwd'], $unit['address']))
+            sys::outjs($aData);
+
+        $aData['ssh'] = '<i class="fa fa-retweet pointer" id="units_restart(\'unit\')" onclick="return units_restart(\''.$id.'\', \'unit\')"></i>';
+
+        $stat_ram = $ssh->get('echo `cat /proc/meminfo | grep MemTotal | awk \'{print $2}\'; cat /proc/meminfo | grep MemFree | awk \'{print $2}\'; cat /proc/meminfo | grep Buffers | awk \'{print $2}\'; cat /proc/meminfo | grep Cached | grep -v SwapCached | awk \'{print $2}\'`');
+        $aData['ram'] = ceil(sys::ram_load($stat_ram)).'%';
+
+        $aData['hdd'] = $ssh->get('df -P / | awk \'{print $5}\' | tail -1');
+
+        $aData['apache'] = sys::status($ssh->get('service apache2 status')) ? 'Работает' : '<a href="#" onclick="return units_restart(\''.$id.'\', \'apache2\')">Поднять</a>';
+        $aData['nginx'] = sys::status($ssh->get('service nginx status')) ? 'Работает' : '<a href="#" onclick="return units_restart(\''.$id.'\', \'nginx\')">Поднять</a>';
+        $aData['mysql'] = sys::status($ssh->get('service mysql status')) ? 'Работает' : '<a href="#" onclick="return units_restart\''.$id.'\', (\'mysql\')">Поднять</a>';
+        
+        $time = ceil($ssh->get('cat /proc/uptime | awk \'{print $1}\''));
+        $aData['uptime'] = sys::uptime_load($time);
+
+        $aData['cpu'] = sys::cpu_load($ssh->get('echo "`ps -A -o pcpu | tail -n+2 | paste -sd+ | bc | awk \'{print $0}\'` `cat /proc/cpuinfo | grep processor | wc -l | awk \'{print $1}\'`"')).'%';
+
+        sys::outjs($aData);
+    }
+
+    $loads = '';
+    $list = '';
+
+    $sql->query('SELECT `id`, `name` FROM `units` ORDER BY `id` ASC');
+    while($unit = $sql->get())
+    {
+        $list .= '<tr>';
+            $list .= '<td>'.$unit['id'].'</td>';
+            $list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
+            $list .= '<td id="cpu_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="ram_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="hdd_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="apache_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="nginx_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="mysql_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="uptime_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+            $list .= '<td id="ssh_'.$unit['id'].'" class="text-center"><i class="fa fa-spinner fa-pulse fa-1x fa-fw margin-bottom"></i></td>';
+        $list .= '</tr>';
+
+        $loads .= 'units_load(\''.$unit['id'].'\', false);';
+    }
+
+    $html->get('loading', 'sections/units');
+
+        $html->set('list', $list);
+        $html->set('loads', $loads);
+
+    $html->pack('main');
 ?>

+ 47 - 47
system/acp/sections/units/stats.php

@@ -1,65 +1,65 @@
 <?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 = '';
 
-	$all_money = 0;
-	$all_money_month = 0;
+    $all_money = 0;
+    $all_money_month = 0;
 
-	$units = $sql->query('SELECT `id`, `name`, `show` FROM `units` ORDER BY `id` ASC');
-	while($unit = $sql->get($units))
-	{
-		$servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `unit`="'.$unit['id'].'"');
-		$all_servers = $sql->num($servers);
+    $units = $sql->query('SELECT `id`, `name`, `show` FROM `units` ORDER BY `id` ASC');
+    while($unit = $sql->get($units))
+    {
+        $servers = $sql->query('SELECT `id`, `user` FROM `servers` WHERE `unit`="'.$unit['id'].'"');
+        $all_servers = $sql->num($servers);
 
-		$money_all = 0;
-		$money_month = 0;
+        $money_all = 0;
+        $money_month = 0;
 
-		$time = date('j', $start_point)*86400;
+        $time = date('j', $start_point)*86400;
 
-		while($server = $sql->get($servers))
-		{
-			$sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1');
-			if(!$sql->num())
-				continue;
+        while($server = $sql->get($servers))
+        {
+            $sql->query('SELECT `id` FROM `users` WHERE `id`="'.$server['user'].'" AND `group`="user" LIMIT 1');
+            if(!$sql->num())
+                continue;
 
-			$sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\'');
-			while($logs = $sql->get())
-			{
-				$money_all += $logs['money'];
+            $sql->query('SELECT `money`, `date` FROM `logs` WHERE `user`="'.$server['user'].'" AND (`type`="buy" OR `type`="extend") AND `text` LIKE \'%(сервер: #'.$server['id'].')%\'');
+            while($logs = $sql->get())
+            {
+                $money_all += $logs['money'];
 
-				if($logs['date'] >= ($start_point-$time))
-					$money_month += $logs['money'];
-			}
-		}
+                if($logs['date'] >= ($start_point-$time))
+                    $money_month += $logs['money'];
+            }
+        }
 
-		$all_money += $money_all;
-		$all_money_month += $money_month;
+        $all_money += $money_all;
+        $all_money_month += $money_month;
 
-		$sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit['id'].'" AND `time`<"'.$start_point.'"');
-		$overdue_servers = $sql->num();
+        $sql->query('SELECT `id` FROM `servers` WHERE `unit`="'.$unit['id'].'" AND `time`<"'.$start_point.'"');
+        $overdue_servers = $sql->num();
 
-		$list .= '<tr>';
-			$list .= '<td>'.$unit['id'].'</td>';
-			$list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
-			$list .= '<td>'.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').'</td>';
-			$list .= '<td>'.$all_servers.' шт.</td>';
-			$list .= '<td>'.$overdue_servers.' шт.</td>';
-			$list .= '<td>'.$money_all.' '.$cfg['currency'].'</td>';
-			$list .= '<td>'.$money_month.' '.$cfg['currency'].'</td>';
-		$list .= '</tr>';
-	}
+        $list .= '<tr>';
+            $list .= '<td>'.$unit['id'].'</td>';
+            $list .= '<td><a href="'.$cfg['http'].'acp/units/id/'.$unit['id'].'">'.$unit['name'].'</a></td>';
+            $list .= '<td>'.($unit['show'] == '1' ? 'Доступна' : 'Недоступна').'</td>';
+            $list .= '<td>'.$all_servers.' шт.</td>';
+            $list .= '<td>'.$overdue_servers.' шт.</td>';
+            $list .= '<td>'.$money_all.' '.$cfg['currency'].'</td>';
+            $list .= '<td>'.$money_month.' '.$cfg['currency'].'</td>';
+        $list .= '</tr>';
+    }
 
-	$html->get('stats', 'sections/units');
+    $html->get('stats', 'sections/units');
 
-		$html->set('list', $list);
+        $html->set('list', $list);
 
-		$html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8'));
+        $html->set('month', mb_strtolower(params::$aNameMonth[sys::int(date('n', $start_point))], 'UTF-8'));
 
-		$html->set('all_money', $all_money);
-		$html->set('all_money_month', $all_money_month);
-		$html->set('cur', $cfg['currency']);
+        $html->set('all_money', $all_money);
+        $html->set('all_money_month', $all_money_month);
+        $html->set('cur', $cfg['currency']);
 
-	$html->pack('main');
+    $html->pack('main');
 ?>

Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů