@@ -14,39 +14,39 @@ discard block |
||
| 14 | 14 | |
| 15 | 15 | lng_include('fleet'); |
| 16 | 16 | |
| 17 | -if($TargetPlanet = sys_get_param_id('jmpto')) |
|
| 17 | +if ($TargetPlanet = sys_get_param_id('jmpto')) |
|
| 18 | 18 | { |
| 19 | 19 | sn_db_transaction_start(); |
| 20 | 20 | db_user_by_id($user['id'], true, 'id'); |
| 21 | 21 | $planetrow = DBStaticPlanet::db_planet_by_id($planetrow['id'], true); |
| 22 | - if(!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
| 22 | + if (!($NextJumpTime = uni_get_time_to_jump($planetrow))) |
|
| 23 | 23 | { |
| 24 | 24 | $TargetGate = DBStaticPlanet::db_planet_by_id($TargetPlanet, true, '`id`, `last_jump_time`'); |
| 25 | - if(mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
| 25 | + if (mrc_get_level($user, $TargetGate, STRUC_MOON_GATE) > 0) |
|
| 26 | 26 | { |
| 27 | - $NextDestTime = uni_get_time_to_jump ( $TargetGate ); |
|
| 28 | - if(!$NextDestTime) |
|
| 27 | + $NextDestTime = uni_get_time_to_jump($TargetGate); |
|
| 28 | + if (!$NextDestTime) |
|
| 29 | 29 | { |
| 30 | 30 | // $SubQueryOri = ""; |
| 31 | 31 | // $SubQueryDes = ""; |
| 32 | 32 | $ship_list = sys_get_param('ships'); |
| 33 | 33 | $db_changeset = array(); |
| 34 | - foreach($ship_list as $ship_id => $ship_count) |
|
| 34 | + foreach ($ship_list as $ship_id => $ship_count) |
|
| 35 | 35 | { |
| 36 | - if(!in_array($ship_id, sn_get_groups('fleet'))) |
|
| 36 | + if (!in_array($ship_id, sn_get_groups('fleet'))) |
|
| 37 | 37 | { |
| 38 | 38 | continue; |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | $ship_count = max(0, min(floor($ship_count), mrc_get_level($user, $planetrow, $ship_id))); |
| 42 | - if($ship_count) |
|
| 42 | + if ($ship_count) |
|
| 43 | 43 | { |
| 44 | 44 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, -$ship_count, $user, $planetrow['id']); |
| 45 | 45 | $db_changeset['unit'][] = OldDbChangeSet::db_changeset_prepare_unit($ship_id, $ship_count, $user, $TargetGate['id']); |
| 46 | 46 | } |
| 47 | 47 | } |
| 48 | 48 | // Dit monsieur, y avait quelque chose a envoyer ??? |
| 49 | - if(!empty($db_changeset)) |
|
| 49 | + if (!empty($db_changeset)) |
|
| 50 | 50 | { |
| 51 | 51 | DBStaticPlanet::db_planet_set_by_id($TargetGate['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
| 52 | 52 | DBStaticPlanet::db_planet_set_by_id($planetrow['id'], "`last_jump_time` = " . SN_TIME_NOW . ""); |
@@ -55,31 +55,31 @@ discard block |
||
| 55 | 55 | db_user_set_by_id($user['id'], "`current_planet` = '{$TargetGate['id']}'"); |
| 56 | 56 | |
| 57 | 57 | $planetrow['last_jump_time'] = SN_TIME_NOW; |
| 58 | - $RetMessage = $lang['gate_jump_done'] ." - ". pretty_time(uni_get_time_to_jump($planetrow)); |
|
| 58 | + $RetMessage = $lang['gate_jump_done'] . " - " . pretty_time(uni_get_time_to_jump($planetrow)); |
|
| 59 | 59 | } else { |
| 60 | 60 | $RetMessage = $lang['gate_wait_data']; |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | - $RetMessage = $lang['gate_wait_dest'] ." - ". pretty_time($NextDestTime); |
|
| 63 | + $RetMessage = $lang['gate_wait_dest'] . " - " . pretty_time($NextDestTime); |
|
| 64 | 64 | } |
| 65 | 65 | } else { |
| 66 | 66 | $RetMessage = $lang['gate_no_dest_g']; |
| 67 | 67 | } |
| 68 | 68 | } else { |
| 69 | - $RetMessage = $lang['gate_wait_star'] ." - ". pretty_time($NextJumpTime); |
|
| 69 | + $RetMessage = $lang['gate_wait_star'] . " - " . pretty_time($NextJumpTime); |
|
| 70 | 70 | } |
| 71 | 71 | sn_db_transaction_commit(); |
| 72 | 72 | messageBox($RetMessage, $lang['tech'][STRUC_MOON_GATE], "jumpgate.php", 10); |
| 73 | 73 | } else { |
| 74 | 74 | $template = gettemplate('jumpgate', true); |
| 75 | - if(mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
| 75 | + if (mrc_get_level($user, $planetrow, STRUC_MOON_GATE) > 0) |
|
| 76 | 76 | { |
| 77 | 77 | $Combo = ''; |
| 78 | 78 | $MoonList = DBStaticPlanet::db_planet_list_moon_other($user['id'], $planetrow['id']); |
| 79 | 79 | // while($CurMoon = db_fetch($MoonList)) |
| 80 | - foreach($MoonList as $CurMoon) |
|
| 80 | + foreach ($MoonList as $CurMoon) |
|
| 81 | 81 | { |
| 82 | - if(mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
| 82 | + if (mrc_get_level($user, $CurMoon, STRUC_MOON_GATE) >= 1) |
|
| 83 | 83 | { |
| 84 | 84 | $NextJumpTime = uni_get_time_to_jump($CurMoon); |
| 85 | 85 | $template->assign_block_vars('moon', array( |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | } |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - foreach(sn_get_groups('fleet') as $Ship) |
|
| 96 | + foreach (sn_get_groups('fleet') as $Ship) |
|
| 97 | 97 | { |
| 98 | - if(($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
| 98 | + if (($ship_count = mrc_get_level($user, $planetrow, $Ship)) <= 0) |
|
| 99 | 99 | { |
| 100 | 100 | continue; |
| 101 | 101 | } |
@@ -115,8 +115,7 @@ |
||
| 115 | 115 | )); |
| 116 | 116 | |
| 117 | 117 | display($template, $lang['tech'][STRUC_MOON_GATE]); |
| 118 | - } |
|
| 119 | - else |
|
| 118 | + } else |
|
| 120 | 119 | { |
| 121 | 120 | messageBox($lang['gate_no_src_ga'], $lang['tech'][STRUC_MOON_GATE], "overview.php", 10); |
| 122 | 121 | } |
@@ -2,9 +2,9 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
| 4 | 4 | |
| 5 | -if(!empty($_POST['return']) && is_array($_POST['return'])) { |
|
| 6 | - foreach($_POST['return'] as $fleet_id) { |
|
| 7 | - if($fleet_id = idval($fleet_id)) { |
|
| 5 | +if (!empty($_POST['return']) && is_array($_POST['return'])) { |
|
| 6 | + foreach ($_POST['return'] as $fleet_id) { |
|
| 7 | + if ($fleet_id = idval($fleet_id)) { |
|
| 8 | 8 | sn_db_transaction_start(); |
| 9 | 9 | $FleetRow = db_fleet_get($fleet_id); |
| 10 | 10 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | lng_include('overview'); |
| 24 | 24 | lng_include('fleet'); |
| 25 | 25 | |
| 26 | -if(!$planetrow) { |
|
| 26 | +if (!$planetrow) { |
|
| 27 | 27 | messageBox($lang['fl_noplanetrow'], $lang['fl_error']); |
| 28 | 28 | } |
| 29 | 29 | |
@@ -31,13 +31,13 @@ discard block |
||
| 31 | 31 | |
| 32 | 32 | $i = 0; |
| 33 | 33 | $fleet_list = fleet_list_by_owner_id($user['id']); |
| 34 | -foreach($fleet_list as $fleet_id => $fleet_row) { |
|
| 34 | +foreach ($fleet_list as $fleet_id => $fleet_row) { |
|
| 35 | 35 | $i++; |
| 36 | 36 | $fleet_data = tpl_parse_fleet_db($fleet_row, $i, $user); |
| 37 | 37 | |
| 38 | 38 | $template->assign_block_vars('fleets', $fleet_data['fleet']); |
| 39 | 39 | |
| 40 | - foreach($fleet_data['ships'] as $ship_data) { |
|
| 40 | + foreach ($fleet_data['ships'] as $ship_data) { |
|
| 41 | 41 | $template->assign_block_vars('fleets.ships', $ship_data); |
| 42 | 42 | } |
| 43 | 43 | } |
@@ -1,25 +1,25 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) { |
|
| 4 | 4 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if(!$user_admin) { |
|
| 7 | +if (!$user_admin) { |
|
| 8 | 8 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $template = gettemplate('ali_admin', $template); |
| 12 | 12 | |
| 13 | 13 | $text_list = array( |
| 14 | - 1 => array ('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
| 15 | - 2 => array ('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
| 16 | - 3 => array ('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
| 14 | + 1 => array('db_field' => 'ally_description', 'text_type' => 'Public_text_of_alliance'), |
|
| 15 | + 2 => array('db_field' => 'ally_text', 'text_type' => 'Internal_text'), |
|
| 16 | + 3 => array('db_field' => 'ally_request', 'text_type' => 'Show_of_request_text'), |
|
| 17 | 17 | ); |
| 18 | 18 | |
| 19 | 19 | $allyTextID = sys_get_param_int('t', 1); |
| 20 | -$allyTextID = ($allyTextID<1 || $allyTextID>3) ? 1 : $allyTextID; |
|
| 20 | +$allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
|
| 21 | 21 | |
| 22 | -if(sys_get_param_str('isSaveOptions')) { |
|
| 22 | +if (sys_get_param_str('isSaveOptions')) { |
|
| 23 | 23 | require_once('includes/includes/sys_avatar.php'); |
| 24 | 24 | |
| 25 | 25 | $new_image = $ally['ally_image']; |
@@ -31,32 +31,32 @@ discard block |
||
| 31 | 31 | // $template->assign_block_vars('result', $avatar_upload_result); |
| 32 | 32 | |
| 33 | 33 | $ally_changeset = array(); |
| 34 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
| 34 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
| 35 | 35 | $new_tag_unsafe = $new_tag; |
| 36 | 36 | $new_tag = db_escape($new_tag); |
| 37 | 37 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_tag($new_tag); |
| 38 | - if(!empty($isTaggedAllyExists)) { |
|
| 38 | + if (!empty($isTaggedAllyExists)) { |
|
| 39 | 39 | messageBox(sprintf($lang['ally_message_tag_exists'], $new_tag_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
| 40 | 40 | } |
| 41 | 41 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
| 42 | 42 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
| 45 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
| 46 | 46 | $new_name_unsafe = $new_name; |
| 47 | 47 | $new_name = db_escape($new_name); |
| 48 | 48 | $isTaggedAllyExists = DBStaticAlly::db_ally_get_by_name($new_name); |
| 49 | - if(!empty($isTaggedAllyExists)) { |
|
| 49 | + if (!empty($isTaggedAllyExists)) { |
|
| 50 | 50 | messageBox(sprintf($lang['ally_message_name_exists'], $new_name_unsafe), '', 'alliance.php?mode=admin&edit=ally'); |
| 51 | 51 | } |
| 52 | 52 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
| 55 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
| 56 | 56 | $new_owner_rank = db_escape($new_owner_rank); |
| 57 | 57 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
| 58 | 58 | } |
| 59 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
| 59 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
| 60 | 60 | $new_web = db_escape($new_web); |
| 61 | 61 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
| 62 | 62 | } |
@@ -65,31 +65,31 @@ discard block |
||
| 65 | 65 | // if(($new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow'])) && $new_request != $ally['ally_request_notallow']) { |
| 66 | 66 | // $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
| 67 | 67 | // } |
| 68 | - if($new_image != $ally['ally_image']) { |
|
| 68 | + if ($new_image != $ally['ally_image']) { |
|
| 69 | 69 | $new_image = intval($new_image); |
| 70 | 70 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if(!empty($ally_changeset)) { |
|
| 73 | + if (!empty($ally_changeset)) { |
|
| 74 | 74 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
| 75 | 75 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | -elseif(sys_get_param_str('isSaveText')) |
|
| 78 | +elseif (sys_get_param_str('isSaveText')) |
|
| 79 | 79 | { |
| 80 | 80 | $text = sys_get_param_str_both('text'); |
| 81 | 81 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
| 82 | 82 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
| 83 | 83 | } |
| 84 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
| 84 | +elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
| 85 | 85 | { |
| 86 | - if(!$isAllyOwner) |
|
| 86 | + if (!$isAllyOwner) |
|
| 87 | 87 | { |
| 88 | 88 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
| 92 | - if($newLeader['ally_id'] == $user['ally_id']) |
|
| 92 | + if ($newLeader['ally_id'] == $user['ally_id']) |
|
| 93 | 93 | { |
| 94 | 94 | sn_db_transaction_start(); |
| 95 | 95 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | sys_redirect('alliance.php'); |
| 100 | 100 | } |
| 101 | 101 | } |
| 102 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
| 102 | +elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
| 103 | 103 | { |
| 104 | - if(!$isAllyOwner) |
|
| 104 | + if (!$isAllyOwner) |
|
| 105 | 105 | { |
| 106 | 106 | messageBox($lang['Denied_access'], $lang['ally_admin']); |
| 107 | 107 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | 'ally_name' => htmlspecialchars($ally['ally_name']), |
| 125 | 125 | 'ally_tag' => htmlspecialchars($ally['ally_tag']), |
| 126 | 126 | 'ally_web' => htmlspecialchars($ally['ally_web']), |
| 127 | - 'ally_request_notallow_0' => (( $ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
| 127 | + 'ally_request_notallow_0' => (($ally['ally_request_notallow']) ? ' SELECTED' : ''), |
|
| 128 | 128 | 'ally_request_notallow_1' => ((!$ally['ally_request_notallow']) ? ' SELECTED' : ''), |
| 129 | 129 | 'ally_owner_range' => htmlspecialchars($ally['ally_owner_range']), |
| 130 | 130 | 'hideNotOwner' => $ally['ally_owner'] != $user['id'] ? 'display: hide;' : '', |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | { |
| 134 | 134 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
| 135 | 135 | unset($tmp); |
| 136 | - foreach($userAllyAdmins as $userAllyAdmin) |
|
| 136 | + foreach ($userAllyAdmins as $userAllyAdmin) |
|
| 137 | 137 | { |
| 138 | 138 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
| 139 | 139 | } |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | $template->assign_var('adminMembers', $tmp); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
| 144 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) |
|
| 145 | 145 | { |
| 146 | - if(!$sn_ali_admin_action_locale['title']) |
|
| 146 | + if (!$sn_ali_admin_action_locale['title']) |
|
| 147 | 147 | { |
| 148 | 148 | continue; |
| 149 | 149 | } |
@@ -74,14 +74,12 @@ discard block |
||
| 74 | 74 | doquery("UPDATE {{alliance}} SET " . implode(',', $ally_changeset) . " WHERE `id`='{$ally['id']}' LIMIT 1;"); |
| 75 | 75 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
| 76 | 76 | } |
| 77 | -} |
|
| 78 | -elseif(sys_get_param_str('isSaveText')) |
|
| 77 | +} elseif(sys_get_param_str('isSaveText')) |
|
| 79 | 78 | { |
| 80 | 79 | $text = sys_get_param_str_both('text'); |
| 81 | 80 | doquery("UPDATE {{alliance}} SET `{$text_list[$allyTextID]['db_field']}`='{$text['safe']}' WHERE `id`='{$ally['id']}';"); |
| 82 | 81 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
| 83 | -} |
|
| 84 | -elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
| 82 | +} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) |
|
| 85 | 83 | { |
| 86 | 84 | if(!$isAllyOwner) |
| 87 | 85 | { |
@@ -98,8 +96,7 @@ discard block |
||
| 98 | 96 | sn_db_transaction_commit(); |
| 99 | 97 | sys_redirect('alliance.php'); |
| 100 | 98 | } |
| 101 | -} |
|
| 102 | -elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
| 99 | +} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) |
|
| 103 | 100 | { |
| 104 | 101 | if(!$isAllyOwner) |
| 105 | 102 | { |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 3 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 4 | 4 | { |
| 5 | 5 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | 8 | $template = gettemplate('ali_info', true); |
| 9 | 9 | |
| 10 | -if($mode == 'exit') |
|
| 10 | +if ($mode == 'exit') |
|
| 11 | 11 | { |
| 12 | 12 | if ($ally['ally_owner'] == $user['id']) |
| 13 | 13 | { |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
| 25 | 25 | } |
| 26 | 26 | } |
| 27 | -elseif($mode == 'ainfo') |
|
| 27 | +elseif ($mode == 'ainfo') |
|
| 28 | 28 | { |
| 29 | 29 | $tag = sys_get_param_str('tag'); |
| 30 | 30 | $id_ally = sys_get_param_id('a'); |
| 31 | - if($tag) |
|
| 31 | + if ($tag) |
|
| 32 | 32 | { |
| 33 | 33 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
| 34 | 34 | } |
| 35 | - elseif($id_ally) |
|
| 35 | + elseif ($id_ally) |
|
| 36 | 36 | { |
| 37 | 37 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if(!$ally) |
|
| 40 | + if (!$ally) |
|
| 41 | 41 | { |
| 42 | 42 | messageBox($lang['ali_sys_notFound'], $lang['Ally_info_1']); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(!$ally['ally_description']) |
|
| 45 | + if (!$ally['ally_description']) |
|
| 46 | 46 | { |
| 47 | 47 | $ally['ally_description'] = $lang['Ally_nodescription']; |
| 48 | 48 | } |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | 'EXTERNAL' => true, |
| 52 | 52 | 'USER_ALLY_ID' => $user['ally_id'], |
| 53 | 53 | )); |
| 54 | - $page_header = $lang['sys_alliance']; |
|
| 54 | + $page_header = $lang['sys_alliance']; |
|
| 55 | 55 | } |
| 56 | 56 | else |
| 57 | 57 | { |
| 58 | 58 | $page_header = $lang['your_alliance']; |
| 59 | 59 | |
| 60 | - if($ally['ally_owner'] == $user['id']) |
|
| 60 | + if ($ally['ally_owner'] == $user['id']) |
|
| 61 | 61 | { |
| 62 | 62 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
| 63 | 63 | } |
| 64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
| 64 | + elseif ($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
| 65 | 65 | { |
| 66 | 66 | $range = $ranks[$user['ally_rank_id']]['name']; |
| 67 | 67 | } |
@@ -105,9 +105,9 @@ discard block |
||
| 105 | 105 | )); |
| 106 | 106 | |
| 107 | 107 | $relations = ali_relations($ally['id']); |
| 108 | -foreach($relations as $relation) |
|
| 108 | +foreach ($relations as $relation) |
|
| 109 | 109 | { |
| 110 | - if($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
| 110 | + if ($relation['alliance_diplomacy_contr_ally_id'] && $relation['alliance_diplomacy_ally_id']) |
|
| 111 | 111 | { |
| 112 | 112 | $template->assign_block_vars('relation', array( |
| 113 | 113 | 'NAME' => $relation['alliance_diplomacy_contr_ally_name'], |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | } |
| 118 | 118 | } |
| 119 | 119 | |
| 120 | -function ali_render(){$func_args = func_get_args();return sn_function_call(__FUNCTION__, $func_args);} |
|
| 120 | +function ali_render() {$func_args = func_get_args(); return sn_function_call(__FUNCTION__, $func_args); } |
|
| 121 | 121 | ali_render(); |
| 122 | 122 | |
| 123 | 123 | display($template, "{$lang['alliance']} [{$ally['ally_name']}]"); |
@@ -23,16 +23,14 @@ discard block |
||
| 23 | 23 | $lang['Go_out_welldone'] = str_replace("%s", $ally_name, $lang['Go_out_welldone']); |
| 24 | 24 | messageBox(sprintf($lang['ali_info_leave_success'], $ally['ally_name']), $lang['sys_alliance']); |
| 25 | 25 | } |
| 26 | -} |
|
| 27 | -elseif($mode == 'ainfo') |
|
| 26 | +} elseif($mode == 'ainfo') |
|
| 28 | 27 | { |
| 29 | 28 | $tag = sys_get_param_str('tag'); |
| 30 | 29 | $id_ally = sys_get_param_id('a'); |
| 31 | 30 | if($tag) |
| 32 | 31 | { |
| 33 | 32 | $ally = doquery("SELECT * FROM {{alliance}} WHERE ally_tag='{$tag}' LIMIT 1;", '', true); |
| 34 | - } |
|
| 35 | - elseif($id_ally) |
|
| 33 | + } elseif($id_ally) |
|
| 36 | 34 | { |
| 37 | 35 | $ally = doquery("SELECT * FROM {{alliance}} WHERE id='{$id_ally}' LIMIT 1;", '', true); |
| 38 | 36 | } |
@@ -52,20 +50,17 @@ discard block |
||
| 52 | 50 | 'USER_ALLY_ID' => $user['ally_id'], |
| 53 | 51 | )); |
| 54 | 52 | $page_header = $lang['sys_alliance']; |
| 55 | -} |
|
| 56 | -else |
|
| 53 | +} else |
|
| 57 | 54 | { |
| 58 | 55 | $page_header = $lang['your_alliance']; |
| 59 | 56 | |
| 60 | 57 | if($ally['ally_owner'] == $user['id']) |
| 61 | 58 | { |
| 62 | 59 | $range = $ally['ally_owner_range'] ? $ally['ally_owner_range'] : $lang['Founder']; |
| 63 | - } |
|
| 64 | - elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
| 60 | + } elseif($user['ally_rank_id'] != 0 && isset($ranks[$user['ally_rank_id']]['name'])) |
|
| 65 | 61 | { |
| 66 | 62 | $range = $ranks[$user['ally_rank_id']]['name']; |
| 67 | - } |
|
| 68 | - else |
|
| 63 | + } else |
|
| 69 | 64 | { |
| 70 | 65 | $range = $lang['member']; |
| 71 | 66 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | use \DBAL\DbQuery; |
| 4 | 4 | |
| 5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 6 | 6 | { |
| 7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 8 | 8 | } |
@@ -16,28 +16,28 @@ discard block |
||
| 16 | 16 | |
| 17 | 17 | $ally_name_safe = db_escape($user['ally_name']); |
| 18 | 18 | |
| 19 | -if(sys_get_param_str('ali_dip_offer_make')) |
|
| 19 | +if (sys_get_param_str('ali_dip_offer_make')) |
|
| 20 | 20 | { |
| 21 | 21 | $alliance_negotiation_relation = sys_get_param_str('alliance_negotiation_relation'); |
| 22 | - if(!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
| 22 | + if (!array_key_exists($alliance_negotiation_relation, $sn_diplomacy_relation_list)) |
|
| 23 | 23 | { |
| 24 | 24 | messageBox($lang['ali_dip_err_wrong_offer'], $page_title); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $alliance_negotiation_contr_ally_id = sys_get_param_id('alliance_negotiation_contr_ally_id'); |
| 28 | - if($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
| 28 | + if ($alliance_negotiation_contr_ally_id == $user['ally_id']) |
|
| 29 | 29 | { |
| 30 | 30 | messageBox($lang['ali_dip_err_same_ally'], $page_title); |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $contr_ally_row = doquery("SELECT `ally_name` FROM {{alliance}} WHERE `id` = {$alliance_negotiation_contr_ally_id} LIMIT 1;", '', true); |
| 34 | - if(!$contr_ally_row) |
|
| 34 | + if (!$contr_ally_row) |
|
| 35 | 35 | { |
| 36 | 36 | messageBox($lang['ali_dip_err_no_ally'], $page_title); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $relation_current_id = ali_relation($user['ally_id'], $alliance_negotiation_contr_ally_id); |
| 40 | - if($alliance_negotiation_relation == $relation_current_id) |
|
| 40 | + if ($alliance_negotiation_relation == $relation_current_id) |
|
| 41 | 41 | { |
| 42 | 42 | messageBox(sprintf($lang['ali_dip_err_offer_same'], $lang['ali_dip_relations'][$alliance_negotiation_relation]), $page_title); |
| 43 | 43 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $relation_new = $sn_diplomacy_relation_list[$alliance_negotiation_relation]; |
| 51 | 51 | $relation_current = $sn_diplomacy_relation_list[$relation_current_id]; |
| 52 | - if($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
| 52 | + if ($relation_new['enter_delay'] == -1 || $relation_current['exit_delay'] == -1) |
|
| 53 | 53 | { |
| 54 | 54 | DbQuery::build() |
| 55 | 55 | ->setTable('alliance_negotiation') |
@@ -82,39 +82,39 @@ discard block |
||
| 82 | 82 | else |
| 83 | 83 | { |
| 84 | 84 | $offer_id = sys_get_param_id('offer_id'); |
| 85 | - if($offer_id) |
|
| 85 | + if ($offer_id) |
|
| 86 | 86 | { |
| 87 | 87 | $offer_answer = sys_get_param_str('answer'); |
| 88 | 88 | |
| 89 | 89 | $negotiation = doquery("SELECT * FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;", '', true); |
| 90 | - if(!$negotiation) |
|
| 90 | + if (!$negotiation) |
|
| 91 | 91 | { |
| 92 | 92 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
| 93 | 93 | } |
| 94 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
| 94 | + elseif ($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
| 95 | 95 | { |
| 96 | 96 | // TODO: Add log of hack attempt |
| 97 | 97 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
| 98 | 98 | } |
| 99 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
| 99 | + elseif ($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
| 100 | 100 | { |
| 101 | - if($offer_answer == 'accept') |
|
| 101 | + if ($offer_answer == 'accept') |
|
| 102 | 102 | { |
| 103 | 103 | // TODO: Add log of hack attempt |
| 104 | 104 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
| 105 | 105 | } |
| 106 | - elseif($offer_answer == 'deny') |
|
| 106 | + elseif ($offer_answer == 'deny') |
|
| 107 | 107 | { |
| 108 | 108 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | else |
| 112 | 112 | { |
| 113 | - if($offer_answer == 'accept') |
|
| 113 | + if ($offer_answer == 'accept') |
|
| 114 | 114 | { |
| 115 | 115 | $accept_offer = true; |
| 116 | 116 | } |
| 117 | - elseif($offer_answer == 'deny') |
|
| 117 | + elseif ($offer_answer == 'deny') |
|
| 118 | 118 | { |
| 119 | 119 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
| 120 | 120 | } |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | -if($accept_offer) |
|
| 125 | +if ($accept_offer) |
|
| 126 | 126 | { |
| 127 | 127 | sn_db_transaction_start(); |
| 128 | 128 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | sn_db_transaction_commit(); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | -foreach($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
| 164 | +foreach ($sn_diplomacy_relation_list as $diplomacy_relation_id => $diplomacy_relation) |
|
| 165 | 165 | { |
| 166 | 166 | $template->assign_block_vars('relation', array( |
| 167 | 167 | 'ID' => $diplomacy_relation_id, |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | $query = doquery("SELECT id, ally_name, ally_tag FROM {{alliance}} WHERE `id` != {$user['ally_id']} ORDER BY ally_name;"); |
| 173 | -while($alliance = db_fetch($query)) |
|
| 173 | +while ($alliance = db_fetch($query)) |
|
| 174 | 174 | { |
| 175 | 175 | $template->assign_block_vars('alliance', array( |
| 176 | 176 | 'ID' => $alliance['id'], |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | WHERE |
| 190 | 190 | alliance_negotiation_ally_id = {$user['ally_id']} OR alliance_negotiation_contr_ally_id = {$user['ally_id']};" |
| 191 | 191 | ); |
| 192 | -while($offer = db_fetch($query)) |
|
| 192 | +while ($offer = db_fetch($query)) |
|
| 193 | 193 | { |
| 194 | 194 | $template->assign_block_vars('offer', array( |
| 195 | 195 | 'ID' => $offer['alliance_negotiation_id'], |
@@ -66,8 +66,7 @@ discard block |
||
| 66 | 66 | ->doInsert(); |
| 67 | 67 | |
| 68 | 68 | $accept_offer = false; |
| 69 | - } |
|
| 70 | - else |
|
| 69 | + } else |
|
| 71 | 70 | { |
| 72 | 71 | $accept_offer = true; |
| 73 | 72 | $negotiation = array( |
@@ -78,8 +77,7 @@ discard block |
||
| 78 | 77 | 'alliance_negotiation_relation' => $alliance_negotiation_relation, |
| 79 | 78 | ); |
| 80 | 79 | } |
| 81 | -} |
|
| 82 | -else |
|
| 80 | +} else |
|
| 83 | 81 | { |
| 84 | 82 | $offer_id = sys_get_param_id('offer_id'); |
| 85 | 83 | if($offer_id) |
@@ -90,31 +88,26 @@ discard block |
||
| 90 | 88 | if(!$negotiation) |
| 91 | 89 | { |
| 92 | 90 | messageBox($lang['ali_dip_err_offer_none'], $page_title); |
| 93 | - } |
|
| 94 | - elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
| 91 | + } elseif($negotiation['alliance_negotiation_ally_id'] != $user['ally_id'] && $negotiation['alliance_negotiation_contr_ally_id'] != $user['ally_id']) |
|
| 95 | 92 | { |
| 96 | 93 | // TODO: Add log of hack attempt |
| 97 | 94 | messageBox($lang['ali_dip_err_offer_alien'], $page_title); |
| 98 | - } |
|
| 99 | - elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
| 95 | + } elseif($negotiation['alliance_negotiation_ally_id'] == $user['ally_id']) |
|
| 100 | 96 | { |
| 101 | 97 | if($offer_answer == 'accept') |
| 102 | 98 | { |
| 103 | 99 | // TODO: Add log of hack attempt |
| 104 | 100 | messageBox($lang['ali_dip_err_offer_accept_own'], $page_title); |
| 105 | - } |
|
| 106 | - elseif($offer_answer == 'deny') |
|
| 101 | + } elseif($offer_answer == 'deny') |
|
| 107 | 102 | { |
| 108 | 103 | doquery("DELETE FROM {{alliance_negotiation}} WHERE alliance_negotiation_id = {$offer_id} LIMIT 1;"); |
| 109 | 104 | } |
| 110 | - } |
|
| 111 | - else |
|
| 105 | + } else |
|
| 112 | 106 | { |
| 113 | 107 | if($offer_answer == 'accept') |
| 114 | 108 | { |
| 115 | 109 | $accept_offer = true; |
| 116 | - } |
|
| 117 | - elseif($offer_answer == 'deny') |
|
| 110 | + } elseif($offer_answer == 'deny') |
|
| 118 | 111 | { |
| 119 | 112 | DBStaticAlly::db_ally_negotiation_update_status_1($offer_id); |
| 120 | 113 | } |
@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | // Pretty Safe |
| 3 | 3 | // TODO: Add ally_tag to usertable |
| 4 | 4 | |
| 5 | -if(!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 5 | +if (!defined('SN_IN_ALLY') || SN_IN_ALLY !== true) |
|
| 6 | 6 | { |
| 7 | 7 | $debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 8 | 8 | } |
@@ -12,15 +12,15 @@ discard block |
||
| 12 | 12 | $ally_name_raw = sys_get_param_str_unsafe('name'); |
| 13 | 13 | $ally_name = db_escape($ally_name_raw); |
| 14 | 14 | |
| 15 | -if($ally_tag) |
|
| 15 | +if ($ally_tag) |
|
| 16 | 16 | { |
| 17 | - if(!$ally_name_raw || !$ally_tag_raw) |
|
| 17 | + if (!$ally_name_raw || !$ally_tag_raw) |
|
| 18 | 18 | { |
| 19 | 19 | messageBox($lang['have_not_name'], $lang['make_alliance']); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | $query = doquery("SELECT ally_tag FROM {{alliance}} WHERE `ally_tag` = '{$ally_tag}' or `ally_name` = '{$ally_name}' LIMIT 1;", true); |
| 23 | - if($query) |
|
| 23 | + if ($query) |
|
| 24 | 24 | { |
| 25 | 25 | messageBox(str_replace('%s', $query['ally_tag'] == $ally_tag_raw ? $ally_tag_raw : $ally_name_raw, $lang['always_exist']), $lang['make_alliance']); |
| 26 | 26 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | $language_new = sys_get_param_str('langer', $user['lang']); |
| 13 | 13 | |
| 14 | - if($language_new != $user['lang']) { |
|
| 14 | + if ($language_new != $user['lang']) { |
|
| 15 | 15 | $lang->lng_switch($language_new); |
| 16 | 16 | } |
| 17 | 17 | |
@@ -20,35 +20,35 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | $FMT_DATE = preg_replace(array('/d/', '/m/', '/Y/'), array('DD', 'MM', 'YYYY'), FMT_DATE); |
| 22 | 22 | |
| 23 | - if(sys_get_param_str('mode') == 'change') { |
|
| 24 | - if($user['authlevel'] > 0) { |
|
| 23 | + if (sys_get_param_str('mode') == 'change') { |
|
| 24 | + if ($user['authlevel'] > 0) { |
|
| 25 | 25 | $planet_protection = sys_get_param_int('adm_pl_prot') ? $user['authlevel'] : 0; |
| 26 | 26 | DBStaticPlanet::db_planet_set_by_owner($user['id'], "`id_level` = '{$planet_protection}'"); |
| 27 | 27 | db_user_set_by_id($user['id'], "`admin_protection` = '{$planet_protection}'"); |
| 28 | 28 | $user['admin_protection'] = $planet_protection; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | - if(sys_get_param_int('vacation') && !$config->user_vacation_disable) { |
|
| 31 | + if (sys_get_param_int('vacation') && !$config->user_vacation_disable) { |
|
| 32 | 32 | sn_db_transaction_start(); |
| 33 | - if($user['authlevel'] < 3) { |
|
| 34 | - if($user['vacation_next'] > SN_TIME_NOW) { |
|
| 33 | + if ($user['authlevel'] < 3) { |
|
| 34 | + if ($user['vacation_next'] > SN_TIME_NOW) { |
|
| 35 | 35 | messageBox($lang['opt_vacation_err_timeout'], $lang['Error'], 'index.php?page=options', 5); |
| 36 | 36 | die(); |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | - if(fleet_count_flying($user['id'])) { |
|
| 39 | + if (fleet_count_flying($user['id'])) { |
|
| 40 | 40 | messageBox($lang['opt_vacation_err_your_fleet'], $lang['Error'], 'index.php?page=options', 5); |
| 41 | 41 | die(); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $que = que_get($user['id'], false); |
| 45 | - if(!empty($que)) { |
|
| 45 | + if (!empty($que)) { |
|
| 46 | 46 | messageBox($lang['opt_vacation_err_que'], $lang['Error'], 'index.php?page=options', 5); |
| 47 | 47 | die(); |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $query = classSupernova::db_get_record_list(LOC_PLANET, "`id_owner` = {$user['id']}"); |
| 51 | - foreach($query as $planet) { |
|
| 51 | + foreach ($query as $planet) { |
|
| 52 | 52 | DBStaticPlanet::db_planet_set_by_id($planet['id'], |
| 53 | 53 | "last_update = " . SN_TIME_NOW . ", energy_used = '0', energy_max = '0', |
| 54 | 54 | metal_perhour = '{$config->metal_basic_income}', crystal_perhour = '{$config->crystal_basic_income}', deuterium_perhour = '{$config->deuterium_basic_income}', |
@@ -63,9 +63,9 @@ discard block |
||
| 63 | 63 | sn_db_transaction_commit(); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
| 67 | - foreach($option_group as $option_name => $option_value) { |
|
| 68 | - if($user[$option_name] !== null) { |
|
| 66 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
| 67 | + foreach ($option_group as $option_name => $option_value) { |
|
| 68 | + if ($user[$option_name] !== null) { |
|
| 69 | 69 | $user[$option_name] = sys_get_param_str($option_name); |
| 70 | 70 | } else { |
| 71 | 71 | $user[$option_name] = $option_value; |
@@ -76,12 +76,12 @@ discard block |
||
| 76 | 76 | |
| 77 | 77 | |
| 78 | 78 | $player_options = sys_get_param('options'); |
| 79 | - if(!empty($player_options)) { |
|
| 80 | - if($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) { |
|
| 79 | + if (!empty($player_options)) { |
|
| 80 | + if ($player_options[PLAYER_OPTION_TUTORIAL_CURRENT] == classSupernova::$config->tutorial_first_item) { |
|
| 81 | 81 | $player_options[PLAYER_OPTION_TUTORIAL_FINISHED] = 0; |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - array_walk($player_options, function (&$value) { |
|
| 84 | + array_walk($player_options, function(&$value) { |
|
| 85 | 85 | // TODO - Когда будет больше параметров - сделать больше проверок |
| 86 | 86 | $value = intval($value); |
| 87 | 87 | }); |
@@ -90,15 +90,15 @@ discard block |
||
| 90 | 90 | |
| 91 | 91 | $username = substr(sys_get_param_str_unsafe('username'), 0, 32); |
| 92 | 92 | $username_safe = db_escape($username); |
| 93 | - if($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 93 | + if ($username && $user['username'] != $username && $config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_NONE && sys_get_param_int('username_confirm') && !strpbrk($username, LOGIN_REGISTER_CHARACTERS_PROHIBITED)) { |
|
| 94 | 94 | // проверка на корректность |
| 95 | 95 | sn_db_transaction_start(); |
| 96 | 96 | $name_check = doquery("SELECT * FROM {{player_name_history}} WHERE `player_name` LIKE \"{$username_safe}\" LIMIT 1 FOR UPDATE;", true); |
| 97 | - if(!$name_check || $name_check['player_id'] == $user['id']) { |
|
| 97 | + if (!$name_check || $name_check['player_id'] == $user['id']) { |
|
| 98 | 98 | $user = db_user_by_id($user['id'], true); |
| 99 | - switch($config->game_user_changename) { |
|
| 99 | + switch ($config->game_user_changename) { |
|
| 100 | 100 | case SERVER_PLAYER_NAME_CHANGE_PAY: |
| 101 | - if(mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
| 101 | + if (mrc_get_level($user, $planetrow, RES_DARK_MATTER) < $config->game_user_changename_cost) { |
|
| 102 | 102 | $template_result['.']['result'][] = array( |
| 103 | 103 | 'STATUS' => ERR_ERROR, |
| 104 | 104 | 'MESSAGE' => $lang['opt_msg_name_change_err_no_dm'], |
@@ -128,18 +128,18 @@ discard block |
||
| 128 | 128 | sn_db_transaction_commit(); |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - if($new_password = sys_get_param('newpass1')) { |
|
| 131 | + if ($new_password = sys_get_param('newpass1')) { |
|
| 132 | 132 | try { |
| 133 | - if($new_password != sys_get_param('newpass2')) { |
|
| 133 | + if ($new_password != sys_get_param('newpass2')) { |
|
| 134 | 134 | throw new Exception($lang['opt_err_pass_unmatched'], ERR_WARNING); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | - if(!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
| 137 | + if (!classSupernova::$auth->password_change(sys_get_param('db_password'), $new_password)) { |
|
| 138 | 138 | throw new Exception($lang['opt_err_pass_wrong'], ERR_WARNING); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | throw new Exception($lang['opt_msg_pass_changed'], ERR_NONE); |
| 142 | - } catch(Exception $e) { |
|
| 142 | + } catch (Exception $e) { |
|
| 143 | 143 | $template_result['.']['result'][] = array( |
| 144 | 144 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
| 145 | 145 | 'MESSAGE' => $e->getMessage() |
@@ -160,12 +160,12 @@ discard block |
||
| 160 | 160 | $user['gender'] = $user['gender'] == GENDER_UNKNOWN ? $gender : $user['gender']; |
| 161 | 161 | |
| 162 | 162 | try { |
| 163 | - if($user['birthday']) { |
|
| 163 | + if ($user['birthday']) { |
|
| 164 | 164 | throw new exception(); |
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | $user_birthday = sys_get_param_str_unsafe('user_birthday'); |
| 168 | - if(!$user_birthday || $user_birthday == $FMT_DATE) { |
|
| 168 | + if (!$user_birthday || $user_birthday == $FMT_DATE) { |
|
| 169 | 169 | throw new exception(); |
| 170 | 170 | } |
| 171 | 171 | |
@@ -175,16 +175,16 @@ discard block |
||
| 175 | 175 | $pos['Y'] = strpos(FMT_DATE, 'Y'); |
| 176 | 176 | asort($pos); |
| 177 | 177 | $i = 0; |
| 178 | - foreach($pos as &$position) { |
|
| 178 | + foreach ($pos as &$position) { |
|
| 179 | 179 | $position = ++$i; |
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | $regexp = "/" . preg_replace(array('/\\\\/', '/\//', '/\./', '/\-/', '/d/', '/m/', '/Y/'), array('\\\\\\', '\/', '\.', '\-', '(\d?\d)', '(\d?\d)', '(\d{4})'), FMT_DATE) . "/"; |
| 183 | - if(!preg_match($regexp, $user_birthday, $match)) { |
|
| 183 | + if (!preg_match($regexp, $user_birthday, $match)) { |
|
| 184 | 184 | throw new exception(); |
| 185 | 185 | } |
| 186 | 186 | |
| 187 | - if(!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
| 187 | + if (!checkdate($match[$pos['m']], $match[$pos['d']], $match[$pos['Y']])) { |
|
| 188 | 188 | throw new exception(); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -192,13 +192,13 @@ discard block |
||
| 192 | 192 | // EOF black magic! Now we have valid SQL date in $user['user_birthday'] - independent of date format |
| 193 | 193 | |
| 194 | 194 | $year = date('Y', SN_TIME_NOW); |
| 195 | - if(mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
| 195 | + if (mktime(0, 0, 0, $match[$pos['m']], $match[$pos['d']], $year) > SN_TIME_NOW) { |
|
| 196 | 196 | $year--; |
| 197 | 197 | } |
| 198 | 198 | $user['user_birthday_celebrated'] = db_escape("{$year}-{$match[$pos['m']]}-{$match[$pos['d']]}"); |
| 199 | 199 | |
| 200 | 200 | $user_birthday = ", `user_birthday` = '{$user['user_birthday']}', `user_birthday_celebrated` = '{$user['user_birthday_celebrated']}'"; |
| 201 | - } catch(exception $e) { |
|
| 201 | + } catch (exception $e) { |
|
| 202 | 202 | $user_birthday = ''; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -208,14 +208,14 @@ discard block |
||
| 208 | 208 | $template_result['.']['result'][] = $avatar_upload_result; |
| 209 | 209 | |
| 210 | 210 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
| 211 | - if(sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
| 211 | + if (sys_get_param_int('PLAYER_OPTION_TIME_DIFF_FORCED')) { |
|
| 212 | 212 | playerTimeDiff::user_time_diff_set(array( |
| 213 | 213 | PLAYER_OPTION_TIME_DIFF => sys_get_param_int('PLAYER_OPTION_TIME_DIFF'), |
| 214 | 214 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
| 215 | 215 | PLAYER_OPTION_TIME_DIFF_FORCED => 1, |
| 216 | 216 | PLAYER_OPTION_TIME_DIFF_MEASURE_TIME => SN_TIME_SQL, |
| 217 | 217 | )); |
| 218 | - } elseif(sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 218 | + } elseif (sys_get_param_int('opt_time_diff_clear') || $user_time_diff[PLAYER_OPTION_TIME_DIFF_FORCED]) { |
|
| 219 | 219 | playerTimeDiff::user_time_diff_set(array( |
| 220 | 220 | PLAYER_OPTION_TIME_DIFF => '', |
| 221 | 221 | PLAYER_OPTION_TIME_DIFF_UTC_OFFSET => 0, |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | 'STATUS' => ERR_NONE, |
| 236 | 236 | 'MESSAGE' => $lang['opt_msg_saved'] |
| 237 | 237 | ); |
| 238 | - } elseif(sys_get_param_str('result') == 'ok') { |
|
| 238 | + } elseif (sys_get_param_str('result') == 'ok') { |
|
| 239 | 239 | $template_result['.']['result'][] = array( |
| 240 | 240 | 'STATUS' => ERR_NONE, |
| 241 | 241 | 'MESSAGE' => $lang['opt_msg_saved'] |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | $template = gettemplate('options', $template); |
| 259 | 259 | |
| 260 | 260 | $dir = dir(SN_ROOT_PHYSICAL . 'skins'); |
| 261 | - while(($entry = $dir->read()) !== false) { |
|
| 262 | - if(is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
| 261 | + while (($entry = $dir->read()) !== false) { |
|
| 262 | + if (is_dir("skins/{$entry}") && $entry[0] != '.') { |
|
| 263 | 263 | $template_result['.']['skin_list'][] = array( |
| 264 | 264 | 'VALUE' => $entry, |
| 265 | 265 | 'NAME' => $entry, |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | $dir->close(); |
| 271 | 271 | |
| 272 | - foreach($lang['opt_planet_sort_options'] as $key => &$value) { |
|
| 272 | + foreach ($lang['opt_planet_sort_options'] as $key => &$value) { |
|
| 273 | 273 | $template_result['.']['planet_sort_options'][] = array( |
| 274 | 274 | 'VALUE' => $key, |
| 275 | 275 | 'NAME' => $value, |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | ); |
| 278 | 278 | } |
| 279 | 279 | |
| 280 | - foreach($lang['sys_gender_list'] as $key => $value) { |
|
| 280 | + foreach ($lang['sys_gender_list'] as $key => $value) { |
|
| 281 | 281 | $template_result['.']['gender_list'][] = array( |
| 282 | 282 | 'VALUE' => $key, |
| 283 | 283 | 'NAME' => $value, |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | $lang_list = lng_get_list(); |
| 289 | - foreach($lang_list as $lang_id => $lang_data) { |
|
| 289 | + foreach ($lang_list as $lang_id => $lang_data) { |
|
| 290 | 290 | $template_result['.']['languages'][] = array( |
| 291 | 291 | 'VALUE' => $lang_id, |
| 292 | 292 | 'NAME' => $lang_data['LANG_NAME_NATIVE'], |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | |
| 298 | - if(isset($lang['menu_customize_show_hide_button_state'])) { |
|
| 299 | - foreach($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
| 298 | + if (isset($lang['menu_customize_show_hide_button_state'])) { |
|
| 299 | + foreach ($lang['menu_customize_show_hide_button_state'] as $key => $value) { |
|
| 300 | 300 | $template->assign_block_vars('menu_customize_show_hide_button_state', array( |
| 301 | 301 | 'ID' => $key, |
| 302 | 302 | 'NAME' => $value, |
@@ -407,10 +407,10 @@ discard block |
||
| 407 | 407 | 'PAGE_HEADER' => $lang['opt_header'], |
| 408 | 408 | )); |
| 409 | 409 | |
| 410 | - foreach($user_option_list as $option_group_id => $option_group) { |
|
| 411 | - if($option_group_id == OPT_MESSAGE) { |
|
| 412 | - foreach($sn_message_class_list as $message_class_id => $message_class_data) { |
|
| 413 | - if($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
| 410 | + foreach ($user_option_list as $option_group_id => $option_group) { |
|
| 411 | + if ($option_group_id == OPT_MESSAGE) { |
|
| 412 | + foreach ($sn_message_class_list as $message_class_id => $message_class_data) { |
|
| 413 | + if ($message_class_data['switchable'] || ($message_class_data['email'] && $config->game_email_pm)) { |
|
| 414 | 414 | $option_name = $message_class_data['name']; |
| 415 | 415 | |
| 416 | 416 | $template->assign_block_vars("options_{$option_group_id}", array( |
@@ -422,8 +422,8 @@ discard block |
||
| 422 | 422 | } |
| 423 | 423 | } |
| 424 | 424 | } else { |
| 425 | - foreach($option_group as $option_name => $option_value) { |
|
| 426 | - if(array_key_exists($option_name, $user_option_types)) { |
|
| 425 | + foreach ($option_group as $option_name => $option_value) { |
|
| 426 | + if (array_key_exists($option_name, $user_option_types)) { |
|
| 427 | 427 | $option_type = $user_option_types[$option_name]; |
| 428 | 428 | } else { |
| 429 | 429 | $option_type = 'switch'; |
@@ -4,18 +4,18 @@ discard block |
||
| 4 | 4 | // @version 1.0 |
| 5 | 5 | // @copyright 2008 by Chlorel for XNova |
| 6 | 6 | |
| 7 | -if(SN_IN_FLEET !== true) { |
|
| 7 | +if (SN_IN_FLEET !== true) { |
|
| 8 | 8 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $template = gettemplate('fleet1', true); |
| 12 | 12 | |
| 13 | 13 | $ships = sys_get_param('ships', array()); |
| 14 | -if(!is_array($ships)) { |
|
| 14 | +if (!is_array($ships)) { |
|
| 15 | 15 | $ships = array(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | -foreach(array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 18 | +foreach (array(PT_PLANET, PT_DEBRIS, PT_MOON) as $possible_planet_type_id) { |
|
| 19 | 19 | $template->assign_block_vars('possible_planet_type_id', array( |
| 20 | 20 | 'ID' => $possible_planet_type_id, |
| 21 | 21 | 'NAME' => $lang['sys_planet_type_sh'][$possible_planet_type_id], |
@@ -28,7 +28,7 @@ discard block |
||
| 28 | 28 | 'START_NAME' => $planetrow['name'], |
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | -if(!empty($TargetPlanet)) { |
|
| 31 | +if (!empty($TargetPlanet)) { |
|
| 32 | 32 | $template_route += array( |
| 33 | 33 | 'END_TYPE_TEXT_SH' => $lang['sys_planet_type_sh'][$TargetPlanet['planet_type']], |
| 34 | 34 | 'END_COORDS' => uni_render_coordinates($TargetPlanet), |
@@ -39,10 +39,10 @@ discard block |
||
| 39 | 39 | $template->assign_block_vars('fleets', $template_route); |
| 40 | 40 | |
| 41 | 41 | $sn_groups_fleet = sn_get_groups('fleet'); |
| 42 | -foreach($ships as $ship_id => $ship_count) { |
|
| 43 | - if(in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 42 | +foreach ($ships as $ship_id => $ship_count) { |
|
| 43 | + if (in_array($ship_id, $sn_groups_fleet) && $ship_count) { |
|
| 44 | 44 | $ship_info = get_unit_param($ship_id); |
| 45 | - if($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 45 | + if ($ship_count > mrc_get_level($user, $planetrow, $ship_id, false, true)) { |
|
| 46 | 46 | $page .= $lang['fl_noenought']; |
| 47 | 47 | } else { |
| 48 | 48 | $fleet['fleetarray'][$ship_id] = $ship_count; |
@@ -61,13 +61,13 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | -if(empty($fleet['fleetarray'])) { |
|
| 64 | +if (empty($fleet['fleetarray'])) { |
|
| 65 | 65 | messageBox($lang['fl_err_no_ships'], $lang['fl_error'], 'fleet' . DOT_PHP_EX, 5); |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Building list of shortcuts |
| 69 | 69 | $query = doquery("SELECT * FROM {{notes}} WHERE `owner` = {$user['id']} AND `galaxy` <> 0 AND `system` <> 0 AND `planet` <> 0 ORDER BY `priority` DESC, `galaxy`, `system`, `planet`, `planet_type`;"); |
| 70 | -while($shortcut = db_fetch($query)) { |
|
| 70 | +while ($shortcut = db_fetch($query)) { |
|
| 71 | 71 | $template->assign_block_vars('shortcut', array( |
| 72 | 72 | 'NAME' => $shortcut['title'], |
| 73 | 73 | 'GALAXY' => $shortcut['galaxy'], |
@@ -81,10 +81,10 @@ discard block |
||
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | // Building list of own planets & moons |
| 84 | -$colonies = DBStaticPlanet::db_planet_list_sorted ( $user ); |
|
| 85 | -if(count($colonies) > 1) { |
|
| 84 | +$colonies = DBStaticPlanet::db_planet_list_sorted($user); |
|
| 85 | +if (count($colonies) > 1) { |
|
| 86 | 86 | // while($row = db_fetch($colonies)) |
| 87 | - foreach($colonies as $row) { |
|
| 87 | + foreach ($colonies as $row) { |
|
| 88 | 88 | $template->assign_block_vars('colonies', array( |
| 89 | 89 | 'NAME' => $row['name'], |
| 90 | 90 | 'GALAXY' => $row['galaxy'], |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | //ACS Start |
| 100 | 100 | //Need to look for acs attacks. |
| 101 | 101 | $aks_madnessred = doquery('SELECT * FROM {{aks}};'); |
| 102 | -while($row = db_fetch($aks_madnessred)) { |
|
| 102 | +while ($row = db_fetch($aks_madnessred)) { |
|
| 103 | 103 | $members = explode(',', $row['eingeladen']); |
| 104 | - foreach($members as $a => $b) { |
|
| 104 | + foreach ($members as $a => $b) { |
|
| 105 | 105 | if ($b == $user['id']) { |
| 106 | 106 | $template->assign_block_vars('acss', array( |
| 107 | 107 | 'ID' => $row['id'], |
@@ -5,9 +5,9 @@ discard block |
||
| 5 | 5 | // @version 1.0 |
| 6 | 6 | // @copyright 2008 by Chlorel for XNova |
| 7 | 7 | |
| 8 | -if($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
| 8 | +if ($fleet_ship_sort = sys_get_param_id('sort_elements')) { |
|
| 9 | 9 | define('IN_AJAX', true); |
| 10 | - if(!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 10 | + if (!empty($lang['player_option_fleet_ship_sort'][$fleet_ship_sort])) { |
|
| 11 | 11 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT, $fleet_ship_sort); |
| 12 | 12 | // player_save_option($user, PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE, sys_get_param_id('fleet_ship_sort_inverse', 0)); |
| 13 | 13 | classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT] = $fleet_ship_sort; |
@@ -16,13 +16,13 @@ discard block |
||
| 16 | 16 | die(); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | -if(SN_IN_FLEET !== true) { |
|
| 19 | +if (SN_IN_FLEET !== true) { |
|
| 20 | 20 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | lng_include('overview'); |
| 24 | 24 | |
| 25 | -if(!$planetrow) { |
|
| 25 | +if (!$planetrow) { |
|
| 26 | 26 | messageBox($lang['fl_noplanetrow'], $lang['fl_error']); |
| 27 | 27 | } |
| 28 | 28 | |
@@ -30,9 +30,9 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | $record_index = 0; |
| 32 | 32 | $ship_list = array(); |
| 33 | -foreach(sn_get_groups('fleet') as $n => $unit_id) { |
|
| 33 | +foreach (sn_get_groups('fleet') as $n => $unit_id) { |
|
| 34 | 34 | $unit_level = mrc_get_level($user, $planetrow, $unit_id, false, true); |
| 35 | - if($unit_level > 0) { |
|
| 35 | + if ($unit_level > 0) { |
|
| 36 | 36 | $ship_data = get_ship_data($unit_id, $user); |
| 37 | 37 | $ship_list[$unit_id] = array( |
| 38 | 38 | '__INDEX' => $record_index++, |
@@ -52,8 +52,8 @@ discard block |
||
| 52 | 52 | |
| 53 | 53 | $fleet_ship_sort = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT]; |
| 54 | 54 | $fleet_ship_sort_inverse = classSupernova::$user_options[PLAYER_OPTION_FLEET_SHIP_SORT_INVERSE]; |
| 55 | -if($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 56 | - switch($fleet_ship_sort) { |
|
| 55 | +if ($fleet_ship_sort || $fleet_ship_sort_inverse != PLAYER_OPTION_SORT_ORDER_PLAIN) { |
|
| 56 | + switch ($fleet_ship_sort) { |
|
| 57 | 57 | case PLAYER_OPTION_SORT_NAME: $fleet_ship_sort_field = 'NAME'; break; |
| 58 | 58 | case PLAYER_OPTION_SORT_SPEED: $fleet_ship_sort_field = 'SPEED'; break; |
| 59 | 59 | case PLAYER_OPTION_SORT_COUNT: $fleet_ship_sort_field = 'AMOUNT'; break; |
@@ -68,11 +68,11 @@ discard block |
||
| 68 | 68 | }); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | -foreach($ship_list as $ship_data) { |
|
| 71 | +foreach ($ship_list as $ship_data) { |
|
| 72 | 72 | $template->assign_block_vars('ships', $ship_data); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | -foreach($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
| 75 | +foreach ($lang['player_option_fleet_ship_sort'] as $sort_id => $sort_text) { |
|
| 76 | 76 | $template->assign_block_vars('ship_sort_list', array( |
| 77 | 77 | 'VALUE' => $sort_id, |
| 78 | 78 | 'TEXT' => $sort_text, |