@@ -23,7 +23,7 @@ |
||
23 | 23 | * @return array|bool|mysqli_result|null |
24 | 24 | */ |
25 | 25 | public static function db_missile_list_by_arrival() { |
26 | - $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= " . SN_TIME_NOW . " FOR UPDATE;"); |
|
26 | + $iraks = doquery("SELECT * FROM {{iraks}} WHERE `fleet_end_time` <= ".SN_TIME_NOW." FOR UPDATE;"); |
|
27 | 27 | |
28 | 28 | return $iraks; |
29 | 29 | } |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | function db_news_insert_set($announce_time, $text, $detail_url, $user) { |
13 | 13 | doquery("INSERT INTO {{announce}} |
14 | 14 | SET `tsTimeStamp` = FROM_UNIXTIME({$announce_time}), `strAnnounce`='{$text}', detail_url = '{$detail_url}', |
15 | - `user_id` = {$user['id']}, `user_name` = '" . db_escape($user['username']) . "'"); |
|
15 | + `user_id` = {$user['id']}, `user_name` = '".db_escape($user['username'])."'"); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | function db_survey_insert($announce_id, $survey_question, $survey_until) { |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | LEFT JOIN {{survey}} AS s ON s.survey_announce_id = a.idAnnounce |
94 | 94 | LEFT JOIN {{users}} AS u ON u.id = a.user_id |
95 | 95 | {$query_where} |
96 | - ORDER BY `tsTimeStamp` DESC, idAnnounce" . |
|
96 | + ORDER BY `tsTimeStamp` DESC, idAnnounce". |
|
97 | 97 | ($query_limit ? " LIMIT {$query_limit}" : '')); |
98 | 98 | |
99 | 99 | $template->assign_var('NEWS_COUNT', db_num_rows($announce_list)); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * @param $note_id_edit |
37 | 37 | */ |
38 | 38 | public static function db_note_update_by_id($note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky, $note_id_edit) { |
39 | - doquery("UPDATE {{notes}} SET `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
39 | + doquery("UPDATE {{notes}} SET `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
40 | 40 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky} |
41 | 41 | WHERE `id` = {$note_id_edit} LIMIT 1;"); |
42 | 42 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | * @param $note_sticky |
54 | 54 | */ |
55 | 55 | public static function db_note_insert($user, $note_priority, $note_title, $note_text, $note_galaxy, $note_system, $note_planet, $note_planet_type, $note_sticky) { |
56 | - doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = " . SN_TIME_NOW . ", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
56 | + doquery("INSERT INTO {{notes}} SET `owner` = {$user['id']}, `time` = ".SN_TIME_NOW.", `priority` = {$note_priority}, `title` = '{$note_title}', `text` = '{$note_text}', |
|
57 | 57 | `galaxy` = {$note_galaxy}, `system` = {$note_system}, `planet` = {$note_planet}, `planet_type` = {$note_planet_type}, `sticky` = {$note_sticky};"); |
58 | 58 | } |
59 | 59 |
@@ -19,15 +19,11 @@ discard block |
||
19 | 19 | // ------------------------------------------------------------------ |
20 | 20 | function flt_flyingFleetsSort($a, $b) { |
21 | 21 | // Сравниваем время флотов - кто раньше, тот и первый обрабатывается |
22 | - return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : |
|
23 | - // Если время - одинаковое, сравниваем события флотов |
|
22 | + return $a['fleet_time'] > $b['fleet_time'] ? 1 : ($a['fleet_time'] < $b['fleet_time'] ? -1 : // Если время - одинаковое, сравниваем события флотов |
|
24 | 23 | // Если события - одинаковые, то флоты равны |
25 | - ($a['fleet_event'] == $b['fleet_event'] ? 0 : |
|
26 | - // Если события разные - первыми считаем прибывающие флоты |
|
27 | - ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : |
|
28 | - // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
29 | - ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : |
|
30 | - // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
24 | + ($a['fleet_event'] == $b['fleet_event'] ? 0 : // Если события разные - первыми считаем прибывающие флоты |
|
25 | + ($a['fleet_event'] == EVENT_FLT_ARRIVE ? 1 : ($b['fleet_event'] == EVENT_FLT_ARRIVE ? -1 : // Если нет прибывающих флотов - дальше считаем флоты, которые закончили миссию |
|
26 | + ($a['fleet_event'] == EVENT_FLT_ACOMPLISH ? 1 : ($b['fleet_event'] == EVENT_FLT_ACOMPLISH ? -1 : // Если нет флотов, закончивших задание - остались возвращающиеся флоты, которые равны между собой |
|
31 | 27 | // TODO: Добавить еще проверку по ID флота и/или времени запуска - что бы обсчитывать их в порядке запуска |
32 | 28 | ( |
33 | 29 | 0 // Вообще сюда доходить не должно - будет отсекаться на равенстве событий |
@@ -45,13 +41,13 @@ discard block |
||
45 | 41 | $handler = fopen('event.log', 'a+'); |
46 | 42 | } |
47 | 43 | |
48 | - fwrite($handler, date(FMT_DATE_TIME_SQL, time()) . ' ' . $msg . "\r\n"); |
|
44 | + fwrite($handler, date(FMT_DATE_TIME_SQL, time()).' '.$msg."\r\n"); |
|
49 | 45 | } |
50 | 46 | |
51 | 47 | // ------------------------------------------------------------------ |
52 | 48 | function flt_flying_fleet_handler($skip_fleet_update = false) { |
53 | 49 | if (true) { |
54 | - if(!defined('IN_AJAX')) { |
|
50 | + if (!defined('IN_AJAX')) { |
|
55 | 51 | print('<div style="color: red; font-size: 300%">Fleet handler is disabled</div>'); |
56 | 52 | pdump('Fleet handler is disabled'); |
57 | 53 | } |
@@ -177,7 +173,7 @@ discard block |
||
177 | 173 | MT_EXPLORE => 'flt_mission_explore', |
178 | 174 | ); |
179 | 175 | foreach ($missions_used as $mission_id => $cork) { |
180 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/{$mission_files[$mission_id]}" . DOT_PHP_EX); |
|
176 | + require_once(SN_ROOT_PHYSICAL."includes/includes/{$mission_files[$mission_id]}".DOT_PHP_EX); |
|
181 | 177 | } |
182 | 178 | |
183 | 179 | //log_file('Обработка миссий'); |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | public static function cache_clear($location_type, $hard = true) { |
237 | 237 | if ($hard && !empty(static::$data[$location_type])) { |
238 | 238 | // Здесь нельзя делать unset - надо записывать NULL, что бы это отразилось на зависимых записях |
239 | - array_walk(static::$data[$location_type], function (&$item) { $item = null; }); |
|
239 | + array_walk(static::$data[$location_type], function(&$item) { $item = null; }); |
|
240 | 240 | } |
241 | 241 | static::$locator[$location_type] = array(); |
242 | 242 | static::$queries[$location_type] = array(); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | |
355 | 355 | if (!empty($error_msg)) { |
356 | 356 | // TODO - Убрать позже |
357 | - print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - ' . $error_msg . '</h1>'); |
|
357 | + print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_transaction_check() - '.$error_msg.'</h1>'); |
|
358 | 358 | $backtrace = debug_backtrace(); |
359 | 359 | array_shift($backtrace); |
360 | 360 | pdump($backtrace); |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | public static function db_transaction_start($level = '') { |
368 | 368 | static::db_transaction_check(null); |
369 | 369 | |
370 | - $level ? doquery('SET TRANSACTION ISOLATION LEVEL ' . $level) : false; |
|
370 | + $level ? doquery('SET TRANSACTION ISOLATION LEVEL '.$level) : false; |
|
371 | 371 | |
372 | 372 | static::$transaction_id++; |
373 | 373 | doquery('START TRANSACTION'); |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | public static function db_lock_tables($tables) { |
428 | 428 | $tables = is_array($tables) ? $tables : array($tables => ''); |
429 | 429 | foreach ($tables as $table_name => $condition) { |
430 | - self::$db->doquery("SELECT 1 FROM {{{$table_name}}}" . ($condition ? ' WHERE ' . $condition : '')); |
|
430 | + self::$db->doquery("SELECT 1 FROM {{{$table_name}}}".($condition ? ' WHERE '.$condition : '')); |
|
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
@@ -503,8 +503,8 @@ discard block |
||
503 | 503 | $query = static::db_query( |
504 | 504 | "SELECT |
505 | 505 | distinct({{{$location_info[P_TABLE_NAME]}}}.{$owner_data[P_OWNER_FIELD]}) AS parent_id |
506 | - FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
507 | - ($filter ? ' WHERE ' . $filter : '') . |
|
506 | + FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
507 | + ($filter ? ' WHERE '.$filter : ''). |
|
508 | 508 | ($fetch ? ' LIMIT 1' : ''), false, true); |
509 | 509 | |
510 | 510 | while ($row = db_fetch($query)) { |
@@ -517,13 +517,13 @@ discard block |
||
517 | 517 | if ($indexes_str = implode(',', $parent_id_list)) { |
518 | 518 | $parent_id_field = static::$location_info[$owner_location_type][P_ID]; |
519 | 519 | static::db_get_record_list($owner_location_type, |
520 | - $parent_id_field . (count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
520 | + $parent_id_field.(count($parent_id_list) > 1 ? " IN ({$indexes_str})" : " = {$indexes_str}"), $fetch, true); |
|
521 | 521 | } |
522 | 522 | } |
523 | 523 | } |
524 | 524 | |
525 | 525 | $query = static::db_query( |
526 | - "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}" . |
|
526 | + "SELECT * FROM {{{$location_info[P_TABLE_NAME]}}}". |
|
527 | 527 | (($filter = trim($filter)) ? " WHERE {$filter}" : '') |
528 | 528 | ); |
529 | 529 | while ($row = db_fetch($query)) { |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $condition = trim($condition); |
590 | 590 | $table_name = static::$location_info[$location_type][P_TABLE_NAME]; |
591 | 591 | |
592 | - if ($result = static::db_query("UPDATE {{{$table_name}}} SET " . $set . ($condition ? ' WHERE ' . $condition : ''))) { |
|
592 | + if ($result = static::db_query("UPDATE {{{$table_name}}} SET ".$set.($condition ? ' WHERE '.$condition : ''))) { |
|
593 | 593 | |
594 | 594 | if (static::$db->db_affected_rows()) { // Обновляем данные только если ряд был затронут |
595 | 595 | // Поскольку нам неизвестно, что и как обновилось - сбрасываем кэш этого типа полностью |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | // TODO переписать |
752 | 752 | $user = static::dbFetchOne( |
753 | 753 | DBStaticUser::buildSelect() |
754 | - ->where(array("`username` " . ($like ? 'LIKE' : '=') . " '{$username_safe}'")) |
|
754 | + ->where(array("`username` ".($like ? 'LIKE' : '=')." '{$username_safe}'")) |
|
755 | 755 | ); |
756 | 756 | |
757 | 757 | // $user = static::db_query( |
@@ -844,7 +844,7 @@ discard block |
||
844 | 844 | |
845 | 845 | $query_cache = &static::$locator[LOC_UNIT][$location_type][$location_id]; |
846 | 846 | if (!isset($query_cache)) { |
847 | - $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND " . static::db_unit_time_restrictions()); |
|
847 | + $got_data = static::db_get_record_list(LOC_UNIT, "unit_location_type = {$location_type} AND unit_location_id = {$location_id} AND ".static::db_unit_time_restrictions()); |
|
848 | 848 | if (is_array($got_data)) { |
849 | 849 | foreach ($got_data as $unit_id => $unit_data) { |
850 | 850 | $query_cache[$unit_data['unit_snid']] = &static::$data[LOC_UNIT][$unit_id]; |
@@ -905,7 +905,7 @@ discard block |
||
905 | 905 | if ($que_type == QUE_RESEARCH || $planet_id === null) { |
906 | 906 | $query[] = "`que_planet_id` IS NULL"; |
907 | 907 | } elseif ($planet_id) { |
908 | - $query[] = "(`que_planet_id` = {$planet_id}" . ($que_type ? '' : ' OR que_planet_id IS NULL') . ")"; |
|
908 | + $query[] = "(`que_planet_id` = {$planet_id}".($que_type ? '' : ' OR que_planet_id IS NULL').")"; |
|
909 | 909 | } |
910 | 910 | if ($que_type) { |
911 | 911 | $query[] = "`que_type` = {$que_type}"; |
@@ -1026,13 +1026,13 @@ discard block |
||
1026 | 1026 | $condition = "`{$field_name}` = "; |
1027 | 1027 | $value = ''; |
1028 | 1028 | if ($field_data['delta']) { |
1029 | - $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
|
1029 | + $value = "`{$field_name}`".($field_data['delta'] >= 0 ? '+' : '').$field_data['delta']; |
|
1030 | 1030 | } elseif ($field_data['set']) { |
1031 | 1031 | $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | if ($value) { |
1035 | - $fields[] = $condition . $value; |
|
1035 | + $fields[] = $condition.$value; |
|
1036 | 1036 | } |
1037 | 1037 | } |
1038 | 1038 | $conditions[P_FIELDS_STR] = implode(',', $fields); |
@@ -1046,9 +1046,7 @@ discard block |
||
1046 | 1046 | // Простое условие - $field_id = $field_value |
1047 | 1047 | if (is_string($field_id)) { |
1048 | 1048 | $field_value = |
1049 | - $field_value === null ? 'NULL' : |
|
1050 | - (is_string($field_value) ? "'" . db_escape($field_value) . "'" : |
|
1051 | - (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
1049 | + $field_value === null ? 'NULL' : (is_string($field_value) ? "'".db_escape($field_value)."'" : (is_bool($field_value) ? intval($field_value) : $field_value)); |
|
1052 | 1050 | $the_conditions[] = "`{$field_id}` = {$field_value}"; |
1053 | 1051 | } else { |
1054 | 1052 | die('Неподдерживаемый тип условия'); |
@@ -1075,7 +1073,7 @@ discard block |
||
1075 | 1073 | die('Неподдерживаемая операция в classSupernova::db_changeset_condition_compile'); |
1076 | 1074 | } |
1077 | 1075 | |
1078 | - $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR] . ' ' . $conditions[P_FIELDS_STR] . (' WHERE ' . $conditions[P_WHERE_STR]); |
|
1076 | + $conditions[P_QUERY_STR] = $conditions[P_ACTION_STR].' '.$conditions[P_FIELDS_STR].(' WHERE '.$conditions[P_WHERE_STR]); |
|
1079 | 1077 | } |
1080 | 1078 | |
1081 | 1079 | public static function db_changeset_apply($db_changeset, $flush_delayed = false) { |
@@ -1173,7 +1171,7 @@ discard block |
||
1173 | 1171 | ini_get('magic_quotes_sybase') ? die('SN is incompatible with \'magic_quotes_sybase\' turned on. Disable it in php.ini or .htaccess...') : false; |
1174 | 1172 | if (@get_magic_quotes_gpc()) { |
1175 | 1173 | $gpcr = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); |
1176 | - array_walk_recursive($gpcr, function (&$value, $key) { |
|
1174 | + array_walk_recursive($gpcr, function(&$value, $key) { |
|
1177 | 1175 | $value = stripslashes($value); |
1178 | 1176 | }); |
1179 | 1177 | } |
@@ -1187,7 +1185,7 @@ discard block |
||
1187 | 1185 | public static function init_3_load_config_file() { |
1188 | 1186 | $dbsettings = array(); |
1189 | 1187 | |
1190 | - require(SN_ROOT_PHYSICAL . "config" . DOT_PHP_EX); |
|
1188 | + require(SN_ROOT_PHYSICAL."config".DOT_PHP_EX); |
|
1191 | 1189 | self::$cache_prefix = !empty($dbsettings['cache_prefix']) ? $dbsettings['cache_prefix'] : $dbsettings['prefix']; |
1192 | 1190 | self::$db_name = $dbsettings['name']; |
1193 | 1191 | self::$sn_secret_word = $dbsettings['secretword']; |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | define('INSTALL', false); |
11 | 11 | define('IN_ADMIN', true); |
12 | 12 | |
13 | -require('../common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
13 | +require('../common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
14 | 14 | |
15 | 15 | if ($user['authlevel'] < 3) { |
16 | 16 | AdminMessage(classLocale::$lang['adm_err_denied']); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | foreach ($value as $interval_data) { |
112 | 112 | print("<tr>"); |
113 | 113 | print("<td>{$user_id}</td><td>{$user_record['username']}</td><td>{$interval_data[0]}</td><td>{$interval_data[1]}</td><td>{$interval_data[2]}</td>"); |
114 | - print("<td>" . date(FMT_DATE_TIME_SQL, $user_record['onlinetime']) . "</td>"); |
|
114 | + print("<td>".date(FMT_DATE_TIME_SQL, $user_record['onlinetime'])."</td>"); |
|
115 | 115 | print("</tr>"); |
116 | 116 | } |
117 | 117 | } |
@@ -45,8 +45,8 @@ |
||
45 | 45 | */ |
46 | 46 | protected function quoteStringAsFieldByRef(&$string) { |
47 | 47 | $string = $this->stringEscape($string); |
48 | - if ((string)$string && '*' != $string) { |
|
49 | - $string = '`' . $string . '`'; |
|
48 | + if ((string) $string && '*' != $string) { |
|
49 | + $string = '`'.$string.'`'; |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 |
@@ -21,13 +21,13 @@ discard block |
||
21 | 21 | |
22 | 22 | public static function db_unit_count_by_user_and_type_and_snid($user_id, $unit_type = 0, $unit_snid = 0) { |
23 | 23 | $query = doquery( |
24 | - "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} " . |
|
25 | - ($unit_type ? "AND `unit_type` = {$unit_type} " : '') . |
|
26 | - ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : '') . |
|
24 | + "SELECT unit_snid, sum(unit_level) as `qty` FROM {{unit}} WHERE `unit_player_id` = {$user_id} ". |
|
25 | + ($unit_type ? "AND `unit_type` = {$unit_type} " : ''). |
|
26 | + ($unit_snid ? "AND `unit_snid` = {$unit_snid} " : ''). |
|
27 | 27 | 'GROUP BY `unit_snid`' |
28 | 28 | ); |
29 | 29 | $result = array(); |
30 | - while($row = db_fetch($query)) { |
|
30 | + while ($row = db_fetch($query)) { |
|
31 | 31 | $result[$row['unit_snid']] = $row; |
32 | 32 | } |
33 | 33 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | WHERE |
44 | 44 | f.fleet_owner = {$user_id} AND |
45 | 45 | (f.fleet_start_planet_id = {$location_id} OR f.fleet_end_planet_id = {$location_id}) |
46 | - AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = " . LOC_FLEET . " AND " . self::db_unit_time_restrictions() . |
|
47 | - " LIMIT 1" . |
|
46 | + AND u.unit_snid = {$unit_snid} AND u.`unit_location_type` = ".LOC_FLEET." AND ".self::db_unit_time_restrictions(). |
|
47 | + " LIMIT 1". |
|
48 | 48 | ($for_update ? ' FOR UPDATE' : '') |
49 | 49 | , true); |
50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | public static function db_unit_list_laboratories($user_id) { |
54 | 54 | return doquery("SELECT DISTINCT unit_location_id AS `id` |
55 | 55 | FROM {{unit}} |
56 | - WHERE unit_player_id = {$user_id} AND unit_location_type = " . LOC_PLANET . " AND unit_level > 0 AND unit_snid IN (" . STRUC_LABORATORY . ", " . STRUC_LABORATORY_NANO . ");"); |
|
56 | + WHERE unit_player_id = {$user_id} AND unit_location_type = ".LOC_PLANET." AND unit_level > 0 AND unit_snid IN (".STRUC_LABORATORY.", ".STRUC_LABORATORY_NANO.");"); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | public static function db_unit_set_by_id($unit_id, $set) { |
@@ -71,9 +71,9 @@ discard block |
||
71 | 71 | |
72 | 72 | public static function db_unit_list_delete($user_id = 0, $unit_location_type, $unit_location_id = 0, $unit_snid = 0) { |
73 | 73 | return classSupernova::db_del_record_list(LOC_UNIT, |
74 | - "`unit_location_type` = {$unit_location_type}" . |
|
75 | - ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : '') . |
|
76 | - ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : '') . |
|
74 | + "`unit_location_type` = {$unit_location_type}". |
|
75 | + ($unit_location_id = idval($unit_location_id) ? " AND `unit_location_id` = {$unit_location_id}" : ''). |
|
76 | + ($user_id = idval($user_id) ? " AND `unit_player_id` = {$user_id}" : ''). |
|
77 | 77 | ($unit_snid = idval($unit_snid) ? " AND `unit_snid` = {$unit_snid}" : '')); |
78 | 78 | } |
79 | 79 | |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | return doquery( |
82 | 82 | "SELECT unit_player_id, unit_type, unit_snid, unit_level, count(*) AS unit_amount |
83 | 83 | FROM `{{unit}}` |
84 | - WHERE unit_level > 0 AND " . self::db_unit_time_restrictions() . |
|
84 | + WHERE unit_level > 0 AND " . self::db_unit_time_restrictions(). |
|
85 | 85 | " GROUP BY unit_player_id, unit_type, unit_snid, unit_level" |
86 | 86 | ); |
87 | 87 | } |
@@ -93,15 +93,15 @@ discard block |
||
93 | 93 | |
94 | 94 | |
95 | 95 | public static function db_unit_list_admin_delete_mercenaries_finished() { |
96 | - return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(" . SN_TIME_NOW . ") AND unit_type = " . UNIT_MERCENARIES); |
|
96 | + return doquery("DELETE FROM {{unit}} WHERE unit_time_finish IS NOT NULL AND unit_time_finish < FROM_UNIXTIME(".SN_TIME_NOW.") AND unit_type = ".UNIT_MERCENARIES); |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | public static function db_unit_list_admin_set_mercenaries_expire_time($default_length) { |
100 | 100 | return doquery( |
101 | 101 | "UPDATE {{unit}} |
102 | 102 | SET |
103 | - unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW . "), |
|
104 | - unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length) . ") |
|
103 | + unit_time_start = FROM_UNIXTIME(" . SN_TIME_NOW."), |
|
104 | + unit_time_finish = FROM_UNIXTIME(" . (SN_TIME_NOW + $default_length).") |
|
105 | 105 | WHERE unit_type = " . UNIT_MERCENARIES |
106 | 106 | ); |
107 | 107 | } |
@@ -398,31 +398,31 @@ discard block |
||
398 | 398 | |
399 | 399 | return doquery( |
400 | 400 | // Блокировка самого флота |
401 | - "SELECT 1 FROM {{fleets}} AS f " . |
|
401 | + "SELECT 1 FROM {{fleets}} AS f ". |
|
402 | 402 | |
403 | 403 | // Блокировка всех юнитов, принадлежащих этому флоту |
404 | - "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = " . static::$locationType . " AND unit.unit_location_id = f.fleet_id " . |
|
404 | + "LEFT JOIN {{unit}} as unit ON unit.unit_location_type = ".static::$locationType." AND unit.unit_location_id = f.fleet_id ". |
|
405 | 405 | |
406 | 406 | // Блокировка всех прилетающих и улетающих флотов, если нужно |
407 | 407 | // TODO - lock fleets by COORDINATES |
408 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : '') . |
|
408 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{fleets}} AS fd ON fd.fleet_end_planet_id = f.fleet_end_planet_id OR fd.fleet_start_planet_id = f.fleet_end_planet_id " : ''). |
|
409 | 409 | // Блокировка всех юнитов, принадлежащих прилетающим и улетающим флотам - ufd = unit_fleet_destination |
410 | - ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = " . static::$locationType . " AND ufd.unit_location_id = fd.fleet_id " : '') . |
|
410 | + ($mission_data['dst_fleets'] ? "LEFT JOIN {{unit}} AS ufd ON ufd.unit_location_type = ".static::$locationType." AND ufd.unit_location_id = fd.fleet_id " : ''). |
|
411 | 411 | |
412 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : '') . |
|
412 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{users}} AS ud ON ud.id = f.fleet_target_owner " : ''). |
|
413 | 413 | // Блокировка всех юнитов, принадлежащих владельцу планеты-цели |
414 | - ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : '') . |
|
414 | + ($mission_data['dst_user'] || $mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS unit_player_dest ON unit_player_dest.unit_player_id = ud.id " : ''). |
|
415 | 415 | // Блокировка планеты-цели |
416 | - ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : '') . |
|
416 | + ($mission_data['dst_planet'] ? "LEFT JOIN {{planets}} AS pd ON pd.id = f.fleet_end_planet_id " : ''). |
|
417 | 417 | // Блокировка всех юнитов, принадлежащих планете-цели - НЕ НУЖНО. Уже залочили ранее, как принадлежащие игроку-цели |
418 | 418 | // ($mission_data['dst_planet'] ? "LEFT JOIN {{unit}} AS upd ON upd.unit_location_type = " . LOC_PLANET . " AND upd.unit_location_id = pd.id " : '') . |
419 | 419 | |
420 | 420 | |
421 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : '') . |
|
421 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{users}} AS us ON us.id = f.fleet_owner " : ''). |
|
422 | 422 | // Блокировка всех юнитов, принадлежащих владельцу флота |
423 | - ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : '') . |
|
423 | + ($mission_data['src_user'] || $mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS unit_player_src ON unit_player_src.unit_player_id = us.id " : ''). |
|
424 | 424 | // Блокировка планеты отправления |
425 | - ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : '') . |
|
425 | + ($mission_data['src_planet'] ? "LEFT JOIN {{planets}} AS ps ON ps.id = f.fleet_start_planet_id " : ''). |
|
426 | 426 | // Блокировка всех юнитов, принадлежащих планете с которой юниты были отправлены - НЕ НУЖНО. Уже залочили ранее, как принадлежащие владельцу флота |
427 | 427 | // ($mission_data['src_planet'] ? "LEFT JOIN {{unit}} AS ups ON ups.unit_location_type = " . LOC_PLANET . " AND ups.unit_location_id = ps.id " : '') . |
428 | 428 | |
@@ -439,11 +439,11 @@ discard block |
||
439 | 439 | public function dbGetLockById($dbId) { |
440 | 440 | doquery( |
441 | 441 | // Блокировка самого флота |
442 | - "SELECT 1 FROM {{fleets}} AS FLEET0 " . |
|
442 | + "SELECT 1 FROM {{fleets}} AS FLEET0 ". |
|
443 | 443 | // Lock fleet owner |
444 | - "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner " . |
|
444 | + "LEFT JOIN {{users}} as USER0 on USER0.id = FLEET0.fleet_owner ". |
|
445 | 445 | // Блокировка всех юнитов, принадлежащих этому флоту |
446 | - "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = " . LOC_FLEET . " AND UNIT0.unit_location_id = FLEET0.fleet_id " . |
|
446 | + "LEFT JOIN {{unit}} as UNIT0 ON UNIT0.unit_location_type = ".LOC_FLEET." AND UNIT0.unit_location_id = FLEET0.fleet_id ". |
|
447 | 447 | |
448 | 448 | // Без предварительной выборки неизвестно - куда летит этот флот. |
449 | 449 | // Поэтому надо выбирать флоты, чьи координаты прибытия ИЛИ отбытия совпадают с координатами прибытия ИЛИ отбытия текущего флота. |
@@ -459,9 +459,9 @@ discard block |
||
459 | 459 | FLEET1.fleet_end_planet = FLEET0.fleet_end_planet |
460 | 460 | " . |
461 | 461 | // Блокировка всех юнитов, принадлежащих этим флотам |
462 | - "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = " . LOC_FLEET . " AND UNIT1.unit_location_id = FLEET1.fleet_id " . |
|
462 | + "LEFT JOIN {{unit}} as UNIT1 ON UNIT1.unit_location_type = ".LOC_FLEET." AND UNIT1.unit_location_id = FLEET1.fleet_id ". |
|
463 | 463 | // Lock fleet owner |
464 | - "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner " . |
|
464 | + "LEFT JOIN {{users}} as USER1 on USER1.id = FLEET1.fleet_owner ". |
|
465 | 465 | |
466 | 466 | "LEFT JOIN {{fleets}} AS FLEET2 ON |
467 | 467 | FLEET2.fleet_mess = 1 AND FLEET0.fleet_mess = 0 AND |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | " . |
472 | 472 | // Блокировка всех юнитов, принадлежащих этим флотам |
473 | 473 | "LEFT JOIN {{unit}} as UNIT2 ON |
474 | - UNIT2.unit_location_type = " . LOC_FLEET . " AND |
|
474 | + UNIT2.unit_location_type = " . LOC_FLEET." AND |
|
475 | 475 | UNIT2.unit_location_id = FLEET2.fleet_id |
476 | 476 | " . |
477 | 477 | // Lock fleet owner |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | " . |
489 | 489 | // Блокировка всех юнитов, принадлежащих этим флотам |
490 | 490 | "LEFT JOIN {{unit}} as UNIT3 ON |
491 | - UNIT3.unit_location_type = " . LOC_FLEET . " AND |
|
491 | + UNIT3.unit_location_type = " . LOC_FLEET." AND |
|
492 | 492 | UNIT3.unit_location_id = FLEET3.fleet_id |
493 | 493 | " . |
494 | 494 | // Lock fleet owner |
495 | - "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner " . |
|
495 | + "LEFT JOIN {{users}} as USER3 on USER3.id = FLEET3.fleet_owner ". |
|
496 | 496 | |
497 | 497 | "LEFT JOIN {{fleets}} AS FLEET4 ON |
498 | 498 | FLEET4.fleet_mess = 1 AND FLEET0.fleet_mess = 1 AND |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | " . |
503 | 503 | // Блокировка всех юнитов, принадлежащих этим флотам |
504 | 504 | "LEFT JOIN {{unit}} as UNIT4 ON |
505 | - UNIT4.unit_location_type = " . LOC_FLEET . " AND |
|
505 | + UNIT4.unit_location_type = " . LOC_FLEET." AND |
|
506 | 506 | UNIT4.unit_location_id = FLEET4.fleet_id |
507 | 507 | " . |
508 | 508 | // Lock fleet owner |
@@ -524,7 +524,7 @@ discard block |
||
524 | 524 | " . |
525 | 525 | // Блокировка всех юнитов, принадлежащих этой планете |
526 | 526 | "LEFT JOIN {{unit}} as UNIT5 ON |
527 | - UNIT5.unit_location_type = " . LOC_PLANET . " AND |
|
527 | + UNIT5.unit_location_type = " . LOC_PLANET." AND |
|
528 | 528 | UNIT5.unit_location_id = PLANETS5.id |
529 | 529 | " . |
530 | 530 | |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | " . |
543 | 543 | // Блокировка всех юнитов, принадлежащих этой планете |
544 | 544 | "LEFT JOIN {{unit}} as UNIT6 ON |
545 | - UNIT6.unit_location_type = " . LOC_PLANET . " AND |
|
545 | + UNIT6.unit_location_type = " . LOC_PLANET." AND |
|
546 | 546 | UNIT6.unit_location_id = PLANETS6.id |
547 | 547 | " . |
548 | 548 | "WHERE FLEET0.fleet_id = {$dbId} GROUP BY 1 FOR UPDATE" |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | } elseif ($this->isResource($unit_id)) { |
662 | 662 | $this->resource_list[$unit_id] = $unit_count; |
663 | 663 | } else { |
664 | - throw new Exception('Trying to pass to fleet non-resource and non-ship ' . var_export($unit_array, true), ERR_ERROR); |
|
664 | + throw new Exception('Trying to pass to fleet non-resource and non-ship '.var_export($unit_array, true), ERR_ERROR); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | } |
@@ -986,7 +986,7 @@ discard block |
||
986 | 986 | */ |
987 | 987 | public function resourcesSet($resource_list) { |
988 | 988 | if (!empty($this->propertiesAdjusted['resource_list'])) { |
989 | - throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in ' . get_called_class() . '::unitSetResourceList', ERR_ERROR); |
|
989 | + throw new PropertyAccessException('Property "resource_list" already was adjusted so no SET is possible until dbSave in '.get_called_class().'::unitSetResourceList', ERR_ERROR); |
|
990 | 990 | } |
991 | 991 | $this->resourcesAdjust($resource_list, true); |
992 | 992 | } |
@@ -1020,7 +1020,7 @@ discard block |
||
1020 | 1020 | // Check for negative unit value |
1021 | 1021 | if ($this->resource_list[$resource_id] < 0) { |
1022 | 1022 | // TODO |
1023 | - throw new Exception('Resource ' . $resource_id . ' will become negative in ' . get_called_class() . '::unitAdjustResourceList', ERR_ERROR); |
|
1023 | + throw new Exception('Resource '.$resource_id.' will become negative in '.get_called_class().'::unitAdjustResourceList', ERR_ERROR); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | } |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | |
1194 | 1194 | protected function printErrorIfNoShips() { |
1195 | 1195 | if ($this->unitList->unitsCount() <= 0) { |
1196 | - message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
|
1196 | + message(classLocale::$lang['fl_err_no_ships'], classLocale::$lang['fl_error'], 'fleet'.DOT_PHP_EX, 5); |
|
1197 | 1197 | } |
1198 | 1198 | } |
1199 | 1199 | |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | } catch (Exception $e) { |
1541 | 1541 | |
1542 | 1542 | // TODO - MESSAGE BOX |
1543 | - if($e instanceof ExceptionFleetInvalid) { |
|
1543 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1544 | 1544 | sn_db_transaction_rollback(); |
1545 | 1545 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1546 | 1546 | } else { |
@@ -1629,7 +1629,7 @@ discard block |
||
1629 | 1629 | $validator->validate(); |
1630 | 1630 | } catch (Exception $e) { |
1631 | 1631 | // TODO - MESSAGE BOX |
1632 | - if($e instanceof ExceptionFleetInvalid) { |
|
1632 | + if ($e instanceof ExceptionFleetInvalid) { |
|
1633 | 1633 | sn_db_transaction_rollback(); |
1634 | 1634 | pdie(classLocale::$lang['fl_attack_error'][$e->getCode()]); |
1635 | 1635 | } else { |
@@ -1690,7 +1690,7 @@ discard block |
||
1690 | 1690 | |
1691 | 1691 | |
1692 | 1692 | if (!empty($this->captain['unit_id'])) { |
1693 | - DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = " . LOC_FLEET . ", `unit_location_id` = {$this->_dbId}"); |
|
1693 | + DBStaticUnit::db_unit_set_by_id($this->captain['unit_id'], "`unit_location_type` = ".LOC_FLEET.", `unit_location_id` = {$this->_dbId}"); |
|
1694 | 1694 | } |
1695 | 1695 | |
1696 | 1696 | // return $this->fleet->acs['ankunft'] - $this->fleet->time_launch >= $this->fleet->travelData['duration']; |
@@ -1702,7 +1702,7 @@ discard block |
||
1702 | 1702 | $template_result['.']['fleets'][] = $this->renderFleet(SN_TIME_NOW, $timeMissionJob); |
1703 | 1703 | |
1704 | 1704 | $template_result += array( |
1705 | - 'mission' => classLocale::$lang['type_mission'][$this->_mission_type] . ($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' ' . pretty_time($timeMissionJob) : ''), |
|
1705 | + 'mission' => classLocale::$lang['type_mission'][$this->_mission_type].($this->_mission_type == MT_EXPLORE || $this->_mission_type == MT_HOLD ? ' '.pretty_time($timeMissionJob) : ''), |
|
1706 | 1706 | 'dist' => pretty_number($this->travelData['distance']), |
1707 | 1707 | 'speed' => pretty_number($this->travelData['fleet_speed']), |
1708 | 1708 | 'deute_need' => pretty_number($this->travelData['consumption']), |