@@ -34,15 +34,16 @@ discard block |
||
34 | 34 | { |
35 | 35 | $sort2s = "DESC"; |
36 | 36 | $sort2 = 0; |
37 | -} |
|
38 | -else |
|
37 | +} else |
|
39 | 38 | { |
40 | 39 | $sort2s = "ASC"; |
41 | 40 | $sort2 = 1; |
42 | 41 | } |
43 | 42 | |
44 | 43 | $sort1 = sys_get_param_int('sort1'); |
45 | -if($sort1>5 || $sort1<0) $sort1 = 0; |
|
44 | +if($sort1>5 || $sort1<0) { |
|
45 | + $sort1 = 0; |
|
46 | +} |
|
46 | 47 | $sort1s = array( |
47 | 48 | 0 => '`ally_rank_id` %1$s;', |
48 | 49 | 1 => '`username` %1$s;', |
@@ -69,8 +70,7 @@ discard block |
||
69 | 70 | if ($ally['ally_owner'] == $userRow['id']) |
70 | 71 | { |
71 | 72 | $ally_range = ($ally['ally_owner_range'])?$ally['ally_owner_range']:$lang['Founder']; |
72 | - } |
|
73 | - else |
|
73 | + } else |
|
74 | 74 | { |
75 | 75 | if($user_admin) |
76 | 76 | { |
@@ -78,14 +78,14 @@ discard block |
||
78 | 78 | |
79 | 79 | foreach($ranks as $rankID => $rankArray){ |
80 | 80 | $ally_range .= '<option value="' . $rankID . '"'; |
81 | - if($rankID == $userRow['ally_rank_id']) |
|
82 | - $ally_range .= " selected"; |
|
81 | + if($rankID == $userRow['ally_rank_id']) { |
|
82 | + $ally_range .= " selected"; |
|
83 | + } |
|
83 | 84 | $ally_range .= '>' . $rankArray['name']; |
84 | 85 | $ally_range .= '</option>'; |
85 | 86 | } |
86 | 87 | $ally_range .= '</select>'; |
87 | - } |
|
88 | - else |
|
88 | + } else |
|
89 | 89 | { |
90 | 90 | $ally_range = $ranks[$userRow['ally_rank_id']]['name']; |
91 | 91 | } |
@@ -97,53 +97,44 @@ discard block |
||
97 | 97 | if ( $last_active < 60 ) |
98 | 98 | { |
99 | 99 | $tmp = "lime>{$lang['On']}"; |
100 | - } |
|
101 | - elseif ($last_active < 60 * 60) |
|
100 | + } elseif ($last_active < 60 * 60) |
|
102 | 101 | { |
103 | 102 | $last_active = round($last_active / 60); |
104 | 103 | $tmp = "lime>{$last_active} {$lang['sys_min_short']}"; |
105 | - } |
|
106 | - elseif ($last_active < 60 * 60 * 24) |
|
104 | + } elseif ($last_active < 60 * 60 * 24) |
|
107 | 105 | { |
108 | 106 | $last_active = round( $last_active / (60 * 60)); |
109 | 107 | $tmp = "green>{$last_active} {$lang['sys_hrs_short']}"; |
110 | - } |
|
111 | - else |
|
108 | + } else |
|
112 | 109 | { |
113 | 110 | $last_active = round( $last_active / (60 * 60 * 24)); |
114 | 111 | if ($last_active < 7) |
115 | 112 | { |
116 | 113 | $tmp = "yellow"; |
117 | - } |
|
118 | - elseif ($last_active < 30) |
|
114 | + } elseif ($last_active < 30) |
|
119 | 115 | { |
120 | 116 | $tmp = "orange"; |
121 | - } |
|
122 | - else |
|
117 | + } else |
|
123 | 118 | { |
124 | 119 | $tmp = "red"; |
125 | 120 | } |
126 | 121 | $tmp .= ">{$last_active} {$lang['sys_day_short']}"; |
127 | 122 | } |
128 | - } |
|
129 | - else |
|
123 | + } else |
|
130 | 124 | { |
131 | 125 | if($user_onlinestatus) |
132 | 126 | { |
133 | 127 | if ( $last_active < 60 * 5 ) |
134 | 128 | { |
135 | 129 | $tmp = "lime>{$lang['On']}"; |
136 | - } |
|
137 | - elseif ($last_active < 60 * 15) |
|
130 | + } elseif ($last_active < 60 * 15) |
|
138 | 131 | { |
139 | 132 | $tmp = "yellow>{$lang['ali_lessThen15min']}"; |
140 | - } |
|
141 | - else |
|
133 | + } else |
|
142 | 134 | { |
143 | 135 | $tmp = "red>{$lang['Off']}"; |
144 | 136 | } |
145 | - } |
|
146 | - else |
|
137 | + } else |
|
147 | 138 | { |
148 | 139 | $sort1 = max($sort1, 4); |
149 | 140 | $tmp = "orange>-"; |
@@ -23,8 +23,7 @@ |
||
23 | 23 | if($user_request['request_denied']) |
24 | 24 | { |
25 | 25 | $lang['request_text'] = sprintf($lang['ali_req_deny_msg'], $ally['ally_tag'], $user_request['request_text']); |
26 | - } |
|
27 | - else |
|
26 | + } else |
|
28 | 27 | { |
29 | 28 | $lang['request_text'] = sprintf($lang['ali_req_waiting'], $ally['ally_tag']); |
30 | 29 | } |
@@ -43,8 +43,7 @@ |
||
43 | 43 | doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_id} LIMIT 1;"); |
44 | 44 | |
45 | 45 | message(str_replace('%s', $ally_tag_raw, $lang['ally_been_maked']), str_replace('%s', $ally_tag_raw, $lang['ally_maked'])); |
46 | -} |
|
47 | -else |
|
46 | +} else |
|
48 | 47 | { |
49 | 48 | $page .= parsetemplate(gettemplate('ali_external_make'), $lang); |
50 | 49 | } |
@@ -46,8 +46,7 @@ |
||
46 | 46 | sn_db_transaction_commit(); |
47 | 47 | sys_redirect("galaxy.php?mode=name&galaxy={$uni_galaxy}&system={$uni_system}"); |
48 | 48 | } |
49 | - } |
|
50 | - catch (exception $e) |
|
49 | + } catch (exception $e) |
|
51 | 50 | { |
52 | 51 | sn_db_transaction_rollback(); |
53 | 52 | $template->assign_block_vars('result', array( |
@@ -18,18 +18,24 @@ discard block |
||
18 | 18 | |
19 | 19 | // Test de coherance de la destination (voir si elle se trouve dans les limites de l'univers connu |
20 | 20 | $errorlist = ''; |
21 | - if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) |
|
22 | - $errorlist .= $lang['fl_limit_galaxy']; |
|
23 | - if (!$system || $system > $config->game_maxSystem || $system < 1) |
|
24 | - $errorlist .= $lang['fl_limit_system']; |
|
25 | - if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) |
|
26 | - $errorlist .= $lang['fl_limit_planet']; |
|
27 | - if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) |
|
28 | - $errorlist .= $lang['fl_ownpl_err']; |
|
29 | - if (!$planet_type) |
|
30 | - $errorlist .= $lang['fl_no_planettype']; |
|
31 | - if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) |
|
32 | - $errorlist .= $lang['fl_fleet_err_pl']; |
|
21 | + if (!$galaxy || $galaxy > $config->game_maxGalaxy || $galaxy < 1) { |
|
22 | + $errorlist .= $lang['fl_limit_galaxy']; |
|
23 | + } |
|
24 | + if (!$system || $system > $config->game_maxSystem || $system < 1) { |
|
25 | + $errorlist .= $lang['fl_limit_system']; |
|
26 | + } |
|
27 | + if (!$planet || $planet < 1 || ($planet > $config->game_maxPlanet && $target_mission != MT_EXPLORE )) { |
|
28 | + $errorlist .= $lang['fl_limit_planet']; |
|
29 | + } |
|
30 | + if ($planetrow['galaxy'] == $galaxy && $planetrow['system'] == $system && $planetrow['planet'] == $planet && $planetrow['planet_type'] == $planet_type) { |
|
31 | + $errorlist .= $lang['fl_ownpl_err']; |
|
32 | + } |
|
33 | + if (!$planet_type) { |
|
34 | + $errorlist .= $lang['fl_no_planettype']; |
|
35 | + } |
|
36 | + if ($planet_type != PT_PLANET && $planet_type != PT_DEBRIS && $planet_type != PT_MOON) { |
|
37 | + $errorlist .= $lang['fl_fleet_err_pl']; |
|
38 | + } |
|
33 | 39 | if (empty($missiontype[$target_mission])) { |
34 | 40 | $errorlist .= $lang['fl_bad_mission']; |
35 | 41 | } |
@@ -56,29 +62,35 @@ discard block |
||
56 | 62 | } |
57 | 63 | } else { |
58 | 64 | if ($TargetPlanet['id_owner']){ |
59 | - if ($target_mission == MT_COLONIZE) |
|
60 | - $errorlist .= $lang['fl_colonized']; |
|
65 | + if ($target_mission == MT_COLONIZE) { |
|
66 | + $errorlist .= $lang['fl_colonized']; |
|
67 | + } |
|
61 | 68 | |
62 | 69 | if ($TargetPlanet['id_owner'] == $planetrow['id_owner']){ |
63 | - if ($target_mission == MT_ATTACK) |
|
64 | - $errorlist .= $lang['fl_no_self_attack']; |
|
65 | - |
|
66 | - if ($target_mission == MT_SPY) |
|
67 | - $errorlist .= $lang['fl_no_self_spy']; |
|
68 | - }else{ |
|
69 | - if ($target_mission == MT_RELOCATE) |
|
70 | - $errorlist .= $lang['fl_only_stay_at_home']; |
|
70 | + if ($target_mission == MT_ATTACK) { |
|
71 | + $errorlist .= $lang['fl_no_self_attack']; |
|
72 | + } |
|
73 | + |
|
74 | + if ($target_mission == MT_SPY) { |
|
75 | + $errorlist .= $lang['fl_no_self_spy']; |
|
76 | + } |
|
77 | + } else{ |
|
78 | + if ($target_mission == MT_RELOCATE) { |
|
79 | + $errorlist .= $lang['fl_only_stay_at_home']; |
|
80 | + } |
|
71 | 81 | } |
72 | - }else{ |
|
82 | + } else{ |
|
73 | 83 | if ($target_mission < MT_COLONIZE){ |
74 | 84 | $errorlist .= $lang['fl_unknow_target']; |
75 | - }else{ |
|
76 | - if ($target_mission == MT_DESTROY) |
|
77 | - $errorlist .= $lang['fl_nomoon']; |
|
85 | + } else{ |
|
86 | + if ($target_mission == MT_DESTROY) { |
|
87 | + $errorlist .= $lang['fl_nomoon']; |
|
88 | + } |
|
78 | 89 | |
79 | 90 | if ($target_mission == MT_RECYCLE){ |
80 | - if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) |
|
81 | - $errorlist .= $lang['fl_nodebris']; |
|
91 | + if($TargetPlanet['debris_metal'] + $TargetPlanet['debris_crystal'] == 0) { |
|
92 | + $errorlist .= $lang['fl_nodebris']; |
|
93 | + } |
|
82 | 94 | } |
83 | 95 | } |
84 | 96 | } |
@@ -126,8 +138,7 @@ discard block |
||
126 | 138 | $aks = doquery("SELECT * FROM {{aks}} WHERE id = '{$fleet_group}' LIMIT 1;", true); |
127 | 139 | if (!$aks) { |
128 | 140 | $fleet_group = 0; |
129 | - } |
|
130 | - else |
|
141 | + } else |
|
131 | 142 | { |
132 | 143 | $galaxy = $aks['galaxy']; |
133 | 144 | $system = $aks['system']; |
@@ -79,8 +79,7 @@ |
||
79 | 79 | |
80 | 80 | sn_db_transaction_commit(); |
81 | 81 | throw new Exception($info_action, ERR_NONE); |
82 | - } |
|
83 | - catch (Exception $e) |
|
82 | + } catch (Exception $e) |
|
84 | 83 | { |
85 | 84 | sn_db_transaction_rollback(); |
86 | 85 |
@@ -35,8 +35,7 @@ |
||
35 | 35 | if($planetrow['id_owner']) { |
36 | 36 | $global_data = sys_o_get_updated($user, $planetrow, SN_TIME_NOW); |
37 | 37 | $planetrow = $global_data['planet']; |
38 | - } |
|
39 | - else { |
|
38 | + } else { |
|
40 | 39 | // Locking user record |
41 | 40 | $user = db_user_by_id($user['id'], true); |
42 | 41 | } |
@@ -399,7 +399,9 @@ discard block |
||
399 | 399 | $units_levels = array(); |
400 | 400 | foreach($planet_unit_list as $unit_id) { |
401 | 401 | $unit_name = &$units_info[$unit_id][P_NAME]; |
402 | - if(!isset($row[$unit_name]) || !$row[$unit_name]) continue; |
|
402 | + if(!isset($row[$unit_name]) || !$row[$unit_name]) { |
|
403 | + continue; |
|
404 | + } |
|
403 | 405 | $units_levels[$unit_id] = $row[$unit_name]; |
404 | 406 | $unit_data[] = "({$user_id}," . LOC_PLANET . ",{$planet_id},{$units_info[$unit_id][P_UNIT_TYPE]},{$unit_id},{$units_levels[$unit_id]})"; |
405 | 407 | if(count($unit_data) > 30) { |
@@ -413,7 +415,9 @@ discard block |
||
413 | 415 | if($row['que']) { |
414 | 416 | $que = explode(';', $row['que']); |
415 | 417 | foreach($que as $que_item) { |
416 | - if(!$que_item) continue; |
|
418 | + if(!$que_item) { |
|
419 | + continue; |
|
420 | + } |
|
417 | 421 | |
418 | 422 | $que_item = explode(',', $que_item); |
419 | 423 | |
@@ -445,9 +449,13 @@ discard block |
||
445 | 449 | $return_resources = array(RES_METAL => 0, RES_CRYSTAL => 0, RES_DEUTERIUM => 0, ); |
446 | 450 | $hangar_units = sys_unit_str2arr($row['b_hangar_id']); |
447 | 451 | foreach($hangar_units as $unit_id => $unit_count) { |
448 | - if($unit_count <= 0) continue; |
|
452 | + if($unit_count <= 0) { |
|
453 | + continue; |
|
454 | + } |
|
449 | 455 | foreach($units_info[$unit_id][P_COST] as $resource_id => $resource_amount) { |
450 | - if(!in_array($resource_id, $group_resource_loot)) continue; |
|
456 | + if(!in_array($resource_id, $group_resource_loot)) { |
|
457 | + continue; |
|
458 | + } |
|
451 | 459 | $return_resources[$resource_id] += $unit_count * $resource_amount; |
452 | 460 | } |
453 | 461 | } |
@@ -464,11 +472,13 @@ discard block |
||
464 | 472 | } |
465 | 473 | } |
466 | 474 | |
467 | - if(!empty($unit_data)) |
|
468 | - upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
475 | + if(!empty($unit_data)) { |
|
476 | + upd_do_query('REPLACE INTO {{unit}} (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_type`, `unit_snid`, `unit_level`) VALUES ' . implode(',', $unit_data) . ';'); |
|
477 | + } |
|
469 | 478 | |
470 | - if(!empty($que_data)) |
|
471 | - upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
479 | + if(!empty($que_data)) { |
|
480 | + upd_do_query('INSERT INTO {{que}} (`que_player_id`, `que_planet_id`, `que_planet_id_origin`, `que_type`, `que_time_left`, `que_unit_id`, `que_unit_amount`, `que_unit_mode`, `que_unit_level`, `que_unit_time`, `que_unit_price`) VALUES ' . implode(',', $que_data) . ';'); |
|
481 | + } |
|
472 | 482 | |
473 | 483 | upd_alter_table('planets', $drop, true); |
474 | 484 | } |
@@ -761,9 +771,11 @@ discard block |
||
761 | 771 | !empty($strings) ? doquery($query_string . implode(',', $strings)) : false; |
762 | 772 | } |
763 | 773 | |
764 | - if(isset($update_tables['counter']['page'])) // TODO REMOVE |
|
774 | + if(isset($update_tables['counter']['page'])) { |
|
775 | + // TODO REMOVE |
|
765 | 776 | { |
766 | 777 | update_security_url("SELECT DISTINCT `page` as url FROM {{counter}}"); |
778 | + } |
|
767 | 779 | update_security_url("SELECT DISTINCT `url` as url FROM {{counter}}"); |
768 | 780 | } |
769 | 781 | } |
@@ -61,8 +61,7 @@ |
||
61 | 61 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |
62 | 62 | 'ALLY_TAG' => htmlentities($row['ally_tag'], ENT_COMPAT, 'UTF-8'), |
63 | 63 | )); |
64 | - } |
|
65 | - elseif($type=='ally') |
|
64 | + } elseif($type=='ally') |
|
66 | 65 | { |
67 | 66 | $template->assign_block_vars('search_result', array( |
68 | 67 | 'ALLY_NAME' => htmlentities($row['ally_name'], ENT_COMPAT, 'UTF-8'), |