@@ -24,10 +24,10 @@ discard block |
||
| 24 | 24 | ), |
| 25 | 25 | ); |
| 26 | 26 | |
| 27 | - foreach($queries as &$query) { |
|
| 28 | - if(!empty($query['query'])) { |
|
| 27 | + foreach ($queries as &$query) { |
|
| 28 | + if (!empty($query['query'])) { |
|
| 29 | 29 | $query['result'] = doquery($query['query']); |
| 30 | - } elseif(!empty($query['callable']) && is_callable($query['callable'])) { |
|
| 30 | + } elseif (!empty($query['callable']) && is_callable($query['callable'])) { |
|
| 31 | 31 | call_user_func($query['callable']); |
| 32 | 32 | } |
| 33 | 33 | $query['error'] = classSupernova::$db->db_error(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
| 72 | 72 | // pdump($prev_run_array); |
| 73 | 73 | $scheduleList = explode(',', $scheduleList); |
| 74 | - array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
| 74 | + array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
| 75 | 75 | // pdump($schedule); |
| 76 | 76 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
| 77 | 77 | |
@@ -83,21 +83,21 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | // pdump($schedule); |
| 85 | 85 | |
| 86 | - foreach($prev_run_array as $index => $date_part) { |
|
| 86 | + foreach ($prev_run_array as $index => $date_part) { |
|
| 87 | 87 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
| 88 | 88 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
| 89 | 89 | } |
| 90 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 90 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
| 91 | 91 | unset($schedule['array']['now']); |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - foreach($schedule['array'] as $name => $array) { |
|
| 94 | + foreach ($schedule['array'] as $name => $array) { |
|
| 95 | 95 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
| 96 | 96 | $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
| 97 | 97 | $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - foreach($schedule['string'] as $string) { |
|
| 100 | + foreach ($schedule['string'] as $string) { |
|
| 101 | 101 | $timestamp = strtotime($string); |
| 102 | 102 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
| 103 | 103 | } |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | |
| 130 | 130 | $prev_run = 0; |
| 131 | 131 | $next_run = 0; |
| 132 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
| 132 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
| 133 | 133 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
| 134 | 134 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
| 135 | 135 | // pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule)); |
@@ -1,11 +1,11 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -function geoip_status(){return sn_function_call(__FUNCTION__, array(&$result));} |
|
| 3 | +function geoip_status() {return sn_function_call(__FUNCTION__, array(&$result)); } |
|
| 4 | 4 | function sn_geoip_status(&$result) { |
| 5 | 5 | return $result = false; |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -function geoip_ip_info($ip){return sn_function_call(__FUNCTION__, array($ip, &$result));} |
|
| 8 | +function geoip_ip_info($ip) {return sn_function_call(__FUNCTION__, array($ip, &$result)); } |
|
| 9 | 9 | function sn_geoip_ip_info($ip, &$result) { |
| 10 | 10 | return $result = false; |
| 11 | 11 | } |
@@ -3,8 +3,8 @@ discard block |
||
| 3 | 3 | function ali_rank_list_save($ranks) { |
| 4 | 4 | global $user; |
| 5 | 5 | |
| 6 | - if(!empty($ranks)) { |
|
| 7 | - foreach($ranks as $rank => $rights) { |
|
| 6 | + if (!empty($ranks)) { |
|
| 7 | + foreach ($ranks as $rank => $rights) { |
|
| 8 | 8 | $rights = implode(',', $rights); |
| 9 | 9 | $ranklist .= $rights . ';'; |
| 10 | 10 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | $temp_array = array(); |
| 23 | 23 | $query = db_ally_diplomacy_get_relations($ally_from, $ally_to); |
| 24 | 24 | |
| 25 | - while($record = db_fetch($query)) { |
|
| 25 | + while ($record = db_fetch($query)) { |
|
| 26 | 26 | $temp_array[$record['alliance_diplomacy_contr_ally_id']] = $record; |
| 27 | 27 | } |
| 28 | 28 | |
@@ -27,19 +27,19 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | function db_set_make_safe_string($set, $delta = false) { |
| 29 | 29 | $set_safe = array(); |
| 30 | - foreach($set as $field => $value) { |
|
| 31 | - if(empty($field)) { |
|
| 30 | + foreach ($set as $field => $value) { |
|
| 31 | + if (empty($field)) { |
|
| 32 | 32 | continue; |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | $field = '`' . db_escape($field) . '`'; |
| 36 | 36 | $new_value = $value; |
| 37 | - if($value === null) { |
|
| 37 | + if ($value === null) { |
|
| 38 | 38 | $new_value = 'NULL'; |
| 39 | - } elseif(is_string($value) && (string)($new_value = floatval($value)) != (string)$value) { |
|
| 39 | + } elseif (is_string($value) && (string) ($new_value = floatval($value)) != (string) $value) { |
|
| 40 | 40 | // non-float |
| 41 | 41 | $new_value = '"' . db_escape($value) . '"'; |
| 42 | - } elseif($delta) { |
|
| 42 | + } elseif ($delta) { |
|
| 43 | 43 | // float and DELTA-set |
| 44 | 44 | $new_value = "{$field} + ({$new_value})"; |
| 45 | 45 | } |
@@ -10,7 +10,7 @@ |
||
| 10 | 10 | * @copyright 2008 by Gorlum for Project "SuperNova.WS" |
| 11 | 11 | */ |
| 12 | 12 | function flt_mission_hold($mission_data) { |
| 13 | - if($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) { |
|
| 13 | + if ($mission_data->fleet->time_mission_job_complete < SN_TIME_NOW) { |
|
| 14 | 14 | $mission_data->fleet->mark_fleet_as_returned_and_save(); |
| 15 | 15 | |
| 16 | 16 | return CACHE_FLEET; |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('IN_UPDATE')) { |
|
| 3 | +if (!defined('IN_UPDATE')) { |
|
| 4 | 4 | die('Trying to call update helpers externally!'); |
| 5 | 5 | } |
| 6 | 6 | |
@@ -8,13 +8,13 @@ discard block |
||
| 8 | 8 | global $update_tables; |
| 9 | 9 | |
| 10 | 10 | upd_add_more_time(); |
| 11 | - if(!$no_log) { |
|
| 11 | + if (!$no_log) { |
|
| 12 | 12 | upd_log_message("Performing query '{$query}'"); |
| 13 | 13 | } |
| 14 | 14 | |
| 15 | 15 | // classSupernova::$db->sn_db_connect(); |
| 16 | - if(!(strpos($query, '{{') === false)) { |
|
| 17 | - foreach($update_tables as $tableName => $cork) { |
|
| 16 | + if (!(strpos($query, '{{') === false)) { |
|
| 17 | + foreach ($update_tables as $tableName => $cork) { |
|
| 18 | 18 | $query = str_replace("{{{$tableName}}}", classSupernova::$db->db_prefix . $tableName, $query); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -27,9 +27,9 @@ discard block |
||
| 27 | 27 | global $config, $sys_log_disabled; |
| 28 | 28 | |
| 29 | 29 | $config->db_loadItem($key); |
| 30 | - if($condition || !isset($config->$key)) { |
|
| 30 | + if ($condition || !isset($config->$key)) { |
|
| 31 | 31 | upd_add_more_time(); |
| 32 | - if(!$sys_log_disabled) { |
|
| 32 | + if (!$sys_log_disabled) { |
|
| 33 | 33 | upd_log_message("Updating config key '{$key}' with value '{$default_value}'"); |
| 34 | 34 | } |
| 35 | 35 | $config->db_saveItem($key, $default_value); |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | function upd_log_message($message) { |
| 58 | 58 | global $sys_log_disabled, $upd_log, $debug; |
| 59 | 59 | |
| 60 | - if($sys_log_disabled) { |
|
| 60 | + if ($sys_log_disabled) { |
|
| 61 | 61 | // print("{$message}<br />"); |
| 62 | 62 | } else { |
| 63 | 63 | $upd_log .= "{$message}\r\n"; |
@@ -68,15 +68,15 @@ discard block |
||
| 68 | 68 | function upd_unset_table_info($table_name) { |
| 69 | 69 | global $update_tables, $update_indexes, $update_foreigns; |
| 70 | 70 | |
| 71 | - if(isset($update_tables[$table_name])) { |
|
| 71 | + if (isset($update_tables[$table_name])) { |
|
| 72 | 72 | unset($update_tables[$table_name]); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - if(isset($update_indexes[$table_name])) { |
|
| 75 | + if (isset($update_indexes[$table_name])) { |
|
| 76 | 76 | unset($update_indexes[$table_name]); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - if(isset($update_foreigns[$table_name])) { |
|
| 79 | + if (isset($update_foreigns[$table_name])) { |
|
| 80 | 80 | unset($update_foreigns[$table_name]); |
| 81 | 81 | } |
| 82 | 82 | } |
@@ -90,18 +90,18 @@ discard block |
||
| 90 | 90 | upd_unset_table_info($tableName); |
| 91 | 91 | |
| 92 | 92 | $q1 = upd_do_query("SHOW FULL COLUMNS FROM {$prefix_table_name};", true); |
| 93 | - while($r1 = db_fetch($q1)) { |
|
| 93 | + while ($r1 = db_fetch($q1)) { |
|
| 94 | 94 | $update_tables[$tableName][$r1['Field']] = $r1; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | $q1 = upd_do_query("SHOW INDEX FROM {$prefix_table_name};", true); |
| 98 | - while($r1 = db_fetch($q1)) { |
|
| 98 | + while ($r1 = db_fetch($q1)) { |
|
| 99 | 99 | $update_indexes[$tableName][$r1['Key_name']] .= "{$r1['Column_name']},"; |
| 100 | 100 | $update_indexes_full[$tableName][$r1['Key_name']][$r1['Column_name']] = $r1; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $q1 = upd_do_query("SELECT * FROM `information_schema`.`KEY_COLUMN_USAGE` WHERE `TABLE_SCHEMA` = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '{$prefix_table_name}' AND REFERENCED_TABLE_NAME is not null;", true); |
| 104 | - while($r1 = db_fetch($q1)) { |
|
| 104 | + while ($r1 = db_fetch($q1)) { |
|
| 105 | 105 | $table_referenced = str_replace($config->db_prefix, '', $r1['REFERENCED_TABLE_NAME']); |
| 106 | 106 | |
| 107 | 107 | $update_foreigns[$tableName][$r1['CONSTRAINT_NAME']] .= "{$r1['COLUMN_NAME']},{$table_referenced},{$r1['REFERENCED_COLUMN_NAME']};"; |
@@ -118,7 +118,7 @@ discard block |
||
| 118 | 118 | function upd_alter_table($table, $alters, $condition = true) { |
| 119 | 119 | global $config; |
| 120 | 120 | |
| 121 | - if(!$condition) { |
|
| 121 | + if (!$condition) { |
|
| 122 | 122 | return; |
| 123 | 123 | } |
| 124 | 124 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $alters_print = is_array($alters) ? dump($alters) : $alters; |
| 127 | 127 | upd_log_message("Altering table '{$table}' with alterations {$alters_print}"); |
| 128 | 128 | |
| 129 | - if(!is_array($alters)) { |
|
| 129 | + if (!is_array($alters)) { |
|
| 130 | 130 | $alters = array($alters); |
| 131 | 131 | } |
| 132 | 132 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | //$result = db_query($qry); |
| 138 | 138 | $result = upd_do_query($qry); |
| 139 | 139 | $error = db_error(); |
| 140 | - if($error) { |
|
| 140 | + if ($error) { |
|
| 141 | 141 | die("Altering error for table `{$table}`: {$error}<br />{$alters_print}"); |
| 142 | 142 | } |
| 143 | 143 | |
@@ -160,11 +160,11 @@ discard block |
||
| 160 | 160 | function upd_create_table($table_name, $declaration) { |
| 161 | 161 | global $config, $update_tables; |
| 162 | 162 | |
| 163 | - if(!$update_tables[$table_name]) { |
|
| 163 | + if (!$update_tables[$table_name]) { |
|
| 164 | 164 | upd_do_query('set foreign_key_checks = 0;', true); |
| 165 | 165 | $result = upd_do_query("CREATE TABLE IF NOT EXISTS `{$config->db_prefix}{$table_name}` {$declaration}"); |
| 166 | 166 | $error = db_error(); |
| 167 | - if($error) { |
|
| 167 | + if ($error) { |
|
| 168 | 168 | die("Creating error for table `{$table_name}`: {$error}<br />" . dump($declaration)); |
| 169 | 169 | } |
| 170 | 170 | upd_do_query('set foreign_key_checks = 1;', true); |
@@ -190,14 +190,14 @@ discard block |
||
| 190 | 190 | |
| 191 | 191 | |
| 192 | 192 | function upd_db_unit_changeset_prepare($unit_id, $unit_value, $user, $planet_id = null) { |
| 193 | - if(!is_array($user)) { |
|
| 193 | + if (!is_array($user)) { |
|
| 194 | 194 | // TODO - remove later |
| 195 | 195 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_unit_changeset_prepare() - USER is not ARRAY</h1>'); |
| 196 | 196 | pdump(debug_backtrace()); |
| 197 | 197 | die('USER is not ARRAY'); |
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if(!isset($user['id']) || !$user['id']) { |
|
| 200 | + if (!isset($user['id']) || !$user['id']) { |
|
| 201 | 201 | // TODO - remove later |
| 202 | 202 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sn_db_unit_changeset_prepare() - USER[id] пустой</h1>'); |
| 203 | 203 | pdump($user); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | $db_changeset = array(); |
| 214 | 214 | $temp = upd_db_unit_by_location($user['id'], $unit_location, $location_id, $unit_id, true, 'unit_id'); |
| 215 | - if($temp['unit_id']) { |
|
| 215 | + if ($temp['unit_id']) { |
|
| 216 | 216 | // update |
| 217 | 217 | $db_changeset = array( |
| 218 | 218 | 'action' => SQL_OP_UPDATE, |
@@ -257,41 +257,41 @@ discard block |
||
| 257 | 257 | |
| 258 | 258 | |
| 259 | 259 | function upd_db_changeset_apply($db_changeset) { |
| 260 | - if(!is_array($db_changeset) || empty($db_changeset)) { |
|
| 260 | + if (!is_array($db_changeset) || empty($db_changeset)) { |
|
| 261 | 261 | return; |
| 262 | 262 | } |
| 263 | 263 | |
| 264 | - foreach($db_changeset as $table_name => $table_data) { |
|
| 265 | - foreach($table_data as $record_id => $conditions) { |
|
| 264 | + foreach ($db_changeset as $table_name => $table_data) { |
|
| 265 | + foreach ($table_data as $record_id => $conditions) { |
|
| 266 | 266 | $where = ''; |
| 267 | - if(!empty($conditions['where'])) { |
|
| 267 | + if (!empty($conditions['where'])) { |
|
| 268 | 268 | $where = 'WHERE ' . implode(' AND ', $conditions['where']); |
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | $fields = array(); |
| 272 | - if($conditions['fields']) { |
|
| 273 | - foreach($conditions['fields'] as $field_name => $field_data) { |
|
| 272 | + if ($conditions['fields']) { |
|
| 273 | + foreach ($conditions['fields'] as $field_name => $field_data) { |
|
| 274 | 274 | $condition = "`{$field_name}` = "; |
| 275 | 275 | $value = ''; |
| 276 | - if($field_data['delta']) { |
|
| 276 | + if ($field_data['delta']) { |
|
| 277 | 277 | $value = "`{$field_name}`" . ($field_data['delta'] >= 0 ? '+' : '') . $field_data['delta']; |
| 278 | - } elseif($field_data['set']) { |
|
| 278 | + } elseif ($field_data['set']) { |
|
| 279 | 279 | $value = (is_string($field_data['set']) ? "'{$field_data['set']}'" : $field_data['set']); |
| 280 | 280 | } |
| 281 | - if($value) { |
|
| 281 | + if ($value) { |
|
| 282 | 282 | $fields[] = $condition . $value; |
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | } |
| 286 | 286 | $fields = implode(',', $fields); |
| 287 | 287 | |
| 288 | - switch($conditions['action']) { |
|
| 288 | + switch ($conditions['action']) { |
|
| 289 | 289 | case SQL_OP_DELETE: |
| 290 | 290 | upd_do_query("DELETE FROM {{{$table_name}}} {$where}"); |
| 291 | 291 | break; |
| 292 | 292 | |
| 293 | 293 | case SQL_OP_UPDATE: |
| 294 | - if($fields) { |
|
| 294 | + if ($fields) { |
|
| 295 | 295 | /*if($table_name == 'unit') |
| 296 | 296 | { |
| 297 | 297 | pdump("UPDATE {{{$table_name}}} SET {$fields} {$where}"); |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | break; |
| 303 | 303 | |
| 304 | 304 | case SQL_OP_INSERT: |
| 305 | - if($fields) { |
|
| 305 | + if ($fields) { |
|
| 306 | 306 | upd_do_query("INSERT INTO {{{$table_name}}} SET {$fields}"); |
| 307 | 307 | } |
| 308 | 308 | break; |
| 309 | 309 | |
| 310 | 310 | case SQL_OP_REPLACE: |
| 311 | - if($fields) { |
|
| 311 | + if ($fields) { |
|
| 312 | 312 | upd_do_query("REPLACE INTO {{{$table_name}}} SET {$fields}"); |
| 313 | 313 | } |
| 314 | 314 | break; |
@@ -1,19 +1,19 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(SN_IN_FLEET !== true) { |
|
| 3 | +if (SN_IN_FLEET !== true) { |
|
| 4 | 4 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | 7 | $fleetid = sys_get_param_id('fleetid'); |
| 8 | 8 | |
| 9 | -if(!is_numeric($fleetid) || empty($fleetid)) { |
|
| 9 | +if (!is_numeric($fleetid) || empty($fleetid)) { |
|
| 10 | 10 | header("Location: fleet.php"); |
| 11 | 11 | exit(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $objFleet = new Fleet(); |
| 15 | 15 | $objFleet->dbLoad($fleetid); |
| 16 | -if(!$objFleet->dbId) { |
|
| 16 | +if (!$objFleet->dbId) { |
|
| 17 | 17 | message($lang['fl_fleet_not_exists'], $lang['fl_error']); |
| 18 | 18 | } |
| 19 | 19 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | message($lang['fl_isback'], $lang['fl_error']); |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | -if($objFleet->playerOwnerId != $user['id']) { |
|
| 25 | - $debug->warning($lang['fl_aks_hack_wrong_fleet'],'Wrong Fleet Owner',301); |
|
| 24 | +if ($objFleet->playerOwnerId != $user['id']) { |
|
| 25 | + $debug->warning($lang['fl_aks_hack_wrong_fleet'], 'Wrong Fleet Owner', 301); |
|
| 26 | 26 | message($lang['fl_aks_hack_wrong_fleet'], $lang['fl_error']); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | !$aks && !$userToAdd_unsafe ? $userToAdd_unsafe = $user['username'] : false; |
| 34 | 34 | |
| 35 | -if($userToAdd_unsafe) { |
|
| 35 | +if ($userToAdd_unsafe) { |
|
| 36 | 36 | $userToAdd = db_escape($userToAdd_unsafe); |
| 37 | 37 | $userToAddID = db_user_by_username($userToAdd_unsafe, false, 'id', true, true); |
| 38 | 38 | $userToAddID = $userToAddID['id']; |
| 39 | 39 | |
| 40 | - if($objFleet->target_owner_id == $userToAddID) { |
|
| 40 | + if ($objFleet->target_owner_id == $userToAddID) { |
|
| 41 | 41 | message($lang['flt_aks_player_same'], $lang['fl_error']); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | - if($userToAddID) { |
|
| 45 | - if(!$aks) { |
|
| 44 | + if ($userToAddID) { |
|
| 45 | + if (!$aks) { |
|
| 46 | 46 | // No AСS exists - making one |
| 47 | - if(!$objFleet->group_id) { |
|
| 47 | + if (!$objFleet->group_id) { |
|
| 48 | 48 | db_acs_insert($lang, $fleetid, $user, $objFleet); |
| 49 | 49 | |
| 50 | 50 | $aks = db_acs_get_by_fleet($fleetid); |
@@ -58,26 +58,26 @@ discard block |
||
| 58 | 58 | |
| 59 | 59 | $isUserExists = false; |
| 60 | 60 | $invited_ar = explode(",", $aks['eingeladen']); |
| 61 | - foreach($invited_ar as $inv) { |
|
| 61 | + foreach ($invited_ar as $inv) { |
|
| 62 | 62 | if ($userToAddID == $inv) { |
| 63 | 63 | $isUserExists = true; |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if(count($invited_ar) >= 5) { |
|
| 67 | + if (count($invited_ar) >= 5) { |
|
| 68 | 68 | message($lang['flt_aks_error_too_much_players'], $lang['fl_error']); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if($isUserExists) { |
|
| 71 | + if ($isUserExists) { |
|
| 72 | 72 | $userToAdd_unsafe != $user['username'] ? $add_user_message_mr = sprintf($lang['fl_aks_player_invited_already'], $userToAdd) : false; |
| 73 | 73 | } else { |
| 74 | 74 | $add_user_message_mr = sprintf($lang['fl_aks_player_invited'], $userToAdd); |
| 75 | 75 | db_acs_update($userToAddID, $fleetid) |
| 76 | - or die(sprintf($lang['fl_aks_adding_error'],db_error())); |
|
| 76 | + or die(sprintf($lang['fl_aks_adding_error'], db_error())); |
|
| 77 | 77 | $aks['eingeladen'] .= ',' . $userToAddID; |
| 78 | 78 | } |
| 79 | - msg_send_simple_message ( $userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
| 80 | - $lang['fl_aks_invite_message_header'], sprintf( $lang['fl_aks_invite_message'], $user['username'])); |
|
| 79 | + msg_send_simple_message($userToAddID, $user['id'], SN_TIME_NOW, MSG_TYPE_COMBAT, $user['username'], |
|
| 80 | + $lang['fl_aks_invite_message_header'], sprintf($lang['fl_aks_invite_message'], $user['username'])); |
|
| 81 | 81 | } else { |
| 82 | 82 | $add_user_message_mr = sprintf($lang['fl_aks_player_error'], $userToAdd); |
| 83 | 83 | } |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | 'MISSION_NAME' => $lang['type_mission'][MT_AKS], |
| 92 | 92 | )); |
| 93 | 93 | |
| 94 | -if($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
| 95 | - foreach($members as $row) { |
|
| 94 | +if ($aks['eingeladen'] && is_array($members = classSupernova::db_get_record_list(LOC_USER, "`id` in ({$aks['eingeladen']})")) && !empty($members)) { |
|
| 95 | + foreach ($members as $row) { |
|
| 96 | 96 | $template->assign_block_vars('invited', array( |
| 97 | 97 | 'NAME' => $row['username'], |
| 98 | 98 | )); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | $fleet_data = tplParseFleetObject($objFleet, $i, $user); |
| 118 | 118 | |
| 119 | 119 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
| 120 | -foreach($fleet_data['ships'] as $ship_data) { |
|
| 120 | +foreach ($fleet_data['ships'] as $ship_data) { |
|
| 121 | 121 | $template->assign_block_vars('fleets.ships', $ship_data); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | $destination_planet = &$mission_data->dst_planet; |
| 18 | 18 | |
| 19 | - if(empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
| 19 | + if (empty($destination_planet['id_owner']) || $objFleet->playerOwnerId != $destination_planet['id_owner']) { |
|
| 20 | 20 | $objFleet->mark_fleet_as_returned_and_save(); |
| 21 | 21 | |
| 22 | 22 | return CACHE_FLEET; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $fleet_resources[RES_DEUTERIUM], $lang['Deuterium'] |
| 32 | 32 | ) . '<br />' . $lang['sys_relocate_mess_user']; |
| 33 | 33 | $fleet_real_array = $objFleet->get_unit_list(); |
| 34 | - foreach($fleet_real_array as $ship_id => $ship_count) { |
|
| 34 | + foreach ($fleet_real_array as $ship_id => $ship_count) { |
|
| 35 | 35 | $Message .= $lang['tech'][$ship_id] . ' - ' . $ship_count . '<br />'; |
| 36 | 36 | } |
| 37 | 37 | msg_send_simple_message( |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | $source_planet = &$mission_data->src_planet; |
| 17 | 17 | $destination_planet = &$mission_data->dst_planet; |
| 18 | 18 | |
| 19 | - if(!isset($destination_planet['id']) || !$destination_planet['id_owner']) { |
|
| 19 | + if (!isset($destination_planet['id']) || !$destination_planet['id_owner']) { |
|
| 20 | 20 | $objFleet->mark_fleet_as_returned_and_save(); |
| 21 | 21 | |
| 22 | 22 | return CACHE_FLEET; |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $fleet_resources[RES_DEUTERIUM], $lang['Deuterium']); |
| 32 | 32 | msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
| 33 | 33 | |
| 34 | - if($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
| 34 | + if ($objFleet->target_owner_id <> $objFleet->playerOwnerId) { |
|
| 35 | 35 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_TRANSPORT, $lang['sys_mess_tower'], $lang['sys_mess_transport'], $Message); |
| 36 | 36 | } |
| 37 | 37 | |
@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * Fleet mission "Relocate" |
| 33 | 33 | * |
| 34 | - * @param $mission_data Mission |
|
| 34 | + * @param Mission $mission_data Mission |
|
| 35 | 35 | * |
| 36 | 36 | * @return int |
| 37 | 37 | * |