@@ -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(); |
@@ -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 | /** |
@@ -27,9 +27,9 @@ discard block |
||
27 | 27 | print($round); |
28 | 28 | print('<table border=1>'); |
29 | 29 | print('<tr align="left">'); |
30 | - foreach($header as $key => $value) |
|
30 | + foreach ($header as $key => $value) |
|
31 | 31 | { |
32 | - if(is_array($value)) |
|
32 | + if (is_array($value)) |
|
33 | 33 | { |
34 | 34 | continue; |
35 | 35 | } |
@@ -61,9 +61,9 @@ discard block |
||
61 | 61 | ); |
62 | 62 | |
63 | 63 | print('<tr align="right">'); |
64 | - foreach($unit_crossfire_result as $key => $value) |
|
64 | + foreach ($unit_crossfire_result as $key => $value) |
|
65 | 65 | { |
66 | - if(is_array($value)) |
|
66 | + if (is_array($value)) |
|
67 | 67 | { |
68 | 68 | continue; |
69 | 69 | } |
@@ -20,14 +20,14 @@ discard block |
||
20 | 20 | $TargetAddress = sprintf(classLocale::$lang['sys_adress_planet'], $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet']); |
21 | 21 | |
22 | 22 | $TheMessage = classLocale::$lang['sys_colo_no_colonizer']; |
23 | - if($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
23 | + if ($objFleet->shipsGetTotalById(SHIP_COLONIZER) >= 1) { |
|
24 | 24 | $TheMessage = classLocale::$lang['sys_colo_notfree']; |
25 | - if(empty($mission_data->dst_planet)) { |
|
25 | + if (empty($mission_data->dst_planet)) { |
|
26 | 26 | $iPlanetCount = get_player_current_colonies($src_user_row); |
27 | 27 | |
28 | 28 | // Can we colonize more planets? |
29 | 29 | $TheMessage = classLocale::$lang['sys_colo_maxcolo']; |
30 | - if($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
30 | + if ($iPlanetCount < get_player_max_colonies($src_user_row)) { |
|
31 | 31 | // Yes, we can colonize |
32 | 32 | $TheMessage = classLocale::$lang['sys_colo_badpos']; |
33 | 33 | |
@@ -35,8 +35,8 @@ discard block |
||
35 | 35 | $fleet_end_coordinates['galaxy'], $fleet_end_coordinates['system'], $fleet_end_coordinates['planet'], |
36 | 36 | $objFleet->playerOwnerId, "{$classLocale['sys_colo_defaultname']} {$iPlanetCount}", false, |
37 | 37 | array('user_row' => $src_user_row)); |
38 | - if($NewOwnerPlanet) { |
|
39 | - $TheMessage = classLocale::$lang['sys_colo_arrival'] . $TargetAddress . classLocale::$lang['sys_colo_allisok']; |
|
38 | + if ($NewOwnerPlanet) { |
|
39 | + $TheMessage = classLocale::$lang['sys_colo_arrival'].$TargetAddress.classLocale::$lang['sys_colo_allisok']; |
|
40 | 40 | msg_send_simple_message($objFleet->playerOwnerId, '', $objFleet->time_arrive_to_target, MSG_TYPE_SPY, classLocale::$lang['sys_colo_mess_from'], classLocale::$lang['sys_colo_mess_report'], $TheMessage); |
41 | 41 | |
42 | 42 | $objFleet->shipAdjustCount(SHIP_COLONIZER, -1); |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | $classLocale = classLocale::$lang; |
4 | 4 | |
5 | -if(!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
5 | +if (!defined('SN_IN_MARKET') || SN_IN_MARKET !== true) |
|
6 | 6 | { |
7 | 7 | classSupernova::$debug->error("Attempt to call market page mode {$mode} directly - not from market.php", 'Forbidden', 403); |
8 | 8 | } |
@@ -17,54 +17,54 @@ discard block |
||
17 | 17 | )); |
18 | 18 | |
19 | 19 | $info_action = sys_get_param_int('action'); |
20 | -if($info_action) |
|
20 | +if ($info_action) |
|
21 | 21 | { |
22 | 22 | try |
23 | 23 | { |
24 | 24 | sn_db_transaction_start(); |
25 | 25 | |
26 | 26 | $user = db_user_by_id($user['id'], true); |
27 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
27 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->rpg_cost_info) |
|
28 | 28 | { |
29 | 29 | throw new Exception(MARKET_NO_DM, ERR_ERROR); |
30 | 30 | } |
31 | 31 | |
32 | - switch($info_action) |
|
32 | + switch ($info_action) |
|
33 | 33 | { |
34 | 34 | case MARKET_INFO_PLAYER: |
35 | 35 | $user_info_name_unsafe = sys_get_param_str_unsafe('user_info_name'); |
36 | - if(!$user_info_name_unsafe) |
|
36 | + if (!$user_info_name_unsafe) |
|
37 | 37 | { |
38 | 38 | throw new Exception(MARKET_INFO_PLAYER_WRONG, ERR_ERROR); |
39 | 39 | } |
40 | 40 | |
41 | - if(is_id($user_info_name_unsafe)) |
|
41 | + if (is_id($user_info_name_unsafe)) |
|
42 | 42 | { |
43 | 43 | $user_info = db_user_by_id($user_info_name_unsafe, true, '`id`, `username`', true); |
44 | 44 | } |
45 | - if(!is_array($user_info)) |
|
45 | + if (!is_array($user_info)) |
|
46 | 46 | { |
47 | 47 | $user_info = db_user_by_username($user_info_name_unsafe, true, '`id`, `username`', true, true); |
48 | 48 | } |
49 | - if(!is_array($user_info)) |
|
49 | + if (!is_array($user_info)) |
|
50 | 50 | { |
51 | 51 | throw new Exception(MARKET_INFO_PLAYER_NOT_FOUND, ERR_ERROR); |
52 | 52 | } |
53 | - if($user_info['id'] == $user['id']) |
|
53 | + if ($user_info['id'] == $user['id']) |
|
54 | 54 | { |
55 | 55 | throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
56 | 56 | } |
57 | 57 | |
58 | 58 | $msg_text = array(); |
59 | - foreach(sn_get_groups('mercenaries') as $mercenary_id) |
|
59 | + foreach (sn_get_groups('mercenaries') as $mercenary_id) |
|
60 | 60 | { |
61 | - $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - " . (($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
|
61 | + $msg_text[] = "{$classLocale['tech'][$mercenary_id]} - ".(($mercenary_level = mrc_get_level($user_info, null, $mercenary_id)) ? "{$classLocale['sys_level']} {$mercenary_level}" : classLocale::$lang['eco_mrk_info_not_hired']); |
|
62 | 62 | } |
63 | - if($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
63 | + if ($mercenary_level = mrc_get_level($user_info, null, UNIT_PREMIUM)) |
|
64 | 64 | { |
65 | 65 | $msg_text[] = "{$classLocale['tech'][UNIT_PREMIUM]} - {$mercenary_level} {$classLocale['sys_level']}"; |
66 | 66 | } |
67 | - $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username']) . "\r\n" . implode("\r\n", $msg_text); |
|
67 | + $msg_text = sprintf(classLocale::$lang['eco_mrk_info_player_message'], $user_info['id'], $user_info['username'])."\r\n".implode("\r\n", $msg_text); |
|
68 | 68 | |
69 | 69 | msg_send_simple_message($user['id'], 0, SN_TIME_NOW, MSG_TYPE_SPY, classLocale::$lang['eco_mrk_info_msg_from'], "{$classLocale['eco_mrk_info_player']} ID {$user_info['id']} [{$user_info['username']}]", $msg_text, false, true); |
70 | 70 | break; |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | break; |
75 | 75 | } |
76 | 76 | |
77 | - if(!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
77 | + if (!rpg_points_change($user['id'], RPG_MARKET_INFO_MERCENARY, -classSupernova::$config->rpg_cost_info, "Using Black Market page {$classLocale['eco_mrk_info']} - getting info about user ID {$user_info['id']}")) |
|
78 | 78 | { |
79 | 79 | // TODO: throw new Exception(MARKET_INFO_PLAYER_SAME, ERR_ERROR); |
80 | 80 | } |
@@ -11,12 +11,12 @@ discard block |
||
11 | 11 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
12 | 12 | $uni_system = sys_get_param_int('system'); |
13 | 13 | |
14 | - if($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies) |
|
14 | + if ($uni_galaxy < 1 || $uni_galaxy > Vector::$knownGalaxies) |
|
15 | 15 | { |
16 | 16 | throw new exception(classLocale::$lang['uni_msg_error_wrong_galaxy'], ERR_ERROR); |
17 | 17 | } |
18 | 18 | |
19 | - if($uni_system < 0 || $uni_system > Vector::$knownSystems) |
|
19 | + if ($uni_system < 0 || $uni_system > Vector::$knownSystems) |
|
20 | 20 | { |
21 | 21 | throw new exception(classLocale::$lang['uni_msg_error_wrong_system'], ERR_ERROR); |
22 | 22 | } |
@@ -25,12 +25,12 @@ discard block |
||
25 | 25 | $uni_row['universe_price'] += $uni_system ? classSupernova::$config->uni_price_system : classSupernova::$config->uni_price_galaxy; |
26 | 26 | $uni_row['universe_name'] = strip_tags($uni_row['universe_name'] ? $uni_row['universe_name'] : ($uni_system ? "{$classLocale['sys_system']} [{$uni_galaxy}:{$uni_system}]" : "{$classLocale['sys_galaxy']} {$uni_galaxy}")); |
27 | 27 | |
28 | - if(sys_get_param_str('uni_name_submit')) |
|
28 | + if (sys_get_param_str('uni_name_submit')) |
|
29 | 29 | { |
30 | 30 | $uni_row['universe_name'] = strip_tags(sys_get_param_str('uni_name')); |
31 | 31 | |
32 | 32 | $uni_price = sys_get_param_float('uni_price'); |
33 | - if($uni_price < $uni_row['universe_price']) |
|
33 | + if ($uni_price < $uni_row['universe_price']) |
|
34 | 34 | { |
35 | 35 | throw new exception(classLocale::$lang['uni_msg_error_low_price'], ERR_ERROR); |
36 | 36 | } |
@@ -39,12 +39,12 @@ discard block |
||
39 | 39 | sn_db_transaction_start(); |
40 | 40 | $user = db_user_by_id($user['id'], true); |
41 | 41 | // if($user[get_unit_param(RES_DARK_MATTER, P_NAME)] < $uni_price) |
42 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
42 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < $uni_price) |
|
43 | 43 | { |
44 | 44 | throw new exception(classLocale::$lang['uni_msg_error_no_dm'], ERR_ERROR); |
45 | 45 | } |
46 | 46 | |
47 | - if(!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to " . sys_get_param_str_unsafe('uni_name'))) |
|
47 | + if (!rpg_points_change($user['id'], RPG_RENAME, -$uni_price, "Renaming [{$uni_galaxy}:{$uni_system}] to ".sys_get_param_str_unsafe('uni_name'))) |
|
48 | 48 | { |
49 | 49 | throw new exception(classLocale::$lang['sys_msg_err_update_dm'], ERR_ERROR); |
50 | 50 | } |
@@ -74,4 +74,4 @@ discard block |
||
74 | 74 | 'PAGE_HINT' => classLocale::$lang['uni_name_page_hint'], |
75 | 75 | )); |
76 | 76 | |
77 | - display($template, classLocale::$lang['sys_universe'] . ' - ' . classLocale::$lang['uni_naming'], true, '', false); |
|
77 | + display($template, classLocale::$lang['sys_universe'].' - '.classLocale::$lang['uni_naming'], true, '', false); |
@@ -2,32 +2,32 @@ discard block |
||
2 | 2 | |
3 | 3 | function sys_avatar_upload($subject_id, &$avatar_field, $prefix = 'avatar') { |
4 | 4 | try { |
5 | - $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL . 'images/avatar/' . $prefix . '_' . $subject_id; |
|
5 | + $avatar_filename = $fullsize_filename = SN_ROOT_PHYSICAL.'images/avatar/'.$prefix.'_'.$subject_id; |
|
6 | 6 | $avatar_filename .= '.png'; |
7 | 7 | $fullsize_filename .= '_full.png'; |
8 | - if(sys_get_param_int('avatar_remove')) { |
|
9 | - if(file_exists($avatar_filename) && !unlink($avatar_filename)) { |
|
8 | + if (sys_get_param_int('avatar_remove')) { |
|
9 | + if (file_exists($avatar_filename) && !unlink($avatar_filename)) { |
|
10 | 10 | throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR); |
11 | 11 | } |
12 | 12 | $avatar_field = 0; |
13 | 13 | throw new Exception(classLocale::$lang['opt_msg_avatar_removed'], ERR_NONE); |
14 | - } elseif($_FILES['avatar']['size']) { |
|
15 | - if(!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) { |
|
14 | + } elseif ($_FILES['avatar']['size']) { |
|
15 | + if (!in_array($_FILES['avatar']['type'], array('image/gif', 'image/jpeg', 'image/jpg', 'image/pjpeg', 'image/png')) || $_FILES['avatar']['size'] > 204800) { |
|
16 | 16 | throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING); |
17 | 17 | } |
18 | 18 | |
19 | - if($_FILES['avatar']['error']) { |
|
19 | + if ($_FILES['avatar']['error']) { |
|
20 | 20 | throw new Exception(sprintf(classLocale::$lang['opt_msg_avatar_error_upload'], $_FILES['avatar']['error']), ERR_ERROR); |
21 | 21 | } |
22 | 22 | |
23 | - if(!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) { |
|
23 | + if (!($avatar_image = imagecreatefromstring(file_get_contents($_FILES['avatar']['tmp_name'])))) { |
|
24 | 24 | throw new Exception(classLocale::$lang['opt_msg_avatar_error_unsupported'], ERR_WARNING); |
25 | 25 | } |
26 | 26 | |
27 | 27 | $avatar_size = getimagesize($_FILES['avatar']['tmp_name']); |
28 | 28 | $avatar_max_width = classSupernova::$config->avatar_max_width; |
29 | 29 | $avatar_max_height = classSupernova::$config->avatar_max_height; |
30 | - if($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) { |
|
30 | + if ($avatar_size[0] > $avatar_max_width || $avatar_size[1] > $avatar_max_height) { |
|
31 | 31 | $aspect_ratio = min($avatar_max_width / $avatar_size[0], $avatar_max_height / $avatar_size[1]); |
32 | 32 | $avatar_image_new = imagecreatetruecolor($avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio); |
33 | 33 | $result = imagecopyresized($avatar_image_new, $avatar_image, 0, 0, 0, 0, $avatar_size[0] * $aspect_ratio, $avatar_size[0] * $aspect_ratio, $avatar_size[0], $avatar_size[1]); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | $avatar_image = $avatar_image_new; |
36 | 36 | } |
37 | 37 | |
38 | - if(file_exists($avatar_filename) && !unlink($avatar_filename)) { |
|
38 | + if (file_exists($avatar_filename) && !unlink($avatar_filename)) { |
|
39 | 39 | throw new Exception(classLocale::$lang['opt_msg_avatar_error_delete'], ERR_ERROR); |
40 | 40 | } |
41 | 41 | |
42 | - if(!imagepng($avatar_image, $avatar_filename, 9)) { |
|
42 | + if (!imagepng($avatar_image, $avatar_filename, 9)) { |
|
43 | 43 | throw new Exception(classLocale::$lang['opt_msg_avatar_error_writing'], ERR_ERROR); |
44 | 44 | } |
45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | imagedestroy($avatar_image); |
48 | 48 | throw new Exception(classLocale::$lang['opt_msg_avatar_uploaded'], ERR_NONE); |
49 | 49 | } |
50 | - } catch(Exception $e) { |
|
50 | + } catch (Exception $e) { |
|
51 | 51 | return array( |
52 | 52 | 'STATUS' => in_array($e->getCode(), array(ERR_NONE, ERR_WARNING, ERR_ERROR)) ? $e->getCode() : ERR_ERROR, |
53 | 53 | 'MESSAGE' => $e->getMessage() |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | global $who; |
12 | 12 | |
13 | 13 | // $sn_group_stat_common = sn_get_groups('STAT_COMMON'); |
14 | - foreach($array as $key => $value) { |
|
15 | - if($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
14 | + foreach ($array as $key => $value) { |
|
15 | + if ($array_name == 'type' && $who == 2 && !in_array($key, $sn_group_stat_common)) { |
|
16 | 16 | continue; |
17 | 17 | } |
18 | 18 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | |
29 | 29 | $allow_anonymous = true; |
30 | 30 | |
31 | -include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
|
31 | +include('common.'.substr(strrchr(__FILE__, '.'), 1)); |
|
32 | 32 | |
33 | 33 | lng_include('stat'); |
34 | 34 | |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | $subject_list = array( |
45 | 45 | 1 => array('header' => classLocale::$lang['stat_player']), |
46 | 46 | ); |
47 | -if(!$source) { |
|
47 | +if (!$source) { |
|
48 | 48 | $subject_list[2] = array('header' => classLocale::$lang['stat_allys']); |
49 | 49 | } |
50 | 50 | stat_tpl_assign($template, $who, 'subject', $subject_list, $sn_group_stat_common); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | $page_count = floor($record_count / 100); |
115 | 115 | $pages = array(); |
116 | -for($i = 0; $i <= $page_count; $i++) { |
|
116 | +for ($i = 0; $i <= $page_count; $i++) { |
|
117 | 117 | $first_element = $i * 100 + 1; |
118 | 118 | $last_element = $first_element + 99; |
119 | 119 | $pages[$first_element] = array( |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ); |
134 | 134 | //pdump($row); |
135 | 135 | |
136 | - if($who == 1) { |
|
136 | + if ($who == 1) { |
|
137 | 137 | $row_stat['ALLY_NAME'] = $row['ally_name']; |
138 | 138 | $row_stat['ALLY_ID'] = $row['ally_id']; |
139 | 139 | empty($row['username']) ? $row['username'] = $row['name'] : false; |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | $id_ref = $_GET['id_ref'] ? intval($_GET['id_ref']) : 0; |
4 | -$id_ref = $id_ref ? '?id_ref=' . $id_ref : ''; |
|
4 | +$id_ref = $id_ref ? '?id_ref='.$id_ref : ''; |
|
5 | 5 | |
6 | 6 | header('HTTP/1.1 301 Moved Permanently'); |
7 | 7 | header("Location: login.php{$id_ref}#tab_password_reset"); |