@@ -37,8 +37,7 @@ |
||
| 37 | 37 | </script>'; |
| 38 | 38 | |
| 39 | 39 | messageBoxAdmin("{$script}<img src=\"design/images/progressbar.gif\"><br>{$lang['sys_wait']}", $lang['adm_stat_title'], '', 0); |
| 40 | -} |
|
| 41 | -else |
|
| 40 | +} else |
|
| 42 | 41 | { |
| 43 | 42 | messageBoxAdmin($lang['adm_stat_already_started'], $lang['adm_stat_title'], 'admin/overview.php'); |
| 44 | 43 | } |
@@ -4,8 +4,7 @@ discard block |
||
| 4 | 4 | * |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | -function sn_chat_model() |
|
| 8 | -{ |
|
| 7 | +function sn_chat_model() { |
|
| 9 | 8 | global $config, $user, $template_result, $lang; |
| 10 | 9 | |
| 11 | 10 | $config->array_set('users', $user['id'], 'chat_last_activity', SN_TIME_MICRO); |
@@ -44,15 +43,13 @@ discard block |
||
| 44 | 43 | |
| 45 | 44 | $template_result['PAGE_HEADER'] = $page_title; |
| 46 | 45 | } |
| 47 | -function sn_chat_view($template = null) |
|
| 48 | -{ |
|
| 46 | +function sn_chat_view($template = null) { |
|
| 49 | 47 | $template = gettemplate('chat_body', $template); |
| 50 | 48 | |
| 51 | 49 | return $template; |
| 52 | 50 | } |
| 53 | 51 | |
| 54 | -function sn_chat_add_model() |
|
| 55 | -{ |
|
| 52 | +function sn_chat_add_model() { |
|
| 56 | 53 | global $config, $user; |
| 57 | 54 | |
| 58 | 55 | define('IN_AJAX', true); |
@@ -76,8 +73,7 @@ discard block |
||
| 76 | 73 | |
| 77 | 74 | die(); |
| 78 | 75 | } |
| 79 | -function sn_chat_msg_view($template = null) |
|
| 80 | -{ |
|
| 76 | +function sn_chat_msg_view($template = null) { |
|
| 81 | 77 | global $config, $user, $lang; |
| 82 | 78 | |
| 83 | 79 | define('IN_AJAX', true); |
@@ -99,8 +95,7 @@ discard block |
||
| 99 | 95 | 'TIME' => date(FMT_DATE_TIME, htmlentities(SN_CLIENT_TIME_LOCAL, ENT_QUOTES, 'utf-8')), |
| 100 | 96 | 'DISABLE' => true, |
| 101 | 97 | ); |
| 102 | - } |
|
| 103 | - else |
|
| 98 | + } else |
|
| 104 | 99 | { |
| 105 | 100 | $alliance = sys_get_param_str('ally') && $user['ally_id'] ? $user['ally_id'] : 0; |
| 106 | 101 | |
@@ -121,8 +116,7 @@ discard block |
||
| 121 | 116 | } |
| 122 | 117 | |
| 123 | 118 | $page = min($page_count, max(0, sys_get_param_int('sheet'))); |
| 124 | - } |
|
| 125 | - else |
|
| 119 | + } else |
|
| 126 | 120 | { |
| 127 | 121 | $last_message = sys_get_param_id('last_message'); |
| 128 | 122 | $where_add = $last_message ? "AND `messageid` > {$last_message}" : ''; |
@@ -171,8 +165,7 @@ discard block |
||
| 171 | 165 | { |
| 172 | 166 | $pageTitle = "{$lang['chat_history']} - {$lang[$alliance ? 'chat_ally' : 'chat_common']}"; |
| 173 | 167 | display($template, $pageTitle); |
| 174 | - } |
|
| 175 | - else |
|
| 168 | + } else |
|
| 176 | 169 | { |
| 177 | 170 | $result['last_message'] = $last_message; |
| 178 | 171 | $result['html'] = templateRenderToHtml($template); |
@@ -1,8 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | function admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list){return sn_function_call('admin_planet_edit_mode', array(&$template, &$admin_planet_edit_mode_list));} |
| 4 | -function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) |
|
| 5 | -{ |
|
| 4 | +function sn_admin_planet_edit_mode(&$template, &$admin_planet_edit_mode_list) { |
|
| 6 | 5 | global $lang; |
| 7 | 6 | |
| 8 | 7 | $admin_planet_edit_mode_list = array_merge(isset($admin_planet_edit_mode_list) ? $admin_planet_edit_mode_list : array(), array( |
@@ -25,8 +24,7 @@ discard block |
||
| 25 | 24 | * @param $edit_planet_row |
| 26 | 25 | * @param $mode |
| 27 | 26 | */ |
| 28 | -function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) |
|
| 29 | -{ |
|
| 27 | +function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
|
| 30 | 28 | global $lang; |
| 31 | 29 | |
| 32 | 30 | $unit_list = sn_get_groups($mode); |
@@ -48,15 +46,13 @@ discard block |
||
| 48 | 46 | } |
| 49 | 47 | |
| 50 | 48 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode){return sn_function_call('admin_planet_edit_query_string', array($unit_id, $unit_amount, $mode));} |
| 51 | -function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) |
|
| 52 | -{ |
|
| 49 | +function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
|
| 53 | 50 | if($unit_amount && in_array($unit_id, sn_get_groups($mode))) |
| 54 | 51 | { |
| 55 | 52 | $unit_amount = round($unit_amount); |
| 56 | 53 | $unit_name = get_unit_param($unit_id, P_NAME); |
| 57 | 54 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
| 58 | - } |
|
| 59 | - else |
|
| 55 | + } else |
|
| 60 | 56 | { |
| 61 | 57 | $result = ''; |
| 62 | 58 | } |
@@ -30,8 +30,7 @@ |
||
| 30 | 30 | * @param $resource_id |
| 31 | 31 | * @param ResourceCalculations $capsObj |
| 32 | 32 | */ |
| 33 | -function int_calc_storage_bar($resource_id, $capsObj) |
|
| 34 | -{ |
|
| 33 | +function int_calc_storage_bar($resource_id, $capsObj) { |
|
| 35 | 34 | global $lang, $template, $planetrow, $user; |
| 36 | 35 | |
| 37 | 36 | $totalProduction = $capsObj->getProduction($resource_id); |
@@ -15,8 +15,7 @@ discard block |
||
| 15 | 15 | 1.5 - copyright (c) 2010-2011 by Gorlum for http://supernova.ws |
| 16 | 16 | [+] SuperMassMailing - authlevel=3 player can send messages to whole server ('*' as $owners) |
| 17 | 17 | */ |
| 18 | -function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) |
|
| 19 | -{ |
|
| 18 | +function msg_ali_send($message, $subject, $ally_rank_id = 0, $ally_id = 0) { |
|
| 20 | 19 | global $user; |
| 21 | 20 | |
| 22 | 21 | $ally_id = $ally_id ? $ally_id : $user['ally_id']; |
@@ -49,8 +48,7 @@ discard block |
||
| 49 | 48 | * @param bool $force |
| 50 | 49 | * @param bool $json |
| 51 | 50 | */ |
| 52 | -function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) |
|
| 53 | -{ |
|
| 51 | +function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = STRING_NEED_ESCAPING, $force = false, $json = false) { |
|
| 54 | 52 | global $config, $user, $sn_message_class_list; |
| 55 | 53 | |
| 56 | 54 | if(!$owners) |
@@ -91,8 +89,7 @@ discard block |
||
| 91 | 89 | // TODO Добавить $sender - рассылка может быть и от кого-то |
| 92 | 90 | db_message_insert_all($message_type, $from, $subject, $text); |
| 93 | 91 | $owners = []; |
| 94 | - } |
|
| 95 | - else |
|
| 92 | + } else |
|
| 96 | 93 | { |
| 97 | 94 | $insert_values = []; |
| 98 | 95 | $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}', '" . intval($json) . "')"); |
@@ -102,8 +99,7 @@ discard block |
||
| 102 | 99 | if($user['id'] != $owner) |
| 103 | 100 | { |
| 104 | 101 | $owner_row = db_user_by_id($owner); |
| 105 | - } |
|
| 106 | - else |
|
| 102 | + } else |
|
| 107 | 103 | { |
| 108 | 104 | $owner_row = $user; |
| 109 | 105 | } |
@@ -139,11 +139,13 @@ |
||
| 139 | 139 | $error_backtrace['locks'] = _SnCacheInternal::$locks; |
| 140 | 140 | $error_backtrace['cSN_data'] = _SnCacheInternal::$data; |
| 141 | 141 | foreach($error_backtrace['cSN_data'] as &$location) { |
| 142 | - foreach($location as $location_id => &$location_data) // $location_data = $location_id; |
|
| 142 | + foreach($location as $location_id => &$location_data) { |
|
| 143 | + // $location_data = $location_id; |
|
| 143 | 144 | { |
| 144 | 145 | $location_data = isset($location_data['username']) ? $location_data['username'] : |
| 145 | 146 | (isset($location_data['name']) ? $location_data['name'] : $location_id); |
| 146 | 147 | } |
| 148 | + } |
|
| 147 | 149 | } |
| 148 | 150 | } |
| 149 | 151 | |
@@ -56,8 +56,7 @@ discard block |
||
| 56 | 56 | sprintf($lang['buddy_msg_accept_text'], $user['username'])); |
| 57 | 57 | sn_db_transaction_commit(); |
| 58 | 58 | throw new exception('buddy_err_accept_none', ERR_NONE); |
| 59 | - } |
|
| 60 | - else |
|
| 59 | + } else |
|
| 61 | 60 | { |
| 62 | 61 | throw new exception('buddy_err_accept_internal', ERR_ERROR); |
| 63 | 62 | } |
@@ -69,9 +68,11 @@ discard block |
||
| 69 | 68 | throw new exception('buddy_err_delete_alien', ERR_ERROR); |
| 70 | 69 | } |
| 71 | 70 | |
| 72 | - if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) // Existing friendship |
|
| 71 | + if($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_ACTIVE) { |
|
| 72 | + // Existing friendship |
|
| 73 | 73 | { |
| 74 | 74 | $ex_friend_id = $buddy_row['BUDDY_SENDER_ID'] == $user['id'] ? $buddy_row['BUDDY_OWNER_ID'] : $buddy_row['BUDDY_SENDER_ID']; |
| 75 | + } |
|
| 75 | 76 | |
| 76 | 77 | msg_send_simple_message($ex_friend_id, $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_unfriend_title'], |
| 77 | 78 | sprintf($lang['buddy_msg_unfriend_text'], $user['username'])); |
@@ -79,17 +80,19 @@ discard block |
||
| 79 | 80 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 80 | 81 | sn_db_transaction_commit(); |
| 81 | 82 | throw new exception('buddy_err_unfriend_none', ERR_NONE); |
| 82 | - } |
|
| 83 | - elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) // Player's outcoming request - either denied or waiting |
|
| 83 | + } elseif($buddy_row['BUDDY_SENDER_ID'] == $user['id']) { |
|
| 84 | + // Player's outcoming request - either denied or waiting |
|
| 84 | 85 | { |
| 85 | 86 | doquery("DELETE FROM {{buddy}} WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 87 | + } |
|
| 86 | 88 | sn_db_transaction_commit(); |
| 87 | 89 | throw new exception('buddy_err_delete_own', ERR_NONE); |
| 88 | - } |
|
| 89 | - elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) // Deny incoming request |
|
| 90 | + } elseif($buddy_row['BUDDY_STATUS'] == BUDDY_REQUEST_WAITING) { |
|
| 91 | + // Deny incoming request |
|
| 90 | 92 | { |
| 91 | 93 | msg_send_simple_message($buddy_row['BUDDY_SENDER_ID'], $user['id'], SN_TIME_NOW, MSG_TYPE_PLAYER, $user['username'], $lang['buddy_msg_deny_title'], |
| 92 | 94 | sprintf($lang['buddy_msg_deny_text'], $user['username'])); |
| 95 | + } |
|
| 93 | 96 | |
| 94 | 97 | doquery("UPDATE {{buddy}} SET `BUDDY_STATUS` = " . BUDDY_REQUEST_DENIED . " WHERE `BUDDY_ID` = {$buddy_id} LIMIT 1;"); |
| 95 | 98 | sn_db_transaction_commit(); |
@@ -104,8 +107,7 @@ discard block |
||
| 104 | 107 | if($new_friend_id = sys_get_param_id('request_user_id')) |
| 105 | 108 | { |
| 106 | 109 | $new_friend_row = db_user_by_id($new_friend_id, true, '`id`, `username`'); |
| 107 | - } |
|
| 108 | - elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 110 | + } elseif($new_friend_name = sys_get_param_str_unsafe('request_user_name')) |
|
| 109 | 111 | { |
| 110 | 112 | $new_friend_row = db_user_by_username($new_friend_name); |
| 111 | 113 | $new_friend_name = db_escape($new_friend_name); |
@@ -138,8 +140,7 @@ discard block |
||
| 138 | 140 | sn_db_transaction_commit(); |
| 139 | 141 | throw new exception('buddy_err_adding_none', ERR_NONE); |
| 140 | 142 | } |
| 141 | -} |
|
| 142 | -catch(exception $e) |
|
| 143 | +} catch(exception $e) |
|
| 143 | 144 | { |
| 144 | 145 | $result[] = array( |
| 145 | 146 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
@@ -290,10 +290,12 @@ discard block |
||
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | - if ($fleet_id) // Не планета |
|
| 293 | + if ($fleet_id) { |
|
| 294 | + // Не планета |
|
| 294 | 295 | { |
| 295 | 296 | if ($fleet_info[UBE_FLEET_TYPE] == UBE_ATTACKERS && $outcome[UBE_MOON_REAPERS] == UBE_MOON_REAPERS_DIED) { |
| 296 | 297 | $new_fleet_count = 0; |
| 298 | + } |
|
| 297 | 299 | } |
| 298 | 300 | |
| 299 | 301 | if ($new_fleet_count) { |
@@ -316,10 +318,12 @@ discard block |
||
| 316 | 318 | } |
| 317 | 319 | DBStaticPlanet::db_planet_set_by_id($planet_id, implode(',', $temp)); |
| 318 | 320 | } |
| 319 | - if (!empty($db_changeset)) // Сохраняем изменения юнитов на планете - если они есть |
|
| 321 | + if (!empty($db_changeset)) { |
|
| 322 | + // Сохраняем изменения юнитов на планете - если они есть |
|
| 320 | 323 | { |
| 321 | 324 | OldDbChangeSet::db_changeset_apply($db_changeset); |
| 322 | 325 | } |
| 326 | + } |
|
| 323 | 327 | } |
| 324 | 328 | } |
| 325 | 329 | |
@@ -236,9 +236,11 @@ |
||
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
| 239 | - if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
| 239 | + if (!isset($planet_row['id'])) { |
|
| 240 | + // || $planet_row['id'] != $user['current_planet'] |
|
| 240 | 241 | { |
| 241 | 242 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
| 243 | + } |
|
| 242 | 244 | // Если текущей планеты не существует - выставляем Столицу |
| 243 | 245 | if (!isset($planet_row['id'])) { |
| 244 | 246 | $planet_row = DBStaticPlanet::db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |