@@ -87,18 +87,18 @@ discard block |
||
| 87 | 87 | case 0: |
| 88 | 88 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
| 89 | 89 | $is_this_planet = ( |
| 90 | - ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) AND |
|
| 91 | - ($planetrow['system'] == $objFleet->fleet_end_system) AND |
|
| 92 | - ($planetrow['planet'] == $objFleet->fleet_end_planet) AND |
|
| 90 | + ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) and |
|
| 91 | + ($planetrow['system'] == $objFleet->fleet_end_system) and |
|
| 92 | + ($planetrow['planet'] == $objFleet->fleet_end_planet) and |
|
| 93 | 93 | ($planetrow['planet_type'] == $planet_end_type)); |
| 94 | 94 | break; |
| 95 | 95 | |
| 96 | 96 | case 1: |
| 97 | 97 | $objFleet->event_time = $objFleet->time_mission_job_complete; |
| 98 | 98 | $is_this_planet = ( |
| 99 | - ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) AND |
|
| 100 | - ($planetrow['system'] == $objFleet->fleet_end_system) AND |
|
| 101 | - ($planetrow['planet'] == $objFleet->fleet_end_planet) AND |
|
| 99 | + ($planetrow['galaxy'] == $objFleet->fleet_end_galaxy) and |
|
| 100 | + ($planetrow['system'] == $objFleet->fleet_end_system) and |
|
| 101 | + ($planetrow['planet'] == $objFleet->fleet_end_planet) and |
|
| 102 | 102 | ($planetrow['planet_type'] == $planet_end_type)); |
| 103 | 103 | break; |
| 104 | 104 | |
@@ -106,9 +106,9 @@ discard block |
||
| 106 | 106 | case 3: |
| 107 | 107 | $objFleet->event_time = $objFleet->time_return_to_source; |
| 108 | 108 | $is_this_planet = ( |
| 109 | - ($planetrow['galaxy'] == $objFleet->fleet_start_galaxy) AND |
|
| 110 | - ($planetrow['system'] == $objFleet->fleet_start_system) AND |
|
| 111 | - ($planetrow['planet'] == $objFleet->fleet_start_planet) AND |
|
| 109 | + ($planetrow['galaxy'] == $objFleet->fleet_start_galaxy) and |
|
| 110 | + ($planetrow['system'] == $objFleet->fleet_start_system) and |
|
| 111 | + ($planetrow['planet'] == $objFleet->fleet_start_planet) and |
|
| 112 | 112 | ($planetrow['planet_type'] == $objFleet->fleet_start_type)); |
| 113 | 113 | break; |
| 114 | 114 | |
@@ -288,7 +288,7 @@ discard block |
||
| 288 | 288 | </script> |
| 289 | 289 | </body> |
| 290 | 290 | </html> |
| 291 | -HTML; |
|
| 291 | +html; |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | function sxd_tpl_auth($error = ''){ |
@@ -350,5 +350,5 @@ discard block |
||
| 350 | 350 | </div> |
| 351 | 351 | </body> |
| 352 | 352 | </html> |
| 353 | -HTML; |
|
| 353 | +html; |
|
| 354 | 354 | } |
| 355 | 355 | \ No newline at end of file |
@@ -30,7 +30,7 @@ |
||
| 30 | 30 | if(count($obj) == 0) return '[]'; |
| 31 | 31 | $is_obj = isset($obj[count($obj) - 1]) ? false : true; |
| 32 | 32 | $str = $is_obj ? '{' : '['; |
| 33 | - foreach ($obj AS $key => $value) { |
|
| 33 | + foreach ($obj as $key => $value) { |
|
| 34 | 34 | $str .= $is_obj ? "'" . addcslashes($key, "\n\r\t'\\/") . "'" . ':' : ''; |
| 35 | 35 | if (is_array($value)) $str .= sxd_php2json($value); |
| 36 | 36 | elseif (is_null($value)) $str .= 'null'; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->langs = &$langs; |
| 40 | 40 | $lng = 'en'; |
| 41 | 41 | if(preg_match_all('/[a-z]{2}(-[a-z]{2})?/', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $m)) { |
| 42 | - foreach($m[0] AS $l){ |
|
| 42 | + foreach($m[0] as $l){ |
|
| 43 | 43 | if(isset($langs[$l])){ |
| 44 | 44 | $lng_name = $l; |
| 45 | 45 | break; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $this->CFG['my_db'] = ''; |
| 76 | 76 | } |
| 77 | 77 | if ($args) { // консольный режим |
| 78 | - foreach($args AS $key => $arg){ |
|
| 78 | + foreach($args as $key => $arg){ |
|
| 79 | 79 | if (preg_match("/^-([hupoj])=(.*?)$/", $arg, $m)){ |
| 80 | 80 | switch ($m[1]) { |
| 81 | 81 | case 'h': $this->CFG['my_host'] = $m[2]; break; // хост |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | $port = !empty($_POST['port']) && is_numeric($_POST['port']) ? $_POST['port'] : 3306; |
| 120 | 120 | $temp = preg_split('/\s+/', $this->CFG['auth']); |
| 121 | 121 | if(!empty($_REQUEST['lang']) && preg_match('/^[a-z]{2}(-[a-z]{2})?$/', $_REQUEST['lang'])) {$this->loadLang($_REQUEST['lang']);} |
| 122 | - foreach($temp AS $a){ |
|
| 122 | + foreach($temp as $a){ |
|
| 123 | 123 | switch($a) { |
| 124 | 124 | case 'cfg': if(empty($user)) {continue;} |
| 125 | 125 | $auth = !empty($CFG['user']) && isset($CFG['pass']) && $CFG['user']== $user && $CFG['pass'] == $pass; |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | header("Location: ./"); |
| 145 | 145 | exit; |
| 146 | 146 | } |
| 147 | - foreach(array('user', 'pass', 'host', 'port') AS $key){ |
|
| 147 | + foreach(array('user', 'pass', 'host', 'port') as $key){ |
|
| 148 | 148 | $_POST[$key] = !empty($_POST[$key]) ? htmlspecialchars($_POST[$key], ENT_NOQUOTES) : ''; |
| 149 | 149 | } |
| 150 | 150 | $_POST['save'] = !empty($_POST['save']) ? ' CHECKED' : ''; |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | } |
| 157 | 157 | $this->lng_list = '<option value="auto">- auto -</opinion>'; |
| 158 | 158 | if(!isset($this->langs)) {include('lang/list.php');$this->langs = &$langs;} |
| 159 | - foreach($this->langs AS $k => $v){ |
|
| 159 | + foreach($this->langs as $k => $v){ |
|
| 160 | 160 | $this->lng_list .= "<option value=\"{$k}\"" . ($k == (!empty($_REQUEST['lang']) ? $this->LNG['name'] : $this->CFG['lang']) ? ' SELECTED' : '') . ">{$v}</opinion>"; |
| 161 | 161 | } |
| 162 | 162 | include('tmpl.php'); |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | echo "alert(" . sxd_esc(mysql_error()) . ");"; |
| 345 | 345 | } |
| 346 | 346 | function cfg2js($cfg){ |
| 347 | - foreach($cfg AS $k => $v){ |
|
| 347 | + foreach($cfg as $k => $v){ |
|
| 348 | 348 | $cfg[$k] = sxd_esc($v, false); |
| 349 | 349 | } |
| 350 | 350 | return $cfg; |
@@ -429,11 +429,11 @@ discard block |
||
| 429 | 429 | } |
| 430 | 430 | function createFilters(&$obj, &$filter, &$object){ |
| 431 | 431 | $types = array('TA', 'TC', 'VI', 'PR', 'FU', 'TR', 'EV'); |
| 432 | - foreach($types AS $type){ |
|
| 432 | + foreach($types as $type){ |
|
| 433 | 433 | $filter[$type] = array(); |
| 434 | 434 | $object[$type] = array(); |
| 435 | 435 | if(!empty($obj[$type])){ |
| 436 | - foreach($obj[$type] AS $v){ |
|
| 436 | + foreach($obj[$type] as $v){ |
|
| 437 | 437 | if(strpos($v, '*') !== false) { |
| 438 | 438 | $filter[$type][] = str_replace('*', '.*?', $v); |
| 439 | 439 | } |
@@ -492,12 +492,12 @@ discard block |
||
| 492 | 492 | $rows = 0; |
| 493 | 493 | $this->tab_rows = array(); |
| 494 | 494 | $todo = array(); |
| 495 | - foreach($objects AS $t => $list){ |
|
| 495 | + foreach($objects as $t => $list){ |
|
| 496 | 496 | if($t == 'TA' && (!empty($object['TC']) || !empty($filter['TC']))) {} |
| 497 | 497 | elseif(empty($object[$t]) && empty($filter[$t])) {continue;} |
| 498 | 498 | if (empty($list)) continue; |
| 499 | 499 | |
| 500 | - foreach($list AS $item){ |
|
| 500 | + foreach($list as $item){ |
|
| 501 | 501 | switch($t){ |
| 502 | 502 | case 'TA': |
| 503 | 503 | $type = ''; |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | $tab = $m[2]; |
| 632 | 632 | $this->rtl[7] = 0; |
| 633 | 633 | $this->rtl[8] = 0; |
| 634 | - foreach($this->JOB['todo']['TA'] AS $t){ |
|
| 634 | + foreach($this->JOB['todo']['TA'] as $t){ |
|
| 635 | 635 | if($t[1] == $tab) { |
| 636 | 636 | $this->rtl[8] = $t[2]; |
| 637 | 637 | } |
@@ -684,7 +684,7 @@ discard block |
||
| 684 | 684 | $this->rtl[5] = $m[2]; |
| 685 | 685 | $this->rtl[7] = 0; |
| 686 | 686 | $this->rtl[8] = 0; |
| 687 | - mysql_query("DROP {$types[$m[1]]} IF EXISTS `{$m[2]}`") or sxd_my_error(); |
|
| 687 | + mysql_query("drop {$types[$m[1]]} IF EXISTS `{$m[2]}`") or sxd_my_error(); |
|
| 688 | 688 | $this->addLog(sprintf($this->LNG["restore_{$m[1]}"], $m[2])); |
| 689 | 689 | $ei = 0; |
| 690 | 690 | } |
@@ -730,7 +730,7 @@ discard block |
||
| 730 | 730 | $this->rtl[6] = ''; |
| 731 | 731 | $this->rtl[7] = 0; |
| 732 | 732 | $this->rtl[8] = 0; |
| 733 | - foreach($this->JOB['todo']['TA'] AS $tab){ |
|
| 733 | + foreach($this->JOB['todo']['TA'] as $tab){ |
|
| 734 | 734 | if ($tab[0] == 'TC') continue; |
| 735 | 735 | mysql_query("ALTER TABLE `{$tab[1]}` ENABLE KEYS") or sxd_my_error(); |
| 736 | 736 | $this->rtl[1] = time(); |
@@ -919,7 +919,7 @@ discard block |
||
| 919 | 919 | $todo = $header = array(); |
| 920 | 920 | $tabs = $rows = 0; |
| 921 | 921 | $only_create = explode(' ', $this->CFG['only_create']); |
| 922 | - foreach($queries AS $query){ |
|
| 922 | + foreach($queries as $query){ |
|
| 923 | 923 | $t = $query[2]; |
| 924 | 924 | if($t == 'TA' && (!empty($object['TC']) || !empty($filter['TC']))) {} |
| 925 | 925 | elseif(empty($object[$t]) && empty($filter[$t])) continue; |
@@ -976,9 +976,9 @@ discard block |
||
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | while (count($views) > 0) { |
| 979 | - foreach($views AS $n => $view) { |
|
| 979 | + foreach($views as $n => $view) { |
|
| 980 | 980 | $can_dumped = true; |
| 981 | - foreach($view AS $k) { |
|
| 981 | + foreach($view as $k) { |
|
| 982 | 982 | if (isset($views[$k]) && !isset($dumped[$k])) $can_dumped = false; |
| 983 | 983 | } |
| 984 | 984 | if ($can_dumped) { |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | $this->JOB['todo'] = $todo; |
| 1007 | 1007 | $this->saveJob($this->JOB['job'], $this->JOB); |
| 1008 | 1008 | $fcache = implode('|', array('#SXD20', V_SXD, V_MYSQL, V_PHP, date('Y.m.d H:i:s'), $this->JOB['db'], $this->JOB['charset'], $tabs, $rows, sxd_esc($this->JOB['comment'], false))) . "\n"; |
| 1009 | - foreach($header AS $t => $o){ |
|
| 1009 | + foreach($header as $t => $o){ |
|
| 1010 | 1010 | if (!empty($o)) $fcache .= "#{$t} " . implode('|', $o) . "\n"; |
| 1011 | 1011 | } |
| 1012 | 1012 | $this->fh_rtl = fopen($this->JOB['file_rtl'], 'wb'); |
@@ -1031,10 +1031,10 @@ discard block |
||
| 1031 | 1031 | $time_old = time(); |
| 1032 | 1032 | $exit_time = $time_old + $this->CFG['time_web'] - 1; |
| 1033 | 1033 | $no_cache = V_MYSQL < 40101 ? 'SQL_NO_CACHE ' : ''; |
| 1034 | - foreach($this->JOB['todo'] AS $t => $o){ |
|
| 1034 | + foreach($this->JOB['todo'] as $t => $o){ |
|
| 1035 | 1035 | if (empty($this->rtl[4])) $this->rtl[4] = $t; |
| 1036 | 1036 | elseif ($this->rtl[4] != $t) continue; |
| 1037 | - foreach($o AS $n){ |
|
| 1037 | + foreach($o as $n){ |
|
| 1038 | 1038 | if (empty($this->rtl[5])) { |
| 1039 | 1039 | $this->rtl[5] = $n[1]; |
| 1040 | 1040 | $this->rtl[7] = 0; |
@@ -1074,7 +1074,7 @@ discard block |
||
| 1074 | 1074 | $time_old = time(); |
| 1075 | 1075 | $z = 0; |
| 1076 | 1076 | // Достаем данные |
| 1077 | - $r = mysql_unbuffered_query("SELECT {$no_cache}* FROM `{$n[1]}`{$from}"); |
|
| 1077 | + $r = mysql_unbuffered_query("select {$no_cache}* FROM `{$n[1]}`{$from}"); |
|
| 1078 | 1078 | while($row = mysql_fetch_row($r)) { |
| 1079 | 1079 | if (strlen($fcache) >= 61440) { |
| 1080 | 1080 | $z = 0; |
@@ -1167,7 +1167,7 @@ discard block |
||
| 1167 | 1167 | if (!empty($this->JOB['del_count'])){ |
| 1168 | 1168 | ksort($files); |
| 1169 | 1169 | $file_to_delete = count($files) - $this->JOB['del_count']; |
| 1170 | - foreach ($files AS $file){ |
|
| 1170 | + foreach ($files as $file){ |
|
| 1171 | 1171 | if ($file_to_delete-- > 0){ |
| 1172 | 1172 | if(unlink($this->CFG['backup_path'] . $file)) $this->addLog(sprintf($this->LNG['del_by_count'], $file)); |
| 1173 | 1173 | else $this->addLog(sprintf($this->LNG['del_fail'], $file)); |
@@ -1205,7 +1205,7 @@ discard block |
||
| 1205 | 1205 | $qq = (V_MYSQL < 50000) ? '' : '\''; |
| 1206 | 1206 | if ($this->CFG['my_db']) { |
| 1207 | 1207 | $tmp = explode(',', $this->CFG['my_db']); |
| 1208 | - foreach($tmp AS $d){ |
|
| 1208 | + foreach($tmp as $d){ |
|
| 1209 | 1209 | $d = trim($d); |
| 1210 | 1210 | $items[] = $qq . sxd_esc($d, false) . $qq; |
| 1211 | 1211 | $dbs[$d] = "{$d} (0)"; |
@@ -1220,7 +1220,7 @@ discard block |
||
| 1220 | 1220 | } |
| 1221 | 1221 | } |
| 1222 | 1222 | if(V_MYSQL < 50000){ |
| 1223 | - foreach($items AS $item){ |
|
| 1223 | + foreach($items as $item){ |
|
| 1224 | 1224 | $tables = mysql_query("SHOW TABLES FROM `{$item}`") or sxd_my_error(); |
| 1225 | 1225 | if ($tables) { |
| 1226 | 1226 | $tabs = mysql_num_rows($tables); |
@@ -1361,13 +1361,13 @@ discard block |
||
| 1361 | 1361 | $objects['TA'][$tab_prefix][] = $t; |
| 1362 | 1362 | unset($objects['TA'][$i]); |
| 1363 | 1363 | } |
| 1364 | - foreach($objects AS $type => $o){ |
|
| 1364 | + foreach($objects as $type => $o){ |
|
| 1365 | 1365 | if(!count($o)) continue; |
| 1366 | 1366 | if($type == 'TA') { |
| 1367 | 1367 | $open_childs = count($o['*']) > 1 ? 0 : 1; |
| 1368 | 1368 | $obj .= "[{$row},0," . sxd_esc($info[$type][0]) . ",1,1,1],"; |
| 1369 | 1369 | $row++; |
| 1370 | - foreach($o['*'] AS $value){ |
|
| 1370 | + foreach($o['*'] as $value){ |
|
| 1371 | 1371 | if(is_string($value)){ |
| 1372 | 1372 | if(count($o[$value]) > 1) { |
| 1373 | 1373 | $obj .= "[{$row},1,'{$value}*',1,1,{$open_childs}],"; |
@@ -1541,7 +1541,7 @@ discard block |
||
| 1541 | 1541 | if(count($obj) == 0) return '[]'; |
| 1542 | 1542 | $is_obj = isset($obj[0]) && isset($obj[count($obj) - 1]) ? false : true; |
| 1543 | 1543 | $str = $is_obj ? '{' : '['; |
| 1544 | - foreach ($obj AS $key => $value) { |
|
| 1544 | + foreach ($obj as $key => $value) { |
|
| 1545 | 1545 | $str .= $is_obj ? "'" . addcslashes($key, "\n\r\t'\\/") . "'" . ':' : ''; |
| 1546 | 1546 | if (is_array($value)) $str .= sxd_php2json($value); |
| 1547 | 1547 | elseif (is_null($value)) $str .= 'null'; |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $logs = array(); |
| 40 | 40 | if(!empty($rawlog)){ |
| 41 | 41 | $temp = explode("\n", $rawlog); |
| 42 | - foreach($temp AS $l){ |
|
| 42 | + foreach($temp as $l){ |
|
| 43 | 43 | if(empty($l)) continue; |
| 44 | 44 | $t = explode("\t", $l); |
| 45 | 45 | if(count($t) < 3) continue; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | include('lang/list.php'); |
| 104 | 104 | $lng = 'en'; |
| 105 | 105 | if(preg_match_all('/[a-z]{2}(-[a-z]{2})?/', $_SERVER['HTTP_ACCEPT_LANGUAGE'], $m)) { |
| 106 | - foreach($m[0] AS $l){ |
|
| 106 | + foreach($m[0] as $l){ |
|
| 107 | 107 | if(isset($langs[$l])){ |
| 108 | 108 | $lng_name = $l; |
| 109 | 109 | break; |
@@ -157,7 +157,7 @@ |
||
| 157 | 157 | * @return array|bool|mysqli_result|null |
| 158 | 158 | */ |
| 159 | 159 | public static function db_chat_player_get($player_id, $fields) { |
| 160 | - return classSupernova::$db->doSelectFetchArray("SELECT {$fields} FROM {{chat_player}} WHERE `chat_player_player_id` = {$player_id} LIMIT 1"); |
|
| 160 | + return classSupernova::$db->doSelectFetchArray("select {$fields} FROM {{chat_player}} WHERE `chat_player_player_id` = {$player_id} LIMIT 1"); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | |
| 92 | 92 | $result = array(); |
| 93 | 93 | $transaction_id = classSupernova::$db->getTransaction()->getNextQueryTransactionId(); |
| 94 | - $result[] = "tID {$transaction_id}"; |
|
| 94 | + $result[] = "tid {$transaction_id}"; |
|
| 95 | 95 | foreach($backtrace as $a_trace) { |
| 96 | 96 | if(in_array($a_trace['function'], $exclude_functions)) { |
| 97 | 97 | continue; |
@@ -586,7 +586,7 @@ discard block |
||
| 586 | 586 | // Search array to get correct position |
| 587 | 587 | list($search_key, $search_value) = @each($key); |
| 588 | 588 | |
| 589 | - $key = NULL; |
|
| 589 | + $key = null; |
|
| 590 | 590 | foreach ($this->_tpldata[$blockname] as $i => $val_ary) |
| 591 | 591 | { |
| 592 | 592 | if ($val_ary[$search_key] === $search_value) |
@@ -597,7 +597,7 @@ discard block |
||
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | // key/value pair not found |
| 600 | - if ($key === NULL) |
|
| 600 | + if ($key === null) |
|
| 601 | 601 | { |
| 602 | 602 | return false; |
| 603 | 603 | } |
@@ -232,7 +232,7 @@ |
||
| 232 | 232 | public function ube_calculate_attack_results(UBE $ube) { |
| 233 | 233 | // Каждый флот атакует все |
| 234 | 234 | foreach($this->_container as $attack_fleet_data) { |
| 235 | - defined('DEBUG_UBE') ? print("Fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false; |
|
| 235 | + defined('DEBUG_UBE') ? print("fleet {$attack_fleet_data->db_id} attacks<br /><div style='margin-left: 30px;'>") : false; |
|
| 236 | 236 | |
| 237 | 237 | $attack_fleet_data->attack_fleets($this, $ube->is_simulator); |
| 238 | 238 | |