@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | // Защита от двойного инита |
4 | -if(defined('INIT')) { |
|
4 | +if (defined('INIT')) { |
|
5 | 5 | return; |
6 | 6 | } |
7 | 7 | |
@@ -19,22 +19,22 @@ discard block |
||
19 | 19 | define('SN_DEBUG_PDUMP_CALLER', true); |
20 | 20 | |
21 | 21 | // Бенчмарк |
22 | -register_shutdown_function(function () { |
|
23 | - if(defined('IN_AJAX')) { |
|
22 | +register_shutdown_function(function() { |
|
23 | + if (defined('IN_AJAX')) { |
|
24 | 24 | return; |
25 | 25 | } |
26 | 26 | |
27 | 27 | global $user, $locale_cache_statistic; |
28 | 28 | |
29 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
30 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
31 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
29 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
30 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
31 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
32 | 32 | '</div>'); |
33 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
33 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
34 | 34 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
35 | 35 | } |
36 | 36 | |
37 | - if(!empty($locale_cache_statistic['misses'])) { |
|
37 | + if (!empty($locale_cache_statistic['misses'])) { |
|
38 | 38 | print('<!--'); |
39 | 39 | pdump($locale_cache_statistic); |
40 | 40 | print('-->'); |
@@ -54,46 +54,46 @@ discard block |
||
54 | 54 | |
55 | 55 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
56 | 56 | |
57 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
57 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
58 | 58 | define('SN_GOOGLE', true); |
59 | 59 | } |
60 | 60 | |
61 | 61 | // Эти три строки должны быть В ЭТОМ ФАЙЛЕ, ПО ЭТОМУ ПУТИ и ПЕРЕД ЭТИМ ИНКЛЮДОМ!!! |
62 | -define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__) . '/')); |
|
62 | +define('SN_ROOT_PHYSICAL', str_replace(array('\\', '//'), '/', dirname(__DIR__).'/')); |
|
63 | 63 | define('SN_ROOT_PHYSICAL_STR_LEN', strlen(SN_ROOT_PHYSICAL)); |
64 | 64 | $phpbb_root_path = SN_ROOT_PHYSICAL; // Это нужно для работы PTL |
65 | 65 | |
66 | -$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd() . '/'); |
|
66 | +$sn_root_relative = str_replace(array('\\', '//'), '/', getcwd().'/'); |
|
67 | 67 | //$sn_root_relative .= $sn_root_relative[strlen($sn_root_relative) - 1] == '/' ? '' : '/'; |
68 | 68 | $sn_root_relative = str_replace(SN_ROOT_PHYSICAL, '', $sn_root_relative); |
69 | 69 | $sn_root_relative .= basename($_SERVER['SCRIPT_NAME']); |
70 | 70 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
71 | 71 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
72 | 72 | |
73 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
73 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
74 | 74 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
75 | 75 | |
76 | 76 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
77 | -define('DOT_PHP_EX', '.' . $phpEx); // PHP extension on this server |
|
77 | +define('DOT_PHP_EX', '.'.$phpEx); // PHP extension on this server |
|
78 | 78 | |
79 | 79 | |
80 | 80 | header('Content-type: text/html; charset=utf-8'); |
81 | 81 | ob_start(); |
82 | 82 | ini_set('error_reporting', E_ALL ^ E_NOTICE); |
83 | 83 | |
84 | -empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL . 'classes/' : false; |
|
85 | -spl_autoload_register(function ($class) use ($classRoot) { |
|
84 | +empty($classRoot) ? $classRoot = SN_ROOT_PHYSICAL.'classes/' : false; |
|
85 | +spl_autoload_register(function($class) use ($classRoot) { |
|
86 | 86 | $class = str_replace('\\', '/', $class); |
87 | - if (file_exists($classRoot . $class . '.php')) { |
|
88 | - require_once $classRoot . $class . '.php'; |
|
89 | - } elseif (file_exists($classRoot . 'UBE/' . $class . '.php')) { |
|
90 | - require_once $classRoot . 'UBE/' . $class . '.php'; |
|
87 | + if (file_exists($classRoot.$class.'.php')) { |
|
88 | + require_once $classRoot.$class.'.php'; |
|
89 | + } elseif (file_exists($classRoot.'UBE/'.$class.'.php')) { |
|
90 | + require_once $classRoot.'UBE/'.$class.'.php'; |
|
91 | 91 | } |
92 | 92 | }); |
93 | 93 | |
94 | 94 | require_once 'constants.php'; |
95 | -require_once SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX; |
|
96 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
95 | +require_once SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX; |
|
96 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @var classConfig $config |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | // define('BE_DEBUG', true); // Отладка боевого движка |
112 | 112 | classSupernova::init_debug_state(); |
113 | 113 | |
114 | -require_once(SN_ROOT_PHYSICAL . "includes/vars/vars" . DOT_PHP_EX); |
|
115 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
114 | +require_once(SN_ROOT_PHYSICAL."includes/vars/vars".DOT_PHP_EX); |
|
115 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
116 | 116 | |
117 | 117 | init_update(); |
118 | 118 | |
@@ -121,28 +121,28 @@ discard block |
||
121 | 121 | ? trim(strip_tags($_GET['page'])) |
122 | 122 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
123 | 123 | define('INITIAL_PAGE', $sn_page_name_original); |
124 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
127 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
128 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
129 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
130 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
124 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
125 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
126 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
127 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
128 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
129 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
130 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
131 | 131 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
132 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
133 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
132 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
133 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
134 | 134 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
135 | 135 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
136 | 136 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
137 | 137 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
138 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
138 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
139 | 139 | |
140 | 140 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
141 | 141 | |
142 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
142 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
143 | 143 | $template_result = array('.' => array('result' => array())); |
144 | 144 | |
145 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", DOT_PHP_EX); |
|
145 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", DOT_PHP_EX); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // Подключаем все модули |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // Конфиг - часть манифеста? |
153 | 153 | classSupernova::$auth = new core_auth(); |
154 | 154 | |
155 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", DOT_PHP_EX, true); |
|
155 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", DOT_PHP_EX, true); |
|
156 | 156 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
157 | 157 | |
158 | 158 | // Подключаем дефолтную страницу |
@@ -160,10 +160,10 @@ discard block |
||
160 | 160 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
161 | 161 | // Но нужно, пока у нас есть не MVC-страницы |
162 | 162 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
163 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
164 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
163 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
164 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
165 | 165 | require_once($sn_page_name_file); |
166 | - if(is_array($sn_page_data['options'])) { |
|
166 | + if (is_array($sn_page_data['options'])) { |
|
167 | 167 | classSupernova::$options = array_merge(classSupernova::$options, $sn_page_data['options']); |
168 | 168 | } |
169 | 169 | } |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
176 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
176 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
177 | 177 | $sn_page_name = ''; |
178 | 178 | } |
179 | 179 | |
@@ -181,6 +181,6 @@ discard block |
||
181 | 181 | classLocale::$lang = $lang = classSupernova::$gc->localePlayer; |
182 | 182 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
183 | 183 | |
184 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
184 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
185 | 185 | require_once "init_secondary.php"; |
186 | 186 | } |
@@ -31,6 +31,9 @@ |
||
31 | 31 | |
32 | 32 | } |
33 | 33 | |
34 | + /** |
|
35 | + * @param integer $snId |
|
36 | + */ |
|
34 | 37 | public function unitAdd($snId, $level) { |
35 | 38 | if($this->indexIsSet($snId)) { |
36 | 39 | $this->indexGetObject($snId)->$level += $level; |
@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
3 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
4 | 4 | |
5 | 5 | $template = gettemplate('viewreport', true); |
6 | 6 | $template->assign_var('PAGE_HINT', classLocale::$lang['cr_view_hint']); |
@@ -7,7 +7,6 @@ |
||
7 | 7 | |
8 | 8 | use Common\V2Location; |
9 | 9 | use DBStatic\DBStaticFleetACS; |
10 | -use V2Unit\V2UnitList; |
|
11 | 10 | use Vector\Vector; |
12 | 11 | use Entity\KeyedModel; |
13 | 12 |
@@ -93,28 +93,28 @@ discard block |
||
93 | 93 | public function __construct(\Common\GlobalContainer $gc) { |
94 | 94 | parent::__construct($gc); |
95 | 95 | |
96 | - $this->accessors->set(P_CONTAINER_SET, 'dbId', function (V2FleetContainer $that, $value) { |
|
96 | + $this->accessors->set(P_CONTAINER_SET, 'dbId', function(V2FleetContainer $that, $value) { |
|
97 | 97 | $that->setDirect('dbId', $value); |
98 | 98 | $that->location->setLocationId($value); |
99 | 99 | }); |
100 | 100 | |
101 | - $this->accessors->set(P_CONTAINER_SET, 'ownerId', function (V2FleetContainer $that, $value) { |
|
101 | + $this->accessors->set(P_CONTAINER_SET, 'ownerId', function(V2FleetContainer $that, $value) { |
|
102 | 102 | $that->setDirect('ownerId', $value); |
103 | 103 | $that->location->setLocationPlayerId($value); |
104 | 104 | }); |
105 | 105 | |
106 | - $this->accessors->set(P_CONTAINER_SET, 'owner', function (V2FleetContainer $that, $value) { |
|
106 | + $this->accessors->set(P_CONTAINER_SET, 'owner', function(V2FleetContainer $that, $value) { |
|
107 | 107 | $that->owner = $value; |
108 | - if(isset($value['id'])) { |
|
108 | + if (isset($value['id'])) { |
|
109 | 109 | $that->ownerId = $value['id']; |
110 | 110 | } else { |
111 | 111 | $that->ownerId = 0; |
112 | 112 | } |
113 | 113 | }); |
114 | 114 | |
115 | - $this->accessors->set(P_CONTAINER_SET, 'departure', function (V2FleetContainer $that, $value) { |
|
115 | + $this->accessors->set(P_CONTAINER_SET, 'departure', function(V2FleetContainer $that, $value) { |
|
116 | 116 | $that->departure = $value; |
117 | - if(isset($value['id'])) { |
|
117 | + if (isset($value['id'])) { |
|
118 | 118 | $that->departurePlanetId = $value['id']; |
119 | 119 | $that->vectorDeparture = $value; |
120 | 120 | } else { |
@@ -122,20 +122,20 @@ discard block |
||
122 | 122 | } |
123 | 123 | }); |
124 | 124 | |
125 | - $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function (V2FleetContainer $that) { |
|
125 | + $this->accessors->set(P_CONTAINER_GET, 'vectorDeparture', function(V2FleetContainer $that) { |
|
126 | 126 | $vector = new Vector(); |
127 | 127 | $that->setDirect('vectorDeparture', $vector); |
128 | 128 | |
129 | 129 | return $vector; |
130 | 130 | }, ACCESSOR_SHARED); |
131 | - $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function (V2FleetContainer $that, $value) { |
|
131 | + $this->accessors->set(P_CONTAINER_SET, 'vectorDeparture', function(V2FleetContainer $that, $value) { |
|
132 | 132 | $vector = $that->vectorDeparture; |
133 | 133 | |
134 | - if(is_array($value)) { |
|
134 | + if (is_array($value)) { |
|
135 | 135 | $value = Vector::convertToVector($value); |
136 | 136 | } |
137 | 137 | |
138 | - if($value instanceof Vector) { |
|
138 | + if ($value instanceof Vector) { |
|
139 | 139 | $vector->readFromVector($value); |
140 | 140 | } else { |
141 | 141 | throw new \Exception('V2Fleet::vectorDeparture setter - value is not a Vector or array!', ERR_ERROR); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | $this->accessors->set(P_CONTAINER_EXPORT, 'vectorArrive', array($this, 'exportVector')); |
149 | 149 | |
150 | 150 | |
151 | - $this->accessors->set(P_CONTAINER_GET, 'location', function (V2FleetContainer $that) { |
|
151 | + $this->accessors->set(P_CONTAINER_GET, 'location', function(V2FleetContainer $that) { |
|
152 | 152 | // if (is_null($location = $that->getDirect('location'))) {} |
153 | 153 | $location = new V2Location(LOC_FLEET); |
154 | 154 | $that->setDirect('location', $location); |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | return $location; |
157 | 157 | }, ACCESSOR_SHARED); |
158 | 158 | |
159 | - $this->accessors->set(P_CONTAINER_GET, 'units', function (V2FleetContainer $that) { |
|
159 | + $this->accessors->set(P_CONTAINER_GET, 'units', function(V2FleetContainer $that) { |
|
160 | 160 | // if (is_null($units = $that->getDirect('units'))) {} |
161 | 161 | $units = \classSupernova::$gc->unitList; |
162 | 162 | $that->setDirect('units', $units); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | return $units; |
165 | 165 | }, ACCESSOR_SHARED); |
166 | 166 | |
167 | - $this->accessors->set(P_CONTAINER_GET, 'isReturning', function (V2FleetContainer $that) { |
|
167 | + $this->accessors->set(P_CONTAINER_GET, 'isReturning', function(V2FleetContainer $that) { |
|
168 | 168 | return $that->status == FLEET_FLAG_RETURNING; |
169 | 169 | }); |
170 | 170 |
@@ -213,7 +213,7 @@ |
||
213 | 213 | /** |
214 | 214 | * @param int|string $dbId |
215 | 215 | * |
216 | - * @return V2FleetContainer|false |
|
216 | + * @return V2FleetContainer |
|
217 | 217 | */ |
218 | 218 | public function loadById($dbId) { |
219 | 219 | /** |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @throws \Exception |
72 | 72 | */ |
73 | 73 | protected function indexDuplicated($object, $data) { |
74 | - throw new \Exception('Duplicate index [' . $data . '] in ' . __CLASS__); |
|
74 | + throw new \Exception('Duplicate index ['.$data.'] in '.__CLASS__); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if ($this->contains($object)) { |
120 | 120 | $this->indexUnset($object); |
121 | 121 | } |
122 | - if($this->indexSet($object, $data)) { |
|
122 | + if ($this->indexSet($object, $data)) { |
|
123 | 123 | // Attaches object only if index sets successfully |
124 | 124 | parent::attach($object, $data); |
125 | 125 | } |
@@ -80,7 +80,7 @@ |
||
80 | 80 | * @since 5.0.0 |
81 | 81 | */ |
82 | 82 | public function offsetUnset($offset) { |
83 | - if($this->offsetExists($offset)) { |
|
83 | + if ($this->offsetExists($offset)) { |
|
84 | 84 | parent::offsetUnset($this->offsetGet($offset)); |
85 | 85 | } |
86 | 86 | } |
@@ -15,7 +15,7 @@ |
||
15 | 15 | } |
16 | 16 | |
17 | 17 | public static function build($callable) { |
18 | - if(is_array($callable) && count($callable) == 2 && is_object($callable[0])) { |
|
18 | + if (is_array($callable) && count($callable) == 2 && is_object($callable[0])) { |
|
19 | 19 | return new static($callable); |
20 | 20 | } else { |
21 | 21 | return false; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | $source_planet = &$mission_data->src_planet; |
19 | 19 | $destination_planet = &$mission_data->dst_planet; |
20 | 20 | |
21 | - if(empty($destination_planet['id_owner'])) { |
|
21 | + if (empty($destination_planet['id_owner'])) { |
|
22 | 22 | $objFleet->markReturnedAndSave(); |
23 | 23 | |
24 | 24 | return $result; |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $fleet_resources[RES_DEUTERIUM], classLocale::$lang['Deuterium']); |
34 | 34 | DBStaticMessages::msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message); |
35 | 35 | |
36 | - if($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
36 | + if ($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
37 | 37 | DBStaticMessages::msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, classLocale::$lang['sys_mess_tower'], classLocale::$lang['sys_mess_transport'], $Message); |
38 | 38 | } |
39 | 39 |
@@ -14,7 +14,6 @@ |
||
14 | 14 | * |
15 | 15 | * @param Fleet $objFleet |
16 | 16 | * @param bool $start |
17 | - * @param null $result |
|
18 | 17 | * |
19 | 18 | * @return mixed |
20 | 19 | */ |
@@ -23,15 +23,11 @@ discard block |
||
23 | 23 | // ------------------------------------------------------------------ |
24 | 24 | function flt_flyingFleetsSort($a, $b) { |
25 | 25 | // Сравниваем время флотов - кто раньше, тот и первый обрабатывается |
26 | - return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : |
|
27 | - // Если время - одинаковое, сравниваем события флотов |
|
26 | + return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов |
|
28 | 27 | // Если события - одинаковые, то флоты равны |
29 | - ($a['fleet_event'] == $b['fleet_event'] ? 0 : |
|
30 | - // Если события разные - первыми считаем прибывающие флоты |
|
31 | - ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : |
|
32 | - // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
33 | - ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : |
|
34 | - // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
28 | + ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты |
|
29 | + ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
30 | + ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
35 | 31 | // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска |
36 | 32 | ( |
37 | 33 | 0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий |
@@ -49,13 +45,13 @@ discard block |
||
49 | 45 | $handler = fopen('event.log', 'a+'); |
50 | 46 | } |
51 | 47 | |
52 | - fwrite($handler, date(FMT_DATE_TIME_SQL, time()) . ' ' . $msg . "\r\n"); |
|
48 | + fwrite($handler, date(FMT_DATE_TIME_SQL, time()).' '.$msg."\r\n"); |
|
53 | 49 | } |
54 | 50 | |
55 | 51 | // ------------------------------------------------------------------ |
56 | 52 | function flt_flying_fleet_handler($skip_fleet_update = false) { |
57 | 53 | if (true) { |
58 | - if(!defined('IN_AJAX')) { |
|
54 | + if (!defined('IN_AJAX')) { |
|
59 | 55 | print('<div style="color: red; font-size: 300%">Fleet handler is disabled</div>'); |
60 | 56 | pdump('Fleet handler is disabled'); |
61 | 57 | } |
@@ -181,7 +177,7 @@ discard block |
||
181 | 177 | MT_EXPLORE => 'flt_mission_explore', |
182 | 178 | ); |
183 | 179 | foreach ($missions_used as $mission_id => $cork) { |
184 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/{$mission_files[$mission_id]}" . DOT_PHP_EX); |
|
180 | + require_once(SN_ROOT_PHYSICAL."includes/includes/{$mission_files[$mission_id]}".DOT_PHP_EX); |
|
185 | 181 | } |
186 | 182 | |
187 | 183 | //log_file('Обработка миссий'); |
@@ -190,7 +186,7 @@ discard block |
||
190 | 186 | // Watchdog timer |
191 | 187 | // If flying fleet handler works more then 10 seconds - stopping it |
192 | 188 | // Let next run handle rest of fleets |
193 | - if(time() - SN_TIME_NOW > 10) { |
|
189 | + if (time() - SN_TIME_NOW > 10) { |
|
194 | 190 | $debug->warning('Flying fleet handler standard routine works more then 10 seconds - watchdog unlocked', 'FFH Warning', 504); |
195 | 191 | break; |
196 | 192 | } |
@@ -256,7 +252,7 @@ discard block |
||
256 | 252 | $objMission->fleet_event = $fleet_event['fleet_event']; |
257 | 253 | |
258 | 254 | // Fleet that have planet destination is returned |
259 | - if($mission_data['dst_planet'] && empty($objMission->dst_planet['id_owner'])) { |
|
255 | + if ($mission_data['dst_planet'] && empty($objMission->dst_planet['id_owner'])) { |
|
260 | 256 | $objFleet->markReturnedAndSave(); |
261 | 257 | sn_db_transaction_commit(); |
262 | 258 | continue; |