@@ -23,7 +23,7 @@ |
||
| 23 | 23 | * @version 41a6.16 |
| 24 | 24 | */ |
| 25 | 25 | protected function db_load_player_by_id($player_id) { |
| 26 | - if(isset($this[$player_id])) { |
|
| 26 | + if (isset($this[$player_id])) { |
|
| 27 | 27 | return; |
| 28 | 28 | } |
| 29 | 29 | |
@@ -154,15 +154,15 @@ discard block |
||
| 154 | 154 | * @param string $group_name |
| 155 | 155 | */ |
| 156 | 156 | public static function _init($group_name = '') { |
| 157 | - if(static::$_is_static_init) { |
|
| 157 | + if (static::$_is_static_init) { |
|
| 158 | 158 | return; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - if($group_name) { |
|
| 161 | + if ($group_name) { |
|
| 162 | 162 | static::$_sn_group_name = $group_name; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if(static::$_sn_group_name) { |
|
| 165 | + if (static::$_sn_group_name) { |
|
| 166 | 166 | static::$_group_unit_id_list = sn_get_groups(static::$_sn_group_name); |
| 167 | 167 | empty(static::$_group_unit_id_list) ? static::$_group_unit_id_list = array() : false; |
| 168 | 168 | } |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | // TODO - Reset combat stats?? |
| 188 | 188 | $this->_unitId = $unitId; |
| 189 | 189 | |
| 190 | - if($this->_unitId) { |
|
| 190 | + if ($this->_unitId) { |
|
| 191 | 191 | $this->info = get_unit_param($this->_unitId); |
| 192 | 192 | $this->_type = $this->info[P_UNIT_TYPE]; |
| 193 | 193 | } else { |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | |
| 199 | 199 | protected function setCount($value) { |
| 200 | 200 | // TODO - Reset combat stats?? |
| 201 | - if($value < 0) { |
|
| 201 | + if ($value < 0) { |
|
| 202 | 202 | classSupernova::$debug->error('Can not set Unit::$count to negative value'); |
| 203 | 203 | } |
| 204 | 204 | $this->_count = $value; |
@@ -17,14 +17,14 @@ |
||
| 17 | 17 | function flt_mission_attack($objMission) { |
| 18 | 18 | $objFleet = $objMission->fleet; |
| 19 | 19 | |
| 20 | - if($objFleet->shipsGetTotal() <= 0) { |
|
| 20 | + if ($objFleet->shipsGetTotal() <= 0) { |
|
| 21 | 21 | return null; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $destination_user = $objMission->dst_user; |
| 25 | 25 | $destination_planet = $objMission->dst_planet; |
| 26 | 26 | |
| 27 | - if( |
|
| 27 | + if ( |
|
| 28 | 28 | // Нет данных о планете назначения или её владельце |
| 29 | 29 | empty($destination_user) || empty($destination_planet) || !is_array($destination_user) || !is_array($destination_planet) |
| 30 | 30 | || |
@@ -21,12 +21,12 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | function sn_admin_planet_edit_template(&$template, $edit_planet_row, $mode) { |
| 23 | 23 | $unit_list = sn_get_groups($mode); |
| 24 | - if(empty($unit_list)) { |
|
| 24 | + if (empty($unit_list)) { |
|
| 25 | 25 | return; |
| 26 | 26 | } |
| 27 | 27 | $name_list = classLocale::$lang['tech']; |
| 28 | 28 | |
| 29 | - foreach($unit_list as $unit_id) { |
|
| 29 | + foreach ($unit_list as $unit_id) { |
|
| 30 | 30 | $template->assign_block_vars('unit', array( |
| 31 | 31 | 'ID' => $unit_id, |
| 32 | 32 | 'NAME' => $name_list[$unit_id], |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | function admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { return sn_function_call(__FUNCTION__, array($unit_id, $unit_amount, $mode)); } |
| 40 | 40 | |
| 41 | 41 | function sn_admin_planet_edit_query_string($unit_id, $unit_amount, $mode) { |
| 42 | - if($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
| 42 | + if ($unit_amount && in_array($unit_id, sn_get_groups($mode))) { |
|
| 43 | 43 | $unit_amount = round($unit_amount); |
| 44 | 44 | $unit_name = get_unit_param($unit_id, P_NAME); |
| 45 | 45 | $result = "{$unit_name} = GREATEST(0, {$unit_name} + ({$unit_amount}))"; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | $query = db_user_list("`authlevel` > 0 ORDER BY `authlevel` ASC"); |
| 17 | 17 | |
| 18 | 18 | // while($row = db_fetch($query)) |
| 19 | - foreach($query as $row) { |
|
| 19 | + foreach ($query as $row) { |
|
| 20 | 20 | $template_result['.']['contact'][] = array( |
| 21 | 21 | 'NAME' => $row['username'], |
| 22 | 22 | 'LEVEL' => classLocale::$lang['user_level'][$row['authlevel']], |
@@ -228,8 +228,8 @@ discard block |
||
| 228 | 228 | * @return int|mixed |
| 229 | 229 | */ |
| 230 | 230 | public function calcColonyMaxCount($astrotech = -1) { |
| 231 | - if($astrotech == -1) { |
|
| 232 | - if(!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
| 231 | + if ($astrotech == -1) { |
|
| 232 | + if (!isset($this->_dbRow[UNIT_PLAYER_COLONIES_MAX])) { |
|
| 233 | 233 | |
| 234 | 234 | $expeditions = get_player_max_expeditons($this->_dbRow); |
| 235 | 235 | $astrotech = mrc_get_level($this->_dbRow, null, TECH_ASTROTECH); |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | |
| 303 | 303 | |
| 304 | 304 | public function expeditionsMax() { |
| 305 | - if($this->expeditionsMax === null) { |
|
| 305 | + if ($this->expeditionsMax === null) { |
|
| 306 | 306 | $this->expeditionsMax = get_player_max_expeditons($this->_dbRow); |
| 307 | 307 | } |
| 308 | 308 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | public function expeditionsFlying() { |
| 313 | - if($this->expeditionsFlying === null) { |
|
| 313 | + if ($this->expeditionsFlying === null) { |
|
| 314 | 314 | $this->expeditionsFlying = FleetList::fleet_count_flying($this->_dbId, MT_EXPLORE); |
| 315 | 315 | } |
| 316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | |
| 320 | 320 | |
| 321 | 321 | public function fleetsMax() { |
| 322 | - if($this->fleetMax === null) { |
|
| 322 | + if ($this->fleetMax === null) { |
|
| 323 | 323 | $this->fleetMax = GetMaxFleets($this->_dbRow); |
| 324 | 324 | } |
| 325 | 325 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | public function fleetsFlying() { |
| 330 | - if($this->fleetFlying === null) { |
|
| 330 | + if ($this->fleetFlying === null) { |
|
| 331 | 331 | $this->fleetFlying = FleetList::fleet_count_flying($this->_dbId); |
| 332 | 332 | } |
| 333 | 333 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | |
| 337 | 337 | |
| 338 | 338 | public function coloniesMax() { |
| 339 | - if($this->coloniesMax === null) { |
|
| 339 | + if ($this->coloniesMax === null) { |
|
| 340 | 340 | $this->coloniesMax = get_player_max_colonies($this->_dbRow); |
| 341 | 341 | } |
| 342 | 342 | |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | public function coloniesCurrent() { |
| 347 | - if($this->coloniesCurrent === null) { |
|
| 347 | + if ($this->coloniesCurrent === null) { |
|
| 348 | 348 | $this->coloniesCurrent = get_player_current_colonies($this->_dbRow); |
| 349 | 349 | } |
| 350 | 350 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | * |
| 13 | 13 | **/ |
| 14 | 14 | |
| 15 | -if(SN_IN_FLEET !== true) { |
|
| 15 | +if (SN_IN_FLEET !== true) { |
|
| 16 | 16 | $debug->error("Attempt to call FLEET page mode {$mode} directly - not from fleet.php", 'Forbidden', 403); |
| 17 | 17 | } |
| 18 | 18 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $planet_list = array(); |
| 27 | 27 | |
| 28 | - if(is_array($resources_taken)) |
|
| 28 | + if (is_array($resources_taken)) |
|
| 29 | 29 | { |
| 30 | 30 | $query = implode(',', array_keys($resources_taken)); |
| 31 | 31 | $query = " AND `destruyed` = 0 AND `id` IN ({$query})"; |
@@ -33,16 +33,16 @@ discard block |
||
| 33 | 33 | $query = ''; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - foreach(sn_get_groups('flt_transports') as $transport_id) { |
|
| 36 | + foreach (sn_get_groups('flt_transports') as $transport_id) { |
|
| 37 | 37 | $transports[$transport_id] = get_unit_param($transport_id, P_CAPACITY); |
| 38 | 38 | } |
| 39 | 39 | arsort($transports); |
| 40 | 40 | |
| 41 | 41 | $planets_db_list = db_planet_list_sorted($user, $planetrow['id'], '*', $query); |
| 42 | 42 | !is_array($planets_db_list) ? $planets_db_list = array() : false; |
| 43 | - foreach($planets_db_list as $planet_db_data) { |
|
| 43 | + foreach ($planets_db_list as $planet_db_data) { |
|
| 44 | 44 | // begin planet loop |
| 45 | - if(!$query) { |
|
| 45 | + if (!$query) { |
|
| 46 | 46 | $resources_taken[$planet_db_data['id']] = 1; |
| 47 | 47 | } |
| 48 | 48 | sn_db_transaction_start(); |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | $planet_id = $planet_db_data['id']; |
| 55 | 55 | |
| 56 | 56 | $planet_resources = 0; |
| 57 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
| 58 | - if($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
| 57 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
| 58 | + if ($resources_taken[$planet_id] == 1 || $resources_taken[$planet_id][$resource_id]) { |
|
| 59 | 59 | $planet_resources += floor(mrc_get_level($user, $planet_db_data, $resource_id, true, true)); // $planet_db_data[get_unit_param($resource_id, P_NAME)]); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | $fleet_capacity = 0; |
| 87 | 87 | $ship_loadout = array(); |
| 88 | 88 | $fleet = array(); |
| 89 | - foreach($transports as $ship_id => $ship_capacity) { |
|
| 90 | - if($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
| 89 | + foreach ($transports as $ship_id => $ship_capacity) { |
|
| 90 | + if ($ship_count = mrc_get_level($user, $planet_db_data, $ship_id, true, true)) { |
|
| 91 | 91 | $ship_loadout[$ship_id]['capacity'] = $ship_count * $ship_capacity; |
| 92 | 92 | $ship_loadout[$ship_id]['taken'] = 0; |
| 93 | 93 | $fleet_capacity += $ship_loadout[$ship_id]['capacity']; |
@@ -98,9 +98,9 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | $will_take = min($planet_resources, $fleet_capacity); |
| 100 | 100 | |
| 101 | - foreach($ship_loadout as $ship_id => &$planet_ship) { |
|
| 101 | + foreach ($ship_loadout as $ship_id => &$planet_ship) { |
|
| 102 | 102 | $can_take = min($will_take, $planet_ship['capacity']); |
| 103 | - if($can_take <= 0) { |
|
| 103 | + if ($can_take <= 0) { |
|
| 104 | 104 | continue; |
| 105 | 105 | } |
| 106 | 106 | $planet_ship['capacity'] -= $can_take; |
@@ -108,23 +108,23 @@ discard block |
||
| 108 | 108 | $fleet[$ship_id] = ceil($planet_ship['taken'] / $transports[$ship_id]); |
| 109 | 109 | |
| 110 | 110 | $will_take -= $can_take; |
| 111 | - if($will_take <= 0) { |
|
| 111 | + if ($will_take <= 0) { |
|
| 112 | 112 | break; |
| 113 | 113 | } |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - if(!empty($fleet)) { |
|
| 116 | + if (!empty($fleet)) { |
|
| 117 | 117 | $travel_data = flt_travel_data($user, $planetrow, $planet_db_data, $fleet, 10); |
| 118 | 118 | $planet_data['FLEET_SPEED'] = $travel_data['fleet_speed']; |
| 119 | 119 | $planet_data['DISTANCE'] = $travel_data['distance']; |
| 120 | 120 | $planet_data['DURATION'] = $travel_data['duration']; |
| 121 | 121 | $planet_data['CONSUMPTION'] = $travel_data['consumption']; |
| 122 | 122 | |
| 123 | - if(floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
| 123 | + if (floor(mrc_get_level($user, $planet_db_data, RES_DEUTERIUM, true)) >= $planet_data['CONSUMPTION']) { |
|
| 124 | 124 | $will_take = min($planet_resources, $fleet_capacity) - $planet_data['CONSUMPTION']; |
| 125 | 125 | |
| 126 | - foreach(sn_get_groups('resources_loot') as $resource_id) { |
|
| 127 | - if($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
| 126 | + foreach (sn_get_groups('resources_loot') as $resource_id) { |
|
| 127 | + if ($resources_taken[$planet_id] != 1 && !$resources_taken[$planet_id][$resource_id]) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | $fleet[$resource_id] = min($will_take, $resource_amount); |
| 134 | 134 | $will_take -= $resource_amount; |
| 135 | 135 | |
| 136 | - if($will_take <= 0) { |
|
| 136 | + if ($will_take <= 0) { |
|
| 137 | 137 | break; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -157,19 +157,19 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $resources_taken = sys_get_param('resources'); |
| 159 | 159 | |
| 160 | -if(!empty($resources_taken)) { // begin processing parameters |
|
| 160 | +if (!empty($resources_taken)) { // begin processing parameters |
|
| 161 | 161 | $planet_list = flt_build_gathering($resources_taken); |
| 162 | 162 | |
| 163 | - foreach($planet_list as $planet_id => $planet_data) { |
|
| 164 | - if($planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
| 163 | + foreach ($planet_list as $planet_id => $planet_data) { |
|
| 164 | + if ($planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
| 165 | 165 | $planet_data['RESULT'] = flt_t_send_fleet($user, $planet_data['PLANET_DB_DATA'], $planetrow, $planet_data['FLEET'], MT_TRANSPORT); |
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | $planet_data['MESSAGE'] = classLocale::$lang['fl_attack_error'][$planet_data['RESULT']]; |
| 169 | 169 | |
| 170 | 170 | $template->assign_block_vars('results', $planet_data); |
| 171 | - if(!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
| 172 | - foreach($planet_data['FLEET'] as $unit_id => $amount) { |
|
| 171 | + if (!empty($planet_data['FLEET']) && $planet_data['RESULT'] == FLIGHT_ALLOWED) { |
|
| 172 | + foreach ($planet_data['FLEET'] as $unit_id => $amount) { |
|
| 173 | 173 | $template->assign_block_vars('results.units', array( |
| 174 | 174 | 'ID' => $unit_id, |
| 175 | 175 | 'NAME' => classLocale::$lang['tech'][$unit_id], |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | // Building list of own planets & moons |
| 184 | 184 | $planet_list = flt_build_gathering(); |
| 185 | -foreach($planet_list as $planet_data) { |
|
| 185 | +foreach ($planet_list as $planet_data) { |
|
| 186 | 186 | $planet_data['DURATION'] = $planet_data['DURATION'] ? pretty_time($planet_data['DURATION']) : classLocale::$lang['flt_no_fuel']; |
| 187 | 187 | $template->assign_block_vars('colonies', $planet_data); |
| 188 | 188 | } |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | $fleet_events = array(); |
| 7 | 7 | $fleet_number = 0; |
| 8 | 8 | |
| 9 | - if($objFleetList->count() <= 0) { |
|
| 9 | + if ($objFleetList->count() <= 0) { |
|
| 10 | 10 | return; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - foreach($objFleetList->_container as $objFleet) { |
|
| 13 | + foreach ($objFleetList->_container as $objFleet) { |
|
| 14 | 14 | $planet_start_type = $objFleet->fleet_start_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 15 | 15 | $planet_start = db_planet_by_gspt($objFleet->fleet_start_galaxy, $objFleet->fleet_start_system, $objFleet->fleet_start_planet, $planet_start_type, false, 'name'); |
| 16 | 16 | $objFleet->fleet_start_name = $planet_start['name']; |
| 17 | 17 | |
| 18 | 18 | $planet_end_type = $objFleet->fleet_end_type == PT_MOON ? PT_MOON : PT_PLANET; |
| 19 | - if($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
| 19 | + if ($objFleet->fleet_end_planet > Vector::$knownPlanets) { |
|
| 20 | 20 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_exploration']; |
| 21 | - } elseif($objFleet->mission_type == MT_COLONIZE) { |
|
| 21 | + } elseif ($objFleet->mission_type == MT_COLONIZE) { |
|
| 22 | 22 | $objFleet->fleet_end_name = classLocale::$lang['ov_fleet_colonization']; |
| 23 | 23 | } else { |
| 24 | 24 | $planet_end = db_planet_by_gspt($objFleet->fleet_end_galaxy, $objFleet->fleet_end_system, $objFleet->fleet_end_planet, $planet_end_type, false, 'name'); |
| 25 | 25 | $objFleet->fleet_end_name = $planet_end['name']; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - if($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 28 | + if ($objFleet->time_arrive_to_target > SN_TIME_NOW && !$objFleet->isReturning() && $objFleet->mission_type != MT_MISSILE && |
|
| 29 | 29 | ($planet_scanned === false |
| 30 | 30 | || |
| 31 | 31 | ( |
@@ -39,11 +39,11 @@ discard block |
||
| 39 | 39 | $fleet_events[] = flt_register_event_objFleet($objFleet, 0, $planet_end_type); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - if($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 42 | + if ($objFleet->time_mission_job_complete > SN_TIME_NOW && !$objFleet->isReturning() && $planet_scanned === false && $objFleet->mission_type != MT_MISSILE) { |
|
| 43 | 43 | $fleet_events[] = flt_register_event_objFleet($objFleet, 1, $planet_end_type); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - if( |
|
| 46 | + if ( |
|
| 47 | 47 | $objFleet->time_return_to_source > SN_TIME_NOW && $objFleet->mission_type != MT_MISSILE && ($objFleet->isReturning() || ($objFleet->mission_type != MT_RELOCATE && $objFleet->mission_type != MT_COLONIZE)) && |
| 48 | 48 | ( |
| 49 | 49 | ($planet_scanned === false && $objFleet->playerOwnerId == $user['id']) |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $fleet_events[] = flt_register_event_objFleet($objFleet, 2, $planet_end_type); |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - if($objFleet->mission_type == MT_MISSILE) { |
|
| 62 | + if ($objFleet->mission_type == MT_MISSILE) { |
|
| 63 | 63 | $fleet_events[] = flt_register_event_objFleet($objFleet, 3, $planet_end_type); |
| 64 | 64 | } |
| 65 | 65 | } |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | $is_this_planet = false; |
| 81 | 81 | |
| 82 | - switch($objFleet->ov_label = $ov_label) { |
|
| 82 | + switch ($objFleet->ov_label = $ov_label) { |
|
| 83 | 83 | case 0: |
| 84 | 84 | $objFleet->event_time = $objFleet->time_arrive_to_target; |
| 85 | 85 | $is_this_planet = ( |
@@ -110,9 +110,9 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - $objFleet->ov_this_planet = $is_this_planet;// || $planet_scanned != false; |
|
| 113 | + $objFleet->ov_this_planet = $is_this_planet; // || $planet_scanned != false; |
|
| 114 | 114 | |
| 115 | - if($objFleet->playerOwnerId == $user['id']) { |
|
| 115 | + if ($objFleet->playerOwnerId == $user['id']) { |
|
| 116 | 116 | $user_data = $user; |
| 117 | 117 | } else { |
| 118 | 118 | $user_data = db_user_by_id($objFleet->playerOwnerId); |
@@ -1,42 +1,42 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once('includes/init.' . substr(strrchr(__FILE__, '.'), 1)); |
|
| 3 | +require_once('includes/init.'.substr(strrchr(__FILE__, '.'), 1)); |
|
| 4 | 4 | |
| 5 | 5 | $mode = sys_get_param_int('mode'); |
| 6 | 6 | $ajax = sys_get_param_int('ajax'); |
| 7 | 7 | |
| 8 | -$url = 'http://supernova.ws/version_check.php?mode=' . $mode |
|
| 9 | - . '&db=' . DB_VERSION |
|
| 10 | - . '&release=' . SN_RELEASE |
|
| 11 | - . '&version=' . SN_VERSION |
|
| 12 | - . '&key=' . urlencode(classSupernova::$config->server_updater_key) |
|
| 13 | - . '&id=' . urlencode(classSupernova::$config->server_updater_id); |
|
| 8 | +$url = 'http://supernova.ws/version_check.php?mode='.$mode |
|
| 9 | + . '&db='.DB_VERSION |
|
| 10 | + . '&release='.SN_RELEASE |
|
| 11 | + . '&version='.SN_VERSION |
|
| 12 | + . '&key='.urlencode(classSupernova::$config->server_updater_key) |
|
| 13 | + . '&id='.urlencode(classSupernova::$config->server_updater_id); |
|
| 14 | 14 | |
| 15 | -switch($mode) { |
|
| 15 | +switch ($mode) { |
|
| 16 | 16 | case SNC_MODE_REGISTER: |
| 17 | - if(classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
| 18 | - if($ajax) { |
|
| 17 | + if (classSupernova::$config->server_updater_key || classSupernova::$config->server_updater_id) { |
|
| 18 | + if ($ajax) { |
|
| 19 | 19 | print(SNC_VER_REGISTER_ERROR_REGISTERED); |
| 20 | 20 | } |
| 21 | 21 | die(); |
| 22 | 22 | } |
| 23 | - $url .= "&name=" . urlencode(classSupernova::$config->game_name) . "&url=" . urlencode(SN_ROOT_VIRTUAL); |
|
| 23 | + $url .= "&name=".urlencode(classSupernova::$config->game_name)."&url=".urlencode(SN_ROOT_VIRTUAL); |
|
| 24 | 24 | break; |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | $check_result = sn_get_url_contents($url); |
| 28 | -if(!$check_result) { |
|
| 28 | +if (!$check_result) { |
|
| 29 | 29 | $version_check = SNC_VER_ERROR_CONNECT; |
| 30 | -} elseif(($version_check = intval($check_result)) && $version_check == $check_result) { |
|
| 30 | +} elseif (($version_check = intval($check_result)) && $version_check == $check_result) { |
|
| 31 | 31 | $version_check = $check_result; |
| 32 | 32 | } else { |
| 33 | 33 | // JSON decode if string |
| 34 | 34 | $check_result = json_decode($check_result, true); |
| 35 | 35 | $version_check = $check_result === null ? SNC_VER_UNKNOWN_RESPONSE : $check_result['version_check']; |
| 36 | 36 | |
| 37 | - switch($mode) { |
|
| 37 | + switch ($mode) { |
|
| 38 | 38 | case SNC_MODE_REGISTER: |
| 39 | - if($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
| 39 | + if ($check_result['site']['site_key'] && $check_result['site']['site_id'] && $check_result['site']['result'] == SNC_VER_REGISTER_REGISTERED) { |
|
| 40 | 40 | classSupernova::$config->db_saveItem('server_updater_key', $check_result['site']['site_key']); |
| 41 | 41 | classSupernova::$config->db_saveItem('server_updater_id', $check_result['site']['site_id']); |
| 42 | 42 | } |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | classSupernova::$config->db_saveItem('server_updater_check_last', SN_TIME_NOW); |
| 50 | 50 | classSupernova::$config->db_saveItem('server_updater_check_result', $version_check); |
| 51 | 51 | |
| 52 | -if($ajax) { |
|
| 52 | +if ($ajax) { |
|
| 53 | 53 | define('IN_AJAX', true); |
| 54 | 54 | print($version_check); |
| 55 | 55 | } |