diff --git a/acp/index.php b/acp/index.php
index 33dbdc8..617deb8 100644
--- a/acp/index.php
+++ b/acp/index.php
@@ -7,17 +7,17 @@ date_default_timezone_set('Europe/Moscow');
@ini_set('html_errors', FALSE);
@ini_set('error_reporting', E_ALL);
-DEFINE('EGP', TRUE);
-DEFINE('ROOT', '../');
-DEFINE('SYS', ROOT . 'system/');
-DEFINE('ACP', ROOT . 'system/acp/');
-DEFINE('TPL', ROOT . 'acp/template/');
-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('DIR', '../');
+define('SYS', DIR . 'system/');
+define('ACP', DIR . 'system/acp/');
+define('TPL', DIR . 'acp/template/');
+define('TEMP', DIR . 'temp/');
+define('FILES', DIR . 'files/');
+define('DATA', SYS . 'data/');
+define('LIB', SYS . 'library/');
+define('ENG', SYS . 'acp/engine/');
+define('SEC', SYS . 'acp/sections/');
$start_point = $_SERVER['REQUEST_TIME'];
@@ -28,10 +28,10 @@ $mcache = new Memcache;
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
// Composer
-if (!file_exists(ROOT . 'vendor/autoload.php')) {
+if (!file_exists(DIR . 'vendor/autoload.php')) {
die('Please install composer and run composer install
');
}
-require(ROOT . 'vendor/autoload.php');
+require(DIR . 'vendor/autoload.php');
// Настройки
include(DATA . 'config.php');
diff --git a/cron.php b/cron.php
index 1ac428d..31fc5eb 100644
--- a/cron.php
+++ b/cron.php
@@ -5,18 +5,17 @@ date_default_timezone_set('Europe/Moscow');
@ini_set('html_errors', TRUE);
@ini_set('error_reporting', E_ALL);
-DEFINE('EGP', TRUE);
-DEFINE('DIR', __DIR__);
-DEFINE('ROOT', DIR . '/');
-DEFINE('SYS', ROOT . 'system/');
-DEFINE('TPL', ROOT . 'template/');
-DEFINE('TEMP', ROOT . 'temp/');
-DEFINE('FILES', ROOT . 'files/');
-DEFINE('DATA', SYS . 'data/');
-DEFINE('LIB', SYS . 'library/');
-DEFINE('ENG', SYS . 'engine/');
-DEFINE('SEC', SYS . 'sections/');
-DEFINE('CRON', LIB . 'cron/');
+define('EGP', TRUE);
+define('DIR', __DIR__ . '/');
+define('SYS', DIR . 'system/');
+define('TPL', DIR . 'template/');
+define('TEMP', DIR . 'temp/');
+define('FILES', DIR . 'files/');
+define('DATA', SYS . 'data/');
+define('LIB', SYS . 'library/');
+define('ENG', SYS . 'engine/');
+define('SEC', SYS . 'sections/');
+define('CRON', LIB . 'cron/');
$start_point = $_SERVER['REQUEST_TIME'];
@@ -24,10 +23,10 @@ $mcache = new Memcache;
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка: не удалось создать связь с Memcache.' . PHP_EOL);
// Composer
-if (!file_exists(ROOT . 'vendor/autoload.php')) {
+if (!file_exists(DIR . 'vendor/autoload.php')) {
die('Please install composer and run composer install
');
}
-require(ROOT . 'vendor/autoload.php');
+require(DIR . 'vendor/autoload.php');
// Настройки
include(DATA . 'config.php');
diff --git a/index.php b/index.php
index 4e44839..b93e0cf 100644
--- a/index.php
+++ b/index.php
@@ -8,17 +8,16 @@ date_default_timezone_set('Europe/Moscow');
@ini_set('html_errors', TRUE);
@ini_set('error_reporting', E_ALL);
-DEFINE('EGP', TRUE);
-DEFINE('DIR', dirname('index.php'));
-DEFINE('ROOT', DIR . '/');
-DEFINE('SYS', ROOT . 'system/');
-DEFINE('TPL', ROOT . 'template/');
-DEFINE('TEMP', ROOT . 'temp/');
-DEFINE('FILES', ROOT . 'files/');
-DEFINE('DATA', SYS . 'data/');
-DEFINE('LIB', SYS . 'library/');
-DEFINE('ENG', SYS . 'engine/');
-DEFINE('SEC', SYS . 'sections/');
+define('EGP', TRUE);
+define('DIR', __DIR__ . '/');
+define('SYS', DIR . 'system/');
+define('TPL', DIR . 'template/');
+define('TEMP', DIR . 'temp/');
+define('FILES', DIR . 'files/');
+define('DATA', SYS . 'data/');
+define('LIB', SYS . 'library/');
+define('ENG', SYS . 'engine/');
+define('SEC', SYS . 'sections/');
$start_point = $_SERVER['REQUEST_TIME'];
@@ -29,10 +28,10 @@ $mcache = new Memcache;
$mcache->connect('127.0.0.1', 11211) or exit('Ошибка подключения Memcache');
// Composer
-if (!file_exists(ROOT . 'vendor/autoload.php')) {
+if (!file_exists(DIR . 'vendor/autoload.php')) {
die('Please install composer and run composer install
');
}
-require(ROOT . 'vendor/autoload.php');
+require(DIR . 'vendor/autoload.php');
// Настройки
include(DATA . 'config.php');
diff --git a/system/acp/distributor.php b/system/acp/distributor.php
index 0e6c532..19d5309 100644
--- a/system/acp/distributor.php
+++ b/system/acp/distributor.php
@@ -15,7 +15,7 @@ $whoops->pushHandler($loggingInConsole);
// логи в файл
$loggingInFile = new \Whoops\Handler\PlainTextHandler();
$loggingInFile->loggerOnly(true);
-$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(ROOT . '/logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
+$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
$whoops->pushHandler($loggingInFile);
// Парсинг адреса
diff --git a/system/acp/sections/users/delete.php b/system/acp/sections/users/delete.php
index 0805d3d..9048ba5 100644
--- a/system/acp/sections/users/delete.php
+++ b/system/acp/sections/users/delete.php
@@ -14,7 +14,7 @@ if (isset($url['delete']) and $url['delete'] == 'all') {
$uploads = $sql->query('SELECT `id`, `name` FROM `help_upload` WHERE `user`="' . $id . '"');
while ($upload = $sql->get($uploads)) {
- @unlink(ROOT . 'upload/' . $upload['name']);
+ @unlink(DIR . 'upload/' . $upload['name']);
$sql->query('DELETE FROM `help_upload` WHERE `id`="' . $upload['id'] . '" LIMIT 1');
}
diff --git a/system/distributor.php b/system/distributor.php
index 78ea99a..15c5e12 100644
--- a/system/distributor.php
+++ b/system/distributor.php
@@ -2,7 +2,6 @@
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
-$device = '!mobile';
// Подключение filp/whoops
$whoops = new \Whoops\Run;
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
@@ -15,7 +14,7 @@ $whoops->pushHandler($loggingInConsole);
// логи в файл
$loggingInFile = new \Whoops\Handler\PlainTextHandler();
$loggingInFile->loggerOnly(true);
-$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(ROOT . '/logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
+$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/enginegp.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
$whoops->pushHandler($loggingInFile);
// Парсинг адреса
diff --git a/system/engine/404.php b/system/engine/404.php
index e6d6abd..6fe78ad 100644
--- a/system/engine/404.php
+++ b/system/engine/404.php
@@ -3,5 +3,5 @@ if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
http_response_code(404);
-exit(file_get_contents(ROOT . '404.html'));
+exit(file_get_contents(DIR . '404.html'));
?>
\ No newline at end of file
diff --git a/system/engine/replenish.php b/system/engine/replenish.php
index 16b5327..baa798c 100644
--- a/system/engine/replenish.php
+++ b/system/engine/replenish.php
@@ -6,7 +6,7 @@ if (!isset($url['response']) and !in_array($url['response'], array('success', 'f
exit();
if ($url['response'] == 'success')
- sys::out(file_get_contents(ROOT . 'success.html'));
+ sys::out(file_get_contents(DIR . 'success.html'));
else
- sys::out(file_get_contents(ROOT . 'fail.html'));
+ sys::out(file_get_contents(DIR . 'fail.html'));
?>
\ No newline at end of file
diff --git a/system/library/acpsystem.php b/system/library/acpsystem.php
index 9de6457..0c26e8f 100644
--- a/system/library/acpsystem.php
+++ b/system/library/acpsystem.php
@@ -699,7 +699,7 @@ class sys
public static function logMessage($message, $logFile = 'enginegp_info', $context = [])
{
$logger = new \Monolog\Logger('EngineGP');
- $logger->pushHandler(new \Monolog\Handler\StreamHandler(ROOT . '/logs/' . $logFile . '.log'));
+ $logger->pushHandler(new \Monolog\Handler\StreamHandler(DIR . 'logs/' . $logFile . '.log'));
$logger->info($message, $context);
}
}
diff --git a/system/library/control/control.php b/system/library/control/control.php
index 72d0f57..736f127 100644
--- a/system/library/control/control.php
+++ b/system/library/control/control.php
@@ -215,7 +215,7 @@ class ctrl
public static function route($server, $inc, $go)
{
- global $device, $start_point;
+ global $start_point;
if (in_array($server['status'], array('install', 'reinstall', 'update', 'recovery'))) {
if ($go)
@@ -232,7 +232,7 @@ class ctrl
public static function cpulist($unit, $core, $count = false)
{
- global $device, $start_point;
+ global $start_point;
include(LIB . 'ssh.php');
diff --git a/system/library/cron.php b/system/library/cron.php
index 53315c9..657b52f 100644
--- a/system/library/cron.php
+++ b/system/library/cron.php
@@ -9,7 +9,7 @@ $whoops->register();
// логи в файл
$loggingInFile = new \Whoops\Handler\PlainTextHandler();
$loggingInFile->loggerOnly(true);
-$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(ROOT . '/logs/cron.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
+$loggingInFile->setLogger((new \Monolog\Logger('EngineGP', [(new \Monolog\Handler\StreamHandler(DIR . 'logs/cron.log'))->setFormatter((new \Monolog\Formatter\LineFormatter(null, null, true)))])));
$whoops->pushHandler($loggingInFile);
// Подгрузка трейта
diff --git a/system/library/html.php b/system/library/html.php
index 81a2416..6364077 100644
--- a/system/library/html.php
+++ b/system/library/html.php
@@ -56,23 +56,11 @@ class html
public function get($name, $path = '')
{
- global $device, $cfg;
-
- $path_root = $device == '!mobile' ? '' : 'megp/';
-
- $path = $path_root . $path;
+ global $cfg;
if ($path != '')
$name = str_replace('//', '/', $path . '/' . $name);
- if (!file_exists($this->dir . '/' . $name . '.html')) {
- $route = explode('/', $name);
- $namefile = end($route);
- $dir = $this->dir . str_replace($namefile, '', $name);
-
- die('Error: html file ' . $namefile . '.html not found in: ' . $dir . '');
- }
-
$this->template = file_get_contents($this->dir . '/' . $name . '.html');
$this->select_template = $this->template;
diff --git a/system/library/ssh.php b/system/library/ssh.php
index f03c4de..48a4a4f 100644
--- a/system/library/ssh.php
+++ b/system/library/ssh.php
@@ -17,10 +17,12 @@ class ssh
public function connect($address)
{
- list($host, $port) = explode(':', $address);
-
- if ($port == '')
+ if (strpos($address, ':') !== false) {
+ list($host, $port) = explode(':', $address);
+ } else {
+ $host = $address;
$port = 22;
+ }
ini_set('default_socket_timeout', '3');
diff --git a/system/library/system.php b/system/library/system.php
index 4f57610..a486a28 100644
--- a/system/library/system.php
+++ b/system/library/system.php
@@ -101,12 +101,7 @@ class sys
$html->set('home', $cfg['http']);
if (is_array($notice)) {
- global $device;
-
- if ($device == '!mobile')
- $html->set('notice', '