@@ -14,13 +14,13 @@ discard block |
||
14 | 14 | |
15 | 15 | $no_data = array('user' => false, 'planet' => false, 'que' => false); |
16 | 16 | |
17 | - if(!$planet) { |
|
17 | + if (!$planet) { |
|
18 | 18 | return $no_data; |
19 | 19 | } |
20 | 20 | |
21 | - if(!$no_user_update) { |
|
21 | + if (!$no_user_update) { |
|
22 | 22 | $user = intval(is_array($user) && $user['id'] ? $user['id'] : $user); |
23 | - if(!$user) { |
|
23 | + if (!$user) { |
|
24 | 24 | // TODO - Убрать позже |
25 | 25 | print('<h1>СООБЩИТЕ ЭТО АДМИНУ: sys_o_get_updated() - USER пустой!</h1>'); |
26 | 26 | $backtrace = debug_backtrace(); |
@@ -32,17 +32,17 @@ discard block |
||
32 | 32 | $user = db_user_by_id($user, !$simulation, '*', true); |
33 | 33 | } |
34 | 34 | |
35 | - if(empty($user['id'])) { |
|
35 | + if (empty($user['id'])) { |
|
36 | 36 | return $no_data; |
37 | 37 | } |
38 | 38 | |
39 | - if(is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
39 | + if (is_array($planet) && isset($planet['galaxy']) && $planet['galaxy']) { |
|
40 | 40 | $planet = db_planet_by_vector($planet, '', !$simulation); |
41 | 41 | } else { |
42 | 42 | $planet = intval(is_array($planet) && isset($planet['id']) ? $planet['id'] : $planet); |
43 | 43 | $planet = db_planet_by_id($planet, !$simulation); |
44 | 44 | } |
45 | - if(!is_array($planet) || !isset($planet['id'])) { |
|
45 | + if (!is_array($planet) || !isset($planet['id'])) { |
|
46 | 46 | return $no_data; |
47 | 47 | } |
48 | 48 | |
@@ -65,19 +65,19 @@ discard block |
||
65 | 65 | RES_DEUTERIUM => 0, |
66 | 66 | ); |
67 | 67 | |
68 | - switch($planet['planet_type']) { |
|
68 | + switch ($planet['planet_type']) { |
|
69 | 69 | case PT_PLANET: |
70 | - foreach($resources_increase as $resource_id => &$increment) { |
|
70 | + foreach ($resources_increase as $resource_id => &$increment) { |
|
71 | 71 | $resource_name = pname_resource_name($resource_id); |
72 | 72 | $increment = $caps_real['total'][$resource_id] * $ProductionTime / 3600; |
73 | 73 | $store_free = $caps_real['total_storage'][$resource_id] - $planet[$resource_name]; |
74 | 74 | $increment = min($increment, max(0, $store_free)); |
75 | 75 | |
76 | - if($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
76 | + if ($planet[$resource_name] + $increment < 0 && !$simulation) { |
|
77 | 77 | classSupernova::$debug->warning("Player ID {$user['id']} have negative resources on ID {$planet['id']}.{$planet['planet_type']} [{$planet['galaxy']}:{$planet['system']}:{$planet['planet']}]. Difference {$planet[$resource_name]} of {$resource_name}", 'Negative Resources', 501); |
78 | 78 | } |
79 | 79 | $planet[$resource_name] += $increment; |
80 | - $planet[$resource_name . '_perhour'] = $caps_real['total'][$resource_id]; |
|
80 | + $planet[$resource_name.'_perhour'] = $caps_real['total'][$resource_id]; |
|
81 | 81 | } |
82 | 82 | break; |
83 | 83 | |
@@ -94,13 +94,13 @@ discard block |
||
94 | 94 | // TODO пересчитывать размер планеты только при постройке чего-нибудь и при покупке сектора |
95 | 95 | $planet['field_current'] = 0; |
96 | 96 | $sn_group_build_allow = sn_get_groups('build_allow'); |
97 | - if(is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
98 | - foreach($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
97 | + if (is_array($sn_group_build_allow[$planet['planet_type']])) { |
|
98 | + foreach ($sn_group_build_allow[$planet['planet_type']] as $building_id) { |
|
99 | 99 | $planet['field_current'] += mrc_get_level($user, $planet, $building_id, !$simulation, true); |
100 | 100 | } |
101 | 101 | } |
102 | 102 | |
103 | - if($simulation) { |
|
103 | + if ($simulation) { |
|
104 | 104 | return array('user' => $user, 'planet' => $planet, 'que' => $que); |
105 | 105 | } |
106 | 106 |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | function sys_user_vacation($user) { |
10 | - if(sys_get_param_str('vacation') == 'leave') { |
|
10 | + if (sys_get_param_str('vacation') == 'leave') { |
|
11 | 11 | if ($user['vacation'] < SN_TIME_NOW) { |
12 | 12 | $user['vacation'] = 0; |
13 | 13 | $user['vacation_next'] = SN_TIME_NOW + classSupernova::$config->player_vacation_timeout; |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | } |
16 | 16 | } |
17 | 17 | |
18 | - if($user['vacation']) { |
|
18 | + if ($user['vacation']) { |
|
19 | 19 | // sn_sys_logout(false, true); |
20 | 20 | // core_auth::logout(false, true); |
21 | 21 | |
@@ -45,33 +45,33 @@ discard block |
||
45 | 45 | // TODO: Full rewrite |
46 | 46 | sn_db_transaction_start(); |
47 | 47 | $TheUser = db_user_by_id($UserID); |
48 | - if ( $TheUser['ally_id'] != 0 ) { |
|
49 | - $TheAlly = doquery ( "SELECT * FROM `{{alliance}}` WHERE `id` = '" . $TheUser['ally_id'] . "';", '', true ); |
|
48 | + if ($TheUser['ally_id'] != 0) { |
|
49 | + $TheAlly = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '".$TheUser['ally_id']."';", '', true); |
|
50 | 50 | $TheAlly['ally_members'] -= 1; |
51 | - if ( $TheAlly['ally_members'] > 0 ) { |
|
52 | - doquery ( "UPDATE `{{alliance}}` SET `ally_members` = '" . $TheAlly['ally_members'] . "' WHERE `id` = '" . $TheAlly['id'] . "';"); |
|
51 | + if ($TheAlly['ally_members'] > 0) { |
|
52 | + doquery("UPDATE `{{alliance}}` SET `ally_members` = '".$TheAlly['ally_members']."' WHERE `id` = '".$TheAlly['id']."';"); |
|
53 | 53 | } else { |
54 | - doquery ( "DELETE FROM `{{alliance}}` WHERE `id` = '" . $TheAlly['id'] . "';"); |
|
55 | - doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '" . $TheAlly['id'] . "';"); |
|
54 | + doquery("DELETE FROM `{{alliance}}` WHERE `id` = '".$TheAlly['id']."';"); |
|
55 | + doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '2' AND `id_owner` = '".$TheAlly['id']."';"); |
|
56 | 56 | } |
57 | 57 | } |
58 | - doquery ( "DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '" . $UserID . "';"); |
|
58 | + doquery("DELETE FROM `{{statpoints}}` WHERE `stat_type` = '1' AND `id_owner` = '".$UserID."';"); |
|
59 | 59 | |
60 | 60 | db_planet_list_delete_by_owner($UserID); |
61 | 61 | |
62 | - doquery ( "DELETE FROM `{{messages}}` WHERE `message_sender` = '" . $UserID . "';"); |
|
63 | - doquery ( "DELETE FROM `{{messages}}` WHERE `message_owner` = '" . $UserID . "';"); |
|
64 | - doquery ( "DELETE FROM `{{notes}}` WHERE `owner` = '" . $UserID . "';"); |
|
62 | + doquery("DELETE FROM `{{messages}}` WHERE `message_sender` = '".$UserID."';"); |
|
63 | + doquery("DELETE FROM `{{messages}}` WHERE `message_owner` = '".$UserID."';"); |
|
64 | + doquery("DELETE FROM `{{notes}}` WHERE `owner` = '".$UserID."';"); |
|
65 | 65 | FleetList::db_fleet_list_delete_by_owner($UserID); |
66 | 66 | // doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner1` = '" . $UserID . "';"); |
67 | 67 | // doquery ( "DELETE FROM `{{rw}}` WHERE `id_owner2` = '" . $UserID . "';"); |
68 | - doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '" . $UserID . "';"); |
|
69 | - doquery ( "DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '" . $UserID . "';"); |
|
70 | - doquery ( "DELETE FROM `{{annonce}}` WHERE `user` = '" . $UserID . "';"); |
|
68 | + doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_SENDER_ID` = '".$UserID."';"); |
|
69 | + doquery("DELETE FROM `{{buddy}}` WHERE `BUDDY_OWNER_ID` = '".$UserID."';"); |
|
70 | + doquery("DELETE FROM `{{annonce}}` WHERE `user` = '".$UserID."';"); |
|
71 | 71 | |
72 | 72 | |
73 | 73 | classSupernova::db_del_record_by_id(LOC_USER, $UserID); |
74 | - doquery ( "DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');"); |
|
74 | + doquery("DELETE FROM `{{referrals}}` WHERE (`id` = '{$UserID}') OR (`id_partner` = '{$UserID}');"); |
|
75 | 75 | classSupernova::$config->db_saveItem('users_amount', classSupernova::$config->db_loadItem('users_amount') - 1); |
76 | 76 | sn_db_transaction_commit(); |
77 | 77 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $ban_current = db_user_by_id($banned['id'], false, 'banaday'); |
88 | 88 | $ban_until = ($ban_current['banaday'] ? $ban_current['banaday'] : SN_TIME_NOW) + $term; |
89 | 89 | |
90 | - db_user_set_by_id($banned['id'], "`banaday` = {$ban_until} " . ($is_vacation ? ", `vacation` = '{$ban_until}' " : '')); |
|
90 | + db_user_set_by_id($banned['id'], "`banaday` = {$ban_until} ".($is_vacation ? ", `vacation` = '{$ban_until}' " : '')); |
|
91 | 91 | |
92 | 92 | $banned['username'] = db_escape($banned['username']); |
93 | 93 | $banner['username'] = db_escape($banner['username']); |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | * @param string $reason |
106 | 106 | */ |
107 | 107 | function sys_admin_player_ban_unset($banner, $banned, $reason = '') { |
108 | - db_user_set_by_id($banned['id'], "`banaday` = 0, `vacation` = " . SN_TIME_NOW . ""); |
|
108 | + db_user_set_by_id($banned['id'], "`banaday` = 0, `vacation` = ".SN_TIME_NOW.""); |
|
109 | 109 | |
110 | 110 | $banned['username'] = db_escape($banned['username']); |
111 | 111 | $banner['username'] = db_escape($banner['username']); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | 'total_points' => $options['total_points'] = empty($options['total_points']) ? 0 : $options['total_points'], |
136 | 136 | |
137 | - 'options' => (empty($options['options']) ? $player_options_string : $options['options']) . (empty($options['options_extra']) ? '' : $options['options_extra']), |
|
137 | + 'options' => (empty($options['options']) ? $player_options_string : $options['options']).(empty($options['options_extra']) ? '' : $options['options_extra']), |
|
138 | 138 | |
139 | 139 | 'galaxy' => $options['galaxy'] = intval($options['galaxy'] ? $options['galaxy'] : 0), |
140 | 140 | 'system' => $options['system'] = intval($options['system'] ? $options['system'] : 0), |
@@ -145,28 +145,28 @@ discard block |
||
145 | 145 | !empty($options['password_encoded_unsafe']) ? $field_set['password'] = $options['password_encoded_unsafe'] : false; |
146 | 146 | |
147 | 147 | $user_new = classSupernova::db_ins_field_set(LOC_USER, $field_set); |
148 | - if(!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
148 | + if (!($options['galaxy'] && $options['system'] && $options['planet'])) { |
|
149 | 149 | $options['galaxy'] = classSupernova::$config->LastSettedGalaxyPos; |
150 | 150 | $options['system'] = classSupernova::$config->LastSettedSystemPos; |
151 | - $segment_size = floor(Vector::$knownPlanets/ 3); |
|
151 | + $segment_size = floor(Vector::$knownPlanets / 3); |
|
152 | 152 | $segment = floor(classSupernova::$config->LastSettedPlanetPos / $segment_size); |
153 | 153 | $segment++; |
154 | 154 | $options['planet'] = mt_rand(1 + $segment * $segment_size, ($segment + 1) * $segment_size); |
155 | 155 | |
156 | 156 | // $new_planet_id = 0; |
157 | - while(true) { |
|
158 | - if($options['planet'] > Vector::$knownPlanets) { |
|
157 | + while (true) { |
|
158 | + if ($options['planet'] > Vector::$knownPlanets) { |
|
159 | 159 | $options['planet'] = mt_rand(0, $segment_size - 1) + 1; |
160 | 160 | $options['system']++; |
161 | 161 | } |
162 | - if($options['system'] > Vector::$knownSystems) { |
|
162 | + if ($options['system'] > Vector::$knownSystems) { |
|
163 | 163 | $options['system'] = 1; |
164 | 164 | $options['galaxy']++; |
165 | 165 | } |
166 | - $options['galaxy'] > Vector::$knownGalaxies? $options['galaxy'] = 1 : false; |
|
166 | + $options['galaxy'] > Vector::$knownGalaxies ? $options['galaxy'] = 1 : false; |
|
167 | 167 | |
168 | 168 | $galaxy_row = db_planet_by_gspt($options['galaxy'], $options['system'], $options['planet'], PT_PLANET, true, 'id'); |
169 | - if(!$galaxy_row['id']) { |
|
169 | + if (!$galaxy_row['id']) { |
|
170 | 170 | classSupernova::$config->db_saveItem(array( |
171 | 171 | 'LastSettedGalaxyPos' => $options['galaxy'], |
172 | 172 | 'LastSettedSystemPos' => $options['system'], |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | $username_safe = db_escape($username_unsafe); |
190 | 190 | db_player_name_history_replace($user_new, $username_safe); |
191 | 191 | |
192 | - if(!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
192 | + if (!empty($options['partner_id']) && ($referral_row = db_user_by_id($options['partner_id'], true))) { |
|
193 | 193 | db_referral_insert($options, $user_new); |
194 | 194 | } |
195 | 195 |
@@ -3,10 +3,10 @@ discard block |
||
3 | 3 | function ali_rank_list_save($ranks) { |
4 | 4 | global $user; |
5 | 5 | |
6 | - if(!empty($ranks)) { |
|
7 | - foreach($ranks as $rank => $rights) { |
|
6 | + if (!empty($ranks)) { |
|
7 | + foreach ($ranks as $rank => $rights) { |
|
8 | 8 | $rights = implode(',', $rights); |
9 | - $ranklist .= $rights . ';'; |
|
9 | + $ranklist .= $rights.';'; |
|
10 | 10 | } |
11 | 11 | } |
12 | 12 | |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $temp_array = array(); |
23 | 23 | $query = db_ally_diplomacy_get_relations($ally_from, $ally_to); |
24 | 24 | |
25 | - while($record = db_fetch($query)) { |
|
25 | + while ($record = db_fetch($query)) { |
|
26 | 26 | $temp_array[$record['alliance_diplomacy_contr_ally_id']] = $record; |
27 | 27 | } |
28 | 28 |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | |
8 | 8 | $possible_cores = array(); |
9 | 9 | $probability = 0; |
10 | - foreach($density_list as $possible_core_id => $core_data) { |
|
11 | - if(!$core_data[UNIT_PLANET_DENSITY_RARITY]) { |
|
10 | + foreach ($density_list as $possible_core_id => $core_data) { |
|
11 | + if (!$core_data[UNIT_PLANET_DENSITY_RARITY]) { |
|
12 | 12 | continue; |
13 | 13 | } |
14 | 14 | |
15 | - if( |
|
15 | + if ( |
|
16 | 16 | // Core type exists |
17 | 17 | in_array($possible_core_id, $position_data['core_types']) |
18 | 18 | // Limit core type with planet sector count |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | |
34 | 34 | $random = mt_rand(1, $probability); |
35 | 35 | $selected_core = null; |
36 | - foreach($possible_cores as $core_type => $core_info) { |
|
37 | - if($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) { |
|
36 | + foreach ($possible_cores as $core_type => $core_info) { |
|
37 | + if ($random <= $core_info[UNIT_PLANET_DENSITY_RARITY]) { |
|
38 | 38 | $selected_core = $core_info; |
39 | 39 | break; |
40 | 40 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | function uni_create_planet($Galaxy, $System, $Position, $PlanetOwnerID, $planet_name_unsafe = '', $HomeWorld = false, $options = array()) { |
58 | 58 | $Position = intval($Position); |
59 | 59 | |
60 | - if(!isset($options['skip_check']) && db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) { |
|
60 | + if (!isset($options['skip_check']) && db_planet_by_gspt($Galaxy, $System, $Position, PT_PLANET, true, '`id`')) { |
|
61 | 61 | return false; |
62 | 62 | } |
63 | 63 | |
@@ -66,11 +66,11 @@ discard block |
||
66 | 66 | |
67 | 67 | $planet_generator = sn_get_groups('planet_generator'); |
68 | 68 | |
69 | - if($HomeWorld) { |
|
69 | + if ($HomeWorld) { |
|
70 | 70 | $position_data = $planet_generator[0]; |
71 | 71 | } else { |
72 | 72 | $position_data = $planet_generator[$Position >= UNIVERSE_RANDOM_PLANET_START || $Position < 1 ? UNIVERSE_RANDOM_PLANET_START : $Position]; |
73 | - if($Position >= UNIVERSE_RANDOM_PLANET_START) { |
|
73 | + if ($Position >= UNIVERSE_RANDOM_PLANET_START) { |
|
74 | 74 | // Корректируем температуру для планеты-странника |
75 | 75 | $position_data['t_max_max'] -= UNIVERSE_RANDOM_PLANET_TEMPERATURE_DECREASE * ($Position - UNIVERSE_RANDOM_PLANET_START); |
76 | 76 | } |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | |
79 | 79 | $planet_images = sn_get_groups('planet_images'); |
80 | 80 | $planet_image = $position_data['planet_images'][mt_rand(0, count($position_data['planet_images']) - 1)]; |
81 | - $planet_image .= 'planet' . $planet_images[$planet_image][mt_rand(0, count($planet_images[$planet_image]) - 1)]; |
|
81 | + $planet_image .= 'planet'.$planet_images[$planet_image][mt_rand(0, count($planet_images[$planet_image]) - 1)]; |
|
82 | 82 | |
83 | 83 | $t_max = sn_rand_gauss_range($position_data['t_max_min'], $position_data['t_max_max'], true, 1.3, true); |
84 | 84 | $t_min = $t_max - sn_rand_gauss_range($position_data['t_delta_min'], $position_data['t_delta_max'], true, 1.3, true); |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | |
90 | 90 | $core_info = uni_create_planet_get_density($position_data, $user_row, $planet_sectors); |
91 | 91 | |
92 | - $planet_name_unsafe = $user_row['username'] . ' ' . ($planet_name_unsafe ? $planet_name_unsafe : classLocale::$lang['sys_colo_defaultname']); |
|
92 | + $planet_name_unsafe = $user_row['username'].' '.($planet_name_unsafe ? $planet_name_unsafe : classLocale::$lang['sys_colo_defaultname']); |
|
93 | 93 | |
94 | 94 | $planet['name'] = db_escape(strip_tags(trim($planet_name_unsafe))); |
95 | 95 | $planet['id_owner'] = $PlanetOwnerID; |
@@ -170,15 +170,15 @@ discard block |
||
170 | 170 | $moon_name = ''; |
171 | 171 | $moon_row = array(); |
172 | 172 | $moon = db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_MOON, false, 'id'); |
173 | - if(!$moon['id']) { |
|
173 | + if (!$moon['id']) { |
|
174 | 174 | $moon_planet = db_planet_by_gspt($pos_galaxy, $pos_system, $pos_planet, PT_PLANET, true, '`id`, `temp_min`, `temp_max`, `name`, `debris_metal`, `debris_crystal`'); |
175 | 175 | |
176 | - if($moon_planet['id']) { |
|
176 | + if ($moon_planet['id']) { |
|
177 | 177 | $base_storage_size = BASE_STORAGE_SIZE; |
178 | 178 | |
179 | - if(!$moon_chance) { |
|
179 | + if (!$moon_chance) { |
|
180 | 180 | $size = mt_rand(1100, 8999); |
181 | - } elseif($moon_chance <= 100) { |
|
181 | + } elseif ($moon_chance <= 100) { |
|
182 | 182 | $size = mt_rand($moon_chance * 100 + 1000, $moon_chance * 200 + 2999); |
183 | 183 | } else { |
184 | 184 | $size = $moon_chance; |
@@ -194,22 +194,22 @@ discard block |
||
194 | 194 | |
195 | 195 | $field_max = ceil($size / 1000); |
196 | 196 | |
197 | - if(isset($options['image']) && $options['image']) { |
|
197 | + if (isset($options['image']) && $options['image']) { |
|
198 | 198 | $moon_image = $options['image']; |
199 | 199 | } else { |
200 | 200 | $moon_image = 'mond'; |
201 | 201 | } |
202 | 202 | |
203 | 203 | $moon_row = classSupernova::db_ins_record(LOC_PLANET, |
204 | - "`id_owner` = '{$user_id}', `parent_planet` = '{$moon_planet['id']}', `name` = '{$moon_name_safe}', `last_update` = " . SN_TIME_NOW . ", `image` = '{$moon_image}', |
|
205 | - `galaxy` = '{$pos_galaxy}', `system` = '{$pos_system}', `planet` = '{$pos_planet}', `planet_type` = " . PT_MOON . ", |
|
204 | + "`id_owner` = '{$user_id}', `parent_planet` = '{$moon_planet['id']}', `name` = '{$moon_name_safe}', `last_update` = ".SN_TIME_NOW.", `image` = '{$moon_image}', |
|
205 | + `galaxy` = '{$pos_galaxy}', `system` = '{$pos_system}', `planet` = '{$pos_planet}', `planet_type` = ".PT_MOON.", |
|
206 | 206 | `diameter` = '{$size}', `field_max` = '{$field_max}', `density` = 2500, `density_index` = 2, `temp_min` = '{$temp_min}', `temp_max` = '{$temp_max}', |
207 | 207 | `metal` = '0', `metal_perhour` = '0', `metal_max` = '{$base_storage_size}', |
208 | 208 | `crystal` = '0', `crystal_perhour` = '0', `crystal_max` = '{$base_storage_size}', |
209 | 209 | `deuterium` = '0', `deuterium_perhour` = '0', `deuterium_max` = '{$base_storage_size}'" |
210 | 210 | ); |
211 | 211 | |
212 | - if($update_debris) { |
|
212 | + if ($update_debris) { |
|
213 | 213 | $debris_spent = $moon_chance * 1000000; |
214 | 214 | $metal_spent = round(min($moon_planet['debris_metal'], $debris_spent * mt_rand(50, 75) / 100)); |
215 | 215 | $crystal_spent = min($moon_planet['debris_crystal'], $debris_spent - $metal_spent); |
@@ -244,28 +244,28 @@ discard block |
||
244 | 244 | $planet_row['id'] = $user['current_planet']; |
245 | 245 | |
246 | 246 | // Пытаемся переключить на новую планету |
247 | - if(($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) { |
|
247 | + if (($selected_planet = sys_get_param_id('cp')) && $selected_planet != $user['current_planet']) { |
|
248 | 248 | $planet_row = db_planet_by_id_and_owner($selected_planet, $user['id'], false, 'id'); |
249 | 249 | } else { |
250 | 250 | $planet_row = db_planet_by_id($planet_row['id']); |
251 | 251 | } |
252 | 252 | |
253 | 253 | // Если новая планета не найдена или было переключения - проверяем текущую выбранную планету |
254 | - if(!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
254 | + if (!isset($planet_row['id'])) // || $planet_row['id'] != $user['current_planet'] |
|
255 | 255 | { |
256 | 256 | $planet_row = db_planet_by_id_and_owner($user['current_planet'], $user['id'], false, 'id'); |
257 | 257 | // Если текущей планеты не существует - выставляем Столицу |
258 | - if(!isset($planet_row['id'])) { |
|
258 | + if (!isset($planet_row['id'])) { |
|
259 | 259 | $planet_row = db_planet_by_id_and_owner($user['id_planet'], $user['id'], false, 'id'); |
260 | 260 | // Если и столицы не существует - значит что-то очень не так с записью пользователя |
261 | - if(!isset($planet_row['id'])) { |
|
261 | + if (!isset($planet_row['id'])) { |
|
262 | 262 | classSupernova::$debug->error("User ID {$user['id']} has Capital planet {$user['id_planet']} but this planet does not exists", 'User record error', 502); |
263 | 263 | } |
264 | 264 | } |
265 | 265 | } |
266 | 266 | |
267 | 267 | // Если производилось переключение планеты - делаем запись в юзере |
268 | - if($user['current_planet'] != $planet_row['id']) { |
|
268 | + if ($user['current_planet'] != $planet_row['id']) { |
|
269 | 269 | db_user_set_by_id($user['id'], "`current_planet` = '{$planet_row['id']}'"); |
270 | 270 | $user['current_planet'] = $planet_row['id']; |
271 | 271 | } |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | |
283 | 283 | // ---------------------------------------------------------------------------------------------------------------- |
284 | 284 | function uni_render_coordinates($from, $prefix = '') { |
285 | - return "[{$from[$prefix . 'galaxy']}:{$from[$prefix . 'system']}:{$from[$prefix . 'planet']}]"; |
|
285 | + return "[{$from[$prefix.'galaxy']}:{$from[$prefix.'system']}:{$from[$prefix.'planet']}]"; |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | function uni_render_planet($from) { |
@@ -290,17 +290,17 @@ discard block |
||
290 | 290 | } |
291 | 291 | |
292 | 292 | function uni_render_planet_full($from, $prefix = '', $html_safe = true, $include_id = false) { |
293 | - if(!$from['id']) { |
|
293 | + if (!$from['id']) { |
|
294 | 294 | $result = classLocale::$lang['sys_planet_expedition']; |
295 | 295 | } else { |
296 | 296 | $from_planet_id = $include_id ? ( |
297 | - 'ID {' . ($from['id'] ? $from['id'] : ($from[$prefix . 'planet_id'] ? $from[$prefix . 'planet_id'] : 0)) . '} ' |
|
297 | + 'ID {'.($from['id'] ? $from['id'] : ($from[$prefix.'planet_id'] ? $from[$prefix.'planet_id'] : 0)).'} ' |
|
298 | 298 | ) : ''; |
299 | 299 | |
300 | - $from_planet_type = $from['planet_type'] ? $from['planet_type'] : ($from[$prefix . 'type'] ? $from[$prefix . 'type'] : 0); |
|
301 | - $from_planet_type = ($from_planet_type ? ' ' . classLocale::$lang['sys_planet_type_sh'][$from_planet_type] : ''); |
|
300 | + $from_planet_type = $from['planet_type'] ? $from['planet_type'] : ($from[$prefix.'type'] ? $from[$prefix.'type'] : 0); |
|
301 | + $from_planet_type = ($from_planet_type ? ' '.classLocale::$lang['sys_planet_type_sh'][$from_planet_type] : ''); |
|
302 | 302 | |
303 | - $result = $from_planet_id . uni_render_coordinates($from, $prefix) . $from_planet_type . ($from['name'] ? ' ' . $from['name'] : ''); |
|
303 | + $result = $from_planet_id.uni_render_coordinates($from, $prefix).$from_planet_type.($from['name'] ? ' '.$from['name'] : ''); |
|
304 | 304 | $result = $html_safe ? str_replace(' ', ' ', htmlentities($result, ENT_COMPAT, 'UTF-8')) : $result; |
305 | 305 | } |
306 | 306 | |
@@ -308,11 +308,11 @@ discard block |
||
308 | 308 | } |
309 | 309 | |
310 | 310 | function uni_render_coordinates_url($from, $prefix = '', $page = 'galaxy.php') { |
311 | - return $page . (strpos($page, '?') === false ? '?' : '&') . "galaxy={$from[$prefix . 'galaxy']}&system={$from[$prefix . 'system']}&planet={$from[$prefix . 'planet']}"; |
|
311 | + return $page.(strpos($page, '?') === false ? '?' : '&')."galaxy={$from[$prefix.'galaxy']}&system={$from[$prefix.'system']}&planet={$from[$prefix.'planet']}"; |
|
312 | 312 | } |
313 | 313 | |
314 | 314 | function uni_render_coordinates_href($from, $prefix = '', $mode = 0, $fleet_type = '') { |
315 | - return '<a href="' . uni_render_coordinates_url($from, $prefix, "galaxy.php?mode={$mode}") . '"' . ($fleet_type ? " {$fleet_type}" : '') . '>' . uni_render_coordinates($from, $prefix) . '</a>'; |
|
315 | + return '<a href="'.uni_render_coordinates_url($from, $prefix, "galaxy.php?mode={$mode}").'"'.($fleet_type ? " {$fleet_type}" : '').'>'.uni_render_coordinates($from, $prefix).'</a>'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | function uni_get_time_to_jump($moon_row) { |
@@ -340,30 +340,30 @@ discard block |
||
340 | 340 | $coordinates["{$prefix}planet"] = intval($coordinates["{$prefix}planet"]); |
341 | 341 | |
342 | 342 | return |
343 | - isset($coordinates["{$prefix}galaxy"]) && $coordinates["{$prefix}galaxy"] > 0 && $coordinates["{$prefix}galaxy"] <= Vector::$knownGalaxies&& |
|
344 | - isset($coordinates["{$prefix}system"]) && $coordinates["{$prefix}system"] > 0 && $coordinates["{$prefix}system"] <= Vector::$knownSystems&& |
|
343 | + isset($coordinates["{$prefix}galaxy"]) && $coordinates["{$prefix}galaxy"] > 0 && $coordinates["{$prefix}galaxy"] <= Vector::$knownGalaxies && |
|
344 | + isset($coordinates["{$prefix}system"]) && $coordinates["{$prefix}system"] > 0 && $coordinates["{$prefix}system"] <= Vector::$knownSystems && |
|
345 | 345 | isset($coordinates["{$prefix}planet"]) && $coordinates["{$prefix}planet"] > 0 && $coordinates["{$prefix}planet"] <= Vector::$knownPlanets; |
346 | 346 | } |
347 | 347 | |
348 | 348 | function uni_planet_teleport_check($user, $planetrow, $new_coordinates = null) { |
349 | 349 | try { |
350 | - if($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) { |
|
350 | + if ($planetrow['planet_teleport_next'] && $planetrow['planet_teleport_next'] > SN_TIME_NOW) { |
|
351 | 351 | throw new exception(classLocale::$lang['ov_teleport_err_cooldown'], ERR_ERROR); |
352 | 352 | } |
353 | 353 | |
354 | - if(mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->planet_teleport_cost) { |
|
354 | + if (mrc_get_level($user, null, RES_DARK_MATTER) < classSupernova::$config->planet_teleport_cost) { |
|
355 | 355 | throw new exception(classLocale::$lang['ov_teleport_err_no_dark_matter'], ERR_ERROR); |
356 | 356 | } |
357 | 357 | |
358 | 358 | // TODO: Replace quick-check with using gathered flying fleet data |
359 | - if(FleetList::fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) { |
|
359 | + if (FleetList::fleet_count_incoming($planetrow['galaxy'], $planetrow['system'], $planetrow['planet'])) { |
|
360 | 360 | throw new exception(classLocale::$lang['ov_teleport_err_fleet'], ERR_ERROR); |
361 | 361 | } |
362 | 362 | |
363 | - if(is_array($new_coordinates)) { |
|
363 | + if (is_array($new_coordinates)) { |
|
364 | 364 | $new_coordinates['planet_type'] = PT_PLANET; |
365 | 365 | $incoming = db_planet_by_vector($new_coordinates, '', true, 'id'); |
366 | - if($incoming['id']) { |
|
366 | + if ($incoming['id']) { |
|
367 | 367 | throw new exception(classLocale::$lang['ov_teleport_err_destination_busy'], ERR_ERROR); |
368 | 368 | } |
369 | 369 | } |
@@ -372,7 +372,7 @@ discard block |
||
372 | 372 | 'result' => ERR_NONE, |
373 | 373 | 'message' => '', |
374 | 374 | ); |
375 | - } catch(exception $e) { |
|
375 | + } catch (exception $e) { |
|
376 | 376 | $response = array( |
377 | 377 | 'result' => $e->getCode(), |
378 | 378 | 'message' => $e->getMessage(), |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | |
23 | 23 | $list = ''; |
24 | 24 | $query = db_user_list( |
25 | - "ally_id = '{$ally_id}'" . ($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
25 | + "ally_id = '{$ally_id}'".($ally_rank_id >= 0 ? " AND ally_rank_id = {$ally_rank_id}" : ''), |
|
26 | 26 | false, 'id, username'); |
27 | 27 | // while ($u = db_fetch($query)) |
28 | - foreach($query as $u) { |
|
28 | + foreach ($query as $u) { |
|
29 | 29 | $sendList[] = $u['id']; |
30 | 30 | $list .= "<br>{$u['username']} "; |
31 | 31 | } |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | function msg_send_simple_message($owners, $sender, $timestamp, $message_type, $from, $subject, $text, $escaped = false, $force = false) { |
39 | 39 | global $user, $sn_message_class_list; |
40 | 40 | |
41 | - if(!$owners) { |
|
41 | + if (!$owners) { |
|
42 | 42 | return; |
43 | 43 | } |
44 | 44 | |
45 | 45 | $timestamp = $timestamp ? $timestamp : SN_TIME_NOW; |
46 | 46 | $sender = intval($sender); |
47 | - if(!is_array($owners)) { |
|
47 | + if (!is_array($owners)) { |
|
48 | 48 | $owners = array($owners); |
49 | 49 | } |
50 | 50 | |
51 | - if(!$escaped) { |
|
51 | + if (!$escaped) { |
|
52 | 52 | $from = db_escape($from); |
53 | 53 | $subject = db_escape($subject); |
54 | 54 | $text = db_escape($text); |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | |
64 | 64 | $message_class_name_total = $sn_message_class_list[MSG_TYPE_NEW]['name']; |
65 | 65 | |
66 | - if($owners[0] == '*') { |
|
67 | - if($user['authlevel'] < 3) { |
|
66 | + if ($owners[0] == '*') { |
|
67 | + if ($user['authlevel'] < 3) { |
|
68 | 68 | return false; |
69 | 69 | } |
70 | 70 | // TODO Добавить $timestamp - рассылка может быть и отсроченной |
@@ -73,26 +73,26 @@ discard block |
||
73 | 73 | $owners = array(); |
74 | 74 | } else { |
75 | 75 | $insert_values = array(); |
76 | - $insert_template = "('%u'," . str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
76 | + $insert_template = "('%u',".str_replace('%', '%%', " '{$sender}', '{$timestamp}', '{$message_type}', '{$from}', '{$subject}', '{$text}')"); |
|
77 | 77 | |
78 | - foreach($owners as $owner) { |
|
79 | - if($user['id'] != $owner) { |
|
78 | + foreach ($owners as $owner) { |
|
79 | + if ($user['id'] != $owner) { |
|
80 | 80 | $owner_row = db_user_by_id($owner); |
81 | 81 | } else { |
82 | 82 | $owner_row = $user; |
83 | 83 | } |
84 | 84 | sys_user_options_unpack($owner_row); |
85 | 85 | |
86 | - if($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) { |
|
86 | + if ($force || !$message_class_switchable || $owner_row["opt_{$message_class_name}"]) { |
|
87 | 87 | $insert_values[] = sprintf($insert_template, $owner); |
88 | 88 | } |
89 | 89 | |
90 | - if($message_class_email && classSupernova::$config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) { |
|
90 | + if ($message_class_email && classSupernova::$config->game_email_pm && $owner_row["opt_email_{$message_class_name}"]) { |
|
91 | 91 | @$result = mymail($owner_row['email'], $subject, $text_unescaped, '', true); |
92 | 92 | } |
93 | 93 | } |
94 | 94 | |
95 | - if(empty($insert_values)) { |
|
95 | + if (empty($insert_values)) { |
|
96 | 96 | return; |
97 | 97 | } |
98 | 98 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | } |
101 | 101 | db_user_list_set_mass_mail($owners, "`{$message_class_name}` = `{$message_class_name}` + 1, `{$message_class_name_total}` = `{$message_class_name_total}` + 1"); |
102 | 102 | |
103 | - if(in_array($user['id'], $owners) || $owners[0] == '*') { |
|
103 | + if (in_array($user['id'], $owners) || $owners[0] == '*') { |
|
104 | 104 | $user[$message_class_name]++; |
105 | 105 | $user[$message_class_name_total]++; |
106 | 106 | } |
@@ -11,15 +11,15 @@ discard block |
||
11 | 11 | $announce_list = db_news_list_get_by_query($template, $query_where, $query_limit); |
12 | 12 | |
13 | 13 | $users = array(); |
14 | - while($announce = db_fetch($announce_list)) { |
|
15 | - if($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
14 | + while ($announce = db_fetch($announce_list)) { |
|
15 | + if ($announce['user_id'] && !isset($users[$announce['user_id']])) { |
|
16 | 16 | $users[$announce['user_id']] = db_user_by_id($announce['user_id']); |
17 | 17 | } |
18 | 18 | |
19 | 19 | $survey_vote = array('survey_vote_id' => 1); |
20 | 20 | $survey_complete = strtotime($announce['survey_until']) < SN_TIME_NOW; |
21 | 21 | |
22 | - if($announce['survey_id'] && !empty($user['id'])) { |
|
22 | + if ($announce['survey_id'] && !empty($user['id'])) { |
|
23 | 23 | $survey_vote = !$survey_complete ? db_survey_get_vote($announce, $user) : array(); |
24 | 24 | } |
25 | 25 | |
@@ -31,8 +31,7 @@ discard block |
||
31 | 31 | 'ANNOUNCE' => cht_message_parse($announce['strAnnounce'], false, intval($announce['authlevel'])), |
32 | 32 | 'DETAIL_URL' => $announce['detail_url'], |
33 | 33 | 'USER_NAME' => |
34 | - isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : |
|
35 | - js_safe_string($announce['user_name']), |
|
34 | + isset($users[$announce['user_id']]) && $users[$announce['user_id']] ? player_nick_render_to_html($users[$announce['user_id']], array('color' => true)) : js_safe_string($announce['user_name']), |
|
36 | 35 | 'NEW' => $announce['unix_time'] + classSupernova::$config->game_news_actual >= SN_TIME_NOW, |
37 | 36 | 'FUTURE' => $announce['unix_time'] > SN_TIME_NOW, |
38 | 37 | 'SURVEY_ID' => $announce['survey_id'], |
@@ -42,25 +41,25 @@ discard block |
||
42 | 41 | 'SURVEY_UNTIL' => $announce['survey_until'], |
43 | 42 | )); |
44 | 43 | |
45 | - foreach($announce_exploded as $announce_paragraph) { |
|
44 | + foreach ($announce_exploded as $announce_paragraph) { |
|
46 | 45 | $template->assign_block_vars('announces.paragraph', array( |
47 | 46 | 'TEXT' => $announce_paragraph, |
48 | 47 | )); |
49 | 48 | } |
50 | 49 | |
51 | - if($announce['survey_id']) { |
|
50 | + if ($announce['survey_id']) { |
|
52 | 51 | $survey_query = db_survey_get_answer_texts($announce); |
53 | 52 | $survey_vote_result = array(); |
54 | 53 | $total_votes = 0; |
55 | - while($row = db_fetch($survey_query)) { |
|
54 | + while ($row = db_fetch($survey_query)) { |
|
56 | 55 | $survey_vote_result[] = $row; |
57 | 56 | $total_votes += $row['VOTES']; |
58 | 57 | } |
59 | 58 | |
60 | - if(empty($survey_vote) && !$survey_complete) { |
|
59 | + if (empty($survey_vote) && !$survey_complete) { |
|
61 | 60 | // Can vote |
62 | 61 | $survey_query = db_survey_answers_get_list_by_parent($announce); |
63 | - while($row = db_fetch($survey_query)) { |
|
62 | + while ($row = db_fetch($survey_query)) { |
|
64 | 63 | $template->assign_block_vars('announces.survey_answers', array( |
65 | 64 | 'ID' => $row['survey_answer_id'], |
66 | 65 | 'TEXT' => $row['survey_answer_text'], |
@@ -68,7 +67,7 @@ discard block |
||
68 | 67 | } |
69 | 68 | } else { |
70 | 69 | // Show result |
71 | - foreach($survey_vote_result as &$vote_result) { |
|
70 | + foreach ($survey_vote_result as &$vote_result) { |
|
72 | 71 | $vote_percent = $total_votes ? $vote_result['VOTES'] / $total_votes * 100 : 0; |
73 | 72 | $vote_result['PERCENT'] = $vote_percent; |
74 | 73 | $vote_result['PERCENT_TEXT'] = round($vote_percent, 1); |
@@ -85,8 +84,8 @@ discard block |
||
85 | 84 | } |
86 | 85 | |
87 | 86 | function nws_mark_read(&$user) { |
88 | - if(isset($user['id'])) { |
|
89 | - db_user_set_by_id($user['id'], '`news_lastread` = ' . SN_TIME_NOW); |
|
87 | + if (isset($user['id'])) { |
|
88 | + db_user_set_by_id($user['id'], '`news_lastread` = '.SN_TIME_NOW); |
|
90 | 89 | $user['news_lastread'] = SN_TIME_NOW; |
91 | 90 | } |
92 | 91 | |
@@ -94,17 +93,17 @@ discard block |
||
94 | 93 | } |
95 | 94 | |
96 | 95 | function survey_vote(&$user) { |
97 | - if(empty($user['id'])) { |
|
96 | + if (empty($user['id'])) { |
|
98 | 97 | return true; |
99 | 98 | } |
100 | 99 | |
101 | 100 | sn_db_transaction_start(); |
102 | 101 | $survey_id = sys_get_param_id('survey_id'); |
103 | 102 | $is_voted = db_survey_vote_get($user, $survey_id); |
104 | - if(empty($is_voted)) { |
|
103 | + if (empty($is_voted)) { |
|
105 | 104 | $survey_vote_id = sys_get_param_id('survey_vote'); |
106 | 105 | $is_answer_exists = db_survey_answer_get($survey_id, $survey_vote_id); |
107 | - if(!empty($is_answer_exists)) { |
|
106 | + if (!empty($is_answer_exists)) { |
|
108 | 107 | $user_name_safe = db_escape($user['username']); |
109 | 108 | db_survey_vote_insert($user, $survey_id, $survey_vote_id, $user_name_safe); |
110 | 109 | } |
@@ -3,7 +3,7 @@ |
||
3 | 3 | // ---------------------------------------------------------------------------------------------------------------- |
4 | 4 | function lng_try_filepath($path, $file_path_relative) |
5 | 5 | { |
6 | - $file_path = SN_ROOT_PHYSICAL . ($path && file_exists(SN_ROOT_PHYSICAL . $path . $file_path_relative) ? $path : '') . $file_path_relative; |
|
6 | + $file_path = SN_ROOT_PHYSICAL.($path && file_exists(SN_ROOT_PHYSICAL.$path.$file_path_relative) ? $path : '').$file_path_relative; |
|
7 | 7 | return file_exists($file_path) ? $file_path : false; |
8 | 8 | } |
9 | 9 |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | // banner.php?id=<userid>&type=<banner|userbar>&format=<png> |
16 | 16 | $id = intval($id); |
17 | 17 | |
18 | - switch($type) { |
|
18 | + switch ($type) { |
|
19 | 19 | case 'banner': |
20 | 20 | $img_name = classSupernova::$config->int_banner_background; |
21 | 21 | break; |
@@ -24,8 +24,8 @@ discard block |
||
24 | 24 | $img_name = classSupernova::$config->int_userbar_background; |
25 | 25 | break; |
26 | 26 | } |
27 | - $size = getimagesize(SN_ROOT_PHYSICAL . $img_name); |
|
28 | - $im = imagecreatefrompng(SN_ROOT_PHYSICAL . $img_name); |
|
27 | + $size = getimagesize(SN_ROOT_PHYSICAL.$img_name); |
|
28 | + $im = imagecreatefrompng(SN_ROOT_PHYSICAL.$img_name); |
|
29 | 29 | $image = imagecreatetruecolor($size[0], $size[1]); |
30 | 30 | imagecopy($image, $im, 0, 0, 0, 0, $size[0], $size[1]); |
31 | 31 | imagedestroy($im); |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | $txt_color2 = imagecolorallocatealpha($image, 255, 255, 255, 40); |
43 | 43 | |
44 | 44 | $fonts = array( |
45 | - 'userbar' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_userbar_font, |
|
46 | - 'universe' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontUniverse, |
|
47 | - 'raids' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontRaids, |
|
48 | - 'info' => SN_ROOT_PHYSICAL . "design/fonts/" . classSupernova::$config->int_banner_fontInfo, |
|
45 | + 'userbar' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_userbar_font, |
|
46 | + 'universe' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontUniverse, |
|
47 | + 'raids' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontRaids, |
|
48 | + 'info' => SN_ROOT_PHYSICAL."design/fonts/".classSupernova::$config->int_banner_fontInfo, |
|
49 | 49 | ); |
50 | 50 | |
51 | - if($id) { |
|
51 | + if ($id) { |
|
52 | 52 | // Querys |
53 | 53 | $user = db_user_by_id($id); |
54 | 54 | $planet_row = db_planet_by_id($user['id_planet']); |
@@ -57,14 +57,14 @@ discard block |
||
57 | 57 | $b_user = $user['username']; |
58 | 58 | $b_ally = $user['ally_name']; |
59 | 59 | $b_planet = $planet_row['name']; |
60 | - $b_xyz = "[" . $planet_row['galaxy'] . ":" . $planet_row['system'] . ":" . $planet_row['planet'] . "]"; |
|
61 | - $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount) . "/" . classSupernova::$config->users_amount; |
|
60 | + $b_xyz = "[".$planet_row['galaxy'].":".$planet_row['system'].":".$planet_row['planet']."]"; |
|
61 | + $b_lvl = ($user['total_rank'] ? $user['total_rank'] : classSupernova::$config->users_amount)."/".classSupernova::$config->users_amount; |
|
62 | 62 | } else { |
63 | 63 | $b_user = classLocale::$lang['ov_banner_empty_id']; |
64 | 64 | } |
65 | 65 | |
66 | 66 | $b_univ = classSupernova::$config->game_name; |
67 | - switch($type) { |
|
67 | + switch ($type) { |
|
68 | 68 | case 'banner': |
69 | 69 | // Banner size 416 x 58 |
70 | 70 | $fsize = 15; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | imagettftext($image, 11, 0, 8, 26, $txt_shadow, $fonts['info'], $b_user); |
78 | 78 | imagettftext($image, 11, 0, 6, 23, $txt_color, $fonts['info'], $b_user); |
79 | 79 | |
80 | - if($id) { |
|
80 | + if ($id) { |
|
81 | 81 | // Player level - right-alligned |
82 | 82 | $is = imagettfbbox(11, 0, $fonts['info'], $b_lvl); |
83 | 83 | imagettftext($image, 11, 0, $size[0] - 4 - $is[2], 25, $txt_shadow, $fonts['info'], $b_lvl); |
@@ -89,11 +89,11 @@ discard block |
||
89 | 89 | imagettftext($image, 9, 0, 410 - $is[2], 35, $txt_color, $fonts['info'], $b_ally); |
90 | 90 | |
91 | 91 | // Player b_planet |
92 | - imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
93 | - imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet . " " . $b_xyz); |
|
92 | + imagettftext($image, 6, 0, 8, 10, $txt_shadow2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
93 | + imagettftext($image, 6, 0, 6, 9, $txt_color2, $fonts['raids'], $b_planet." ".$b_xyz); |
|
94 | 94 | |
95 | 95 | //StatPoint |
96 | - $b_points = classLocale::$lang['ov_points'] . ": " . pretty_number($user['total_points']); |
|
96 | + $b_points = classLocale::$lang['ov_points'].": ".pretty_number($user['total_points']); |
|
97 | 97 | $is = imagettfbbox(8, 0, $fonts['info'], $b_points); |
98 | 98 | imagettftext($image, 8, 0, 412 - $is[2], 11, $txt_shadow, $fonts['info'], $b_points); |
99 | 99 | imagettftext($image, 8, 0, 410 - $is[2], 9, $txt_color, $fonts['info'], $b_points); |
@@ -101,21 +101,21 @@ discard block |
||
101 | 101 | //Raids Total |
102 | 102 | imagettftext($image, 6, 0, 8, 37, $txt_shadow2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
103 | 103 | imagettftext($image, 6, 0, 6, 35, $txt_color2, $fonts['raids'], classLocale::$lang['NumberOfRaids']); |
104 | - $b_points = ": " . pretty_number($user['raids']); |
|
104 | + $b_points = ": ".pretty_number($user['raids']); |
|
105 | 105 | imagettftext($image, 6, 0, 61, 37, $txt_shadow2, $fonts['raids'], $b_points); |
106 | 106 | imagettftext($image, 6, 0, 59, 35, $txt_color2, $fonts['raids'], $b_points); |
107 | 107 | |
108 | 108 | //Raids Won |
109 | 109 | imagettftext($image, 6, 0, 8, 47, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
110 | 110 | imagettftext($image, 6, 0, 6, 45, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsWin']); |
111 | - $b_points = ": " . pretty_number($user['raidswin']); |
|
111 | + $b_points = ": ".pretty_number($user['raidswin']); |
|
112 | 112 | imagettftext($image, 6, 0, 61, 47, $txt_shadow2, $fonts['raids'], $b_points); |
113 | 113 | imagettftext($image, 6, 0, 59, 45, $txt_color2, $fonts['raids'], $b_points); |
114 | 114 | |
115 | 115 | //Raids Lost |
116 | 116 | imagettftext($image, 6, 0, 8, 57, $txt_shadow2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
117 | 117 | imagettftext($image, 6, 0, 6, 55, $txt_color2, $fonts['raids'], classLocale::$lang['RaidsLoose']); |
118 | - $b_points = ": " . pretty_number($user['raidsloose']); |
|
118 | + $b_points = ": ".pretty_number($user['raidsloose']); |
|
119 | 119 | imagettftext($image, 6, 0, 61, 57, $txt_shadow2, $fonts['raids'], $b_points); |
120 | 120 | imagettftext($image, 6, 0, 59, 55, $txt_color2, $fonts['raids'], $b_points); |
121 | 121 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | imagettftext($image, 9, 0, 4, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_user); |
136 | 136 | imagettftext($image, 9, 0, 2, $size[1] - 6, $txt_color, $fonts['userbar'], $b_user); |
137 | 137 | |
138 | - if($id) { |
|
138 | + if ($id) { |
|
139 | 139 | // Player level - right-alligned |
140 | 140 | $isp = imagettfbbox(9, 0, $fonts['userbar'], $b_lvl); |
141 | 141 | imagettftext($image, 9, 0, $is - $isp[2] - 10, $size[1] - 4, $txt_shadow, $fonts['userbar'], $b_lvl); |
@@ -22,10 +22,10 @@ discard block |
||
22 | 22 | ), |
23 | 23 | ); |
24 | 24 | |
25 | - foreach($queries as &$query) { |
|
26 | - if(!empty($query['query'])) { |
|
25 | + foreach ($queries as &$query) { |
|
26 | + if (!empty($query['query'])) { |
|
27 | 27 | $query['result'] = doquery($query['query']); |
28 | - } elseif(!empty($query['callable']) && is_callable($query['callable'])) { |
|
28 | + } elseif (!empty($query['callable']) && is_callable($query['callable'])) { |
|
29 | 29 | call_user_func($query['callable']); |
30 | 30 | } |
31 | 31 | $query['error'] = classSupernova::$db->db_error(); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $today_array = array($today_array['seconds'], $today_array['minutes'], $today_array['hours'], $today_array['mday'], $today_array['mon'], $today_array['year']); |
70 | 70 | // pdump($prev_run_array); |
71 | 71 | $scheduleList = explode(',', $scheduleList); |
72 | - array_walk($scheduleList, function (&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
72 | + array_walk($scheduleList, function(&$schedule) use ($prev_run_array, $today_array, $date_part_names_reverse, &$possible_schedules) { |
|
73 | 73 | // pdump($schedule); |
74 | 74 | $schedule = array('schedule_array' => array_reverse(explode(':', trim($schedule)))); |
75 | 75 | |
@@ -81,21 +81,21 @@ discard block |
||
81 | 81 | */ |
82 | 82 | // pdump($schedule); |
83 | 83 | |
84 | - foreach($prev_run_array as $index => $date_part) { |
|
84 | + foreach ($prev_run_array as $index => $date_part) { |
|
85 | 85 | $schedule['array']['recorded'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $date_part; |
86 | 86 | $schedule['array']['now'][$index] = isset($schedule['schedule_array'][$index]) ? intval($schedule['schedule_array'][$index]) : $today_array[$index]; |
87 | 87 | } |
88 | - if($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
88 | + if ($schedule['array']['recorded'] == $schedule['array']['now']) { |
|
89 | 89 | unset($schedule['array']['now']); |
90 | 90 | } |
91 | 91 | |
92 | - foreach($schedule['array'] as $name => $array) { |
|
92 | + foreach ($schedule['array'] as $name => $array) { |
|
93 | 93 | $schedule['string'][$name] = "{$array[5]}-{$array[4]}-{$array[3]} {$array[2]}:{$array[1]}:{$array[0]}"; |
94 | - $schedule['string'][$name . '_next'] = $schedule['string'][$name] . ' +1 ' . $interval; |
|
95 | - $schedule['string'][$name . '_prev'] = $schedule['string'][$name] . ' -1 ' . $interval; |
|
94 | + $schedule['string'][$name.'_next'] = $schedule['string'][$name].' +1 '.$interval; |
|
95 | + $schedule['string'][$name.'_prev'] = $schedule['string'][$name].' -1 '.$interval; |
|
96 | 96 | } |
97 | 97 | |
98 | - foreach($schedule['string'] as $string) { |
|
98 | + foreach ($schedule['string'] as $string) { |
|
99 | 99 | $timestamp = strtotime($string); |
100 | 100 | $schedule['timestamp'][$timestamp] = $possible_schedules[$timestamp] = date(FMT_DATE_TIME_SQL, strtotime($string)); |
101 | 101 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | $prev_run = 0; |
129 | 129 | $next_run = 0; |
130 | - foreach($possible_schedules as $timestamp => $string_date) { |
|
130 | + foreach ($possible_schedules as $timestamp => $string_date) { |
|
131 | 131 | $prev_run = SN_TIME_NOW >= $timestamp ? $timestamp : $prev_run; |
132 | 132 | $next_run = SN_TIME_NOW < $timestamp && !$next_run ? $timestamp : $next_run; |
133 | 133 | // pdump($schedule, '$schedule ' . date(FMT_DATE_TIME_SQL, $schedule)); |