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