supernova-ws /
SuperNova
| 1 | <?php |
||||
| 2 | |||||
| 3 | /** |
||||
| 4 | * galaxy.php |
||||
| 5 | * |
||||
| 6 | * Galaxy view |
||||
| 7 | * |
||||
| 8 | * History version |
||||
| 9 | * 2.1 - 'galaxy' table replaced with 'planets' by Gorlum for http://supernova.ws |
||||
| 10 | * 2.0 - Rewrote by Gorlum for http://supernova.ws |
||||
| 11 | * [+] Template-related parts cutted from PHP and moved to TPL-code |
||||
| 12 | * 1.4 - Security checks & tests by Gorlum for http://supernova.ws |
||||
| 13 | * 1.3 - 2eme Nettoyage Chlorel ... Mise en fonction et debuging complet |
||||
| 14 | * 1.2 - 1er Nettoyage Chlorel ... |
||||
| 15 | * 1.1 - Modified by -MoF- (UGamela germany) |
||||
| 16 | * 1.0 - Created by Perberos |
||||
| 17 | * @copyright 2008 by Chlorel for XNova |
||||
| 18 | */ |
||||
| 19 | |||||
| 20 | include('common.' . substr(strrchr(__FILE__, '.'), 1)); |
||||
| 21 | |||||
| 22 | global $config, $template_result, $planetrow, $debug, $lang; |
||||
| 23 | |||||
| 24 | lng_include('universe'); |
||||
| 25 | lng_include('stat'); |
||||
| 26 | |||||
| 27 | $mode = sys_get_param_str('mode'); |
||||
| 28 | $scan = sys_get_param_str('scan'); |
||||
| 29 | $uni_galaxy = sys_get_param_int('galaxy', $planetrow['galaxy']); |
||||
| 30 | $uni_system = sys_get_param_int('system', $planetrow['system']); |
||||
| 31 | $planet = sys_get_param_int('planet', $planetrow['planet']); |
||||
| 32 | |||||
| 33 | if ($mode == 'name') { |
||||
| 34 | require_once('includes/includes/uni_rename.php'); |
||||
| 35 | } |
||||
| 36 | |||||
| 37 | require_once('includes/includes/flt_functions.php'); |
||||
| 38 | |||||
| 39 | $CurrentPlanetID = sys_get_param_id('current'); |
||||
| 40 | $POST_galaxyLeft = sys_get_param_str('galaxyLeft'); |
||||
| 41 | $POST_galaxyRight = sys_get_param_str('galaxyRight'); |
||||
| 42 | $POST_systemLeft = sys_get_param_str('systemLeft'); |
||||
| 43 | $POST_systemRight = sys_get_param_str('systemRight'); |
||||
| 44 | |||||
| 45 | $fleetmax = GetMaxFleets($user); |
||||
| 46 | $CurrentPlID = $planetrow['id']; |
||||
| 47 | $CurrentMIP = mrc_get_level($user, $planetrow, UNIT_DEF_MISSILE_INTERPLANET, false, true); |
||||
| 48 | $HavePhalanx = mrc_get_level($user, $planetrow, STRUC_MOON_PHALANX); |
||||
| 49 | $CurrentSystem = $planetrow['system']; |
||||
| 50 | $CurrentGalaxy = $planetrow['galaxy']; |
||||
| 51 | |||||
| 52 | //$maxfleet = doquery("SELECT COUNT(*) AS flying_fleet_count FROM {{fleets}} WHERE `fleet_owner` = '{$user['id']}';", '', true); |
||||
| 53 | //$maxfleet_count = $maxfleet['flying_fleet_count']; |
||||
| 54 | $flying_fleet_count = fleet_count_flying($user['id']); |
||||
| 55 | |||||
| 56 | if ($mode == 1) { |
||||
| 57 | } elseif ($mode == 2 || $mode == 3) { |
||||
| 58 | $planet = $planetrow['planet']; |
||||
| 59 | } else { |
||||
| 60 | $uni_galaxy = $planetrow['galaxy']; |
||||
| 61 | $uni_system = $planetrow['system']; |
||||
| 62 | $planet = $planetrow['planet']; |
||||
| 63 | } |
||||
| 64 | |||||
| 65 | $uni_galaxy = $uni_galaxy < 1 ? 1 : ($uni_galaxy > classSupernova::$config->game_maxGalaxy ? classSupernova::$config->game_maxGalaxy : $uni_galaxy); |
||||
| 66 | $uni_system = $uni_system < 1 ? 1 : ($uni_system > classSupernova::$config->game_maxSystem ? classSupernova::$config->game_maxSystem : $uni_system); |
||||
| 67 | $planet = $planet < 1 ? 1 : ($planet > classSupernova::$config->game_maxPlanet + 1 ? classSupernova::$config->game_maxPlanet + 1 : $planet); |
||||
| 68 | |||||
| 69 | $planetcount = 0; |
||||
| 70 | $lunacount = 0; |
||||
| 71 | $CurrentRC = $planetrow['recycler']; |
||||
| 72 | $cached = array('users' => array(), 'allies' => array()); |
||||
| 73 | |||||
| 74 | |||||
| 75 | $template = gettemplate('universe', true); |
||||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||||
| 76 | |||||
| 77 | $CurrentPoints = $user['total_points']; |
||||
| 78 | |||||
| 79 | $MissileRange = flt_get_missile_range($user); |
||||
| 80 | $PhalanxRange = GetPhalanxRange($HavePhalanx); |
||||
| 81 | |||||
| 82 | $planet_precache_query = DBStaticPlanet::db_planet_list_in_system($uni_galaxy, $uni_system); |
||||
| 83 | if (!empty($planet_precache_query)) { |
||||
| 84 | foreach ($planet_precache_query as $planet_row) { |
||||
| 85 | if (CheckAbandonPlanetState($planet_row)) { |
||||
| 86 | continue; |
||||
| 87 | } |
||||
| 88 | $planet_list[$planet_row['planet']][$planet_row['planet_type']] = $planet_row; |
||||
| 89 | } |
||||
| 90 | } |
||||
| 91 | |||||
| 92 | $system_fleet_list = fleet_list_by_planet_coords($uni_galaxy, $uni_system); |
||||
| 93 | foreach ($system_fleet_list as $fleet_row) { |
||||
| 94 | $fleet_planet = $fleet_row['fleet_mess'] == 0 ? $fleet_row['fleet_end_planet'] : $fleet_row['fleet_start_planet']; |
||||
| 95 | $fleet_type = $fleet_row['fleet_mess'] == 0 ? $fleet_row['fleet_end_type'] : $fleet_row['fleet_start_type']; |
||||
| 96 | $fleet_list[$fleet_planet][$fleet_type][] = $fleet_row; |
||||
| 97 | } |
||||
| 98 | |||||
| 99 | $time_now_parsed = getdate(SN_TIME_NOW); |
||||
| 100 | |||||
| 101 | $recycler_info = array(); |
||||
| 102 | $planet_recyclers_orbiting = 0; |
||||
| 103 | $recyclers_fleet = array(); |
||||
| 104 | foreach (sn_get_groups('flt_recyclers') as $recycler_id) { |
||||
| 105 | $recycler_info[$recycler_id] = get_ship_data($recycler_id, $user); |
||||
| 106 | $recyclers_fleet[$recycler_id] = mrc_get_level($user, $planetrow, $recycler_id); |
||||
| 107 | $planet_recyclers_orbiting += $recyclers_fleet[$recycler_id]; |
||||
| 108 | } |
||||
| 109 | |||||
| 110 | $user_skip_list = sys_stat_get_user_skip_list(); |
||||
| 111 | $fleetsTotalIncomeOwn = array(); |
||||
| 112 | $config_game_max_planet = classSupernova::$config->game_maxPlanet + 1; |
||||
| 113 | for ($Planet = 1; $Planet < $config_game_max_planet; $Planet++) { |
||||
| 114 | unset($uni_galaxyRowPlanet); |
||||
| 115 | unset($uni_galaxyRowMoon); |
||||
| 116 | unset($uni_galaxyRowUser); |
||||
| 117 | unset($uni_galaxyRowAlly); |
||||
| 118 | |||||
| 119 | $templatizedMoon = []; |
||||
| 120 | |||||
| 121 | if ( |
||||
| 122 | empty($planet_list[$Planet][PT_PLANET]['id']) |
||||
| 123 | || |
||||
| 124 | !($uni_galaxyRowPlanet = $planet_list[$Planet][PT_PLANET]) |
||||
| 125 | || |
||||
| 126 | (!empty($uni_galaxyRowPlanet['destruyed']) && CheckAbandonPlanetState($uni_galaxyRowPlanet)) |
||||
| 127 | ) { |
||||
| 128 | $template->assign_block_vars('galaxyrow', ['PLANET_NUM' => $Planet,]); |
||||
| 129 | continue; |
||||
| 130 | } |
||||
| 131 | |||||
| 132 | $planet_fleet_id = 0; |
||||
| 133 | if (!isset($cached['users'][$uni_galaxyRowPlanet['id_owner']])) { |
||||
| 134 | $cached['users'][$uni_galaxyRowPlanet['id_owner']] = db_user_by_id($uni_galaxyRowPlanet['id_owner']); |
||||
|
0 ignored issues
–
show
The function
db_user_by_id() has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 135 | } |
||||
| 136 | $uni_galaxyRowUser = $cached['users'][$uni_galaxyRowPlanet['id_owner']]; |
||||
| 137 | |||||
| 138 | // Checking if there is planet owner record |
||||
| 139 | if (empty($uni_galaxyRowUser)) { |
||||
| 140 | // If there is planet owner but planet not destroyed - marking as destroyed |
||||
| 141 | if ($uni_galaxyRowPlanet['id_owner'] && empty($uni_galaxyRowPlanet['destruyed'])) { |
||||
| 142 | $debug->warning("Planet '{$uni_galaxyRowPlanet['name']}' [{$uni_galaxy}:{$uni_system}:{$Planet}] has no owner!", 'Userless planet', 503); |
||||
| 143 | $uni_galaxyRowPlanet['destruyed'] = SN_TIME_NOW + 60 * 60 * 24; |
||||
| 144 | $uni_galaxyRowPlanet['id_owner'] = 0; |
||||
| 145 | DBStaticPlanet::db_planet_set_by_id($uni_galaxyRowPlanet['id'], "id_owner = 0, destruyed = {$uni_galaxyRowPlanet['destruyed']}"); |
||||
| 146 | } |
||||
| 147 | } else { |
||||
| 148 | if ($uni_galaxyRowUser['ally_id'] && !isset($cached['allies'][$uni_galaxyRowUser['ally_id']])) { |
||||
| 149 | /** @noinspection SqlResolve */ |
||||
| 150 | $cached['allies'][$uni_galaxyRowUser['ally_id']] = doquery("SELECT * FROM `{{alliance}}` WHERE `id` = '{$uni_galaxyRowUser['ally_id']}';", '', true); |
||||
| 151 | } |
||||
| 152 | } |
||||
| 153 | |||||
| 154 | $planetcount++; |
||||
| 155 | |||||
| 156 | $fleets_to_planet = flt_get_fleets_to_planet(false, $fleet_list[$Planet][PT_PLANET]); |
||||
| 157 | if (!empty($fleets_to_planet['own']['count'])) { |
||||
| 158 | $planet_fleet_id = getUniqueFleetId($planet_list[$Planet][PT_PLANET]); |
||||
| 159 | $fleetsTotalIncomeOwn[$planet_list[$Planet][PT_PLANET]['id']] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $planet_fleet_id); |
||||
| 160 | } |
||||
| 161 | |||||
| 162 | if ( |
||||
| 163 | !empty($planet_list[$Planet][PT_MOON]) |
||||
| 164 | && |
||||
| 165 | ($uni_galaxyRowMoon = $planet_list[$Planet][PT_MOON]) |
||||
| 166 | && |
||||
| 167 | ( |
||||
| 168 | empty($uni_galaxyRowMoon['destruyed']) |
||||
| 169 | || |
||||
| 170 | !CheckAbandonPlanetState($uni_galaxyRowMoon) |
||||
| 171 | ) |
||||
| 172 | ) { |
||||
| 173 | $fleets_to_planet = flt_get_fleets_to_planet(false, $fleet_list[$Planet][PT_MOON]); |
||||
| 174 | if (!empty($fleets_to_planet['own']['count'])) { |
||||
| 175 | $moon_fleet_id = getUniqueFleetId($uni_galaxyRowMoon); |
||||
| 176 | $fleetsTotalIncomeOwn[$uni_galaxyRowMoon['id']] = tpl_parse_fleet_sn($fleets_to_planet['own']['total'], $moon_fleet_id); |
||||
| 177 | } else { |
||||
| 178 | $moon_fleet_id = 0; |
||||
| 179 | } |
||||
| 180 | $templatizedMoon = [ |
||||
| 181 | 'MOON_NAME_JS' => js_safe_string($uni_galaxyRowMoon['name']), |
||||
| 182 | 'MOON_IMAGE' => $uni_galaxyRowMoon['image'], |
||||
| 183 | 'MOON_DIAMETER' => number_format($uni_galaxyRowMoon['diameter'], 0, '', '.'), |
||||
| 184 | 'MOON_TEMP' => number_format($uni_galaxyRowMoon['temp_min'], 0, '', '.'), |
||||
| 185 | 'MOON_FLEET_ID' => $moon_fleet_id, |
||||
| 186 | ]; |
||||
| 187 | } |
||||
| 188 | |||||
| 189 | $debrisTemplatized = []; |
||||
| 190 | if ($debrisTotal = $uni_galaxyRowPlanet['debris_metal'] + $uni_galaxyRowPlanet['debris_crystal']) { |
||||
| 191 | $recyclers_incoming_capacity = 0; |
||||
| 192 | if ($fleet_list[$Planet][PT_DEBRIS]) { |
||||
| 193 | foreach ($fleet_list[$Planet][PT_DEBRIS] as $fleet_row) { |
||||
| 194 | if ($fleet_row['fleet_owner'] == $user['id']) { |
||||
| 195 | $fleet_data = sys_unit_str2arr($fleet_row['fleet_array']); |
||||
| 196 | foreach ($recycler_info as $recycler_id => $recycler_data) { |
||||
| 197 | $recyclers_incoming_capacity += $fleet_data[$recycler_id] * $recycler_data['capacity']; |
||||
| 198 | } |
||||
| 199 | } |
||||
| 200 | } |
||||
| 201 | } |
||||
| 202 | |||||
| 203 | $debris_reserved = $uni_galaxyRowPlanet['debris_reserved'] = $recyclers_incoming_capacity; |
||||
| 204 | $debris_reserved_percent = min(100, floor($debris_reserved / $debrisTotal * 100)); |
||||
| 205 | |||||
| 206 | $debris_to_gather = max(0, $debrisTotal - $recyclers_incoming_capacity); |
||||
| 207 | |||||
| 208 | $recyclers_fleet_data = flt_calculate_fleet_to_transport($recyclers_fleet, $debris_to_gather, $planetrow, $uni_galaxyRowPlanet); |
||||
| 209 | |||||
| 210 | $debrisTemplatized = [ |
||||
| 211 | 'DEBRIS' => $debrisTotal, |
||||
| 212 | 'DEBRIS_METAL' => $uni_galaxyRowPlanet['debris_metal'], |
||||
| 213 | 'DEBRIS_CRYSTAL' => $uni_galaxyRowPlanet['debris_crystal'], |
||||
| 214 | |||||
| 215 | 'DEBRIS_RESERVED' => $debris_reserved, |
||||
| 216 | 'DEBRIS_RESERVED_PERCENT' => $debris_reserved_percent, |
||||
| 217 | 'DEBRIS_WILL_GATHER' => $debris_will_gather = max(0, min($recyclers_fleet_data['capacity'], $debris_to_gather)), |
||||
| 218 | 'DEBRIS_WILL_GATHER_PERCENT' => $debris_to_gather |
||||
| 219 | ? floor($debris_will_gather / $debris_to_gather * (100 - $debris_reserved_percent)) |
||||
| 220 | : 0, |
||||
| 221 | 'DEBRIS_GATHER_TOTAL' => $debris_gather_total = max(0, $debris_will_gather + $debris_reserved), |
||||
| 222 | 'DEBRIS_GATHER_TOTAL_PERCENT' => min(100, floor($debris_gather_total / $debrisTotal * 100)), |
||||
| 223 | ]; |
||||
| 224 | } |
||||
| 225 | |||||
| 226 | $RowUserPoints = $uni_galaxyRowUser['total_points']; |
||||
| 227 | $birthday_array = $uni_galaxyRowUser['user_birthday'] ? date_parse($uni_galaxyRowUser['user_birthday']) : array(); |
||||
| 228 | $user_activity = floor((SN_TIME_NOW - $uni_galaxyRowUser['onlinetime']) / (60 * 60 * 24)); |
||||
| 229 | |||||
| 230 | $templatizedPlanet = array_merge([ |
||||
| 231 | 'PLANET_ID' => $uni_galaxyRowPlanet['id'], |
||||
| 232 | 'PLANET_NUM' => $Planet, |
||||
| 233 | 'PLANET_NAME' => $uni_galaxyRowPlanet['name'], |
||||
| 234 | 'PLANET_NAME_JS' => js_safe_string($uni_galaxyRowPlanet['name']), |
||||
| 235 | 'PLANET_DESTROYED' => $uni_galaxyRowPlanet["destruyed"], |
||||
| 236 | 'PLANET_TYPE' => $uni_galaxyRowPlanet["planet_type"], |
||||
| 237 | 'PLANET_ACTIVITY' => floor((SN_TIME_NOW - $uni_galaxyRowPlanet['last_update']) / 60), |
||||
| 238 | 'PLANET_IMAGE' => $uni_galaxyRowPlanet['image'], |
||||
| 239 | 'PLANET_FLEET_ID' => $planet_fleet_id, |
||||
| 240 | 'PLANET_DIAMETER' => number_format($uni_galaxyRowPlanet['diameter'], 0, '', '.'), |
||||
| 241 | |||||
| 242 | 'USER_ID' => $uni_galaxyRowUser['id'], |
||||
| 243 | 'USER_NAME' => player_nick_render_to_html($uni_galaxyRowUser), |
||||
| 244 | 'USER_NAME_JS' => js_safe_string(player_nick_render_to_html($uni_galaxyRowUser)), |
||||
| 245 | 'USER_RANK' => in_array($uni_galaxyRowUser['id'], $user_skip_list) ? '-' : $uni_galaxyRowUser['total_rank'], |
||||
| 246 | 'USER_BANNED' => $uni_galaxyRowUser['banaday'], |
||||
| 247 | 'USER_VACATION' => $uni_galaxyRowUser['vacation'], |
||||
| 248 | 'USER_ACTIVITY' => $user_activity, |
||||
| 249 | 'USER_ATTACKABLE' => $user_activity >= 7, |
||||
| 250 | 'USER_INACTIVE' => $user_activity >= 28, |
||||
| 251 | 'USER_PROTECTED' => classSupernova::$gc->general->playerIsNoobByPoints($RowUserPoints), |
||||
| 252 | 'USER_NOOB' => classSupernova::$gc->general->playerIs1stStrongerThen2nd($CurrentPoints, $RowUserPoints), |
||||
| 253 | 'USER_STRONG' => classSupernova::$gc->general->playerIs1stStrongerThen2nd($RowUserPoints, $CurrentPoints), |
||||
| 254 | 'USER_AUTH' => $uni_galaxyRowUser['authlevel'], |
||||
| 255 | 'USER_ADMIN' => $lang['user_level_shortcut'][$uni_galaxyRowUser['authlevel']], |
||||
| 256 | 'USER_BIRTHDAY' => $birthday_array['month'] == $time_now_parsed['mon'] && $birthday_array['day'] == $time_now_parsed['mday'] ? date(FMT_DATE, SN_TIME_NOW) : 0, |
||||
| 257 | |||||
| 258 | 'ALLY_ID' => $uni_galaxyRowUser['ally_id'], |
||||
| 259 | 'ALLY_TAG' => $uni_galaxyRowUser['ally_tag'], |
||||
| 260 | ], $templatizedMoon, $debrisTemplatized); |
||||
| 261 | $template->assign_block_vars('galaxyrow', $templatizedPlanet); |
||||
| 262 | } |
||||
| 263 | |||||
| 264 | tpl_assign_fleet($template, $fleetsTotalIncomeOwn); |
||||
|
0 ignored issues
–
show
The function
tpl_assign_fleet() has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 265 | |||||
| 266 | foreach (sn_get_groups('defense_active') as $unit_id) { |
||||
| 267 | $template->assign_block_vars('defense_active', array( |
||||
| 268 | 'ID' => $unit_id, |
||||
| 269 | 'NAME' => $lang['tech'][$unit_id], |
||||
| 270 | )); |
||||
| 271 | } |
||||
| 272 | |||||
| 273 | foreach ($cached['users'] as $PlanetUser) { |
||||
| 274 | if (!$PlanetUser) { |
||||
| 275 | continue; |
||||
| 276 | } |
||||
| 277 | |||||
| 278 | $user_ally = $cached['allies'][$PlanetUser['ally_id']]; |
||||
| 279 | if (isset($user_ally)) { |
||||
| 280 | if ($PlanetUser['id'] == $user_ally['ally_owner']) { |
||||
| 281 | $user_rank_title = $user_ally['ally_owner_range']; |
||||
| 282 | } else { |
||||
| 283 | $ally_ranks = explode(';', $user_ally['ranklist']); |
||||
| 284 | list($user_rank_title) = explode(',', $ally_ranks[$PlanetUser['ally_rank_id']]); |
||||
| 285 | } |
||||
| 286 | } else { |
||||
| 287 | $user_rank_title = ''; |
||||
| 288 | } |
||||
| 289 | |||||
| 290 | $birthday_array = $PlanetUser['user_birthday'] ? date_parse($PlanetUser['user_birthday']) : array(); |
||||
| 291 | $template->assign_block_vars('users', array( |
||||
| 292 | 'ID' => $PlanetUser['id'], |
||||
| 293 | 'NAME' => player_nick_render_to_html($PlanetUser, true), |
||||
| 294 | 'NAME_JS' => js_safe_string(player_nick_render_to_html($PlanetUser, true)), |
||||
| 295 | 'RANK' => in_array($PlanetUser['id'], $user_skip_list) ? '-' : $PlanetUser['total_rank'], |
||||
| 296 | 'AVATAR' => $PlanetUser['avatar'], |
||||
| 297 | 'ALLY_ID' => $PlanetUser['ally_id'], |
||||
| 298 | 'ALLY_TAG' => js_safe_string($user_ally['ally_tag']), |
||||
| 299 | 'ALLY_TITLE' => str_replace(' ', ' ', js_safe_string($user_rank_title)), |
||||
| 300 | )); |
||||
| 301 | } |
||||
| 302 | |||||
| 303 | foreach ($cached['allies'] as $PlanetAlly) { |
||||
| 304 | if ($PlanetAlly) { |
||||
| 305 | $template->assign_block_vars('alliances', array( |
||||
| 306 | 'ID' => $PlanetAlly['id'], |
||||
| 307 | 'NAME_JS' => js_safe_string($PlanetAlly['ally_name']), |
||||
| 308 | 'MEMBERS' => $PlanetAlly['ally_members'], |
||||
| 309 | 'URL' => $PlanetAlly['ally_web'], |
||||
| 310 | 'RANK' => $PlanetAlly['total_rank'], |
||||
| 311 | 'AVATAR' => $PlanetAlly['ally_image'], |
||||
| 312 | )); |
||||
| 313 | } |
||||
| 314 | } |
||||
| 315 | |||||
| 316 | $is_missile = classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_MISSILE] && ($CurrentMIP > 0) && ($uni_galaxy == $CurrentGalaxy) && ($uni_system >= $CurrentSystem - $MissileRange) && ($uni_system <= $CurrentSystem + $MissileRange); |
||||
| 317 | $colspan = classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_SPYING] + classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_PM] + classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_BUDDY] + $is_missile; |
||||
| 318 | |||||
| 319 | /** @noinspection SqlResolve */ |
||||
| 320 | $ally_count = doquery("SELECT COUNT(*) AS ally_count FROM `{{alliance}}`;", '', true); |
||||
| 321 | /** @noinspection SqlResolve */ |
||||
| 322 | $galaxy_name = doquery("select `universe_name` from `{{universe}}` where `universe_galaxy` = {$uni_galaxy} and `universe_system` = 0 limit 1;", true); |
||||
| 323 | /** @noinspection SqlResolve */ |
||||
| 324 | $system_name = doquery("select `universe_name` from `{{universe}}` where `universe_galaxy` = {$uni_galaxy} and `universe_system` = {$uni_system} limit 1;", true); |
||||
| 325 | |||||
| 326 | $template->assign_vars(array( |
||||
| 327 | // 'rows' => $Result, |
||||
| 328 | 'userCount' => classSupernova::$config->users_amount, |
||||
| 329 | 'ALLY_COUNT' => $ally_count['ally_count'], |
||||
| 330 | 'PLANET_EXPEDITION' => classSupernova::$config->game_maxPlanet + 1, |
||||
| 331 | 'curPlanetID' => $planetrow['id'], |
||||
| 332 | 'curPlanetG' => $planetrow['galaxy'], |
||||
| 333 | 'curPlanetS' => $planetrow['system'], |
||||
| 334 | 'curPlanetP' => $planetrow['planet'], |
||||
| 335 | 'curPlanetPT' => $planetrow['planet_type'], |
||||
| 336 | 'deathStars' => mrc_get_level($user, $planetrow, SHIP_HUGE_DEATH_STAR, false, true), |
||||
| 337 | 'galaxy' => $uni_galaxy, |
||||
| 338 | 'system' => $uni_system, |
||||
| 339 | 'planet' => $planet, |
||||
| 340 | 'MIPs' => round($CurrentMIP), |
||||
|
0 ignored issues
–
show
It seems like
$CurrentMIP can also be of type boolean; however, parameter $val of round() does only seem to accept double, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 341 | 'MODE' => $mode, |
||||
| 342 | 'planets' => $planetcount, |
||||
| 343 | 'SPs' => HelperString::numberFloorAndFormat(mrc_get_level($user, $planetrow, SHIP_SPY, false, true)), |
||||
|
0 ignored issues
–
show
It seems like
mrc_get_level($user, $pl... SHIP_SPY, false, true) can also be of type boolean; however, parameter $number of HelperString::numberFloorAndFormat() does only seem to accept integer|double, maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
| 344 | 'SHOW_ADMIN' => SHOW_ADMIN, |
||||
| 345 | 'fleet_count' => $flying_fleet_count, |
||||
| 346 | 'fleet_max' => $fleetmax, |
||||
| 347 | 'ALLY_ID' => $user['ally_id'], |
||||
| 348 | 'USER_ID' => $user['id'], |
||||
| 349 | 'ACT_SPIO' => classSupernova::$user_options[PLAYER_OPTION_FLEET_SPY_DEFAULT], |
||||
| 350 | 'ACT_SPY' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_SPYING], |
||||
| 351 | 'ACT_WRITE' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_PM], |
||||
| 352 | 'ACT_STATISTICS' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_STATS], |
||||
| 353 | 'ACT_INFO' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_PROFILE], |
||||
| 354 | 'ACT_FRIEND' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_ICON_BUDDY], |
||||
| 355 | 'opt_uni_tooltip_time' => classSupernova::$user_options[PLAYER_OPTION_TOOLTIP_DELAY], |
||||
| 356 | 'opt_uni_avatar_user' => $user['opt_uni_avatar_user'], |
||||
| 357 | 'opt_uni_avatar_ally' => $user['opt_uni_avatar_ally'], |
||||
| 358 | 'ACT_MISSILE' => $is_missile, |
||||
| 359 | 'PLANET_PHALANX' => $HavePhalanx && $uni_galaxy == $CurrentGalaxy && $uni_system >= $CurrentSystem - $PhalanxRange && $uni_system <= $CurrentSystem + $PhalanxRange, |
||||
| 360 | 'PAGE_HINT' => $lang['gal_sys_hint'], |
||||
| 361 | 'PLANET_RECYCLERS' => $planet_recyclers_orbiting, |
||||
| 362 | 'PLANET_RECYCLERS_TEXT' => HelperString::numberFloorAndFormat($planet_recyclers_orbiting), |
||||
| 363 | 'GALAXY_NAME' => $galaxy_name['universe_name'], |
||||
| 364 | 'SYSTEM_NAME' => $system_name['universe_name'], |
||||
| 365 | 'COL_SPAN' => $colspan + 9, |
||||
| 366 | 'COL_SPAN_PLUS' => $colspan + 3, |
||||
| 367 | |||||
| 368 | 'COL_SPAN_NEW' => $colspan + 4, |
||||
| 369 | 'COL_SPAN_NEW_COLONIZE' => $colspan - 2, |
||||
| 370 | |||||
| 371 | 'PLAYER_OPTION_UNIVERSE_OLD' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_OLD], |
||||
| 372 | 'PLAYER_OPTION_UNIVERSE_DISABLE_COLONIZE' => classSupernova::$user_options[PLAYER_OPTION_UNIVERSE_DISABLE_COLONIZE], |
||||
| 373 | ) |
||||
| 374 | ); |
||||
| 375 | |||||
| 376 | if ($scan) { |
||||
| 377 | $template_result = array_merge($template_result, array( |
||||
| 378 | 'GLOBAL_DISPLAY_MENU' => false, |
||||
| 379 | 'GLOBAL_DISPLAY_NAVBAR' => false, |
||||
| 380 | 'UNIVERSE_SCAN_MODE' => true, |
||||
| 381 | )); |
||||
| 382 | |||||
| 383 | $template->assign_vars(array( |
||||
| 384 | 'UNIVERSE_SCAN_MODE' => true, |
||||
| 385 | )); |
||||
| 386 | } |
||||
| 387 | |||||
| 388 | display($template, $lang['sys_universe']); |
||||
| 389 |