@@ -69,24 +69,24 @@ |
||
| 69 | 69 | $values[] = $data->total; |
| 70 | 70 | |
| 71 | 71 | |
| 72 | - // Lured stops |
|
| 73 | - // ----------- |
|
| 72 | + // Lured stops |
|
| 73 | + // ----------- |
|
| 74 | 74 | |
| 75 | - $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | - $result = $mysqli->query($req); |
|
| 77 | - $data = $result->fetch_object(); |
|
| 75 | + $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | + $result = $mysqli->query($req); |
|
| 77 | + $data = $result->fetch_object(); |
|
| 78 | 78 | |
| 79 | - $values[] = $data->total; |
|
| 79 | + $values[] = $data->total; |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | - // Active Raids |
|
| 83 | - // ----------- |
|
| 82 | + // Active Raids |
|
| 83 | + // ----------- |
|
| 84 | 84 | |
| 85 | - $req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND end >= UTC_TIMESTAMP()"; |
|
| 86 | - $result = $mysqli->query($req); |
|
| 87 | - $data = $result->fetch_object(); |
|
| 85 | + $req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND end >= UTC_TIMESTAMP()"; |
|
| 86 | + $result = $mysqli->query($req); |
|
| 87 | + $data = $result->fetch_object(); |
|
| 88 | 88 | |
| 89 | - $values[] = $data->total; |
|
| 89 | + $values[] = $data->total; |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | 92 | // Team battle |
@@ -58,162 +58,162 @@ discard block |
||
| 58 | 58 | // |
| 59 | 59 | ############################ |
| 60 | 60 | |
| 61 | - case 'home_update': |
|
| 62 | - // Right now |
|
| 63 | - // --------- |
|
| 61 | + case 'home_update': |
|
| 62 | + // Right now |
|
| 63 | + // --------- |
|
| 64 | 64 | |
| 65 | - $req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | - $result = $mysqli->query($req); |
|
| 67 | - $data = $result->fetch_object(); |
|
| 65 | + $req = "SELECT COUNT(*) AS total FROM pokemon WHERE disappear_time >= UTC_TIMESTAMP()"; |
|
| 66 | + $result = $mysqli->query($req); |
|
| 67 | + $data = $result->fetch_object(); |
|
| 68 | 68 | |
| 69 | - $values[] = $data->total; |
|
| 69 | + $values[] = $data->total; |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | - // Lured stops |
|
| 73 | - // ----------- |
|
| 72 | + // Lured stops |
|
| 73 | + // ----------- |
|
| 74 | 74 | |
| 75 | - $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | - $result = $mysqli->query($req); |
|
| 77 | - $data = $result->fetch_object(); |
|
| 75 | + $req = "SELECT COUNT(*) AS total FROM pokestop WHERE lure_expiration >= UTC_TIMESTAMP()"; |
|
| 76 | + $result = $mysqli->query($req); |
|
| 77 | + $data = $result->fetch_object(); |
|
| 78 | 78 | |
| 79 | - $values[] = $data->total; |
|
| 79 | + $values[] = $data->total; |
|
| 80 | 80 | |
| 81 | 81 | |
| 82 | - // Active Raids |
|
| 83 | - // ----------- |
|
| 82 | + // Active Raids |
|
| 83 | + // ----------- |
|
| 84 | 84 | |
| 85 | - $req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND end >= UTC_TIMESTAMP()"; |
|
| 86 | - $result = $mysqli->query($req); |
|
| 87 | - $data = $result->fetch_object(); |
|
| 85 | + $req = "SELECT COUNT(*) AS total FROM raid WHERE start <= UTC_TIMESTAMP AND end >= UTC_TIMESTAMP()"; |
|
| 86 | + $result = $mysqli->query($req); |
|
| 87 | + $data = $result->fetch_object(); |
|
| 88 | 88 | |
| 89 | - $values[] = $data->total; |
|
| 89 | + $values[] = $data->total; |
|
| 90 | 90 | |
| 91 | 91 | |
| 92 | - // Team battle |
|
| 93 | - // ----------- |
|
| 92 | + // Team battle |
|
| 93 | + // ----------- |
|
| 94 | 94 | |
| 95 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym"; |
|
| 96 | - $result = $mysqli->query($req); |
|
| 97 | - $data = $result->fetch_object(); |
|
| 95 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym"; |
|
| 96 | + $result = $mysqli->query($req); |
|
| 97 | + $data = $result->fetch_object(); |
|
| 98 | 98 | |
| 99 | - $values[] = $data->total; |
|
| 99 | + $values[] = $data->total; |
|
| 100 | 100 | |
| 101 | - // Team |
|
| 102 | - // 1 = bleu |
|
| 103 | - // 2 = rouge |
|
| 104 | - // 3 = jaune |
|
| 101 | + // Team |
|
| 102 | + // 1 = bleu |
|
| 103 | + // 2 = rouge |
|
| 104 | + // 3 = jaune |
|
| 105 | 105 | |
| 106 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'"; |
|
| 107 | - $result = $mysqli->query($req); |
|
| 108 | - $data = $result->fetch_object(); |
|
| 106 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '2'"; |
|
| 107 | + $result = $mysqli->query($req); |
|
| 108 | + $data = $result->fetch_object(); |
|
| 109 | 109 | |
| 110 | - // Red |
|
| 111 | - $values[] = $data->total; |
|
| 110 | + // Red |
|
| 111 | + $values[] = $data->total; |
|
| 112 | 112 | |
| 113 | 113 | |
| 114 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'"; |
|
| 115 | - $result = $mysqli->query($req); |
|
| 116 | - $data = $result->fetch_object(); |
|
| 114 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '1'"; |
|
| 115 | + $result = $mysqli->query($req); |
|
| 116 | + $data = $result->fetch_object(); |
|
| 117 | 117 | |
| 118 | - // Blue |
|
| 119 | - $values[] = $data->total; |
|
| 118 | + // Blue |
|
| 119 | + $values[] = $data->total; |
|
| 120 | 120 | |
| 121 | 121 | |
| 122 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'"; |
|
| 123 | - $result = $mysqli->query($req); |
|
| 124 | - $data = $result->fetch_object(); |
|
| 122 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '3'"; |
|
| 123 | + $result = $mysqli->query($req); |
|
| 124 | + $data = $result->fetch_object(); |
|
| 125 | 125 | |
| 126 | - // Yellow |
|
| 127 | - $values[] = $data->total; |
|
| 126 | + // Yellow |
|
| 127 | + $values[] = $data->total; |
|
| 128 | 128 | |
| 129 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'"; |
|
| 130 | - $result = $mysqli->query($req); |
|
| 131 | - $data = $result->fetch_object(); |
|
| 129 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total FROM gym WHERE team_id = '0'"; |
|
| 130 | + $result = $mysqli->query($req); |
|
| 131 | + $data = $result->fetch_object(); |
|
| 132 | 132 | |
| 133 | - // Neutral |
|
| 134 | - $values[] = $data->total; |
|
| 133 | + // Neutral |
|
| 134 | + $values[] = $data->total; |
|
| 135 | 135 | |
| 136 | - header('Content-Type: application/json'); |
|
| 137 | - echo json_encode($values); |
|
| 136 | + header('Content-Type: application/json'); |
|
| 137 | + echo json_encode($values); |
|
| 138 | 138 | |
| 139 | - break; |
|
| 139 | + break; |
|
| 140 | 140 | |
| 141 | 141 | |
| 142 | - #################################### |
|
| 143 | - // |
|
| 144 | - // Update latests spawn on homepage |
|
| 145 | - // |
|
| 146 | - #################################### |
|
| 142 | + #################################### |
|
| 143 | + // |
|
| 144 | + // Update latests spawn on homepage |
|
| 145 | + // |
|
| 146 | + #################################### |
|
| 147 | 147 | |
| 148 | - case 'spawnlist_update': |
|
| 149 | - // Recent spawn |
|
| 150 | - // ------------ |
|
| 151 | - $total_spawns = array(); |
|
| 152 | - $last_uid_param = ""; |
|
| 153 | - if (isset($_GET['last_uid'])) { |
|
| 154 | - $last_uid_param = $_GET['last_uid']; |
|
| 155 | - } |
|
| 156 | - if ($config->system->recents_filter) { |
|
| 157 | - // get all mythic pokemon ids |
|
| 158 | - $mythic_pokemons = array(); |
|
| 159 | - foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 160 | - if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 161 | - $mythic_pokemons[] = $id; |
|
| 162 | - } |
|
| 148 | + case 'spawnlist_update': |
|
| 149 | + // Recent spawn |
|
| 150 | + // ------------ |
|
| 151 | + $total_spawns = array(); |
|
| 152 | + $last_uid_param = ""; |
|
| 153 | + if (isset($_GET['last_uid'])) { |
|
| 154 | + $last_uid_param = $_GET['last_uid']; |
|
| 163 | 155 | } |
| 156 | + if ($config->system->recents_filter) { |
|
| 157 | + // get all mythic pokemon ids |
|
| 158 | + $mythic_pokemons = array(); |
|
| 159 | + foreach ($pokemons->pokemon as $id => $pokemon) { |
|
| 160 | + if ($pokemon->spawn_rate < $config->system->recents_filter_rarity && $pokemon->rating >= $config->system->recents_filter_rating) { |
|
| 161 | + $mythic_pokemons[] = $id; |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | 164 | |
| 165 | - // get last mythic pokemon |
|
| 166 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 165 | + // get last mythic pokemon |
|
| 166 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 167 | 167 | latitude, longitude, cp, individual_attack, individual_defense, individual_stamina |
| 168 | 168 | FROM pokemon |
| 169 | 169 | WHERE pokemon_id IN (".implode(",", $mythic_pokemons).") |
| 170 | 170 | ORDER BY last_modified DESC |
| 171 | 171 | LIMIT 0,12"; |
| 172 | - } else { |
|
| 173 | - // get last pokemon |
|
| 174 | - $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 172 | + } else { |
|
| 173 | + // get last pokemon |
|
| 174 | + $req = "SELECT pokemon_id, encounter_id, disappear_time, last_modified, (CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_time_real, |
|
| 175 | 175 | latitude, longitude, cp, individual_attack, individual_defense, individual_stamina |
| 176 | 176 | FROM pokemon |
| 177 | 177 | ORDER BY last_modified DESC |
| 178 | 178 | LIMIT 0,12"; |
| 179 | - } |
|
| 180 | - $result = $mysqli->query($req); |
|
| 181 | - while ($data = $result->fetch_object()) { |
|
| 182 | - $new_spawn = array(); |
|
| 183 | - $pokeid = $data->pokemon_id; |
|
| 184 | - $pokeuid = $data->encounter_id; |
|
| 185 | - |
|
| 186 | - if ($last_uid_param != $pokeuid) { |
|
| 187 | - $last_seen = strtotime($data->disappear_time_real); |
|
| 188 | - |
|
| 189 | - $location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16'; |
|
| 190 | - $location_link = str_replace('{latitude}', $data->latitude, $location_link); |
|
| 191 | - $location_link = str_replace('{longitude}', $data->longitude, $location_link); |
|
| 192 | - |
|
| 193 | - if ($config->system->recents_encounter_details) { |
|
| 194 | - $encdetails = new stdClass(); |
|
| 195 | - $encdetails->cp = $data->cp; |
|
| 196 | - $encdetails->attack = $data->individual_attack; |
|
| 197 | - $encdetails->defense = $data->individual_defense; |
|
| 198 | - $encdetails->stamina = $data->individual_stamina; |
|
| 199 | - if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) { |
|
| 200 | - $encdetails->available = true; |
|
| 201 | - } else { |
|
| 202 | - $encdetails->available = false; |
|
| 179 | + } |
|
| 180 | + $result = $mysqli->query($req); |
|
| 181 | + while ($data = $result->fetch_object()) { |
|
| 182 | + $new_spawn = array(); |
|
| 183 | + $pokeid = $data->pokemon_id; |
|
| 184 | + $pokeuid = $data->encounter_id; |
|
| 185 | + |
|
| 186 | + if ($last_uid_param != $pokeuid) { |
|
| 187 | + $last_seen = strtotime($data->disappear_time_real); |
|
| 188 | + |
|
| 189 | + $location_link = isset($config->system->location_url) ? $config->system->location_url : 'https://maps.google.com/?q={latitude},{longitude}&ll={latitude},{longitude}&z=16'; |
|
| 190 | + $location_link = str_replace('{latitude}', $data->latitude, $location_link); |
|
| 191 | + $location_link = str_replace('{longitude}', $data->longitude, $location_link); |
|
| 192 | + |
|
| 193 | + if ($config->system->recents_encounter_details) { |
|
| 194 | + $encdetails = new stdClass(); |
|
| 195 | + $encdetails->cp = $data->cp; |
|
| 196 | + $encdetails->attack = $data->individual_attack; |
|
| 197 | + $encdetails->defense = $data->individual_defense; |
|
| 198 | + $encdetails->stamina = $data->individual_stamina; |
|
| 199 | + if (isset($encdetails->cp) && isset($encdetails->attack) && isset($encdetails->defense) && isset($encdetails->stamina)) { |
|
| 200 | + $encdetails->available = true; |
|
| 201 | + } else { |
|
| 202 | + $encdetails->available = false; |
|
| 203 | + } |
|
| 203 | 204 | } |
| 204 | - } |
|
| 205 | 205 | |
| 206 | - $html = ' |
|
| 206 | + $html = ' |
|
| 207 | 207 | <div class="col-md-1 col-xs-4 pokemon-single" data-pokeid="'.$pokeid.'" data-pokeuid="'.$pokeuid.'" style="display: none;"> |
| 208 | 208 | <a href="pokemon/'.$pokeid.'"><img src="'.$pokemons->pokemon->$pokeid->img.'" alt="'.$pokemons->pokemon->$pokeid->name.'" class="img-responsive"></a> |
| 209 | 209 | <a href="pokemon/'.$pokeid.'"><p class="pkmn-name">'.$pokemons->pokemon->$pokeid->name.'</p></a> |
| 210 | 210 | <a href="'.$location_link.'" target="_blank"> |
| 211 | 211 | <small class="pokemon-timer">00:00:00</small> |
| 212 | 212 | </a>'; |
| 213 | - if ($config->system->recents_encounter_details) { |
|
| 214 | - if ($encdetails->available) { |
|
| 215 | - if ($config->system->iv_numbers) { |
|
| 216 | - $html .= ' |
|
| 213 | + if ($config->system->recents_encounter_details) { |
|
| 214 | + if ($encdetails->available) { |
|
| 215 | + if ($config->system->iv_numbers) { |
|
| 216 | + $html .= ' |
|
| 217 | 217 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 218 | 218 | <div title="'.$locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
| 219 | 219 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$encdetails->attack.'</span>'.$encdetails->attack.' |
@@ -225,8 +225,8 @@ discard block |
||
| 225 | 225 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$encdetails->stamina.'</span>'.$encdetails->stamina.' |
| 226 | 226 | </div> |
| 227 | 227 | </div>'; |
| 228 | - } else { |
|
| 229 | - $html .= ' |
|
| 228 | + } else { |
|
| 229 | + $html .= ' |
|
| 230 | 230 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
| 231 | 231 | <div title="'.$locales->IV_ATTACK.': '.$encdetails->attack.'" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(((100 / 15) * $encdetails->attack) / 3).'%"> |
| 232 | 232 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$encdetails->attack.'</span> |
@@ -238,11 +238,11 @@ discard block |
||
| 238 | 238 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$encdetails->stamina.'</span> |
| 239 | 239 | </div> |
| 240 | 240 | </div>'; |
| 241 | - } |
|
| 242 | - $html .= '<small>'.$encdetails->cp.'</small>'; |
|
| 243 | - } else { |
|
| 244 | - if ($config->system->iv_numbers) { |
|
| 245 | - $html .= ' |
|
| 241 | + } |
|
| 242 | + $html .= '<small>'.$encdetails->cp.'</small>'; |
|
| 243 | + } else { |
|
| 244 | + if ($config->system->iv_numbers) { |
|
| 245 | + $html .= ' |
|
| 246 | 246 | <div class="progress" style="height: 15px; margin-bottom: 0"> |
| 247 | 247 | <div title="'.$locales->IV_ATTACK.': not available" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="'.$encdetails->attack.'" aria-valuemin="0" aria-valuemax="45" style="width: '.(100 / 3).'%; line-height: 16px"> |
| 248 | 248 | <span class="sr-only">'.$locales->IV_ATTACK.': '.$locales->NOT_AVAILABLE.'</span>? |
@@ -254,123 +254,123 @@ discard block |
||
| 254 | 254 | <span class="sr-only">'.$locales->IV_STAMINA.': '.$locales->NOT_AVAILABLE.'</span>? |
| 255 | 255 | </div> |
| 256 | 256 | </div>'; |
| 257 | - } else { |
|
| 258 | - $html .= ' |
|
| 257 | + } else { |
|
| 258 | + $html .= ' |
|
| 259 | 259 | <div class="progress" style="height: 6px; width: 80%; margin: 5px auto 0 auto"> |
| 260 | 260 | <div title="IV not available" class="progress-bar" role="progressbar" style="width: 100%; background-color: rgb(210,210,210)" aria-valuenow="1" aria-valuemin="0" aria-valuemax="1"> |
| 261 | 261 | <span class="sr-only">IV '.$locales->NOT_AVAILABLE.'</span> |
| 262 | 262 | </div> |
| 263 | 263 | </div>'; |
| 264 | + } |
|
| 265 | + $html .= '<small>???</small>'; |
|
| 264 | 266 | } |
| 265 | - $html .= '<small>???</small>'; |
|
| 266 | 267 | } |
| 267 | - } |
|
| 268 | - $html .= ' |
|
| 268 | + $html .= ' |
|
| 269 | 269 | </div>'; |
| 270 | - $new_spawn['html'] = $html; |
|
| 271 | - $countdown = $last_seen - time(); |
|
| 272 | - $new_spawn['countdown'] = $countdown; |
|
| 273 | - $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 274 | - $total_spawns[] = $new_spawn; |
|
| 275 | - } else { |
|
| 276 | - break; |
|
| 270 | + $new_spawn['html'] = $html; |
|
| 271 | + $countdown = $last_seen - time(); |
|
| 272 | + $new_spawn['countdown'] = $countdown; |
|
| 273 | + $new_spawn['pokemon_uid'] = $pokeuid; |
|
| 274 | + $total_spawns[] = $new_spawn; |
|
| 275 | + } else { |
|
| 276 | + break; |
|
| 277 | + } |
|
| 277 | 278 | } |
| 278 | - } |
|
| 279 | 279 | |
| 280 | - header('Content-Type: application/json'); |
|
| 281 | - echo json_encode($total_spawns); |
|
| 280 | + header('Content-Type: application/json'); |
|
| 281 | + echo json_encode($total_spawns); |
|
| 282 | 282 | |
| 283 | - break; |
|
| 283 | + break; |
|
| 284 | 284 | |
| 285 | 285 | |
| 286 | - #################################### |
|
| 287 | - // |
|
| 288 | - // List Pokestop |
|
| 289 | - // |
|
| 290 | - #################################### |
|
| 286 | + #################################### |
|
| 287 | + // |
|
| 288 | + // List Pokestop |
|
| 289 | + // |
|
| 290 | + #################################### |
|
| 291 | 291 | |
| 292 | - case 'pokestop': |
|
| 293 | - $where = ""; |
|
| 294 | - $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop "; |
|
| 292 | + case 'pokestop': |
|
| 293 | + $where = ""; |
|
| 294 | + $req = "SELECT latitude, longitude, lure_expiration, UTC_TIMESTAMP() AS now, (CONVERT_TZ(lure_expiration, '+00:00', '".$time_offset."')) AS lure_expiration_real FROM pokestop "; |
|
| 295 | 295 | |
| 296 | - $result = $mysqli->query($req); |
|
| 296 | + $result = $mysqli->query($req); |
|
| 297 | 297 | |
| 298 | - $pokestops = []; |
|
| 298 | + $pokestops = []; |
|
| 299 | 299 | |
| 300 | - while ($data = $result->fetch_object()) { |
|
| 301 | - if ($data->lure_expiration >= $data->now) { |
|
| 302 | - $icon = 'pokestap_lured.png'; |
|
| 303 | - $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
| 304 | - $lured = true; |
|
| 305 | - } else { |
|
| 306 | - $icon = 'pokestap.png'; |
|
| 307 | - $text = $locales->POKESTOPS_MAP_REGULAR; |
|
| 308 | - $lured = false; |
|
| 309 | - } |
|
| 300 | + while ($data = $result->fetch_object()) { |
|
| 301 | + if ($data->lure_expiration >= $data->now) { |
|
| 302 | + $icon = 'pokestap_lured.png'; |
|
| 303 | + $text = sprintf($locales->POKESTOPS_MAP_LURED, date('H:i:s', strtotime($data->lure_expiration_real))); |
|
| 304 | + $lured = true; |
|
| 305 | + } else { |
|
| 306 | + $icon = 'pokestap.png'; |
|
| 307 | + $text = $locales->POKESTOPS_MAP_REGULAR; |
|
| 308 | + $lured = false; |
|
| 309 | + } |
|
| 310 | 310 | |
| 311 | - $pokestops[] = [ |
|
| 312 | - $text, |
|
| 313 | - $icon, |
|
| 314 | - $data->latitude, |
|
| 315 | - $data->longitude, |
|
| 316 | - $lured |
|
| 317 | - ]; |
|
| 318 | - } |
|
| 311 | + $pokestops[] = [ |
|
| 312 | + $text, |
|
| 313 | + $icon, |
|
| 314 | + $data->latitude, |
|
| 315 | + $data->longitude, |
|
| 316 | + $lured |
|
| 317 | + ]; |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - header('Content-Type: application/json'); |
|
| 321 | - echo json_encode($pokestops); |
|
| 320 | + header('Content-Type: application/json'); |
|
| 321 | + echo json_encode($pokestops); |
|
| 322 | 322 | |
| 323 | - break; |
|
| 323 | + break; |
|
| 324 | 324 | |
| 325 | 325 | |
| 326 | - #################################### |
|
| 327 | - // |
|
| 328 | - // Update data for the gym battle |
|
| 329 | - // |
|
| 330 | - #################################### |
|
| 326 | + #################################### |
|
| 327 | + // |
|
| 328 | + // Update data for the gym battle |
|
| 329 | + // |
|
| 330 | + #################################### |
|
| 331 | 331 | |
| 332 | - case 'update_gym': |
|
| 333 | - $teams = new stdClass(); |
|
| 334 | - $teams->mystic = 1; |
|
| 335 | - $teams->valor = 2; |
|
| 336 | - $teams->instinct = 3; |
|
| 332 | + case 'update_gym': |
|
| 333 | + $teams = new stdClass(); |
|
| 334 | + $teams->mystic = 1; |
|
| 335 | + $teams->valor = 2; |
|
| 336 | + $teams->instinct = 3; |
|
| 337 | 337 | |
| 338 | 338 | |
| 339 | - foreach ($teams as $team_name => $team_id) { |
|
| 340 | - $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(total_cp),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 341 | - $result = $mysqli->query($req); |
|
| 342 | - $data = $result->fetch_object(); |
|
| 339 | + foreach ($teams as $team_name => $team_id) { |
|
| 340 | + $req = "SELECT COUNT(DISTINCT(gym_id)) AS total, ROUND(AVG(total_cp),0) AS average_points FROM gym WHERE team_id = '".$team_id."'"; |
|
| 341 | + $result = $mysqli->query($req); |
|
| 342 | + $data = $result->fetch_object(); |
|
| 343 | 343 | |
| 344 | - $return[] = $data->total; |
|
| 345 | - $return[] = $data->average_points; |
|
| 346 | - } |
|
| 344 | + $return[] = $data->total; |
|
| 345 | + $return[] = $data->average_points; |
|
| 346 | + } |
|
| 347 | 347 | |
| 348 | - header('Content-Type: application/json'); |
|
| 349 | - echo json_encode($return); |
|
| 348 | + header('Content-Type: application/json'); |
|
| 349 | + echo json_encode($return); |
|
| 350 | 350 | |
| 351 | - break; |
|
| 351 | + break; |
|
| 352 | 352 | |
| 353 | 353 | |
| 354 | - #################################### |
|
| 355 | - // |
|
| 356 | - // Get datas for the gym map |
|
| 357 | - // |
|
| 358 | - #################################### |
|
| 354 | + #################################### |
|
| 355 | + // |
|
| 356 | + // Get datas for the gym map |
|
| 357 | + // |
|
| 358 | + #################################### |
|
| 359 | 359 | |
| 360 | 360 | |
| 361 | - case 'gym_map': |
|
| 362 | - $req = "SELECT gym_id, team_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, (6 - slots_available) AS level FROM gym"; |
|
| 363 | - $result = $mysqli->query($req); |
|
| 361 | + case 'gym_map': |
|
| 362 | + $req = "SELECT gym_id, team_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, (6 - slots_available) AS level FROM gym"; |
|
| 363 | + $result = $mysqli->query($req); |
|
| 364 | 364 | |
| 365 | - $gyms = []; |
|
| 365 | + $gyms = []; |
|
| 366 | 366 | |
| 367 | - while ($data = $result->fetch_object()) { |
|
| 368 | - // Team |
|
| 369 | - // 1 = bleu |
|
| 370 | - // 2 = rouge |
|
| 371 | - // 3 = jaune |
|
| 367 | + while ($data = $result->fetch_object()) { |
|
| 368 | + // Team |
|
| 369 | + // 1 = bleu |
|
| 370 | + // 2 = rouge |
|
| 371 | + // 3 = jaune |
|
| 372 | 372 | |
| 373 | - switch ($data->team_id) { |
|
| 373 | + switch ($data->team_id) { |
|
| 374 | 374 | case 0: |
| 375 | 375 | $icon = 'map_white.png'; |
| 376 | 376 | $team = 'No Team (yet)'; |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | $team = 'Team Instinct'; |
| 395 | 395 | $color = 'rgba(254, 217, 40, .6)'; |
| 396 | 396 | break; |
| 397 | - } |
|
| 397 | + } |
|
| 398 | 398 | |
| 399 | 399 | if ($data->team_id != 0) { |
| 400 | 400 | $icon .= $data->level.".png"; |
@@ -420,50 +420,50 @@ discard block |
||
| 420 | 420 | // |
| 421 | 421 | #################################### |
| 422 | 422 | |
| 423 | - case 'gym_defenders': |
|
| 424 | - $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 425 | - $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team, |
|
| 423 | + case 'gym_defenders': |
|
| 424 | + $gym_id = $mysqli->real_escape_string($_GET['gym_id']); |
|
| 425 | + $req = "SELECT gymdetails.name AS name, gymdetails.description AS description, gymdetails.url AS url, gym.team_id AS team, |
|
| 426 | 426 | (CONVERT_TZ(gym.last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, gym.guard_pokemon_id AS guard_pokemon_id, gym.total_cp AS total_cp, (6 - gym.slots_available) AS level |
| 427 | 427 | FROM gymdetails |
| 428 | 428 | LEFT JOIN gym ON gym.gym_id = gymdetails.gym_id |
| 429 | 429 | WHERE gym.gym_id='".$gym_id."'"; |
| 430 | - $result = $mysqli->query($req); |
|
| 430 | + $result = $mysqli->query($req); |
|
| 431 | 431 | |
| 432 | - $gymData['gymDetails']['gymInfos'] = false; |
|
| 432 | + $gymData['gymDetails']['gymInfos'] = false; |
|
| 433 | 433 | |
| 434 | - while ($data = $result->fetch_object()) { |
|
| 435 | - $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 436 | - $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 437 | - if ($data->url == null) { |
|
| 438 | - $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 439 | - } else { |
|
| 440 | - $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 434 | + while ($data = $result->fetch_object()) { |
|
| 435 | + $gymData['gymDetails']['gymInfos']['name'] = $data->name; |
|
| 436 | + $gymData['gymDetails']['gymInfos']['description'] = $data->description; |
|
| 437 | + if ($data->url == null) { |
|
| 438 | + $gymData['gymDetails']['gymInfos']['url'] = ''; |
|
| 439 | + } else { |
|
| 440 | + $gymData['gymDetails']['gymInfos']['url'] = $data->url; |
|
| 441 | + } |
|
| 442 | + $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
| 443 | + $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
| 444 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 445 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 446 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 441 | 447 | } |
| 442 | - $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
| 443 | - $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
| 444 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 445 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team; |
|
| 446 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 447 | - } |
|
| 448 | 448 | |
| 449 | - $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 449 | + $req = "SELECT DISTINCT gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, MAX(cp) AS cp, gymmember.gym_id |
|
| 450 | 450 | FROM gympokemon INNER JOIN gymmember ON gympokemon.pokemon_uid=gymmember.pokemon_uid |
| 451 | 451 | GROUP BY gympokemon.pokemon_uid, pokemon_id, iv_attack, iv_defense, iv_stamina, gym_id |
| 452 | 452 | HAVING gymmember.gym_id='".$gym_id."' |
| 453 | 453 | ORDER BY cp DESC"; |
| 454 | - $result = $mysqli->query($req); |
|
| 454 | + $result = $mysqli->query($req); |
|
| 455 | 455 | |
| 456 | - $i = 0; |
|
| 456 | + $i = 0; |
|
| 457 | 457 | |
| 458 | - $gymData['infoWindow'] = ' |
|
| 458 | + $gymData['infoWindow'] = ' |
|
| 459 | 459 | <div class="gym_defenders"> |
| 460 | 460 | '; |
| 461 | - while ($data = $result->fetch_object()) { |
|
| 462 | - $gymData['gymDetails']['pokemons'][] = $data; |
|
| 463 | - if ($data != false) { |
|
| 464 | - $pokemon_id = $data->pokemon_id; |
|
| 465 | - if ($config->system->iv_numbers) { |
|
| 466 | - $gymData['infoWindow'] .= ' |
|
| 461 | + while ($data = $result->fetch_object()) { |
|
| 462 | + $gymData['gymDetails']['pokemons'][] = $data; |
|
| 463 | + if ($data != false) { |
|
| 464 | + $pokemon_id = $data->pokemon_id; |
|
| 465 | + if ($config->system->iv_numbers) { |
|
| 466 | + $gymData['infoWindow'] .= ' |
|
| 467 | 467 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 468 | 468 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 469 | 469 | <img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
@@ -481,8 +481,8 @@ discard block |
||
| 481 | 481 | </div> |
| 482 | 482 | </div> |
| 483 | 483 | </div>'; |
| 484 | - } else { |
|
| 485 | - $gymData['infoWindow'] .= ' |
|
| 484 | + } else { |
|
| 485 | + $gymData['infoWindow'] .= ' |
|
| 486 | 486 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 487 | 487 | <a href="pokemon/'.$data->pokemon_id.'"> |
| 488 | 488 | <img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
@@ -500,80 +500,80 @@ discard block |
||
| 500 | 500 | </div> |
| 501 | 501 | </div> |
| 502 | 502 | </div>' |
| 503 | - ; } |
|
| 504 | - } else { |
|
| 505 | - $pokemon_id = $gymData['gymDetails']['gymInfos']['guardPokemonId']; |
|
| 506 | - $gymData['infoWindow'] .= ' |
|
| 503 | + ; } |
|
| 504 | + } else { |
|
| 505 | + $pokemon_id = $gymData['gymDetails']['gymInfos']['guardPokemonId']; |
|
| 506 | + $gymData['infoWindow'] .= ' |
|
| 507 | 507 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 508 | 508 | <a href="pokemon/'.$gymData['gymDetails']['gymInfos']['guardPokemonId'].'"> |
| 509 | 509 | <img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
| 510 | 510 | </a> |
| 511 | 511 | <p class="pkmn-name">???</p> |
| 512 | 512 | </div>' |
| 513 | - ; |
|
| 513 | + ; |
|
| 514 | + } |
|
| 515 | + $i++; |
|
| 514 | 516 | } |
| 515 | - $i++; |
|
| 516 | - } |
|
| 517 | 517 | |
| 518 | - // check whether we could retrieve gym infos, otherwise use basic gym info |
|
| 519 | - if (!$gymData['gymDetails']['gymInfos']) { |
|
| 520 | - $req = "SELECT gym_id, team_id, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, total_cp, (6 - slots_available) AS level |
|
| 518 | + // check whether we could retrieve gym infos, otherwise use basic gym info |
|
| 519 | + if (!$gymData['gymDetails']['gymInfos']) { |
|
| 520 | + $req = "SELECT gym_id, team_id, guard_pokemon_id, latitude, longitude, (CONVERT_TZ(last_scanned, '+00:00', '".$time_offset."')) AS last_scanned, total_cp, (6 - slots_available) AS level |
|
| 521 | 521 | FROM gym WHERE gym_id='".$gym_id."'"; |
| 522 | - $result = $mysqli->query($req); |
|
| 523 | - $data = $result->fetch_object(); |
|
| 524 | - |
|
| 525 | - $gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE; |
|
| 526 | - $gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE; |
|
| 527 | - $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
| 528 | - $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
| 529 | - $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
| 530 | - $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 531 | - $gymData['gymDetails']['gymInfos']['team'] = $data->team_id; |
|
| 532 | - $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 533 | - |
|
| 534 | - $pokemon_id = $data->guard_pokemon_id; |
|
| 535 | - $gymData['infoWindow'] .= ' |
|
| 522 | + $result = $mysqli->query($req); |
|
| 523 | + $data = $result->fetch_object(); |
|
| 524 | + |
|
| 525 | + $gymData['gymDetails']['gymInfos']['name'] = $locales->NOT_AVAILABLE; |
|
| 526 | + $gymData['gymDetails']['gymInfos']['description'] = $locales->NOT_AVAILABLE; |
|
| 527 | + $gymData['gymDetails']['gymInfos']['url'] = 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Solid_grey.svg/200px-Solid_grey.svg.png'; |
|
| 528 | + $gymData['gymDetails']['gymInfos']['points'] = $data->total_cp; |
|
| 529 | + $gymData['gymDetails']['gymInfos']['level'] = $data->level; |
|
| 530 | + $gymData['gymDetails']['gymInfos']['last_scanned'] = $data->last_scanned; |
|
| 531 | + $gymData['gymDetails']['gymInfos']['team'] = $data->team_id; |
|
| 532 | + $gymData['gymDetails']['gymInfos']['guardPokemonId'] = $data->guard_pokemon_id; |
|
| 533 | + |
|
| 534 | + $pokemon_id = $data->guard_pokemon_id; |
|
| 535 | + $gymData['infoWindow'] .= ' |
|
| 536 | 536 | <div style="text-align: center; width: 50px; display: inline-block; margin-right: 3px"> |
| 537 | 537 | <a href="pokemon/'.$data->guard_pokemon_id.'"> |
| 538 | 538 | <img src="'.$pokemons->pokemon->$pokemon_id->img.'" height="50" style="display:inline-block" > |
| 539 | 539 | </a> |
| 540 | 540 | <p class="pkmn-name">???</p> |
| 541 | 541 | </div>'; |
| 542 | - } |
|
| 543 | - $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 542 | + } |
|
| 543 | + $gymData['infoWindow'] = $gymData['infoWindow'].'</div>'; |
|
| 544 | 544 | |
| 545 | - header('Content-Type: application/json'); |
|
| 546 | - echo json_encode($gymData); |
|
| 545 | + header('Content-Type: application/json'); |
|
| 546 | + echo json_encode($gymData); |
|
| 547 | 547 | |
| 548 | - break; |
|
| 548 | + break; |
|
| 549 | 549 | |
| 550 | 550 | |
| 551 | - case 'trainer': |
|
| 552 | - $name = ""; |
|
| 553 | - $page = "0"; |
|
| 554 | - $where = ""; |
|
| 555 | - $order = ""; |
|
| 556 | - $team = 0; |
|
| 557 | - $ranking = 0; |
|
| 558 | - if (isset($_GET['name'])) { |
|
| 559 | - $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 560 | - $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 561 | - } |
|
| 562 | - if (isset($_GET['team']) && $_GET['team'] != 0) { |
|
| 563 | - $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 564 | - $where .= ($where == "" ? " HAVING" : " AND")." team = ".$team; |
|
| 565 | - } |
|
| 566 | - if (!empty($config->system->trainer_blacklist)) { |
|
| 567 | - $where .= ($where == "" ? " HAVING" : " AND")." name NOT IN ('".implode("','", $config->system->trainer_blacklist)."')"; |
|
| 568 | - } |
|
| 569 | - if (isset($_GET['page'])) { |
|
| 570 | - $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 571 | - } |
|
| 572 | - if (isset($_GET['ranking'])) { |
|
| 573 | - $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 574 | - } |
|
| 551 | + case 'trainer': |
|
| 552 | + $name = ""; |
|
| 553 | + $page = "0"; |
|
| 554 | + $where = ""; |
|
| 555 | + $order = ""; |
|
| 556 | + $team = 0; |
|
| 557 | + $ranking = 0; |
|
| 558 | + if (isset($_GET['name'])) { |
|
| 559 | + $trainer_name = mysqli_real_escape_string($mysqli, $_GET['name']); |
|
| 560 | + $where = " HAVING name LIKE '%".$trainer_name."%'"; |
|
| 561 | + } |
|
| 562 | + if (isset($_GET['team']) && $_GET['team'] != 0) { |
|
| 563 | + $team = mysqli_real_escape_string($mysqli, $_GET['team']); |
|
| 564 | + $where .= ($where == "" ? " HAVING" : " AND")." team = ".$team; |
|
| 565 | + } |
|
| 566 | + if (!empty($config->system->trainer_blacklist)) { |
|
| 567 | + $where .= ($where == "" ? " HAVING" : " AND")." name NOT IN ('".implode("','", $config->system->trainer_blacklist)."')"; |
|
| 568 | + } |
|
| 569 | + if (isset($_GET['page'])) { |
|
| 570 | + $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 571 | + } |
|
| 572 | + if (isset($_GET['ranking'])) { |
|
| 573 | + $ranking = mysqli_real_escape_string($mysqli, $_GET['ranking']); |
|
| 574 | + } |
|
| 575 | 575 | |
| 576 | - switch ($ranking) { |
|
| 576 | + switch ($ranking) { |
|
| 577 | 577 | case 1: |
| 578 | 578 | $order = " ORDER BY active DESC, level DESC"; |
| 579 | 579 | break; |
@@ -582,7 +582,7 @@ discard block |
||
| 582 | 582 | break; |
| 583 | 583 | default: |
| 584 | 584 | $order = " ORDER BY level DESC, active DESC"; |
| 585 | - } |
|
| 585 | + } |
|
| 586 | 586 | |
| 587 | 587 | $order .= ", last_seen DESC, name "; |
| 588 | 588 | |
@@ -658,130 +658,130 @@ discard block |
||
| 658 | 658 | break; |
| 659 | 659 | |
| 660 | 660 | |
| 661 | - case 'raids': |
|
| 662 | - $page = "0"; |
|
| 663 | - if (isset($_GET['page'])) { |
|
| 664 | - $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 665 | - } |
|
| 661 | + case 'raids': |
|
| 662 | + $page = "0"; |
|
| 663 | + if (isset($_GET['page'])) { |
|
| 664 | + $page = mysqli_real_escape_string($mysqli, $_GET['page']); |
|
| 665 | + } |
|
| 666 | 666 | |
| 667 | - $limit = " LIMIT ".($page * 10).",10"; |
|
| 667 | + $limit = " LIMIT ".($page * 10).",10"; |
|
| 668 | 668 | |
| 669 | - $req = "SELECT raid.gym_id, raid.level, raid.pokemon_id, raid.cp, raid.move_1, raid.move_2, CONVERT_TZ(raid.spawn, '+00:00', '".$time_offset."') AS spawn, CONVERT_TZ(raid.start, '+00:00', '".$time_offset."') AS start, CONVERT_TZ(raid.end, '+00:00', '".$time_offset."') AS end, CONVERT_TZ(raid.last_scanned, '+00:00', '".$time_offset."') AS last_scanned, gymdetails.name, gym.latitude, gym.longitude FROM raid |
|
| 669 | + $req = "SELECT raid.gym_id, raid.level, raid.pokemon_id, raid.cp, raid.move_1, raid.move_2, CONVERT_TZ(raid.spawn, '+00:00', '".$time_offset."') AS spawn, CONVERT_TZ(raid.start, '+00:00', '".$time_offset."') AS start, CONVERT_TZ(raid.end, '+00:00', '".$time_offset."') AS end, CONVERT_TZ(raid.last_scanned, '+00:00', '".$time_offset."') AS last_scanned, gymdetails.name, gym.latitude, gym.longitude FROM raid |
|
| 670 | 670 | JOIN gymdetails ON gymdetails.gym_id = raid.gym_id |
| 671 | 671 | JOIN gym ON gym.gym_id = raid.gym_id |
| 672 | 672 | WHERE raid.end > UTC_TIMESTAMP() |
| 673 | 673 | ORDER BY raid.level DESC, raid.start".$limit; |
| 674 | 674 | |
| 675 | - $result = $mysqli->query($req); |
|
| 676 | - $raids = array(); |
|
| 677 | - while ($data = $result->fetch_object()) { |
|
| 678 | - $data->starttime = date("H:i", strtotime($data->start)); |
|
| 679 | - $data->endtime = date("H:i", strtotime($data->end)); |
|
| 680 | - $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
| 681 | - if (isset($data->move_1)) { |
|
| 682 | - $move1 = $data->move_1; |
|
| 683 | - $data->quick_move = $move->$move1->name; |
|
| 684 | - } else { |
|
| 685 | - $data->quick_move = "?"; |
|
| 686 | - } |
|
| 687 | - if (isset($data->move_2)) { |
|
| 688 | - $move2 = $data->move_2; |
|
| 689 | - $data->charge_move = $move->$move2->name; |
|
| 690 | - } else { |
|
| 691 | - $data->charge_move = "?"; |
|
| 675 | + $result = $mysqli->query($req); |
|
| 676 | + $raids = array(); |
|
| 677 | + while ($data = $result->fetch_object()) { |
|
| 678 | + $data->starttime = date("H:i", strtotime($data->start)); |
|
| 679 | + $data->endtime = date("H:i", strtotime($data->end)); |
|
| 680 | + $data->gym_id = str_replace('.', '_', $data->gym_id); |
|
| 681 | + if (isset($data->move_1)) { |
|
| 682 | + $move1 = $data->move_1; |
|
| 683 | + $data->quick_move = $move->$move1->name; |
|
| 684 | + } else { |
|
| 685 | + $data->quick_move = "?"; |
|
| 686 | + } |
|
| 687 | + if (isset($data->move_2)) { |
|
| 688 | + $move2 = $data->move_2; |
|
| 689 | + $data->charge_move = $move->$move2->name; |
|
| 690 | + } else { |
|
| 691 | + $data->charge_move = "?"; |
|
| 692 | + } |
|
| 693 | + $raids[$data->gym_id] = $data; |
|
| 692 | 694 | } |
| 693 | - $raids[$data->gym_id] = $data; |
|
| 694 | - } |
|
| 695 | - $json = array(); |
|
| 696 | - $json['raids'] = $raids; |
|
| 697 | - $locale = array(); |
|
| 698 | - $locale['noraids'] = $locales->RAIDS_NONE; |
|
| 699 | - $json['locale'] = $locale; |
|
| 695 | + $json = array(); |
|
| 696 | + $json['raids'] = $raids; |
|
| 697 | + $locale = array(); |
|
| 698 | + $locale['noraids'] = $locales->RAIDS_NONE; |
|
| 699 | + $json['locale'] = $locale; |
|
| 700 | 700 | |
| 701 | - header('Content-Type: application/json'); |
|
| 702 | - echo json_encode($json); |
|
| 701 | + header('Content-Type: application/json'); |
|
| 702 | + echo json_encode($json); |
|
| 703 | 703 | |
| 704 | - break; |
|
| 704 | + break; |
|
| 705 | 705 | |
| 706 | - case 'pokemon_slider_init': |
|
| 707 | - $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 708 | - $result = $mysqli->query($req); |
|
| 709 | - $bounds = $result->fetch_object(); |
|
| 706 | + case 'pokemon_slider_init': |
|
| 707 | + $req = "SELECT MIN(disappear_time) AS min, MAX(disappear_time) AS max FROM pokemon"; |
|
| 708 | + $result = $mysqli->query($req); |
|
| 709 | + $bounds = $result->fetch_object(); |
|
| 710 | 710 | |
| 711 | - header('Content-Type: application/json'); |
|
| 712 | - echo json_encode($bounds); |
|
| 711 | + header('Content-Type: application/json'); |
|
| 712 | + echo json_encode($bounds); |
|
| 713 | 713 | |
| 714 | - break; |
|
| 714 | + break; |
|
| 715 | 715 | |
| 716 | 716 | |
| 717 | - case 'pokemon_heatmap_points': |
|
| 718 | - $json = ""; |
|
| 719 | - if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 720 | - $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
| 721 | - $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
| 722 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 723 | - $where = " WHERE pokemon_id = ".$pokemon_id." " |
|
| 724 | - . "AND disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 725 | - $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 726 | - $result = $mysqli->query($req); |
|
| 727 | - $points = array(); |
|
| 728 | - while ($result && $data = $result->fetch_object()) { |
|
| 729 | - $points[] = $data; |
|
| 730 | - } |
|
| 717 | + case 'pokemon_heatmap_points': |
|
| 718 | + $json = ""; |
|
| 719 | + if (isset($_GET['start']) && isset($_GET['end']) && isset($_GET['pokemon_id'])) { |
|
| 720 | + $start = date("Y-m-d H:i", (int) $_GET['start']); |
|
| 721 | + $end = date("Y-m-d H:i", (int) $_GET['end']); |
|
| 722 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 723 | + $where = " WHERE pokemon_id = ".$pokemon_id." " |
|
| 724 | + . "AND disappear_time BETWEEN '".$start."' AND '".$end."'"; |
|
| 725 | + $req = "SELECT latitude, longitude FROM pokemon".$where." ORDER BY disappear_time DESC LIMIT 10000"; |
|
| 726 | + $result = $mysqli->query($req); |
|
| 727 | + $points = array(); |
|
| 728 | + while ($result && $data = $result->fetch_object()) { |
|
| 729 | + $points[] = $data; |
|
| 730 | + } |
|
| 731 | 731 | |
| 732 | - $json = json_encode($points); |
|
| 733 | - } |
|
| 732 | + $json = json_encode($points); |
|
| 733 | + } |
|
| 734 | 734 | |
| 735 | - header('Content-Type: application/json'); |
|
| 736 | - echo $json; |
|
| 737 | - break; |
|
| 735 | + header('Content-Type: application/json'); |
|
| 736 | + echo $json; |
|
| 737 | + break; |
|
| 738 | 738 | |
| 739 | 739 | |
| 740 | - case 'maps_localization_coordinates': |
|
| 741 | - $json = ""; |
|
| 742 | - $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 743 | - $result = $mysqli->query($req); |
|
| 744 | - $coordinates = $result->fetch_object(); |
|
| 740 | + case 'maps_localization_coordinates': |
|
| 741 | + $json = ""; |
|
| 742 | + $req = "SELECT MAX(latitude) AS max_latitude, MIN(latitude) AS min_latitude, MAX(longitude) AS max_longitude, MIN(longitude) as min_longitude FROM spawnpoint"; |
|
| 743 | + $result = $mysqli->query($req); |
|
| 744 | + $coordinates = $result->fetch_object(); |
|
| 745 | 745 | |
| 746 | - header('Content-Type: application/json'); |
|
| 747 | - echo json_encode($coordinates); |
|
| 746 | + header('Content-Type: application/json'); |
|
| 747 | + echo json_encode($coordinates); |
|
| 748 | 748 | |
| 749 | - break; |
|
| 749 | + break; |
|
| 750 | 750 | |
| 751 | 751 | |
| 752 | - case 'pokemon_graph_data': |
|
| 753 | - $json = ""; |
|
| 754 | - if (isset($_GET['pokemon_id'])) { |
|
| 755 | - $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 756 | - $req = "SELECT COUNT(*) AS total, |
|
| 752 | + case 'pokemon_graph_data': |
|
| 753 | + $json = ""; |
|
| 754 | + if (isset($_GET['pokemon_id'])) { |
|
| 755 | + $pokemon_id = mysqli_real_escape_string($mysqli, $_GET['pokemon_id']); |
|
| 756 | + $req = "SELECT COUNT(*) AS total, |
|
| 757 | 757 | HOUR(CONVERT_TZ(disappear_time, '+00:00', '".$time_offset."')) AS disappear_hour |
| 758 | 758 | FROM (SELECT disappear_time FROM pokemon WHERE pokemon_id = '".$pokemon_id."' ORDER BY disappear_time LIMIT 10000) AS pokemonFiltered |
| 759 | 759 | GROUP BY disappear_hour |
| 760 | 760 | ORDER BY disappear_hour"; |
| 761 | - $result = $mysqli->query($req); |
|
| 762 | - $array = array_fill(0, 24, 0); |
|
| 763 | - while ($result && $data = $result->fetch_object()) { |
|
| 764 | - $array[$data->disappear_hour] = $data->total; |
|
| 761 | + $result = $mysqli->query($req); |
|
| 762 | + $array = array_fill(0, 24, 0); |
|
| 763 | + while ($result && $data = $result->fetch_object()) { |
|
| 764 | + $array[$data->disappear_hour] = $data->total; |
|
| 765 | + } |
|
| 766 | + // shift array because AM/PM starts at 1AM not 0:00 |
|
| 767 | + $array[] = $array[0]; |
|
| 768 | + array_shift($array); |
|
| 769 | + |
|
| 770 | + $json = json_encode($array); |
|
| 765 | 771 | } |
| 766 | - // shift array because AM/PM starts at 1AM not 0:00 |
|
| 767 | - $array[] = $array[0]; |
|
| 768 | - array_shift($array); |
|
| 769 | 772 | |
| 770 | - $json = json_encode($array); |
|
| 771 | - } |
|
| 773 | + header('Content-Type: application/json'); |
|
| 774 | + echo $json; |
|
| 775 | + break; |
|
| 772 | 776 | |
| 773 | - header('Content-Type: application/json'); |
|
| 774 | - echo $json; |
|
| 775 | - break; |
|
| 776 | 777 | |
| 778 | + case 'postRequest': |
|
| 779 | + break; |
|
| 777 | 780 | |
| 778 | - case 'postRequest': |
|
| 781 | + default: |
|
| 782 | + echo "What do you mean?"; |
|
| 783 | + exit(); |
|
| 779 | 784 | break; |
| 780 | - |
|
| 781 | - default: |
|
| 782 | - echo "What do you mean?"; |
|
| 783 | - exit(); |
|
| 784 | - break; |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | if ($postRequest != "") { |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | </div> |
| 32 | 32 | |
| 33 | 33 | <?php |
| 34 | - if (!$config->system->no_lures === true) { |
|
| 35 | - ?> |
|
| 34 | + if (!$config->system->no_lures === true) { |
|
| 35 | + ?> |
|
| 36 | 36 | <div class="flex-item-homepage big-data"> <!-- POKESTOPS --> |
| 37 | 37 | <a href="pokestops"> |
| 38 | 38 | <img src="core/img/lure-module.png" alt="Discover the <?= $config->infos->site_name ?> Pokéstops" width=50 class="big-icon"> |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | </a> |
| 42 | 42 | </div> |
| 43 | 43 | <?php |
| 44 | - } |
|
| 45 | - if ($config->system->homepage_raids === true) { |
|
| 46 | - ?> |
|
| 44 | + } |
|
| 45 | + if ($config->system->homepage_raids === true) { |
|
| 46 | + ?> |
|
| 47 | 47 | <div class="flex-item-homepage flex-item-homepage-homepage big-data"> <!-- RAIDS --> |
| 48 | 48 | <a href="raids"> |
| 49 | 49 | <img src="core/img/raid.png" alt="Discover the <?= $config->infos->site_name ?> Raids" width=50 |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | </a> |
| 54 | 54 | </div> |
| 55 | 55 | <?php |
| 56 | - } |
|
| 57 | - ?> |
|
| 56 | + } |
|
| 57 | + ?> |
|
| 58 | 58 | |
| 59 | 59 | <div class="flex-item-homepage big-data"> |
| 60 | 60 | <a href="<?= $config->homewidget->url ?>" target="_blank"> |
@@ -13,35 +13,35 @@ |
||
| 13 | 13 | <div class="row area"> |
| 14 | 14 | |
| 15 | 15 | <?php |
| 16 | - if (!$config->system->no_lures === true) { |
|
| 17 | - ?> |
|
| 16 | + if (!$config->system->no_lures === true) { |
|
| 17 | + ?> |
|
| 18 | 18 | <div class="col-md-6 col-sm-6 col-xs-12 big-data" style="border-right:1px lightgray solid;"> <!-- POKESTOPS --> |
| 19 | 19 | <?php |
| 20 | - } else { |
|
| 21 | - ?> |
|
| 20 | + } else { |
|
| 21 | + ?> |
|
| 22 | 22 | <div class="big-data"> <!-- POKESTOPS --> |
| 23 | 23 | <?php |
| 24 | - } |
|
| 25 | - ?> |
|
| 24 | + } |
|
| 25 | + ?> |
|
| 26 | 26 | <img src="core/img/pokestop.png" alt="Pokestop" width=50 class="big-icon"> |
| 27 | 27 | <p><big><strong><?= $pokestop->total ?></strong> <?= $locales->POKESTOPS ?></big><br> <?= sprintf($locales->INCITY, $config->infos->city); ?></p> |
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | 30 | <?php |
| 31 | - if (!$config->system->no_lures === true) { |
|
| 32 | - ?> |
|
| 31 | + if (!$config->system->no_lures === true) { |
|
| 32 | + ?> |
|
| 33 | 33 | <div class="col-md-6 col-sm-6 col-xs-12 big-data"> <!-- LURED STOPS --> |
| 34 | 34 | <img src="core/img/lure-module.png" alt="Lured Pokestop" width=50 class="big-icon"> |
| 35 | 35 | <p><big><strong><?= $pokestop->lured ?></strong> <?= $locales->LURES ?></big><br> <?= $locales->POKESTOPS_LURES ?></p> |
| 36 | 36 | </div> |
| 37 | 37 | <?php |
| 38 | - } |
|
| 39 | - ?> |
|
| 38 | + } |
|
| 39 | + ?> |
|
| 40 | 40 | </div> |
| 41 | 41 | |
| 42 | 42 | <?php |
| 43 | 43 | if (!$config->system->no_lures === true) { |
| 44 | - ?> |
|
| 44 | + ?> |
|
| 45 | 45 | <div class="row text-center subnav"> |
| 46 | 46 | <div class="btn-group" role="group"> |
| 47 | 47 | <a class="btn btn-default active" id="pokestopSelector"><i |