@@ -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 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | function db_stat_list_statistic($who, $is_common_stat, $Rank, $start, $source = false) { |
| 87 | 87 | // pdump($source); |
| 88 | - if(!$source) { |
|
| 88 | + if (!$source) { |
|
| 89 | 89 | $source = array( |
| 90 | 90 | 'statpoints' => 'statpoints', |
| 91 | 91 | 'users' => 'users', |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | ); |
| 107 | 107 | } |
| 108 | 108 | // pdump($source); |
| 109 | - if($who == 1) { |
|
| 110 | - if($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
|
| 109 | + if ($who == 1) { |
|
| 110 | + if ($is_common_stat) { // , UNIX_TIMESTAMP(CONCAT(YEAR(CURRENT_DATE), DATE_FORMAT(`user_birthday`, '-%m-%d'))) AS `nearest_birthday` |
|
| 111 | 111 | $query_str = |
| 112 | 112 | "SELECT |
| 113 | 113 | @rownum:=@rownum+1 rownum, subject.{$source['id']} as `id`, sp.{$Rank}_rank as rank, sp.{$Rank}_old_rank as rank_old, sp.{$Rank}_points as points, subject.{$source['username']} as `name`, subject.* |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | function db_get_set_unique_id_value($current_value_unsafe, $db_id_field_name, $db_table_name, $db_value_field_name) { |
| 192 | 192 | $current_value_safe = db_escape($current_value_unsafe); |
| 193 | 193 | $value_id = doquery("SELECT `{$db_id_field_name}` AS id_field FROM {{{$db_table_name}}} WHERE `{$db_value_field_name}` = '{$current_value_safe}' LIMIT 1 FOR UPDATE", true); |
| 194 | - if(!isset($value_id['id_field']) || !$value_id['id_field']) { |
|
| 194 | + if (!isset($value_id['id_field']) || !$value_id['id_field']) { |
|
| 195 | 195 | doquery("INSERT INTO {{{$db_table_name}}} (`{$db_value_field_name}`) VALUES ('{$current_value_safe}');"); |
| 196 | 196 | $variable_id = db_insert_id(); |
| 197 | 197 | } else { |
@@ -161,7 +161,7 @@ |
||
| 161 | 161 | !is_array($user_id_list) ? $user_id_list = array($user_id_list) : false; |
| 162 | 162 | |
| 163 | 163 | $user_list = array(); |
| 164 | - foreach($user_id_list as $user_id_unsafe) { |
|
| 164 | + foreach ($user_id_list as $user_id_unsafe) { |
|
| 165 | 165 | $user = db_user_by_id($user_id_unsafe); |
| 166 | 166 | !empty($user) ? $user_list[$user_id_unsafe] = $user : false; |
| 167 | 167 | } |
@@ -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; |
@@ -4,9 +4,9 @@ discard block |
||
| 4 | 4 | { |
| 5 | 5 | $strPacked = "{$type}!"; |
| 6 | 6 | |
| 7 | - foreach($combat as $fleetID => $fleetCompress) |
|
| 7 | + foreach ($combat as $fleetID => $fleetCompress) |
|
| 8 | 8 | { |
| 9 | - foreach($fleetCompress as $key => $value) |
|
| 9 | + foreach ($fleetCompress as $key => $value) |
|
| 10 | 10 | { |
| 11 | 11 | $value = intval($value); |
| 12 | 12 | $strPacked .= "{$key},{$value};"; |
@@ -22,29 +22,29 @@ discard block |
||
| 22 | 22 | $fleet_id = 0; |
| 23 | 23 | |
| 24 | 24 | $arr_data_unpacked = explode('!', $str_data); |
| 25 | - foreach($arr_data_unpacked as $data_piece) |
|
| 25 | + foreach ($arr_data_unpacked as $data_piece) |
|
| 26 | 26 | { |
| 27 | - if(!$data_piece) |
|
| 27 | + if (!$data_piece) |
|
| 28 | 28 | { |
| 29 | 29 | continue; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - if($data_piece == 'A' || $data_piece == 'D') |
|
| 32 | + if ($data_piece == 'A' || $data_piece == 'D') |
|
| 33 | 33 | { |
| 34 | 34 | $fleet_type = $data_piece; |
| 35 | 35 | continue; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | $arr_unit_strings = explode(';', $data_piece); |
| 39 | - foreach($arr_unit_strings as $str_unit_string) |
|
| 39 | + foreach ($arr_unit_strings as $str_unit_string) |
|
| 40 | 40 | { |
| 41 | - if(!$str_unit_string) |
|
| 41 | + if (!$str_unit_string) |
|
| 42 | 42 | { |
| 43 | 43 | continue; |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | $arr_unit_data = explode(',', $str_unit_string); |
| 47 | - if($arr_unit_data[1]) |
|
| 47 | + if ($arr_unit_data[1]) |
|
| 48 | 48 | { |
| 49 | 49 | $unpacked[$fleet_type][$fleet_id][$arr_unit_data[0]] = intval($arr_unit_data[1]); |
| 50 | 50 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | */ |
| 12 | 12 | // ---------------------------------------------------------------------------------------------------------------- |
| 13 | 13 | function coe_compress_add_units($unit_group, $target_planet, &$compress_data, $target_user = array()) { |
| 14 | - foreach($unit_group as $unit_id) { |
|
| 15 | - if(($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
| 14 | + foreach ($unit_group as $unit_id) { |
|
| 15 | + if (($unit_count = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
| 16 | 16 | $compress_data[$unit_id] = $unit_count; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -22,8 +22,8 @@ discard block |
||
| 22 | 22 | global $lang; |
| 23 | 23 | |
| 24 | 24 | $result = "<tr><td class=\"c\" colspan=\"4\">{$section_title}</td></tr>"; |
| 25 | - foreach(sn_get_groups($group_name) as $unit_id) { |
|
| 26 | - if(($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
| 25 | + foreach (sn_get_groups($group_name) as $unit_id) { |
|
| 26 | + if (($unit_amount = mrc_get_level($target_user, $target_planet, $unit_id, false, true)) > 0) { |
|
| 27 | 27 | $result .= "<tr><td align=\"left\" colspan=\"3\">{$lang['tech'][$unit_id]}</td><td align=\"right\">{$unit_amount}</td></tr>"; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -54,14 +54,14 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $objFleet = $mission_data->fleet; |
| 56 | 56 | |
| 57 | - if(empty($target_user_row['id']) || empty($target_planet_row['id']) || empty($spying_user_row['id'])) { |
|
| 57 | + if (empty($target_user_row['id']) || empty($target_planet_row['id']) || empty($spying_user_row['id'])) { |
|
| 58 | 58 | $objFleet->mark_fleet_as_returned_and_save(); |
| 59 | 59 | |
| 60 | 60 | return $result; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $spy_probes = $objFleet->shipCountById(SHIP_SPY); |
| 64 | - if($spy_probes > 0) { |
|
| 64 | + if ($spy_probes > 0) { |
|
| 65 | 65 | $TargetSpyLvl = GetSpyLevel($target_user_row); |
| 66 | 66 | $CurrentSpyLvl = GetSpyLevel($spying_user_row); |
| 67 | 67 | $spy_diff_empire = $CurrentSpyLvl - $TargetSpyLvl; |
@@ -85,19 +85,19 @@ discard block |
||
| 85 | 85 | $spy_message .= "<td width=220>{$lang['sys_deuterium']}</td><td width=220 align=right>" . pretty_number($target_planet_row['deuterium']) . "</td>"; |
| 86 | 86 | $spy_message .= "<td width=220>{$lang['sys_energy']}</td><td width=220 align=right>" . pretty_number($target_planet_row['energy_max']) . "</td>"; |
| 87 | 87 | $spy_message .= "</tr>"; |
| 88 | - if($spy_diff >= 2) { |
|
| 88 | + if ($spy_diff >= 2) { |
|
| 89 | 89 | $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'fleet', $lang['tech'][UNIT_SHIPS], $target_user_row) . "</div>"; |
| 90 | 90 | coe_compress_add_units(sn_get_groups('fleet'), $target_planet_row, $combat_pack[0]); |
| 91 | 91 | } |
| 92 | - if($spy_diff >= 3) { |
|
| 92 | + if ($spy_diff >= 3) { |
|
| 93 | 93 | $spy_message .= "<div class='spy_medium'>" . flt_spy_scan($target_planet_row, 'defense', $lang['tech'][UNIT_DEFENCE], $target_user_row) . "</div>"; |
| 94 | 94 | coe_compress_add_units(sn_get_groups('defense_active'), $target_planet_row, $combat_pack[0]); |
| 95 | 95 | } |
| 96 | - if($spy_diff >= 5) { |
|
| 96 | + if ($spy_diff >= 5) { |
|
| 97 | 97 | $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'structures', $lang['tech'][UNIT_STRUCTURES], $target_user_row) . "</div>"; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if($spy_diff_empire >= 0) { |
|
| 100 | + if ($spy_diff_empire >= 0) { |
|
| 101 | 101 | $spy_message .= "<div class='spy_long'>" . flt_spy_scan($target_planet_row, 'tech', $lang['tech'][UNIT_TECHNOLOGIES], $target_user_row) . "</div>"; |
| 102 | 102 | coe_compress_add_units(array(TECH_WEAPON, TECH_SHIELD, TECH_ARMOR), $target_planet_row, $combat_pack[0], $target_user_row); |
| 103 | 103 | } |
@@ -106,13 +106,13 @@ discard block |
||
| 106 | 106 | $simulator_link = sn_ube_simulator_encode_replay($combat_pack, 'D'); |
| 107 | 107 | |
| 108 | 108 | $target_unit_list = 0; |
| 109 | - foreach(sn_get_groups('fleet') as $unit_id) { |
|
| 109 | + foreach (sn_get_groups('fleet') as $unit_id) { |
|
| 110 | 110 | $target_unit_list += max(0, mrc_get_level($target_user_row, $target_planet_row, $unit_id, false, true)); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | $spy_detected = $spy_probes * $target_unit_list / 4 * pow(2, $TargetSpyLvl - $CurrentSpyLvl); |
| 114 | 114 | |
| 115 | - if(mt_rand(0, 99) > $spy_detected) { |
|
| 115 | + if (mt_rand(0, 99) > $spy_detected) { |
|
| 116 | 116 | $spy_outcome_str = sprintf($lang['sys_mess_spy_detect_chance'], $spy_detected); |
| 117 | 117 | $spy_detected = false; |
| 118 | 118 | } else { |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | $target_message = "{$lang['sys_mess_spy_ennemyfleet']} {$spying_planet_row['name']} " . uni_render_coordinates_href($spying_planet_row, '', 3); |
| 133 | 133 | $target_message .= " {$lang['sys_mess_spy_seen_at']} {$target_planet_row['name']} " . uni_render_coordinates($target_planet_row); |
| 134 | 134 | |
| 135 | - if($spy_detected) { |
|
| 135 | + if ($spy_detected) { |
|
| 136 | 136 | $debris_planet_id = $target_planet_row['planet_type'] == PT_PLANET ? $target_planet_row['id'] : $target_planet_row['parent_planet']; |
| 137 | 137 | |
| 138 | 138 | $spy_cost = get_unit_param(SHIP_SPY, P_COST); |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | msg_send_simple_message($objFleet->target_owner_id, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, $lang['sys_mess_spy_control'], $lang['sys_mess_spy_activity'], $target_message); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - if($spy_detected) { |
|
| 152 | + if ($spy_detected) { |
|
| 153 | 153 | $objFleet->db_delete_this_fleet(); |
| 154 | 154 | } else { |
| 155 | 155 | $objFleet->mark_fleet_as_returned_and_save(); |
@@ -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 | |