@@ -1,22 +1,22 @@ |
||
| 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 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -if(!$user_can_send_mails) { |
|
| 7 | +if (!$user_can_send_mails) { |
|
| 8 | 8 | message(classLocale::$lang['Denied_access'], classLocale::$lang['Send_circular_mail']); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | $POST_text = sys_get_param_str('text'); |
| 12 | -if($POST_text) { |
|
| 13 | - message(classLocale::$lang['members_who_recived_message'] . msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
| 12 | +if ($POST_text) { |
|
| 13 | + message(classLocale::$lang['members_who_recived_message'].msg_ali_send($POST_text, classLocale::$lang['ali_adm_msg_subject'], sys_get_param_int('r')), classLocale::$lang['Circular_sended'], "alliance.php", ''); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -$r_list = "<option value=\"-1\">" . classLocale::$lang['All_players'] . "</option>"; |
|
| 17 | -if($ranks) { |
|
| 18 | - foreach($ranks as $id => $array) { |
|
| 19 | - $r_list .= "<option value=\"" . $id . "\">" . $array['name'] . "</option>"; |
|
| 16 | +$r_list = "<option value=\"-1\">".classLocale::$lang['All_players']."</option>"; |
|
| 17 | +if ($ranks) { |
|
| 18 | + foreach ($ranks as $id => $array) { |
|
| 19 | + $r_list .= "<option value=\"".$id."\">".$array['name']."</option>"; |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | |
@@ -1,10 +1,10 @@ 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 | classSupernova::$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 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
| 9 | 9 | } |
| 10 | 10 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $allyTextID = ($allyTextID < 1 || $allyTextID > 3) ? 1 : $allyTextID; |
| 21 | 21 | |
| 22 | 22 | |
| 23 | -if(sys_get_param_str('isSaveOptions')) { |
|
| 23 | +if (sys_get_param_str('isSaveOptions')) { |
|
| 24 | 24 | require_once('includes/includes/sys_avatar.php'); |
| 25 | 25 | |
| 26 | 26 | $new_image = $ally['ally_image']; |
@@ -32,46 +32,46 @@ discard block |
||
| 32 | 32 | // $template->assign_block_vars('result', $avatar_upload_result); |
| 33 | 33 | |
| 34 | 34 | $ally_changeset = array(); |
| 35 | - if(($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
| 35 | + if (($new_tag = sys_get_param_str_unsafe('tag', $ally['ally_tag'])) && $new_tag != $ally['ally_tag']) { |
|
| 36 | 36 | $new_tag = db_escape($new_tag); |
| 37 | 37 | $ally_changeset[] = "`ally_tag`='{$new_tag}'"; |
| 38 | 38 | db_user_set_by_id($ally['ally_user_id'], "`username`='[{$new_tag}]'"); |
| 39 | 39 | } |
| 40 | - if(($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
| 40 | + if (($new_name = sys_get_param_str_unsafe('name', $ally['ally_name'])) && $new_name != $ally['ally_name']) { |
|
| 41 | 41 | $new_name = db_escape($new_name); |
| 42 | 42 | $ally_changeset[] = "`ally_name`='{$new_name}'"; |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - if(($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
| 45 | + if (($new_owner_rank = sys_get_param_str_unsafe('owner_range', $ally['ally_owner_range'])) && $new_owner_rank != $ally['ally_owner_range']) { |
|
| 46 | 46 | $new_owner_rank = db_escape($new_owner_rank); |
| 47 | 47 | $ally_changeset[] = "`ally_owner_range` = '{$new_owner_rank}'"; |
| 48 | 48 | } |
| 49 | - if(($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
| 49 | + if (($new_web = sys_get_param_str_unsafe('web', $ally['ally_web'])) && $new_web != $ally['ally_web']) { |
|
| 50 | 50 | $new_web = db_escape($new_web); |
| 51 | 51 | $ally_changeset[] = "`ally_web` = '{$new_web}'"; |
| 52 | 52 | } |
| 53 | 53 | $new_request = sys_get_param_int('request_notallow', $ally['ally_request_notallow']); |
| 54 | 54 | $ally_changeset[] = "`ally_request_notallow` = '{$new_request}'"; |
| 55 | - if($new_image != $ally['ally_image']) { |
|
| 55 | + if ($new_image != $ally['ally_image']) { |
|
| 56 | 56 | $new_image = intval($new_image); |
| 57 | 57 | $ally_changeset[] = "`ally_image` = '{$new_image}'"; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if(!empty($ally_changeset)) { |
|
| 60 | + if (!empty($ally_changeset)) { |
|
| 61 | 61 | db_ally_update_by_changeset($ally_changeset, $ally); |
| 62 | 62 | sys_redirect('alliance.php?mode=admin&edit=ally'); |
| 63 | 63 | } |
| 64 | -} elseif(sys_get_param_str('isSaveText')) { |
|
| 64 | +} elseif (sys_get_param_str('isSaveText')) { |
|
| 65 | 65 | $text = sys_get_param_str_both('text'); |
| 66 | 66 | db_ally_update_texts($text_list, $allyTextID, $text, $ally); |
| 67 | 67 | $ally[$text_list[$allyTextID]['db_field']] = $text['unsafe']; |
| 68 | -} elseif(sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
| 69 | - if(!$isAllyOwner) { |
|
| 68 | +} elseif (sys_get_param_str('isTransfer') && $idNewLeader = sys_get_param_id('idNewLeader')) { |
|
| 69 | + if (!$isAllyOwner) { |
|
| 70 | 70 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $newLeader = db_user_by_id($idNewLeader, false, `ally_id`); |
| 74 | - if($newLeader['ally_id'] == $user['ally_id']) { |
|
| 74 | + if ($newLeader['ally_id'] == $user['ally_id']) { |
|
| 75 | 75 | sn_db_transaction_start(); |
| 76 | 76 | db_user_set_by_id($user['id'], "`ally_rank_id`='0'"); |
| 77 | 77 | db_ally_update_owner($idNewLeader, $user); |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | sn_db_transaction_commit(); |
| 80 | 80 | sys_redirect('alliance.php'); |
| 81 | 81 | } |
| 82 | -} elseif(sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
| 83 | - if(!$isAllyOwner) { |
|
| 82 | +} elseif (sys_get_param_str('isDisband') && sys_get_param_str('isConfirmDisband')) { |
|
| 83 | + if (!$isAllyOwner) { |
|
| 84 | 84 | message(classLocale::$lang['Denied_access'], classLocale::$lang['ally_admin']); |
| 85 | 85 | } |
| 86 | 86 | sn_db_transaction_start(); |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | $request = db_ally_request_count_by_id($ally); |
| 94 | 94 | |
| 95 | 95 | $template->assign_vars(array( |
| 96 | - 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'] . ': ' . intval($request['request_count']) . '. ' . classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
| 96 | + 'request_count' => $request['request_count'] ? classLocale::$lang['ali_req_requestCount'].': '.intval($request['request_count']).'. '.classLocale::$lang['ali_req_check'] : classLocale::$lang['ali_req_emptyList'], |
|
| 97 | 97 | 'text' => $ally[$text_list[$allyTextID]['db_field']], |
| 98 | 98 | 'request_type' => classLocale::$lang[$text_list[$allyTextID]['text_type']], |
| 99 | 99 | 't' => $allyTextID, |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | $userAllyAdmins = db_user_list("`ally_id`= {$ally['id']}", false, '`id`, `username`'); |
| 127 | 127 | unset($tmp); |
| 128 | 128 | // while ($userAllyAdmin = db_fetch($userAllyAdmins)) |
| 129 | - foreach($userAllyAdmins as $userAllyAdmin) { |
|
| 129 | + foreach ($userAllyAdmins as $userAllyAdmin) { |
|
| 130 | 130 | // pdump($userAllyAdmin); |
| 131 | 131 | $tmp .= "<option value={$userAllyAdmin['id']}>{$userAllyAdmin['username']}</option>"; |
| 132 | 132 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | $template->assign_var('adminMembers', $tmp); |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | -foreach($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
| 138 | - if(!$sn_ali_admin_action_locale['title']) { |
|
| 137 | +foreach ($sn_ali_admin_internal as $sn_ali_admin_action => $sn_ali_admin_action_locale) { |
|
| 138 | + if (!$sn_ali_admin_action_locale['title']) { |
|
| 139 | 139 | continue; |
| 140 | 140 | } |
| 141 | 141 | $template->assign_block_vars('admin_actions', array( |
@@ -1,6 +1,6 @@ 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 | classSupernova::$debug->error("Attempt to call ALLIANCE page mode {$mode} directly - not from alliance.php", 'Forbidden', 403); |
| 6 | 6 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | $new_rank_name = sys_get_param_str('newRankName'); |
| 15 | 15 | if ($new_rank_name) |
| 16 | 16 | { |
| 17 | - foreach($ally_rights as $fieldName) |
|
| 17 | + foreach ($ally_rights as $fieldName) |
|
| 18 | 18 | { |
| 19 | 19 | $newRank[$fieldName] = 0; |
| 20 | 20 | } |
@@ -28,9 +28,9 @@ discard block |
||
| 28 | 28 | { |
| 29 | 29 | unset($ranks); |
| 30 | 30 | |
| 31 | - foreach($rankListInput as $rankID => $rank) |
|
| 31 | + foreach ($rankListInput as $rankID => $rank) |
|
| 32 | 32 | { |
| 33 | - foreach($ally_rights as $rightName) |
|
| 33 | + foreach ($ally_rights as $rightName) |
|
| 34 | 34 | { |
| 35 | 35 | $ranks[$rankID][$rightName] = $rank[$rightName] ? 1 : 0; |
| 36 | 36 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $d = sys_get_param_int('d'); |
| 42 | 42 | if ($d && isset($ranks[$d])) |
| 43 | 43 | { |
| 44 | - if(count($ranks) == 1) |
|
| 44 | + if (count($ranks) == 1) |
|
| 45 | 45 | { |
| 46 | 46 | message(classLocale::$lang['ali_adm_lastRank'], classLocale::$lang['ali_adm_rights_title']); |
| 47 | 47 | } |
@@ -53,17 +53,17 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | if (count($ranks)) |
| 55 | 55 | { |
| 56 | - foreach($ranks as $rankID => $rank) |
|
| 56 | + foreach ($ranks as $rankID => $rank) |
|
| 57 | 57 | { |
| 58 | 58 | $rank_data = array( |
| 59 | 59 | 'ID' => $rankID, |
| 60 | 60 | 'NAME' => $rank['name'], |
| 61 | 61 | ); |
| 62 | 62 | |
| 63 | - for($i = 1; $i < count($rank); $i++) |
|
| 63 | + for ($i = 1; $i < count($rank); $i++) |
|
| 64 | 64 | { |
| 65 | - $rank_data['R' . $i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : '') ; |
|
| 66 | - $rank_data['N' . $i] = $ally_rights[$i]; |
|
| 65 | + $rank_data['R'.$i] = (($rank[$ally_rights[$i]] == 1) ? ' checked' : ''); |
|
| 66 | + $rank_data['N'.$i] = $ally_rights[$i]; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | $template->assign_block_vars('rank', $rank_data); |
@@ -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 | - $field = '`' . db_escape($field) . '`'; |
|
| 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 | - $new_value = '"' . db_escape($value) . '"'; |
|
| 42 | - } elseif($delta) { |
|
| 41 | + $new_value = '"'.db_escape($value).'"'; |
|
| 42 | + } elseif ($delta) { |
|
| 43 | 43 | // float and DELTA-set |
| 44 | 44 | $new_value = "{$field} + ({$new_value})"; |
| 45 | 45 | } |
@@ -2,19 +2,19 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | $classLocale = classLocale::$lang; |
| 4 | 4 | |
| 5 | -if(classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 6 | - include(SN_ROOT_PHYSICAL . 'ajax_version_check' . DOT_PHP_EX); |
|
| 5 | +if (classSupernova::$config->server_updater_check_auto && classSupernova::$config->server_updater_check_last + classSupernova::$config->server_updater_check_period <= SN_TIME_NOW) { |
|
| 6 | + include(SN_ROOT_PHYSICAL.'ajax_version_check'.DOT_PHP_EX); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | -if(classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 10 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/user_birthday_celebrate" . DOT_PHP_EX); |
|
| 9 | +if (classSupernova::$config->user_birthday_gift && SN_TIME_NOW - classSupernova::$config->user_birthday_celebrate > PERIOD_DAY) { |
|
| 10 | + require_once(SN_ROOT_PHYSICAL."includes/includes/user_birthday_celebrate".DOT_PHP_EX); |
|
| 11 | 11 | sn_user_birthday_celebrate(); |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if(!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 14 | +if (!classSupernova::$config->var_online_user_count || classSupernova::$config->var_online_user_time + 30 < SN_TIME_NOW) { |
|
| 15 | 15 | classSupernova::$config->db_saveItem('var_online_user_count', db_user_count(true)); |
| 16 | 16 | classSupernova::$config->db_saveItem('var_online_user_time', SN_TIME_NOW); |
| 17 | - if(classSupernova::$config->server_log_online) { |
|
| 17 | + if (classSupernova::$config->server_log_online) { |
|
| 18 | 18 | db_log_online_insert(); |
| 19 | 19 | } |
| 20 | 20 | } |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | $template_result[F_ACCOUNT_IS_AUTHORIZED] = $sys_user_logged_in = !empty($user) && isset($user['id']) && $user['id']; |
| 42 | 42 | //pdump($template_result[F_ACCOUNT_IS_AUTHORIZED]);die(); |
| 43 | 43 | |
| 44 | -if(!empty($user['id'])) { |
|
| 44 | +if (!empty($user['id'])) { |
|
| 45 | 45 | classSupernova::$user_options->user_change($user['id']); |
| 46 | 46 | } |
| 47 | 47 | |
@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | : false |
| 55 | 55 | ); |
| 56 | 56 | |
| 57 | -if($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 58 | - $prohibited_characters = array_map(function ($value) { |
|
| 59 | - return "'" . htmlentities($value, ENT_QUOTES, 'UTF-8') . "'"; |
|
| 57 | +if ($template_result[F_LOGIN_STATUS] == LOGIN_ERROR_USERNAME_RESTRICTED_CHARACTERS) { |
|
| 58 | + $prohibited_characters = array_map(function($value) { |
|
| 59 | + return "'".htmlentities($value, ENT_QUOTES, 'UTF-8')."'"; |
|
| 60 | 60 | }, str_split(LOGIN_REGISTER_CHARACTERS_PROHIBITED)); |
| 61 | 61 | $template_result[F_LOGIN_MESSAGE] .= implode(', ', $prohibited_characters); |
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | |
| 65 | -if(defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 65 | +if (defined('DEBUG_AUTH') && DEBUG_AUTH && !defined('IN_AJAX')) { |
|
| 66 | 66 | pdump("Отключи отладку перед продакшном!"); |
| 67 | 67 | } |
| 68 | 68 | |
@@ -76,17 +76,17 @@ discard block |
||
| 76 | 76 | ? define('INSTALL_MODE', GAME_DISABLE_INSTALL) |
| 77 | 77 | : false; |
| 78 | 78 | |
| 79 | -if($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
| 79 | +if ($template_result[F_GAME_DISABLE] = classSupernova::$config->game_disable) { |
|
| 80 | 80 | $template_result[F_GAME_DISABLE_REASON] = sys_bbcodeParse( |
| 81 | 81 | classSupernova::$config->game_disable == GAME_DISABLE_REASON |
| 82 | 82 | ? classSupernova::$config->game_disable_reason |
| 83 | 83 | : classLocale::$lang['sys_game_disable_reason'][classSupernova::$config->game_disable] |
| 84 | 84 | ); |
| 85 | - if(defined('IN_API')) { |
|
| 85 | + if (defined('IN_API')) { |
|
| 86 | 86 | return; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | - if( |
|
| 89 | + if ( |
|
| 90 | 90 | ($user['authlevel'] < 1 || !(defined('IN_ADMIN') && IN_ADMIN)) |
| 91 | 91 | && |
| 92 | 92 | !(defined('INSTALL_MODE') && defined('LOGIN_LOGOUT')) |
@@ -100,8 +100,8 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // TODO ban |
| 102 | 102 | // TODO $skip_ban_check |
| 103 | -if($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 104 | - if(defined('IN_API')) { |
|
| 103 | +if ($template_result[F_BANNED_STATUS] && !$skip_ban_check) { |
|
| 104 | + if (defined('IN_API')) { |
|
| 105 | 105 | return; |
| 106 | 106 | } |
| 107 | 107 | |
@@ -119,15 +119,15 @@ discard block |
||
| 119 | 119 | // pdump($allow_anonymous, '$allow_anonymous'); |
| 120 | 120 | // pdump($sys_user_logged_in, '$sys_user_logged_in'); |
| 121 | 121 | |
| 122 | -if($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 123 | - sys_redirect(SN_ROOT_VIRTUAL . 'overview.php'); |
|
| 124 | -} elseif($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 122 | +if ($sys_user_logged_in && INITIAL_PAGE == 'login') { |
|
| 123 | + sys_redirect(SN_ROOT_VIRTUAL.'overview.php'); |
|
| 124 | +} elseif ($account_logged_in && !$sys_user_logged_in) { // empty(core_auth::$user['id']) |
|
| 125 | 125 | // pdump($sn_page_name); |
| 126 | 126 | // pdump(INITIAL_PAGE); |
| 127 | 127 | // die('{Тут должна быть ваша реклама. Точнее - ввод имени игрока}'); |
| 128 | -} elseif(!$allow_anonymous && !$sys_user_logged_in) { |
|
| 128 | +} elseif (!$allow_anonymous && !$sys_user_logged_in) { |
|
| 129 | 129 | // sn_setcookie(SN_COOKIE, '', time() - PERIOD_WEEK, SN_ROOT_RELATIVE); |
| 130 | - sys_redirect(SN_ROOT_VIRTUAL . 'login.php'); |
|
| 130 | + sys_redirect(SN_ROOT_VIRTUAL.'login.php'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | $user_time_diff = playerTimeDiff::user_time_diff_get(); |
@@ -146,16 +146,16 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | global $skip_fleet_update; |
| 148 | 148 | $skip_fleet_update = $skip_fleet_update || $supernova->options['fleet_update_skip'] || defined('IN_ADMIN'); |
| 149 | -if( |
|
| 149 | +if ( |
|
| 150 | 150 | !$skip_fleet_update |
| 151 | 151 | && !(defined('IN_AJAX') && IN_AJAX === true) |
| 152 | 152 | && SN_TIME_NOW - strtotime(classSupernova::$config->fleet_update_last) > classSupernova::$config->fleet_update_interval |
| 153 | 153 | ) { |
| 154 | - require_once(SN_ROOT_PHYSICAL . "includes/includes/flt_flying_fleet_handler2" . DOT_PHP_EX); |
|
| 154 | + require_once(SN_ROOT_PHYSICAL."includes/includes/flt_flying_fleet_handler2".DOT_PHP_EX); |
|
| 155 | 155 | flt_flying_fleet_handler($skip_fleet_update); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | -if(!defined('IN_AJAX')) { |
|
| 158 | +if (!defined('IN_AJAX')) { |
|
| 159 | 159 | print("Scheduled processes is disabled<br />"); |
| 160 | 160 | } |
| 161 | 161 | // scheduler_process(); |
@@ -104,21 +104,21 @@ discard block |
||
| 104 | 104 | 'LEVEL' => 'submenu', |
| 105 | 105 | 'TYPE' => 'lang', |
| 106 | 106 | 'ITEM' => 'tech[UNIT_STRUCTURES]', |
| 107 | - 'LINK' => 'buildings.php?mode=' . QUE_STRUCTURES, |
|
| 107 | + 'LINK' => 'buildings.php?mode='.QUE_STRUCTURES, |
|
| 108 | 108 | 'ICON' => true, |
| 109 | 109 | ), |
| 110 | 110 | 'menu_planet_shipyard' => array( |
| 111 | 111 | 'LEVEL' => 'submenu', |
| 112 | 112 | 'TYPE' => 'lang', |
| 113 | 113 | 'ITEM' => 'Shipyard', |
| 114 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_FLEET, |
|
| 114 | + 'LINK' => 'buildings.php?mode='.SUBQUE_FLEET, |
|
| 115 | 115 | 'ICON' => true, |
| 116 | 116 | ), |
| 117 | 117 | 'menu_planet_defense' => array( |
| 118 | 118 | 'LEVEL' => 'submenu', |
| 119 | 119 | 'TYPE' => 'lang', |
| 120 | 120 | 'ITEM' => 'Defense', |
| 121 | - 'LINK' => 'buildings.php?mode=' . SUBQUE_DEFENSE, |
|
| 121 | + 'LINK' => 'buildings.php?mode='.SUBQUE_DEFENSE, |
|
| 122 | 122 | 'ICON' => true, |
| 123 | 123 | ), |
| 124 | 124 | 'menu_planet_resources' => array( |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | 'LEVEL' => 'submenu', |
| 148 | 148 | 'TYPE' => 'lang', |
| 149 | 149 | 'ITEM' => 'Research', |
| 150 | - 'LINK' => 'buildings.php?mode=' . QUE_RESEARCH, |
|
| 150 | + 'LINK' => 'buildings.php?mode='.QUE_RESEARCH, |
|
| 151 | 151 | 'ICON' => true, |
| 152 | 152 | ), |
| 153 | 153 | 'menu_empire_techtree' => array( |
@@ -233,14 +233,14 @@ discard block |
||
| 233 | 233 | 'LEVEL' => 'submenu', |
| 234 | 234 | 'TYPE' => 'lang', |
| 235 | 235 | 'ITEM' => 'tech[UNIT_MERCENARIES]', |
| 236 | - 'LINK' => 'officer.php?mode=' . UNIT_MERCENARIES, |
|
| 236 | + 'LINK' => 'officer.php?mode='.UNIT_MERCENARIES, |
|
| 237 | 237 | 'ICON' => true, |
| 238 | 238 | ), |
| 239 | 239 | 'menu_empire_schematics' => array( |
| 240 | 240 | 'LEVEL' => 'submenu', |
| 241 | 241 | 'TYPE' => 'lang', |
| 242 | 242 | 'ITEM' => 'tech[UNIT_PLANS]', |
| 243 | - 'LINK' => 'officer.php?mode=' . UNIT_PLANS, |
|
| 243 | + 'LINK' => 'officer.php?mode='.UNIT_PLANS, |
|
| 244 | 244 | 'ICON' => true, |
| 245 | 245 | ), |
| 246 | 246 | 'menu_empire_artifacts' => array( |
@@ -270,14 +270,14 @@ discard block |
||
| 270 | 270 | 'LEVEL' => 'submenu', |
| 271 | 271 | 'TYPE' => 'lang', |
| 272 | 272 | 'ITEM' => 'Chat', |
| 273 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_COMMON, |
|
| 273 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_COMMON, |
|
| 274 | 274 | 'ICON' => true, |
| 275 | 275 | ), |
| 276 | 276 | 'menu_ally_chat' => array( |
| 277 | 277 | 'LEVEL' => 'submenu', |
| 278 | 278 | 'TYPE' => 'lang', |
| 279 | 279 | 'ITEM' => 'AllyChat', |
| 280 | - 'LINK' => 'index.php?page=chat&mode=' . CHAT_MODE_ALLY, |
|
| 280 | + 'LINK' => 'index.php?page=chat&mode='.CHAT_MODE_ALLY, |
|
| 281 | 281 | 'ICON' => true, |
| 282 | 282 | 'DISABLED' => classSupernova::$config->game_mode == GAME_BLITZ, |
| 283 | 283 | ), |
@@ -458,8 +458,8 @@ discard block |
||
| 458 | 458 | ), |
| 459 | 459 | 'menu_admin_version_info' => array( |
| 460 | 460 | 'TYPE' => 'text', |
| 461 | - 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '') . '<div class="' . |
|
| 462 | - $sn_version_check_class[classSupernova::$config->server_updater_check_result] . '">' . classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result] . '</div>', |
|
| 461 | + 'ITEM' => (classSupernova::$config->server_updater_check_last ? date(FMT_DATE, classSupernova::$config->server_updater_check_last) : '').'<div class="'. |
|
| 462 | + $sn_version_check_class[classSupernova::$config->server_updater_check_result].'">'.classLocale::$lang['adm_opt_ver_response_short'][classSupernova::$config->server_updater_check_result].'</div>', |
|
| 463 | 463 | ), |
| 464 | 464 | |
| 465 | 465 | 'USER_AUTHLEVEL_NAME' => array( |
@@ -547,13 +547,13 @@ discard block |
||
| 547 | 547 | 'menu_admin_planet_list_planets' => array( |
| 548 | 548 | 'TYPE' => 'lang', |
| 549 | 549 | 'ITEM' => 'adm_pltlst', |
| 550 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_PLANET, |
|
| 550 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_PLANET, |
|
| 551 | 551 | 'AUTH_LEVEL' => 3, |
| 552 | 552 | ), |
| 553 | 553 | 'menu_admin_planet_list_moons' => array( |
| 554 | 554 | 'TYPE' => 'lang', |
| 555 | 555 | 'ITEM' => 'adm_moonlst', |
| 556 | - 'LINK' => 'admin/adm_planet_list.php?planet_type=' . PT_MOON, |
|
| 556 | + 'LINK' => 'admin/adm_planet_list.php?planet_type='.PT_MOON, |
|
| 557 | 557 | 'AUTH_LEVEL' => 3, |
| 558 | 558 | ), |
| 559 | 559 | 'menu_admin_planet_moon_add' => array( |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // Защита от двойного инита |
| 4 | -if(defined('INIT')) { |
|
| 4 | +if (defined('INIT')) { |
|
| 5 | 5 | return; |
| 6 | 6 | } |
| 7 | 7 | |
@@ -20,22 +20,22 @@ discard block |
||
| 20 | 20 | version_compare(PHP_VERSION, '5.3.2') < 0 ? die('FATAL ERROR: SuperNova REQUIRE PHP version > 5.3.2') : false; |
| 21 | 21 | |
| 22 | 22 | // Бенчмарк |
| 23 | -register_shutdown_function(function () { |
|
| 24 | - if(defined('IN_AJAX')) { |
|
| 23 | +register_shutdown_function(function() { |
|
| 24 | + if (defined('IN_AJAX')) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | global $user, $locale_cache_statistic; |
| 29 | 29 | |
| 30 | - print('<hr><div class="benchmark">Benchmark ' . (microtime(true) - SN_TIME_MICRO) . 's, memory: ' . number_format(memory_get_usage() - SN_MEM_START) . |
|
| 31 | - (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : '') . |
|
| 32 | - (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: ' . classSupernova::$db->time_mysql_total . 'ms' : '') . |
|
| 30 | + print('<hr><div class="benchmark">Benchmark '.(microtime(true) - SN_TIME_MICRO).'s, memory: '.number_format(memory_get_usage() - SN_MEM_START). |
|
| 31 | + (!empty($locale_cache_statistic['misses']) ? ', LOCALE MISSED' : ''). |
|
| 32 | + (class_exists('classSupernova') && is_object(classSupernova::$db) ? ', DB time: '.classSupernova::$db->time_mysql_total.'ms' : ''). |
|
| 33 | 33 | '</div>'); |
| 34 | - if($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL . 'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL . 'badqrys.txt') > 0) { |
|
| 34 | + if ($user['authlevel'] >= 2 && file_exists(SN_ROOT_PHYSICAL.'badqrys.txt') && @filesize(SN_ROOT_PHYSICAL.'badqrys.txt') > 0) { |
|
| 35 | 35 | echo '<a href="badqrys.txt" target="_blank" style="color:red">', 'HACK ALERT!', '</a>'; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - if(!empty($locale_cache_statistic['misses'])) { |
|
| 38 | + if (!empty($locale_cache_statistic['misses'])) { |
|
| 39 | 39 | print('<!--'); |
| 40 | 40 | pdump($locale_cache_statistic); |
| 41 | 41 | print('-->'); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | define('SN_TIME_NOW_GMT_STRING', gmdate(DATE_ATOM, SN_TIME_NOW)); |
| 57 | 57 | |
| 58 | -if(strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
| 58 | +if (strpos(strtolower($_SERVER['SERVER_NAME']), 'google.') !== false) { |
|
| 59 | 59 | define('SN_GOOGLE', true); |
| 60 | 60 | } |
| 61 | 61 | |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | $sn_root_relative = str_replace($sn_root_relative, '', $_SERVER['SCRIPT_NAME']); |
| 75 | 75 | define('SN_ROOT_RELATIVE', $sn_root_relative); |
| 76 | 76 | |
| 77 | -define('SN_ROOT_VIRTUAL', 'http' . (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '') . '://' . $_SERVER['HTTP_HOST'] . SN_ROOT_RELATIVE); |
|
| 77 | +define('SN_ROOT_VIRTUAL', 'http'.(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 's' : '').'://'.$_SERVER['HTTP_HOST'].SN_ROOT_RELATIVE); |
|
| 78 | 78 | define('SN_ROOT_VIRTUAL_PARENT', str_replace('//google.', '//', SN_ROOT_VIRTUAL)); |
| 79 | 79 | |
| 80 | 80 | $phpEx = strpos($phpEx = substr(strrchr(__FILE__, '.'), 1), '/') === false ? $phpEx : ''; |
| 81 | 81 | define('PHP_EX', $phpEx); // PHP extension on this server |
| 82 | -define('DOT_PHP_EX', '.' . PHP_EX); // PHP extension on this server |
|
| 82 | +define('DOT_PHP_EX', '.'.PHP_EX); // PHP extension on this server |
|
| 83 | 83 | |
| 84 | 84 | |
| 85 | 85 | require_once('constants.php'); |
@@ -100,22 +100,22 @@ discard block |
||
| 100 | 100 | |
| 101 | 101 | // required for db.php |
| 102 | 102 | // Initializing global 'debug' object |
| 103 | -require_once(SN_ROOT_PHYSICAL . "includes/debug.class" . DOT_PHP_EX); |
|
| 103 | +require_once(SN_ROOT_PHYSICAL."includes/debug.class".DOT_PHP_EX); |
|
| 104 | 104 | classSupernova::$debug = new debug(); |
| 105 | 105 | |
| 106 | -spl_autoload_register(function ($class) { |
|
| 107 | - if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php')) { |
|
| 108 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/' . $class . '.php'; |
|
| 106 | +spl_autoload_register(function($class) { |
|
| 107 | + if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php')) { |
|
| 108 | + require_once SN_ROOT_PHYSICAL.'includes/classes/'.$class.'.php'; |
|
| 109 | 109 | } |
| 110 | 110 | }); |
| 111 | 111 | |
| 112 | -spl_autoload_register(function ($class) { |
|
| 113 | - if(file_exists(SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php')) { |
|
| 114 | - require_once SN_ROOT_PHYSICAL . 'includes/classes/UBE/' . $class . '.php'; |
|
| 112 | +spl_autoload_register(function($class) { |
|
| 113 | + if (file_exists(SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php')) { |
|
| 114 | + require_once SN_ROOT_PHYSICAL.'includes/classes/UBE/'.$class.'.php'; |
|
| 115 | 115 | } |
| 116 | 116 | }); |
| 117 | 117 | |
| 118 | -require_once(SN_ROOT_PHYSICAL . "includes/db" . DOT_PHP_EX); |
|
| 118 | +require_once(SN_ROOT_PHYSICAL."includes/db".DOT_PHP_EX); |
|
| 119 | 119 | require_once('classes/db_mysql_v4.php'); |
| 120 | 120 | require_once('classes/db_mysql_v5.php'); |
| 121 | 121 | require_once('classes/db_mysql.php'); |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | require_once('classes/module.php'); |
| 129 | 129 | |
| 130 | 130 | require_once('classes/user_options.php'); |
| 131 | -require_once(SN_ROOT_PHYSICAL . "includes/init/init_functions" . DOT_PHP_EX); |
|
| 131 | +require_once(SN_ROOT_PHYSICAL."includes/init/init_functions".DOT_PHP_EX); |
|
| 132 | 132 | |
| 133 | 133 | /** |
| 134 | 134 | * @var classConfig $config |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | // define('BE_DEBUG', true); // Отладка боевого движка |
| 143 | 143 | classSupernova::init_debug_state(); |
| 144 | 144 | |
| 145 | -require_once(SN_ROOT_PHYSICAL . "includes/vars" . DOT_PHP_EX); |
|
| 146 | -require_once(SN_ROOT_PHYSICAL . "includes/general" . DOT_PHP_EX); |
|
| 145 | +require_once(SN_ROOT_PHYSICAL."includes/vars".DOT_PHP_EX); |
|
| 146 | +require_once(SN_ROOT_PHYSICAL."includes/general".DOT_PHP_EX); |
|
| 147 | 147 | |
| 148 | 148 | init_update(); |
| 149 | 149 | |
@@ -152,34 +152,34 @@ discard block |
||
| 152 | 152 | ? trim(strip_tags($_GET['page'])) |
| 153 | 153 | : str_replace(DOT_PHP_EX, '', str_replace(SN_ROOT_RELATIVE, '', str_replace('\\', '/', $_SERVER['SCRIPT_NAME']))); |
| 154 | 154 | define('INITIAL_PAGE', $sn_page_name_original); |
| 155 | -define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova') . (defined('SN_GOOGLE') ? '_G' : '')); |
|
| 156 | -define('SN_COOKIE_I', SN_COOKIE . AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
| 157 | -define('SN_COOKIE_D', SN_COOKIE . '_D'); |
|
| 158 | -define('SN_COOKIE_T', SN_COOKIE . '_T'); // Time measure cookie |
|
| 159 | -define('SN_COOKIE_F', SN_COOKIE . '_F'); // Font size cookie |
|
| 160 | -define('SN_COOKIE_U', SN_COOKIE . '_U'); // Current user cookie aka user ID |
|
| 161 | -define('SN_COOKIE_U_I', SN_COOKIE_U . AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
| 155 | +define('SN_COOKIE', (classSupernova::$config->COOKIE_NAME ? classSupernova::$config->COOKIE_NAME : 'SuperNova').(defined('SN_GOOGLE') ? '_G' : '')); |
|
| 156 | +define('SN_COOKIE_I', SN_COOKIE.AUTH_COOKIE_IMPERSONATE_SUFFIX); |
|
| 157 | +define('SN_COOKIE_D', SN_COOKIE.'_D'); |
|
| 158 | +define('SN_COOKIE_T', SN_COOKIE.'_T'); // Time measure cookie |
|
| 159 | +define('SN_COOKIE_F', SN_COOKIE.'_F'); // Font size cookie |
|
| 160 | +define('SN_COOKIE_U', SN_COOKIE.'_U'); // Current user cookie aka user ID |
|
| 161 | +define('SN_COOKIE_U_I', SN_COOKIE_U.AUTH_COOKIE_IMPERSONATE_SUFFIX); // Current impersonator user cookie aka impersonator user ID |
|
| 162 | 162 | define('TEMPLATE_NAME', classSupernova::$config->game_default_template ? classSupernova::$config->game_default_template : 'OpenGame'); |
| 163 | -define('TEMPLATE_PATH', 'design/templates/' . TEMPLATE_NAME); |
|
| 164 | -define('TEMPLATE_DIR', SN_ROOT_PHYSICAL . TEMPLATE_PATH); |
|
| 163 | +define('TEMPLATE_PATH', 'design/templates/'.TEMPLATE_NAME); |
|
| 164 | +define('TEMPLATE_DIR', SN_ROOT_PHYSICAL.TEMPLATE_PATH); |
|
| 165 | 165 | define('DEFAULT_SKINPATH', classSupernova::$config->game_default_skin ? classSupernova::$config->game_default_skin : 'skins/EpicBlue/'); |
| 166 | 166 | define('DEFAULT_LANG', classSupernova::$config->game_default_language ? classSupernova::$config->game_default_language : 'ru'); |
| 167 | 167 | define('FMT_DATE', classSupernova::$config->int_format_date ? classSupernova::$config->int_format_date : 'd.m.Y'); |
| 168 | 168 | define('FMT_TIME', classSupernova::$config->int_format_time ? classSupernova::$config->int_format_time : 'H:i:s'); |
| 169 | -define('FMT_DATE_TIME', FMT_DATE . ' ' . FMT_TIME); |
|
| 169 | +define('FMT_DATE_TIME', FMT_DATE.' '.FMT_TIME); |
|
| 170 | 170 | |
| 171 | 171 | $HTTP_ACCEPT_LANGUAGE = DEFAULT_LANG; |
| 172 | 172 | |
| 173 | -require_once(SN_ROOT_PHYSICAL . "includes/template" . DOT_PHP_EX); |
|
| 173 | +require_once(SN_ROOT_PHYSICAL."includes/template".DOT_PHP_EX); |
|
| 174 | 174 | $template_result = array('.' => array('result' => array())); |
| 175 | 175 | |
| 176 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "includes/functions/", PHP_EX); |
|
| 176 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."includes/functions/", PHP_EX); |
|
| 177 | 177 | |
| 178 | -spl_autoload_register(function ($class) { |
|
| 179 | - if(file_exists('includes/classes/' . $class . '.php')) { |
|
| 180 | - require_once 'includes/classes/' . $class . '.php'; |
|
| 181 | - } elseif(file_exists('includes/classes/UBE/' . $class . '.php')) { |
|
| 182 | - require_once 'includes/classes/UBE/' . $class . '.php'; |
|
| 178 | +spl_autoload_register(function($class) { |
|
| 179 | + if (file_exists('includes/classes/'.$class.'.php')) { |
|
| 180 | + require_once 'includes/classes/'.$class.'.php'; |
|
| 181 | + } elseif (file_exists('includes/classes/UBE/'.$class.'.php')) { |
|
| 182 | + require_once 'includes/classes/UBE/'.$class.'.php'; |
|
| 183 | 183 | } else { |
| 184 | 184 | // die("Can't find {$class} class"); |
| 185 | 185 | } |
@@ -193,7 +193,7 @@ discard block |
||
| 193 | 193 | // Конфиг - часть манифеста? |
| 194 | 194 | classSupernova::$auth = new core_auth(); |
| 195 | 195 | |
| 196 | -sn_sys_load_php_files(SN_ROOT_PHYSICAL . "modules/", PHP_EX, true); |
|
| 196 | +sn_sys_load_php_files(SN_ROOT_PHYSICAL."modules/", PHP_EX, true); |
|
| 197 | 197 | // Здесь - потому что core_auth модуль лежит в другом каталоге и его нужно инициализировать отдельно |
| 198 | 198 | |
| 199 | 199 | // Подключаем дефолтную страницу |
@@ -201,10 +201,10 @@ discard block |
||
| 201 | 201 | // Сейчас мы делаем это здесь только для того, что бы содержание дефолтной страницы оказалось вверху. Что не факт, что нужно всегда |
| 202 | 202 | // Но нужно, пока у нас есть не MVC-страницы |
| 203 | 203 | $sn_page_data = $sn_data['pages'][$sn_page_name]; |
| 204 | -$sn_page_name_file = 'includes/pages/' . $sn_page_data['filename'] . DOT_PHP_EX; |
|
| 205 | -if($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 204 | +$sn_page_name_file = 'includes/pages/'.$sn_page_data['filename'].DOT_PHP_EX; |
|
| 205 | +if ($sn_page_name && isset($sn_page_data) && file_exists($sn_page_name_file)) { |
|
| 206 | 206 | require_once($sn_page_name_file); |
| 207 | - if(is_array($sn_page_data['options'])) { |
|
| 207 | + if (is_array($sn_page_data['options'])) { |
|
| 208 | 208 | $supernova->options = array_merge($supernova->options, $sn_page_data['options']); |
| 209 | 209 | } |
| 210 | 210 | } |
@@ -219,10 +219,10 @@ discard block |
||
| 219 | 219 | $load_order = array(); |
| 220 | 220 | $sn_req = array(); |
| 221 | 221 | |
| 222 | -foreach(sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
| 222 | +foreach (sn_module::$sn_module as $loaded_module_name => $module_data) { |
|
| 223 | 223 | $load_order[$loaded_module_name] = isset($module_data->manifest['load_order']) && !empty($module_data->manifest['load_order']) ? $module_data->manifest['load_order'] : 100000; |
| 224 | - if(isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
| 225 | - foreach($module_data->manifest['require'] as $require_name) { |
|
| 224 | + if (isset($module_data->manifest['require']) && !empty($module_data->manifest['require'])) { |
|
| 225 | + foreach ($module_data->manifest['require'] as $require_name) { |
|
| 226 | 226 | $sn_req[$loaded_module_name][$require_name] = 0; |
| 227 | 227 | } |
| 228 | 228 | } |
@@ -235,10 +235,10 @@ discard block |
||
| 235 | 235 | do { |
| 236 | 236 | $prev_order = $load_order; |
| 237 | 237 | |
| 238 | - foreach($sn_req as $loaded_module_name => &$req_data) { |
|
| 238 | + foreach ($sn_req as $loaded_module_name => &$req_data) { |
|
| 239 | 239 | $level = 1; |
| 240 | - foreach($req_data as $req_name => &$req_level) { |
|
| 241 | - if($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
| 240 | + foreach ($req_data as $req_name => &$req_level) { |
|
| 241 | + if ($load_order[$req_name] == -1 || !isset($load_order[$req_name])) { |
|
| 242 | 242 | $level = $req_level = -1; |
| 243 | 243 | break; |
| 244 | 244 | } else { |
@@ -246,20 +246,20 @@ discard block |
||
| 246 | 246 | } |
| 247 | 247 | $req_level = $load_order[$req_name]; |
| 248 | 248 | } |
| 249 | - if($level > $load_order[$loaded_module_name] || $level == -1) { |
|
| 249 | + if ($level > $load_order[$loaded_module_name] || $level == -1) { |
|
| 250 | 250 | $load_order[$loaded_module_name] = $level; |
| 251 | 251 | } |
| 252 | 252 | } |
| 253 | -} while($prev_order != $load_order); |
|
| 253 | +} while ($prev_order != $load_order); |
|
| 254 | 254 | |
| 255 | 255 | asort($load_order); |
| 256 | 256 | |
| 257 | 257 | // Инициализируем модули |
| 258 | 258 | // По нормальным делам это должна быть загрузка модулей и лишь затем инициализация - что бы минимизировать размер процесса в памяти |
| 259 | -foreach($load_order as $loaded_module_name => $load_order_order) { |
|
| 260 | - if($load_order_order >= 0) { |
|
| 259 | +foreach ($load_order as $loaded_module_name => $load_order_order) { |
|
| 260 | + if ($load_order_order >= 0) { |
|
| 261 | 261 | sn_module::$sn_module[$loaded_module_name]->check_status(); |
| 262 | - if(!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
| 262 | + if (!sn_module::$sn_module[$loaded_module_name]->manifest['active']) { |
|
| 263 | 263 | unset(sn_module::$sn_module[$loaded_module_name]); |
| 264 | 264 | continue; |
| 265 | 265 | } |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | unset($sn_req); |
| 277 | 277 | |
| 278 | 278 | // А теперь проверяем - поддерживают ли у нас загруженный код такую страницу |
| 279 | -if(!isset($sn_data['pages'][$sn_page_name])) { |
|
| 279 | +if (!isset($sn_data['pages'][$sn_page_name])) { |
|
| 280 | 280 | $sn_page_name = ''; |
| 281 | 281 | } |
| 282 | 282 | |
@@ -284,6 +284,6 @@ discard block |
||
| 284 | 284 | classLocale::$lang = $lang = new classLocale(classSupernova::$config->server_locale_log_usage); |
| 285 | 285 | classLocale::$lang->lng_switch(sys_get_param_str('lang')); |
| 286 | 286 | |
| 287 | -if(!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
| 287 | +if (!defined('DEBUG_INIT_SKIP_SECONDARY') || DEBUG_INIT_SKIP_SECONDARY !== true) { |
|
| 288 | 288 | require_once "init_secondary.php"; |
| 289 | 289 | } |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if(!defined('IN_UPDATE') || IN_UPDATE !== true) { |
|
| 3 | +if (!defined('IN_UPDATE') || IN_UPDATE !== true) { |
|
| 4 | 4 | die('Hack attempt'); |
| 5 | 5 | } |
| 6 | 6 | |
| 7 | -switch($new_version) { |
|
| 7 | +switch ($new_version) { |
|
| 8 | 8 | case 0: |
| 9 | 9 | case 1: |
| 10 | 10 | case 2: |
@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | ); |
| 33 | 33 | upd_drop_table('lunas'); |
| 34 | 34 | |
| 35 | - if($update_tables['galaxy']) { |
|
| 35 | + if ($update_tables['galaxy']) { |
|
| 36 | 36 | upd_do_query( |
| 37 | 37 | 'UPDATE `{{planets}}` |
| 38 | 38 | LEFT JOIN `{{galaxy}}` ON {{galaxy}}.id_planet = {{planets}}.id |
@@ -82,12 +82,12 @@ discard block |
||
| 82 | 82 | ); |
| 83 | 83 | upd_add_more_time(); |
| 84 | 84 | |
| 85 | - if($update_tables['users']['rpg_points']) { |
|
| 85 | + if ($update_tables['users']['rpg_points']) { |
|
| 86 | 86 | upd_do_query( |
| 87 | 87 | "UPDATE {{users}} AS u |
| 88 | 88 | RIGHT JOIN {{referrals}} AS r |
| 89 | - ON r.id_partner = u.id AND r.dark_matter >= " . classSupernova::$config->rpg_bonus_divisor . " |
|
| 90 | - SET u.rpg_points = u.rpg_points + FLOOR(r.dark_matter/" . classSupernova::$config->rpg_bonus_divisor . ");" |
|
| 89 | + ON r.id_partner = u.id AND r.dark_matter >= " . classSupernova::$config->rpg_bonus_divisor." |
|
| 90 | + SET u.rpg_points = u.rpg_points + FLOOR(r.dark_matter/" . classSupernova::$config->rpg_bonus_divisor.");" |
|
| 91 | 91 | ); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -175,18 +175,18 @@ discard block |
||
| 175 | 175 | upd_alter_table('planets', "ADD `governor_level` smallint unsigned NOT NULL DEFAULT '0' COMMENT 'Governor level'", !$update_tables['planets']['governor_level']); |
| 176 | 176 | upd_alter_table('planets', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'Planet que'", !$update_tables['planets']['que']); |
| 177 | 177 | |
| 178 | - if($update_tables['planets']['b_building']) { |
|
| 178 | + if ($update_tables['planets']['b_building']) { |
|
| 179 | 179 | $planet_query = upd_do_query('SELECT * FROM {{planets}} WHERE `b_building` <> 0;'); |
| 180 | 180 | $const_que_structures = QUE_STRUCTURES; |
| 181 | - while($planet_data = db_fetch($planet_query)) { |
|
| 181 | + while ($planet_data = db_fetch($planet_query)) { |
|
| 182 | 182 | $old_que = explode(';', $planet_data['b_building_id']); |
| 183 | - foreach($old_que as $old_que_item_string) { |
|
| 184 | - if(!$old_que_item_string) { |
|
| 183 | + foreach ($old_que as $old_que_item_string) { |
|
| 184 | + if (!$old_que_item_string) { |
|
| 185 | 185 | continue; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | $old_que_item = explode(',', $old_que_item_string); |
| 189 | - if($old_que_item[4] == 'build') { |
|
| 189 | + if ($old_que_item[4] == 'build') { |
|
| 190 | 190 | $old_que_item[4] = BUILD_CREATE; |
| 191 | 191 | } else { |
| 192 | 192 | $old_que_item[4] = BUILD_DESTROY; |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8;" |
| 220 | 220 | ); |
| 221 | 221 | |
| 222 | - if($update_tables['users']['urlaubs_until']) { |
|
| 222 | + if ($update_tables['users']['urlaubs_until']) { |
|
| 223 | 223 | upd_alter_table('users', "ADD `vacation` int(11) NOT NULL DEFAULT '0' COMMENT 'Time when user can leave vacation mode'", !$update_tables['users']['vacation']); |
| 224 | 224 | upd_do_query('UPDATE {{users}} SET `vacation` = `urlaubs_until` WHERE `urlaubs_modus` <> 0;'); |
| 225 | 225 | upd_alter_table('users', 'DROP COLUMN `urlaubs_until`, DROP COLUMN `urlaubs_modus`, DROP COLUMN `urlaubs_modus_time`', $update_tables['users']['urlaubs_until']); |
@@ -269,12 +269,12 @@ discard block |
||
| 269 | 269 | ), !$update_tables['logs']['log_timestamp']); |
| 270 | 270 | upd_do_query('DELETE FROM `{{logs}}` WHERE `log_code` = 303;'); |
| 271 | 271 | |
| 272 | - if($update_tables['errors']) { |
|
| 272 | + if ($update_tables['errors']) { |
|
| 273 | 273 | upd_do_query('INSERT INTO `{{logs}}` (`log_code`, `log_sender`, `log_title`, `log_text`, `log_page`, `log_time`) SELECT 500, `error_sender`, `error_type`, `error_text`, `error_page`, `error_time` FROM `{{errors}}`;'); |
| 274 | - if($update_tables['errors_backup']) { |
|
| 274 | + if ($update_tables['errors_backup']) { |
|
| 275 | 275 | upd_drop_table('errors_backup'); |
| 276 | 276 | } |
| 277 | - upd_alter_table('errors', ' RENAME TO ' . classSupernova::$config->db_prefix . 'errors_backup'); |
|
| 277 | + upd_alter_table('errors', ' RENAME TO '.classSupernova::$config->db_prefix.'errors_backup'); |
|
| 278 | 278 | |
| 279 | 279 | upd_drop_table('errors'); |
| 280 | 280 | } |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | |
| 333 | 333 | upd_alter_table('users', 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci'); |
| 334 | 334 | |
| 335 | - if(!$update_tables['shortcut']) { |
|
| 335 | + if (!$update_tables['shortcut']) { |
|
| 336 | 336 | upd_create_table('shortcut', |
| 337 | 337 | "( |
| 338 | 338 | `shortcut_id` SERIAL, |
@@ -356,10 +356,10 @@ discard block |
||
| 356 | 356 | $temp_planet_types = array(PT_PLANET, PT_DEBRIS, PT_MOON); |
| 357 | 357 | |
| 358 | 358 | $query = upd_do_query("SELECT id, fleet_shortcut FROM {{users}} WHERE fleet_shortcut > '';"); |
| 359 | - while($user_data = db_fetch($query)) { |
|
| 359 | + while ($user_data = db_fetch($query)) { |
|
| 360 | 360 | $shortcuts = explode("\r\n", $user_data['fleet_shortcut']); |
| 361 | - foreach($shortcuts as $shortcut) { |
|
| 362 | - if(!$shortcut) { |
|
| 361 | + foreach ($shortcuts as $shortcut) { |
|
| 362 | + if (!$shortcut) { |
|
| 363 | 363 | continue; |
| 364 | 364 | } |
| 365 | 365 | |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | $shortcut[3] = intval($shortcut[3]); |
| 371 | 371 | $shortcut[4] = intval($shortcut[4]); |
| 372 | 372 | |
| 373 | - if($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) { |
|
| 373 | + if ($shortcut[0] && $shortcut[1] && $shortcut[2] && $shortcut[3] && in_array($shortcut[4], $temp_planet_types)) { |
|
| 374 | 374 | upd_do_query("INSERT INTO {classSupernova::$config->db_prefix}shortcut (shortcut_user_id, shortcut_galaxy, shortcut_system, shortcut_planet, shortcut_planet_type, shortcut_text) VALUES ({$user_data['id']}, {$shortcut[1]}, {$shortcut[2]}, {$shortcut[3]}, {$shortcut[4]}, '{$shortcut[0]}');", true); |
| 375 | 375 | } |
| 376 | 376 | } |
@@ -522,7 +522,7 @@ discard block |
||
| 522 | 522 | |
| 523 | 523 | upd_check_key('quest_total', 0, !isset(classSupernova::$config->quest_total)); |
| 524 | 524 | |
| 525 | - for($i = 0; $i < 25; $i++) { |
|
| 525 | + for ($i = 0; $i < 25; $i++) { |
|
| 526 | 526 | upd_alter_table('alliance', array("DROP INDEX `id_{$i}`",), $update_indexes['alliance']["id_{$i}"]); |
| 527 | 527 | upd_alter_table('users', array("DROP INDEX `id_{$i}`",), $update_indexes['users']["id_{$i}"]); |
| 528 | 528 | upd_alter_table('planets', array("DROP INDEX `id_{$i}`",), $update_indexes['planets']["id_{$i}"]); |
@@ -550,7 +550,7 @@ discard block |
||
| 550 | 550 | "ADD `msg_admin` bigint(11) unsigned DEFAULT '0' AFTER mnl_buildlist" |
| 551 | 551 | ), !$update_tables['users']['msg_admin']); |
| 552 | 552 | |
| 553 | - if(!$update_foreigns['users']['FK_users_ally_id']) { |
|
| 553 | + if (!$update_foreigns['users']['FK_users_ally_id']) { |
|
| 554 | 554 | upd_alter_table('users', array( |
| 555 | 555 | 'MODIFY COLUMN `ally_name` VARCHAR(32) DEFAULT NULL', |
| 556 | 556 | 'MODIFY COLUMN `ally_id` BIGINT(20) UNSIGNED DEFAULT NULL', |
@@ -572,7 +572,7 @@ discard block |
||
| 572 | 572 | ), strtoupper($update_tables['planets']['debris_metal']['Type']) != 'BIGINT(20) UNSIGNED'); |
| 573 | 573 | |
| 574 | 574 | $illegal_moon_query = upd_do_query("SELECT id FROM `{{planets}}` WHERE `id_owner` <> 0 AND `planet_type` = 3 AND `parent_planet` <> 0 AND `parent_planet` NOT IN (SELECT `id` FROM {{planets}} WHERE `planet_type` = 1);"); |
| 575 | - while($illegal_moon_row = db_fetch($illegal_moon_query)) { |
|
| 575 | + while ($illegal_moon_row = db_fetch($illegal_moon_query)) { |
|
| 576 | 576 | upd_do_query("DELETE FROM {{planets}} WHERE id = {$illegal_moon_row['id']} LIMIT 1;", true); |
| 577 | 577 | } |
| 578 | 578 | |
@@ -609,16 +609,16 @@ discard block |
||
| 609 | 609 | upd_do_query('COMMIT;', true); |
| 610 | 610 | |
| 611 | 611 | $records = 1; |
| 612 | - while($records) { |
|
| 612 | + while ($records) { |
|
| 613 | 613 | upd_do_query('START TRANSACTION;', true); |
| 614 | 614 | $query = upd_do_query("SELECT * FROM {{LOGS}} WHERE log_code = 102 ORDER BY log_id LIMIT 1000;"); |
| 615 | 615 | $records = db_num_rows($query); |
| 616 | - while($row = db_fetch($query)) { |
|
| 616 | + while ($row = db_fetch($query)) { |
|
| 617 | 617 | $result = preg_match('/^Player ID (\d+) Dark Matter was adjusted with (\-?\d+). Reason: (.+)$/', $row['log_text'], $matches); |
| 618 | 618 | |
| 619 | 619 | $reason = RPG_NONE; |
| 620 | 620 | $comment = $matches[3]; |
| 621 | - switch($matches[3]) { |
|
| 621 | + switch ($matches[3]) { |
|
| 622 | 622 | case 'Level Up For Structure Building': |
| 623 | 623 | $reason = RPG_STRUCTURE; |
| 624 | 624 | break; |
@@ -634,22 +634,22 @@ discard block |
||
| 634 | 634 | break; |
| 635 | 635 | |
| 636 | 636 | default: |
| 637 | - if(preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) { |
|
| 637 | + if (preg_match('/^Using Black Market page (\d+)$/', $comment, $matches2)) { |
|
| 638 | 638 | $reason = RPG_MARKET; |
| 639 | - } elseif(preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) { |
|
| 639 | + } elseif (preg_match('/^Spent for officer (.+) ID (\d+)$/', $comment, $matches2)) { |
|
| 640 | 640 | $reason = RPG_MERCENARY; |
| 641 | 641 | $comment = "Spent for mercenary {$matches2[1]} GUID {$matches2[2]}"; |
| 642 | - } elseif(preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) { |
|
| 642 | + } elseif (preg_match('/^Incoming From Referral ID\ ?(\d+)$/', $comment, $matches2)) { |
|
| 643 | 643 | $reason = RPG_REFERRAL; |
| 644 | 644 | $comment = "Incoming from referral ID {$matches[1]}"; |
| 645 | - } elseif(preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) { |
|
| 645 | + } elseif (preg_match('/^Through admin interface for user .* ID \d+ (.*)$/', $comment, $matches2)) { |
|
| 646 | 646 | $reason = RPG_ADMIN; |
| 647 | 647 | $comment = $matches2[1]; |
| 648 | 648 | } |
| 649 | 649 | break; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - if($matches[2]) { |
|
| 652 | + if ($matches[2]) { |
|
| 653 | 653 | $row['log_username'] = db_escape($row['log_username']); |
| 654 | 654 | $row['log_page'] = db_escape($row['log_page']); |
| 655 | 655 | $comment = db_escape($comment); |
@@ -668,12 +668,12 @@ discard block |
||
| 668 | 668 | upd_do_query('COMMIT;', true); |
| 669 | 669 | } |
| 670 | 670 | |
| 671 | - foreach($update_tables as $table_name => $cork) { |
|
| 672 | - $row = db_fetch(upd_do_query("SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = '" . db_escape(classSupernova::$db_name) . "' AND TABLE_NAME = '" . classSupernova::$config->db_prefix . "{$table_name}';", true)); |
|
| 673 | - if($row['ENGINE'] != 'InnoDB') { |
|
| 671 | + foreach ($update_tables as $table_name => $cork) { |
|
| 672 | + $row = db_fetch(upd_do_query("SELECT * FROM information_schema.TABLES WHERE TABLE_SCHEMA = '".db_escape(classSupernova::$db_name)."' AND TABLE_NAME = '".classSupernova::$config->db_prefix."{$table_name}';", true)); |
|
| 673 | + if ($row['ENGINE'] != 'InnoDB') { |
|
| 674 | 674 | upd_alter_table($table_name, 'ENGINE=InnoDB', true); |
| 675 | 675 | } |
| 676 | - if($row['TABLE_COLLATION'] != 'utf8_general_ci') { |
|
| 676 | + if ($row['TABLE_COLLATION'] != 'utf8_general_ci') { |
|
| 677 | 677 | upd_alter_table($table_name, 'CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci', true); |
| 678 | 678 | } |
| 679 | 679 | } |
@@ -693,7 +693,7 @@ discard block |
||
| 693 | 693 | "CHANGE COLUMN `governor_level` `PLANET_GOVERNOR_LEVEL` SMALLINT(5) NOT NULL DEFAULT 0", |
| 694 | 694 | ), !$update_tables['planets']['PLANET_GOVERNOR_ID']); |
| 695 | 695 | |
| 696 | - if($update_tables['users']['rpg_geologue']) { |
|
| 696 | + if ($update_tables['users']['rpg_geologue']) { |
|
| 697 | 697 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_geologue` + `rpg_ingenieur` + `rpg_constructeur` + `rpg_technocrate` + `rpg_scientifique` + `rpg_defenseur`) * 3;"); |
| 698 | 698 | |
| 699 | 699 | upd_alter_table('users', array( |
@@ -706,7 +706,7 @@ discard block |
||
| 706 | 706 | ), $update_tables['users']['rpg_geologue']); |
| 707 | 707 | } |
| 708 | 708 | |
| 709 | - if($update_tables['users']['rpg_bunker']) { |
|
| 709 | + if ($update_tables['users']['rpg_bunker']) { |
|
| 710 | 710 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` + (`rpg_bunker`) * 3;"); |
| 711 | 711 | |
| 712 | 712 | upd_alter_table('users', array( |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | ), !isset($update_tables['alliance']['total_rank'])); |
| 757 | 757 | doquery("UPDATE {{alliance}} AS a JOIN {{statpoints}} AS sp ON sp.id_owner = a.id AND sp.stat_code = 1 AND sp.stat_type = 2 SET a.total_rank = sp.total_rank, a.total_points = sp.total_points;"); |
| 758 | 758 | |
| 759 | - if(!isset($update_tables['users']['ally_tag'])) { |
|
| 759 | + if (!isset($update_tables['users']['ally_tag'])) { |
|
| 760 | 760 | upd_alter_table('users', array( |
| 761 | 761 | "ADD COLUMN `ally_tag` varchar(8) DEFAULT NULL AFTER `ally_id`", |
| 762 | 762 | ), !isset($update_tables['users']['ally_tag'])); |
@@ -771,7 +771,7 @@ discard block |
||
| 771 | 771 | "ADD COLUMN `player_artifact_list` TEXT", |
| 772 | 772 | ), !isset($update_tables['users']['player_artifact_list'])); |
| 773 | 773 | |
| 774 | - if(!isset($update_tables['users']['player_rpg_tech_xp'])) { |
|
| 774 | + if (!isset($update_tables['users']['player_rpg_tech_xp'])) { |
|
| 775 | 775 | upd_check_key('eco_scale_storage', 1, !isset(classSupernova::$config->eco_scale_storage)); |
| 776 | 776 | |
| 777 | 777 | upd_alter_table('users', array( |
@@ -801,7 +801,7 @@ discard block |
||
| 801 | 801 | "MODIFY COLUMN `ally_owner` BIGINT(20) UNSIGNED DEFAULT NULL", |
| 802 | 802 | ), strtoupper($update_tables['alliance']['ally_owner']['Type']) != 'BIGINT(20) UNSIGNED'); |
| 803 | 803 | |
| 804 | - if(strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 804 | + if (strtoupper($update_tables['alliance_diplomacy']['alliance_diplomacy_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 805 | 805 | upd_alter_table('alliance_diplomacy', array( |
| 806 | 806 | "DROP FOREIGN KEY `FK_diplomacy_ally_id`", |
| 807 | 807 | "DROP FOREIGN KEY `FK_diplomacy_contr_ally_id`" |
@@ -816,7 +816,7 @@ discard block |
||
| 816 | 816 | ), true); |
| 817 | 817 | } |
| 818 | 818 | |
| 819 | - if(strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 819 | + if (strtoupper($update_tables['alliance_negotiation']['alliance_negotiation_ally_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 820 | 820 | upd_alter_table('alliance_negotiation', array( |
| 821 | 821 | "DROP FOREIGN KEY `FK_negotiation_ally_id`", |
| 822 | 822 | "DROP FOREIGN KEY `FK_negotiation_contr_ally_id`" |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | ), true); |
| 833 | 833 | } |
| 834 | 834 | |
| 835 | - if(strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 835 | + if (strtoupper($update_tables['alliance_requests']['id_user']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 836 | 836 | upd_do_query('DELETE FROM {{alliance_requests}} WHERE id_user NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
| 837 | 837 | |
| 838 | 838 | upd_alter_table('alliance_requests', array( |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | ), true); |
| 847 | 847 | } |
| 848 | 848 | |
| 849 | - if(strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 849 | + if (strtoupper($update_tables['annonce']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 850 | 850 | upd_do_query('DELETE FROM {{annonce}} WHERE USER NOT IN (SELECT username FROM {{users}});', true); |
| 851 | 851 | |
| 852 | 852 | upd_alter_table('annonce', array( |
@@ -859,7 +859,7 @@ discard block |
||
| 859 | 859 | ), true); |
| 860 | 860 | } |
| 861 | 861 | |
| 862 | - if(strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 862 | + if (strtoupper($update_tables['bashing']['bashing_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 863 | 863 | upd_alter_table('bashing', array( |
| 864 | 864 | "DROP FOREIGN KEY `FK_bashing_user_id`", |
| 865 | 865 | "DROP FOREIGN KEY `FK_bashing_planet_id`", |
@@ -874,7 +874,7 @@ discard block |
||
| 874 | 874 | ), true); |
| 875 | 875 | } |
| 876 | 876 | |
| 877 | - if(strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 877 | + if (strtoupper($update_tables['buddy']['id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 878 | 878 | upd_do_query('DELETE FROM {{buddy}} WHERE sender NOT IN (SELECT id FROM {{users}}) OR OWNER NOT IN (SELECT id FROM {{users}});', true); |
| 879 | 879 | |
| 880 | 880 | upd_alter_table('buddy', array( |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | "MODIFY COLUMN `fleet_resource_deuterium` DECIMAL(65,0) DEFAULT '0'", |
| 913 | 913 | ), strtoupper($update_tables['fleets']['fleet_resource_metal']['Type']) != 'DECIMAL(65,0)'); |
| 914 | 914 | |
| 915 | - if(strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 915 | + if (strtoupper($update_tables['iraks']['fleet_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 916 | 916 | upd_do_query('DELETE FROM {{iraks}} WHERE OWNER NOT IN (SELECT id FROM {{users}}) OR zielid NOT IN (SELECT id FROM {{users}});', true); |
| 917 | 917 | |
| 918 | 918 | upd_alter_table('iraks', array( |
@@ -936,7 +936,7 @@ discard block |
||
| 936 | 936 | ), true); |
| 937 | 937 | } |
| 938 | 938 | |
| 939 | - if(strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 939 | + if (strtoupper($update_tables['notes']['owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 940 | 940 | upd_do_query('DELETE FROM {{notes}} WHERE OWNER NOT IN (SELECT id FROM {{users}});', true); |
| 941 | 941 | |
| 942 | 942 | upd_alter_table('notes', array( |
@@ -1061,7 +1061,7 @@ discard block |
||
| 1061 | 1061 | "DROP COLUMN `b_hangar_plus`", |
| 1062 | 1062 | ), isset($update_tables['planets']['b_hangar_plus'])); |
| 1063 | 1063 | |
| 1064 | - if(strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1064 | + if (strtoupper($update_tables['referrals']['id_partner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1065 | 1065 | upd_do_query('DELETE FROM {{referrals}} WHERE id NOT IN (SELECT id FROM {{users}}) OR id_partner NOT IN (SELECT id FROM {{users}});', true); |
| 1066 | 1066 | |
| 1067 | 1067 | upd_alter_table('referrals', array( |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | "MODIFY COLUMN `id_owner2` BIGINT(20) UNSIGNED", |
| 1081 | 1081 | ), strtoupper($update_tables['rw']['id_owner1']['Type']) != 'BIGINT(20) UNSIGNED'); |
| 1082 | 1082 | |
| 1083 | - if(strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1083 | + if (strtoupper($update_tables['shortcut']['shortcut_user_id']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1084 | 1084 | upd_do_query('DELETE FROM {{shortcut}} WHERE shortcut_user_id NOT IN (SELECT id FROM {{users}}) OR shortcut_planet_id NOT IN (SELECT id FROM {{planets}});', true); |
| 1085 | 1085 | |
| 1086 | 1086 | upd_alter_table('shortcut', array( |
@@ -1095,7 +1095,7 @@ discard block |
||
| 1095 | 1095 | ), true); |
| 1096 | 1096 | } |
| 1097 | 1097 | |
| 1098 | - if(strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1098 | + if (strtoupper($update_tables['statpoints']['id_owner']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1099 | 1099 | upd_do_query('DELETE FROM {{statpoints}} WHERE id_owner NOT IN (SELECT id FROM {{users}}) OR id_ally NOT IN (SELECT id FROM {{alliance}});', true); |
| 1100 | 1100 | |
| 1101 | 1101 | upd_alter_table('statpoints', array( |
@@ -1249,7 +1249,7 @@ discard block |
||
| 1249 | 1249 | "DROP COLUMN `settings_allylogo`", |
| 1250 | 1250 | ), isset($update_tables['users']['settings_allylogo'])); |
| 1251 | 1251 | |
| 1252 | - if(!isset($update_tables['powerup'])) { |
|
| 1252 | + if (!isset($update_tables['powerup'])) { |
|
| 1253 | 1253 | upd_do_query("DROP TABLE IF EXISTS {{mercenaries}};"); |
| 1254 | 1254 | |
| 1255 | 1255 | upd_create_table('powerup', |
@@ -1279,24 +1279,24 @@ discard block |
||
| 1279 | 1279 | |
| 1280 | 1280 | $update_query_template = "UPDATE {{users}} SET id = id %s WHERE id = %d LIMIT 1;"; |
| 1281 | 1281 | $user_list = upd_do_query("SELECT * FROM {{users}};"); |
| 1282 | - while($user_row = db_fetch($user_list)) { |
|
| 1282 | + while ($user_row = db_fetch($user_list)) { |
|
| 1283 | 1283 | $update_query_str = ''; |
| 1284 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) { |
|
| 1284 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) { |
|
| 1285 | 1285 | $mercenary_data_name = get_unit_param($mercenary_id, P_NAME); |
| 1286 | - if($mercenary_level = $user_row[$mercenary_data_name]) { |
|
| 1286 | + if ($mercenary_level = $user_row[$mercenary_data_name]) { |
|
| 1287 | 1287 | $update_query_str = ", `{$mercenary_data_name}` = 0"; |
| 1288 | 1288 | upd_do_query("DELETE FROM {{powerup}} WHERE powerup_user_id = {$user_row['id']} AND powerup_unit_id = {$mercenary_id} LIMIT 1;"); |
| 1289 | 1289 | upd_do_query("INSERT {{powerup}} SET powerup_user_id = {$user_row['id']}, powerup_unit_id = {$mercenary_id}, powerup_unit_level = {$mercenary_level};"); |
| 1290 | 1290 | } |
| 1291 | 1291 | } |
| 1292 | 1292 | |
| 1293 | - if($update_query_str) { |
|
| 1293 | + if ($update_query_str) { |
|
| 1294 | 1294 | upd_do_query(sprintf($update_query_template, $update_query_str, $user_row['id'])); |
| 1295 | 1295 | } |
| 1296 | 1296 | } |
| 1297 | 1297 | } |
| 1298 | 1298 | |
| 1299 | - if(!isset($update_tables['universe'])) { |
|
| 1299 | + if (!isset($update_tables['universe'])) { |
|
| 1300 | 1300 | upd_create_table('universe', |
| 1301 | 1301 | "( |
| 1302 | 1302 | `universe_galaxy` SMALLINT UNSIGNED NOT NULL DEFAULT '0', |
@@ -1319,7 +1319,7 @@ discard block |
||
| 1319 | 1319 | |
| 1320 | 1320 | // ------------------------------------------------------------------------ |
| 1321 | 1321 | // Modifying tables |
| 1322 | - if(strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1322 | + if (strtoupper($update_tables['users']['user_as_ally']['Type']) != 'BIGINT(20) UNSIGNED') { |
|
| 1323 | 1323 | upd_alter_table('users', array( |
| 1324 | 1324 | "ADD COLUMN user_as_ally BIGINT(20) UNSIGNED DEFAULT NULL", |
| 1325 | 1325 | |
@@ -1340,23 +1340,23 @@ discard block |
||
| 1340 | 1340 | // ------------------------------------------------------------------------ |
| 1341 | 1341 | // Creating players for allies |
| 1342 | 1342 | $ally_row_list = doquery("SELECT `id`, `ally_tag` FROM {{alliance}} WHERE ally_user_id IS NULL;"); |
| 1343 | - while($ally_row = db_fetch($ally_row_list)) { |
|
| 1343 | + while ($ally_row = db_fetch($ally_row_list)) { |
|
| 1344 | 1344 | $ally_user_name = db_escape("[{$ally_row['ally_tag']}]"); |
| 1345 | - doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = " . SN_TIME_NOW . ", `user_as_ally` = {$ally_row['id']};"); |
|
| 1345 | + doquery("INSERT INTO {{users}} SET `username` = '{$ally_user_name}', `register_time` = ".SN_TIME_NOW.", `user_as_ally` = {$ally_row['id']};"); |
|
| 1346 | 1346 | $ally_user_id = db_insert_id(); |
| 1347 | 1347 | doquery("UPDATE {{alliance}} SET ally_user_id = {$ally_user_id} WHERE id = {$ally_row['id']} LIMIT 1;"); |
| 1348 | 1348 | } |
| 1349 | 1349 | // Renaming old ally players TODO: Remove on release |
| 1350 | 1350 | upd_do_query("UPDATE {{users}} AS u LEFT JOIN {{alliance}} AS a ON u.user_as_ally = a.id SET u.username = CONCAT('[', a.ally_tag, ']') WHERE u.user_as_ally IS NOT NULL AND u.username = '';"); |
| 1351 | 1351 | // Setting last online time to old ally players TODO: Remove on release |
| 1352 | - upd_do_query("UPDATE {{users}} SET `onlinetime` = " . SN_TIME_NOW . " WHERE onlinetime = 0;"); |
|
| 1352 | + upd_do_query("UPDATE {{users}} SET `onlinetime` = ".SN_TIME_NOW." WHERE onlinetime = 0;"); |
|
| 1353 | 1353 | |
| 1354 | 1354 | // ------------------------------------------------------------------------ |
| 1355 | 1355 | // Creating planets for allies |
| 1356 | 1356 | $ally_user_list = doquery("SELECT `id`, `username` FROM {{users}} WHERE `user_as_ally` IS NOT NULL AND `id_planet` = 0;"); |
| 1357 | - while($ally_user_row = db_fetch($ally_user_list)) { |
|
| 1357 | + while ($ally_user_row = db_fetch($ally_user_list)) { |
|
| 1358 | 1358 | $ally_planet_name = db_escape($ally_user_row['username']); |
| 1359 | - doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = " . SN_TIME_NOW . ", `id_owner` = {$ally_user_row['id']};"); |
|
| 1359 | + doquery("INSERT INTO {{planets}} SET `name` = '{$ally_planet_name}', `last_update` = ".SN_TIME_NOW.", `id_owner` = {$ally_user_row['id']};"); |
|
| 1360 | 1360 | $ally_planet_id = db_insert_id(); |
| 1361 | 1361 | doquery("UPDATE {{users}} SET `id_planet` = {$ally_planet_id} WHERE `id` = {$ally_user_row['id']} LIMIT 1;"); |
| 1362 | 1362 | } |
@@ -1385,10 +1385,10 @@ discard block |
||
| 1385 | 1385 | // Adding db field |
| 1386 | 1386 | upd_alter_table('users', "ADD `que` varchar(4096) NOT NULL DEFAULT '' COMMENT 'User que'", !$update_tables['users']['que']); |
| 1387 | 1387 | // Converting old data to new one and dropping old fields |
| 1388 | - if($update_tables['users']['b_tech_planet']) { |
|
| 1388 | + if ($update_tables['users']['b_tech_planet']) { |
|
| 1389 | 1389 | $query = doquery("SELECT * FROM {{planets}} WHERE `b_tech_id` <> 0;"); |
| 1390 | - while($planet_row = db_fetch($query)) { |
|
| 1391 | - $que_item_string = "{$planet_row['b_tech_id']},1," . max(0, $planet_row['b_tech'] - SN_TIME_NOW) . "," . BUILD_CREATE . "," . QUE_RESEARCH; |
|
| 1390 | + while ($planet_row = db_fetch($query)) { |
|
| 1391 | + $que_item_string = "{$planet_row['b_tech_id']},1,".max(0, $planet_row['b_tech'] - SN_TIME_NOW).",".BUILD_CREATE.",".QUE_RESEARCH; |
|
| 1392 | 1392 | doquery("UPDATE {{users}} SET `que` = '{$que_item_string}' WHERE `id` = {$planet_row['id_owner']} LIMIT 1;"); |
| 1393 | 1393 | } |
| 1394 | 1394 | |
@@ -1400,10 +1400,10 @@ discard block |
||
| 1400 | 1400 | upd_alter_table('users', "DROP COLUMN `b_tech_planet`", $update_tables['users']['b_tech_planet']); |
| 1401 | 1401 | } |
| 1402 | 1402 | |
| 1403 | - if(!$update_tables['powerup']['powerup_category']) { |
|
| 1403 | + if (!$update_tables['powerup']['powerup_category']) { |
|
| 1404 | 1404 | upd_alter_table('powerup', "ADD COLUMN `powerup_category` SMALLINT NOT NULL DEFAULT 0 AFTER `powerup_planet_id`", !$update_tables['powerup']['powerup_category']); |
| 1405 | 1405 | |
| 1406 | - doquery("UPDATE {{powerup}} SET powerup_category = " . BONUS_MERCENARY); |
|
| 1406 | + doquery("UPDATE {{powerup}} SET powerup_category = ".BONUS_MERCENARY); |
|
| 1407 | 1407 | } |
| 1408 | 1408 | |
| 1409 | 1409 | upd_check_key('rpg_cost_info', 10000, !isset(classSupernova::$config->rpg_cost_info)); |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | upd_check_key('ali_bonus_brackets', 10, !isset(classSupernova::$config->ali_bonus_brackets)); |
| 1422 | 1422 | upd_check_key('ali_bonus_brackets_divisor', 50, !isset(classSupernova::$config->ali_bonus_brackets_divisor)); |
| 1423 | 1423 | |
| 1424 | - if(!classSupernova::$config->db_loadItem('rpg_flt_explore')) { |
|
| 1424 | + if (!classSupernova::$config->db_loadItem('rpg_flt_explore')) { |
|
| 1425 | 1425 | $inflation_rate = 1000; |
| 1426 | 1426 | |
| 1427 | 1427 | classSupernova::$config->db_saveItem('rpg_cost_banker', classSupernova::$config->rpg_cost_banker * $inflation_rate); |
@@ -1438,17 +1438,17 @@ discard block |
||
| 1438 | 1438 | doquery("UPDATE {{users}} SET `dark_matter` = `dark_matter` * {$inflation_rate};"); |
| 1439 | 1439 | |
| 1440 | 1440 | $query = doquery("SELECT * FROM {{quest}}"); |
| 1441 | - while($row = db_fetch($query)) { |
|
| 1441 | + while ($row = db_fetch($query)) { |
|
| 1442 | 1442 | $query_add = ''; |
| 1443 | 1443 | $quest_reward_list = explode(';', $row['quest_rewards']); |
| 1444 | - foreach($quest_reward_list as &$quest_reward) { |
|
| 1444 | + foreach ($quest_reward_list as &$quest_reward) { |
|
| 1445 | 1445 | list($reward_resource, $reward_amount) = explode(',', $quest_reward); |
| 1446 | - if($reward_resource == RES_DARK_MATTER) { |
|
| 1447 | - $quest_reward = "{$reward_resource}," . $reward_amount * 1000; |
|
| 1446 | + if ($reward_resource == RES_DARK_MATTER) { |
|
| 1447 | + $quest_reward = "{$reward_resource},".$reward_amount * 1000; |
|
| 1448 | 1448 | } |
| 1449 | 1449 | } |
| 1450 | 1450 | $new_rewards = implode(';', $quest_reward_list); |
| 1451 | - if($new_rewards != $row['quest_rewards']) { |
|
| 1451 | + if ($new_rewards != $row['quest_rewards']) { |
|
| 1452 | 1452 | doquery("UPDATE {{quest}} SET `quest_rewards` = '{$new_rewards}' WHERE quest_id = {$row['quest_id']} LIMIT 1;"); |
| 1453 | 1453 | } |
| 1454 | 1454 | } |
@@ -1478,7 +1478,7 @@ discard block |
||
| 1478 | 1478 | upd_check_key('user_birthday_range', 30, !isset(classSupernova::$config->user_birthday_range)); |
| 1479 | 1479 | upd_check_key('user_birthday_celebrate', 0, !isset(classSupernova::$config->user_birthday_celebrate)); |
| 1480 | 1480 | |
| 1481 | - if(!isset($update_tables['payment'])) { |
|
| 1481 | + if (!isset($update_tables['payment'])) { |
|
| 1482 | 1482 | upd_alter_table('users', array( |
| 1483 | 1483 | "ADD KEY `I_user_id_name` (`id`, `username`)", |
| 1484 | 1484 | ), !$update_indexes['users']['I_user_id_name']); |
@@ -1512,15 +1512,15 @@ discard block |
||
| 1512 | 1512 | upd_check_key('payment_lot_price', 1, !isset(classSupernova::$config->payment_lot_price)); |
| 1513 | 1513 | |
| 1514 | 1514 | // Updating category for Mercenaries |
| 1515 | - upd_do_query("UPDATE {{powerup}} SET powerup_category = " . UNIT_MERCENARIES . " WHERE powerup_unit_id > 600 AND powerup_unit_id < 700;"); |
|
| 1515 | + upd_do_query("UPDATE {{powerup}} SET powerup_category = ".UNIT_MERCENARIES." WHERE powerup_unit_id > 600 AND powerup_unit_id < 700;"); |
|
| 1516 | 1516 | |
| 1517 | 1517 | // Convert Destructor to Death Star schematic |
| 1518 | 1518 | upd_do_query("UPDATE {{powerup}} |
| 1519 | - SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS . ", powerup_unit_id = " . UNIT_PLAN_SHIP_DEATH_STAR . " |
|
| 1519 | + SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS.", powerup_unit_id = ".UNIT_PLAN_SHIP_DEATH_STAR." |
|
| 1520 | 1520 | WHERE (powerup_time_start = 0 OR powerup_time_finish >= UNIX_TIMESTAMP()) AND powerup_unit_id = 612;"); |
| 1521 | 1521 | // Convert Assasin to SuperNova schematic |
| 1522 | 1522 | upd_do_query("UPDATE {{powerup}} |
| 1523 | - SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS . ", powerup_unit_id = " . UNIT_PLAN_SHIP_SUPERNOVA . " |
|
| 1523 | + SET powerup_time_start = 0, powerup_time_finish = 0, powerup_category = " . UNIT_PLANS.", powerup_unit_id = ".UNIT_PLAN_SHIP_SUPERNOVA." |
|
| 1524 | 1524 | WHERE (powerup_time_start = 0 OR powerup_time_finish >= UNIX_TIMESTAMP()) AND powerup_unit_id = 614;"); |
| 1525 | 1525 | |
| 1526 | 1526 | upd_alter_table('iraks', array( |
@@ -1529,7 +1529,7 @@ discard block |
||
| 1529 | 1529 | ), !$update_tables['iraks']['fleet_start_type']); |
| 1530 | 1530 | |
| 1531 | 1531 | |
| 1532 | - if(!$update_tables['payment']['payment_status']) { |
|
| 1532 | + if (!$update_tables['payment']['payment_status']) { |
|
| 1533 | 1533 | upd_alter_table('payment', array( |
| 1534 | 1534 | "ADD COLUMN `payment_status` INT DEFAULT 0 COMMENT 'Payment status' AFTER `payment_id`", |
| 1535 | 1535 | |
@@ -1544,7 +1544,7 @@ discard block |
||
| 1544 | 1544 | ), !$update_tables['payment']['payment_status']); |
| 1545 | 1545 | } |
| 1546 | 1546 | |
| 1547 | - upd_do_query("UPDATE {{powerup}} SET powerup_time_start = 0, powerup_time_finish = 0 WHERE powerup_category = " . UNIT_PLANS . ";"); |
|
| 1547 | + upd_do_query("UPDATE {{powerup}} SET powerup_time_start = 0, powerup_time_finish = 0 WHERE powerup_category = ".UNIT_PLANS.";"); |
|
| 1548 | 1548 | |
| 1549 | 1549 | upd_check_key('server_start_date', date('d.m.Y', SN_TIME_NOW), !isset(classSupernova::$config->server_start_date)); |
| 1550 | 1550 | upd_check_key('server_que_length_structures', 5, !isset(classSupernova::$config->server_que_length_structures)); |
@@ -1556,7 +1556,7 @@ discard block |
||
| 1556 | 1556 | |
| 1557 | 1557 | upd_check_key('chat_highlight_premium', '<span class="nick_premium">$1</span>', !isset(classSupernova::$config->chat_highlight_premium)); |
| 1558 | 1558 | |
| 1559 | - upd_do_query("UPDATE {{planets}} SET `PLANET_GOVERNOR_LEVEL` = CEILING(`PLANET_GOVERNOR_LEVEL`/2) WHERE PLANET_GOVERNOR_ID = " . MRC_ENGINEER . " AND `PLANET_GOVERNOR_LEVEL` > 8;"); |
|
| 1559 | + upd_do_query("UPDATE {{planets}} SET `PLANET_GOVERNOR_LEVEL` = CEILING(`PLANET_GOVERNOR_LEVEL`/2) WHERE PLANET_GOVERNOR_ID = ".MRC_ENGINEER." AND `PLANET_GOVERNOR_LEVEL` > 8;"); |
|
| 1560 | 1560 | |
| 1561 | 1561 | |
| 1562 | 1562 | upd_do_query('COMMIT;', true); |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | "ADD INDEX `I_owner_priority_time` (`owner`, `priority`, `time`)", |
| 1614 | 1614 | ), !$update_indexes['notes']['I_owner_priority_time']); |
| 1615 | 1615 | |
| 1616 | - if(!$update_tables['buddy']['BUDDY_ID']) { |
|
| 1616 | + if (!$update_tables['buddy']['BUDDY_ID']) { |
|
| 1617 | 1617 | upd_alter_table('buddy', array( |
| 1618 | 1618 | "CHANGE COLUMN `id` `BUDDY_ID` SERIAL COMMENT 'Buddy table row ID'", |
| 1619 | 1619 | "CHANGE COLUMN `active` `BUDDY_STATUS` TINYINT(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT 'Buddy request status'", |
@@ -1634,16 +1634,16 @@ discard block |
||
| 1634 | 1634 | |
| 1635 | 1635 | $query = upd_do_query("SELECT `BUDDY_ID`, `BUDDY_SENDER_ID`, `BUDDY_OWNER_ID` FROM {{buddy}} ORDER BY `BUDDY_ID`;"); |
| 1636 | 1636 | $found = $lost = array(); |
| 1637 | - while($row = db_fetch($query)) { |
|
| 1638 | - $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']) . ';' . max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
|
| 1639 | - if(!isset($found[$index])) { |
|
| 1637 | + while ($row = db_fetch($query)) { |
|
| 1638 | + $index = min($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']).';'.max($row['BUDDY_SENDER_ID'], $row['BUDDY_OWNER_ID']); |
|
| 1639 | + if (!isset($found[$index])) { |
|
| 1640 | 1640 | $found[$index] = $row['BUDDY_ID']; |
| 1641 | 1641 | } else { |
| 1642 | 1642 | $lost[] = $row['BUDDY_ID']; |
| 1643 | 1643 | } |
| 1644 | 1644 | } |
| 1645 | 1645 | $lost = implode(',', $lost); |
| 1646 | - if($lost) { |
|
| 1646 | + if ($lost) { |
|
| 1647 | 1647 | upd_do_query("DELETE FROM {{buddy}} WHERE `BUDDY_ID` IN ({$lost})"); |
| 1648 | 1648 | } |
| 1649 | 1649 | |
@@ -1664,7 +1664,7 @@ discard block |
||
| 1664 | 1664 | |
| 1665 | 1665 | upd_do_query("UPDATE {{users}} SET `ally_name` = NULL, `ally_tag` = NULL, ally_register_time = 0, ally_rank_id = 0 WHERE `ally_id` IS NULL"); |
| 1666 | 1666 | |
| 1667 | - if(!$update_tables['ube_report']) { |
|
| 1667 | + if (!$update_tables['ube_report']) { |
|
| 1668 | 1668 | upd_create_table('ube_report', |
| 1669 | 1669 | "( |
| 1670 | 1670 | `ube_report_id` SERIAL COMMENT 'Report ID', |
@@ -1705,7 +1705,7 @@ discard block |
||
| 1705 | 1705 | ); |
| 1706 | 1706 | } |
| 1707 | 1707 | |
| 1708 | - if(!$update_tables['ube_report_player']) { |
|
| 1708 | + if (!$update_tables['ube_report_player']) { |
|
| 1709 | 1709 | upd_create_table('ube_report_player', |
| 1710 | 1710 | "( |
| 1711 | 1711 | `ube_report_player_id` SERIAL COMMENT 'Record ID', |
@@ -1726,7 +1726,7 @@ discard block |
||
| 1726 | 1726 | ); |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | - if(!$update_tables['ube_report_fleet']) { |
|
| 1729 | + if (!$update_tables['ube_report_fleet']) { |
|
| 1730 | 1730 | upd_create_table('ube_report_fleet', |
| 1731 | 1731 | "( |
| 1732 | 1732 | `ube_report_fleet_id` SERIAL COMMENT 'Record DB ID', |
@@ -1756,7 +1756,7 @@ discard block |
||
| 1756 | 1756 | ); |
| 1757 | 1757 | } |
| 1758 | 1758 | |
| 1759 | - if(!$update_tables['ube_report_unit']) { |
|
| 1759 | + if (!$update_tables['ube_report_unit']) { |
|
| 1760 | 1760 | // TODO: Сохранять так же имя корабля - на случай конструкторов - не, хуйня. Конструктор может давать имена разные на разных языках |
| 1761 | 1761 | // Может сохранять имена удаленных кораблей долго? |
| 1762 | 1762 | |
@@ -1793,7 +1793,7 @@ discard block |
||
| 1793 | 1793 | ); |
| 1794 | 1794 | } |
| 1795 | 1795 | |
| 1796 | - if(!$update_tables['ube_report_outcome_fleet']) { |
|
| 1796 | + if (!$update_tables['ube_report_outcome_fleet']) { |
|
| 1797 | 1797 | upd_create_table('ube_report_outcome_fleet', |
| 1798 | 1798 | "( |
| 1799 | 1799 | `ube_report_outcome_fleet_id` SERIAL COMMENT 'Record DB ID', |
@@ -1822,7 +1822,7 @@ discard block |
||
| 1822 | 1822 | ); |
| 1823 | 1823 | } |
| 1824 | 1824 | |
| 1825 | - if(!$update_tables['ube_report_outcome_unit']) { |
|
| 1825 | + if (!$update_tables['ube_report_outcome_unit']) { |
|
| 1826 | 1826 | upd_create_table('ube_report_outcome_unit', |
| 1827 | 1827 | "( |
| 1828 | 1828 | `ube_report_outcome_unit_id` SERIAL COMMENT 'Record DB ID', |
@@ -1843,7 +1843,7 @@ discard block |
||
| 1843 | 1843 | ); |
| 1844 | 1844 | } |
| 1845 | 1845 | |
| 1846 | - if(!$update_tables['unit']) { |
|
| 1846 | + if (!$update_tables['unit']) { |
|
| 1847 | 1847 | upd_create_table('unit', |
| 1848 | 1848 | "( |
| 1849 | 1849 | `unit_id` SERIAL COMMENT 'Record ID', |
@@ -1862,7 +1862,7 @@ discard block |
||
| 1862 | 1862 | ); |
| 1863 | 1863 | } |
| 1864 | 1864 | |
| 1865 | - if(!$update_tables['captain']) { |
|
| 1865 | + if (!$update_tables['captain']) { |
|
| 1866 | 1866 | upd_create_table('captain', |
| 1867 | 1867 | "( |
| 1868 | 1868 | `captain_id` SERIAL COMMENT 'Record ID', |
@@ -1882,7 +1882,7 @@ discard block |
||
| 1882 | 1882 | ); |
| 1883 | 1883 | } |
| 1884 | 1884 | |
| 1885 | - if(!$update_tables['fleets']['fleet_start_planet_id']) { |
|
| 1885 | + if (!$update_tables['fleets']['fleet_start_planet_id']) { |
|
| 1886 | 1886 | upd_alter_table('fleets', array( |
| 1887 | 1887 | "ADD `fleet_start_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet start planet ID' AFTER `fleet_start_time`", |
| 1888 | 1888 | "ADD `fleet_end_planet_id` BIGINT(20) UNSIGNED DEFAULT NULL COMMENT 'Fleet end planet ID' AFTER `fleet_end_stay`", |
@@ -1904,7 +1904,7 @@ discard block |
||
| 1904 | 1904 | |
| 1905 | 1905 | upd_alter_table('fleets', array("DROP COLUMN `processing_start`"), $update_tables['fleets']['processing_start']); |
| 1906 | 1906 | |
| 1907 | - if(!$update_tables['chat_player']) { |
|
| 1907 | + if (!$update_tables['chat_player']) { |
|
| 1908 | 1908 | upd_create_table('chat_player', |
| 1909 | 1909 | "( |
| 1910 | 1910 | `chat_player_id` SERIAL COMMENT 'Record ID', |
@@ -1966,7 +1966,7 @@ discard block |
||
| 1966 | 1966 | "DROP FOREIGN KEY `FK_payment_user`", |
| 1967 | 1967 | ), $update_foreigns['payment']['FK_payment_user']); |
| 1968 | 1968 | |
| 1969 | - if($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') { |
|
| 1969 | + if ($update_foreigns['chat']['FK_chat_message_sender_user_id'] != 'chat_message_sender_id,users,id;') { |
|
| 1970 | 1970 | upd_alter_table('chat', array( |
| 1971 | 1971 | "DROP FOREIGN KEY `FK_chat_message_sender_user_id`", |
| 1972 | 1972 | "DROP FOREIGN KEY `FK_chat_message_sender_recipient_id`", |
@@ -1999,7 +1999,7 @@ discard block |
||
| 1999 | 1999 | "ADD KEY `I_ube_report_time_combat` (`ube_report_time_combat`)", |
| 2000 | 2000 | ), !$update_indexes['ube_report']['I_ube_report_time_combat']); |
| 2001 | 2001 | |
| 2002 | - if(!$update_tables['unit']['unit_time_start']) { |
|
| 2002 | + if (!$update_tables['unit']['unit_time_start']) { |
|
| 2003 | 2003 | upd_alter_table('unit', array( |
| 2004 | 2004 | "ADD COLUMN `unit_time_start` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation start time'", |
| 2005 | 2005 | "ADD COLUMN `unit_time_finish` DATETIME NULL DEFAULT NULL COMMENT 'Unit activation end time'", |
@@ -2009,13 +2009,13 @@ discard block |
||
| 2009 | 2009 | "INSERT INTO {{unit}} |
| 2010 | 2010 | (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level, unit_time_start, unit_time_finish) |
| 2011 | 2011 | SELECT |
| 2012 | - `powerup_user_id`, " . LOC_USER . ", `powerup_user_id`, `powerup_category`, `powerup_unit_id`, `powerup_unit_level` |
|
| 2012 | + `powerup_user_id`, " . LOC_USER.", `powerup_user_id`, `powerup_category`, `powerup_unit_id`, `powerup_unit_level` |
|
| 2013 | 2013 | , IF(`powerup_time_start`, FROM_UNIXTIME(`powerup_time_start`), NULL), IF(`powerup_time_finish`, FROM_UNIXTIME(`powerup_time_finish`), NULL) |
| 2014 | 2014 | FROM {{powerup}}" |
| 2015 | 2015 | ); |
| 2016 | 2016 | } |
| 2017 | 2017 | |
| 2018 | - if(!$update_tables['que']) { |
|
| 2018 | + if (!$update_tables['que']) { |
|
| 2019 | 2019 | upd_create_table('que', |
| 2020 | 2020 | "( |
| 2021 | 2021 | `que_id` SERIAL COMMENT 'Internal que id', |
@@ -2047,25 +2047,25 @@ discard block |
||
| 2047 | 2047 | } |
| 2048 | 2048 | |
| 2049 | 2049 | // Конвертирум очередь исследований |
| 2050 | - if($update_tables['users']['que']) { |
|
| 2050 | + if ($update_tables['users']['que']) { |
|
| 2051 | 2051 | $que_lines = array(); |
| 2052 | 2052 | $que_query = upd_do_query("SELECT * FROM {{users}} WHERE `que`"); |
| 2053 | - while($que_row = db_fetch($que_query)) { |
|
| 2053 | + while ($que_row = db_fetch($que_query)) { |
|
| 2054 | 2054 | $que_data = explode(',', $que_row['que']); |
| 2055 | 2055 | |
| 2056 | - if(!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) { |
|
| 2056 | + if (!in_array($que_data[QI_UNIT_ID], sn_get_groups('tech'))) { |
|
| 2057 | 2057 | continue; |
| 2058 | 2058 | } |
| 2059 | 2059 | |
| 2060 | 2060 | $que_data[QI_TIME] = $que_data[QI_TIME] >= 0 ? $que_data[QI_TIME] : 0; |
| 2061 | 2061 | // Если планета пустая - ставим главку |
| 2062 | 2062 | $que_data[QI_PLANET_ID] = $que_data[QI_PLANET_ID] ? $que_data[QI_PLANET_ID] : $que_row['id_planet']; |
| 2063 | - if($que_data[QI_PLANET_ID]) { |
|
| 2063 | + if ($que_data[QI_PLANET_ID]) { |
|
| 2064 | 2064 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
| 2065 | - if(!$que_planet_check['id']) { |
|
| 2065 | + if (!$que_planet_check['id']) { |
|
| 2066 | 2066 | $que_data[QI_PLANET_ID] = $que_row['id_planet']; |
| 2067 | 2067 | $que_planet_check = db_fetch(upd_do_query("SELECT `id` FROM {{planets}} WHERE `id` = {$que_data[QI_PLANET_ID]}")); |
| 2068 | - if(!$que_planet_check['id']) { |
|
| 2068 | + if (!$que_planet_check['id']) { |
|
| 2069 | 2069 | $que_data[QI_PLANET_ID] = 'NULL'; |
| 2070 | 2070 | } |
| 2071 | 2071 | } |
@@ -2079,20 +2079,20 @@ discard block |
||
| 2079 | 2079 | $price_increase = pow($unit_factor, $unit_level); |
| 2080 | 2080 | $unit_level++; |
| 2081 | 2081 | $unit_cost = array(); |
| 2082 | - foreach($unit_info[P_COST] as $resource_id => $resource_amount) { |
|
| 2083 | - if($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) { |
|
| 2082 | + foreach ($unit_info[P_COST] as $resource_id => $resource_amount) { |
|
| 2083 | + if ($resource_id === P_FACTOR || $resource_id == RES_ENERGY || !($resource_cost = $resource_amount * $price_increase)) { |
|
| 2084 | 2084 | continue; |
| 2085 | 2085 | } |
| 2086 | - $unit_cost[] = $resource_id . ',' . floor($resource_cost); |
|
| 2086 | + $unit_cost[] = $resource_id.','.floor($resource_cost); |
|
| 2087 | 2087 | } |
| 2088 | 2088 | $unit_cost = implode(';', $unit_cost); |
| 2089 | 2089 | |
| 2090 | - $que_lines[] = "({$que_row['id']},{$que_data[QI_PLANET_ID]}," . QUE_RESEARCH . ",{$que_data[QI_TIME]},{$que_data[QI_UNIT_ID]},1," . |
|
| 2091 | - BUILD_CREATE . ",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
|
| 2090 | + $que_lines[] = "({$que_row['id']},{$que_data[QI_PLANET_ID]},".QUE_RESEARCH.",{$que_data[QI_TIME]},{$que_data[QI_UNIT_ID]},1,". |
|
| 2091 | + BUILD_CREATE.",{$unit_level},{$que_data[QI_TIME]},'{$unit_cost}')"; |
|
| 2092 | 2092 | } |
| 2093 | 2093 | |
| 2094 | - if(!empty($que_lines)) { |
|
| 2095 | - upd_do_query('INSERT INTO `{{que}}` (`que_player_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_lines)); |
|
| 2094 | + if (!empty($que_lines)) { |
|
| 2095 | + upd_do_query('INSERT INTO `{{que}}` (`que_player_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_lines)); |
|
| 2096 | 2096 | } |
| 2097 | 2097 | |
| 2098 | 2098 | upd_alter_table('users', array( |
@@ -2105,23 +2105,23 @@ discard block |
||
| 2105 | 2105 | |
| 2106 | 2106 | |
| 2107 | 2107 | // Ковертируем технологии в таблицы |
| 2108 | - if($update_tables['users']['graviton_tech']) { |
|
| 2109 | - upd_do_query("DELETE FROM {{unit}} WHERE unit_type = " . UNIT_TECHNOLOGIES); |
|
| 2108 | + if ($update_tables['users']['graviton_tech']) { |
|
| 2109 | + upd_do_query("DELETE FROM {{unit}} WHERE unit_type = ".UNIT_TECHNOLOGIES); |
|
| 2110 | 2110 | |
| 2111 | 2111 | $que_lines = array(); |
| 2112 | 2112 | $user_query = upd_do_query("SELECT * FROM {{users}}"); |
| 2113 | 2113 | upd_add_more_time(300); |
| 2114 | 2114 | $sn_group_tech = sn_get_groups('tech'); |
| 2115 | - while($user_row = db_fetch($user_query)) { |
|
| 2116 | - foreach($sn_group_tech as $tech_id) { |
|
| 2117 | - if($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) { |
|
| 2118 | - $que_lines[] = "({$user_row['id']}," . LOC_USER . ",{$user_row['id']}," . UNIT_TECHNOLOGIES . ",{$tech_id},{$tech_level})"; |
|
| 2115 | + while ($user_row = db_fetch($user_query)) { |
|
| 2116 | + foreach ($sn_group_tech as $tech_id) { |
|
| 2117 | + if ($tech_level = intval($user_row[get_unit_param($tech_id, P_NAME)])) { |
|
| 2118 | + $que_lines[] = "({$user_row['id']},".LOC_USER.",{$user_row['id']},".UNIT_TECHNOLOGIES.",{$tech_id},{$tech_level})"; |
|
| 2119 | 2119 | } |
| 2120 | 2120 | } |
| 2121 | 2121 | } |
| 2122 | 2122 | |
| 2123 | - if(!empty($que_lines)) { |
|
| 2124 | - upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES " . implode(',', $que_lines)); |
|
| 2123 | + if (!empty($que_lines)) { |
|
| 2124 | + upd_do_query("INSERT INTO {{unit}} (unit_player_id, unit_location_type, unit_location_id, unit_type, unit_snid, unit_level) VALUES ".implode(',', $que_lines)); |
|
| 2125 | 2125 | } |
| 2126 | 2126 | |
| 2127 | 2127 | upd_alter_table('users', array( |
@@ -2129,25 +2129,25 @@ discard block |
||
| 2129 | 2129 | ), $update_tables['users']['graviton_tech']); |
| 2130 | 2130 | } |
| 2131 | 2131 | |
| 2132 | - if(!$update_indexes['unit']['I_unit_record_search']) { |
|
| 2132 | + if (!$update_indexes['unit']['I_unit_record_search']) { |
|
| 2133 | 2133 | upd_alter_table('unit', array( |
| 2134 | 2134 | "ADD KEY `I_unit_record_search` (`unit_snid`,`unit_player_id`,`unit_level` DESC,`unit_id`)", |
| 2135 | 2135 | ), !$update_indexes['unit']['I_unit_record_search']); |
| 2136 | 2136 | |
| 2137 | - foreach(sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) { |
|
| 2137 | + foreach (sn_get_groups(array('structures', 'fleet', 'defense')) as $unit_id) { |
|
| 2138 | 2138 | $planet_units[get_unit_param($unit_id, P_NAME)] = 1; |
| 2139 | 2139 | } |
| 2140 | 2140 | $drop_index = array(); |
| 2141 | 2141 | $create_index = &$drop_index; // array(); |
| 2142 | - foreach($planet_units as $unit_name => $unit_create) { |
|
| 2143 | - if($update_indexes['planets']['I_' . $unit_name]) { |
|
| 2142 | + foreach ($planet_units as $unit_name => $unit_create) { |
|
| 2143 | + if ($update_indexes['planets']['I_'.$unit_name]) { |
|
| 2144 | 2144 | $drop_index[] = "DROP KEY I_{$unit_name}"; |
| 2145 | 2145 | } |
| 2146 | - if($update_indexes['planets']['i_' . $unit_name]) { |
|
| 2146 | + if ($update_indexes['planets']['i_'.$unit_name]) { |
|
| 2147 | 2147 | $drop_index[] = "DROP KEY i_{$unit_name}"; |
| 2148 | 2148 | } |
| 2149 | 2149 | |
| 2150 | - if($unit_create) { |
|
| 2150 | + if ($unit_create) { |
|
| 2151 | 2151 | $create_index[] = "ADD KEY `I_{$unit_name}` (`id_owner`, {$unit_name} DESC)"; |
| 2152 | 2152 | } |
| 2153 | 2153 | } |
@@ -2158,7 +2158,7 @@ discard block |
||
| 2158 | 2158 | "ADD `user_time_utc_offset` INT(11) DEFAULT NULL COMMENT 'User time difference with server time' AFTER `user_time_diff`", |
| 2159 | 2159 | ), !$update_tables['users']['user_time_utc_offset']); |
| 2160 | 2160 | |
| 2161 | - if(!$update_foreigns['alliance']['FK_alliance_owner']) { |
|
| 2161 | + if (!$update_foreigns['alliance']['FK_alliance_owner']) { |
|
| 2162 | 2162 | upd_do_query("UPDATE {{alliance}} SET ally_owner = NULL WHERE ally_owner NOT IN (SELECT id FROM {{users}})"); |
| 2163 | 2163 | |
| 2164 | 2164 | upd_alter_table('alliance', array( |
@@ -2178,7 +2178,7 @@ discard block |
||
| 2178 | 2178 | |
| 2179 | 2179 | upd_check_key('chat_highlight_developer', '<span class="nick_developer">$1</span>', !classSupernova::$config->chat_highlight_developer); |
| 2180 | 2180 | |
| 2181 | - if(!$update_tables['player_name_history']) { |
|
| 2181 | + if (!$update_tables['player_name_history']) { |
|
| 2182 | 2182 | upd_check_key('game_user_changename_cost', 100000, !classSupernova::$config->game_user_changename_cost); |
| 2183 | 2183 | upd_check_key('game_user_changename', SERVER_PLAYER_NAME_CHANGE_PAY, classSupernova::$config->game_user_changename != SERVER_PLAYER_NAME_CHANGE_PAY); |
| 2184 | 2184 | |
@@ -2204,10 +2204,10 @@ discard block |
||
| 2204 | 2204 | |
| 2205 | 2205 | upd_alter_table('planets', array( |
| 2206 | 2206 | "ADD `density` SMALLINT NOT NULL DEFAULT 5500 COMMENT 'Planet average density kg/m3'", |
| 2207 | - "ADD `density_index` TINYINT NOT NULL DEFAULT " . PLANET_DENSITY_STANDARD . " COMMENT 'Planet cached density index'", |
|
| 2207 | + "ADD `density_index` TINYINT NOT NULL DEFAULT ".PLANET_DENSITY_STANDARD." COMMENT 'Planet cached density index'", |
|
| 2208 | 2208 | ), !$update_tables['planets']['density_index']); |
| 2209 | 2209 | |
| 2210 | - if($update_tables['users']['player_artifact_list']) { |
|
| 2210 | + if ($update_tables['users']['player_artifact_list']) { |
|
| 2211 | 2211 | upd_alter_table('unit', "DROP KEY `unit_id`", $update_indexes['unit']['unit_id']); |
| 2212 | 2212 | |
| 2213 | 2213 | upd_alter_table('unit', "ADD KEY `I_unit_player_location_snid` (`unit_player_id`, `unit_location_type`, `unit_location_id`, `unit_snid`)", !$update_indexes['unit']['I_unit_player_location_snid']); |
@@ -2217,14 +2217,14 @@ discard block |
||
| 2217 | 2217 | $db_changeset = array(); |
| 2218 | 2218 | |
| 2219 | 2219 | $query = upd_do_query("SELECT `id`, `player_artifact_list` FROM {{users}} WHERE `player_artifact_list` IS NOT NULL AND `player_artifact_list` != '' FOR UPDATE"); |
| 2220 | - while($row = db_fetch($query)) { |
|
| 2220 | + while ($row = db_fetch($query)) { |
|
| 2221 | 2221 | $artifact_list = explode(';', $row['player_artifact_list']); |
| 2222 | - if(!$row['player_artifact_list'] || empty($artifact_list)) { |
|
| 2222 | + if (!$row['player_artifact_list'] || empty($artifact_list)) { |
|
| 2223 | 2223 | continue; |
| 2224 | 2224 | } |
| 2225 | - foreach($artifact_list as $key => &$value) { |
|
| 2225 | + foreach ($artifact_list as $key => &$value) { |
|
| 2226 | 2226 | $value = explode(',', $value); |
| 2227 | - if(!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) { |
|
| 2227 | + if (!isset($value[1]) || $value[1] <= 0 || !isset($sn_data_artifacts[$value[0]])) { |
|
| 2228 | 2228 | unset($artifact_list[$key]); |
| 2229 | 2229 | continue; |
| 2230 | 2230 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | function pname_factory_production_field_name($factory_unit_id) |
| 6 | 6 | { |
| 7 | - return get_unit_param($factory_unit_id, P_NAME) . '_porcent'; |
|
| 7 | + return get_unit_param($factory_unit_id, P_NAME).'_porcent'; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | /** |