Skip to content
Permalink
Browse files

Big code formatting refactor (#79)

* Format index.php

* Format offline.html

* Format htaccess

* Format functions.php

* Format config.example.php

* Format config.example.php 2

* Format 404.page.php

* Format dashboard.page.php

* Format gym.page.php

* Format home.page.php

* Remove stray </div>
There is no open tag for it

* Format pokemon.page.php

* Format pokedex.page.php

* Format gym.page.php even more

* Format home.page.php even more

* Format pokestops.page.php

* Format aru.php

* Format data.loader.php + minor error text fixes

* Change Brusselopole to Worldopole

* Replace Brusselopole alt strings with configured site_name

* Add some more img alt tags

* Format variables.examples.json

* Format gym.cron.php

* Format crontabs.include.php

* Format pokemon.cron.php

* Format pokestop.cron.php

* Format style.css

* Format pokemon.rarety.php

* Format meta.inc.php

* Fix some link syntax in translations.json

* Format dashboard.graph.js.php

* Format gym.graph.js.php

* Format gym.maps.js

* Format gym.script.js

* Format home.script.js

* Format pokemon.graph.js.php

* Format pokemon.maps.js.php

* Format pokestops.maps.js

* Format manifest.json

* Replace another Brusselopole string with site_name

* Remove unused twitter url
Change twitter link at the end of file instead

* Minor code formatting fixes in home.script.js

* Minor text fixes
  • Loading branch information...
Obihoernchen committed Oct 2, 2016
1 parent 0aa13f8 commit b2464bc960dcfb446356cbcabeb90e299b20b972
@@ -30,46 +30,34 @@
define('SYS_DEVELOPMENT_MODE' ,false);
if(directory() != ''){
if (directory() != '') {
$subdirectory = '/'.directory().'/';
}else{
} else {
$subdirectory = '/';
}
if(isset($_SERVER['REQUEST_SCHEME'])){
define('HOST_URL' , $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].''.$subdirectory); // Host
}else{
if(isset($_SERVER['HTTPS']) AND $_SERVER['HTTPS'] == 'on'){
define('HOST_URL' , 'https://'.$_SERVER['HTTP_HOST']); // Host
}else{
define('HOST_URL' , 'http://'.$_SERVER['HTTP_HOST']); // Host
if (isset($_SERVER['REQUEST_SCHEME'])) {
define('HOST_URL' ,$_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].''.$subdirectory); // Host
} else {
if (isset($_SERVER['HTTPS']) AND $_SERVER['HTTPS'] == 'on') {
define('HOST_URL' ,'https://'.$_SERVER['HTTP_HOST']); // Host
} else {
define('HOST_URL' ,'http://'.$_SERVER['HTTP_HOST']); // Host
}
}
## Subdirectory trick
function directory(){
$root = $_SERVER['DOCUMENT_ROOT'];
$filePath = dirname(__FILE__);
if ($root == $filePath) {
return ''; // installed in the root
} else {
$subdir_path = explode('/', $filePath);
$subdir = end($subdir_path);
return $subdir;
}
function directory() {
$root = $_SERVER['DOCUMENT_ROOT'];
$filePath = dirname(__FILE__);
if ($root == $filePath) {
return ''; // installed in the root
} else {
$subdir_path = explode('/', $filePath);
$subdir = end($subdir_path);
return $subdir;
}
}
?>
@@ -3,37 +3,34 @@
// This file only include other files to have only 1 entry in your crontabs.
// ------------------------------------------------------------------------
$filePath = dirname(__FILE__);
$config_file = $filePath.'/../../config.php';
$filePath = dirname(__FILE__);
$config_file = $filePath.'/../../config.php';
include_once($config_file);
# MySQL
$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
$mysqli = new mysqli(SYS_DB_HOST, SYS_DB_USER, SYS_DB_PSWD, SYS_DB_NAME, SYS_DB_PORT);
if($mysqli->connect_error != ''){
die('MySQL connect error');
}
$gym_file = SYS_PATH.'/core/json/gym.stats.json';
$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json';
$pokemon_file = SYS_PATH.'/core/json/pokemon.stats.json';
$gym_file = SYS_PATH.'/core/json/gym.stats.json';
$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json';
$pokemon_file = SYS_PATH.'/core/json/pokemon.stats.json';
$gymsdatas = json_decode(file_get_contents($gym_file), true);
$stopdatas = json_decode(file_get_contents($pokestop_file), true);
$pokedatas = json_decode(file_get_contents($pokemon_file), true);
$gymsdatas = json_decode(file_get_contents($gym_file), true);
$stopdatas = json_decode(file_get_contents($pokestop_file), true);
$pokedatas = json_decode(file_get_contents($pokemon_file), true);
$timestamp = time();
$timestamp = time();
include_once(SYS_PATH.'/core/cron/gym.cron.php');
include_once(SYS_PATH.'/core/cron/pokemon.cron.php');
include_once(SYS_PATH.'/core/cron/pokestop.cron.php');
?>
?>
@@ -8,27 +8,27 @@
// -----------------------------------------------------------------------------------------------------------
$gym['timestamp'] = $timestamp;
$gym['timestamp'] = $timestamp;
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$gym['total'] = $data->total;
$gym['total'] = $data->total;
// Mystic
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '1' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$gym['team']['mystic']['gym_owned'] = $data->total;
$gym['team']['mystic']['gym_owned'] = $data->total;
$req = "SELECT gym_points FROM gym WHERE team_id = '1' ";
$result = $mysqli->query($req);
$req = "SELECT gym_points FROM gym WHERE team_id = '1' ";
$result = $mysqli->query($req);
$total_points=0;
@@ -38,22 +38,22 @@
}
$gym['team']['mystic']['average'] = round($total_points / $gym['team']['mystic']['gym_owned']);
$gym['team']['mystic']['average'] = round($total_points / $gym['team']['mystic']['gym_owned']);
// Valor
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '2' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$gym['team']['valor']['gym_owned'] = $data->total;
$gym['team']['valor']['gym_owned'] = $data->total;
$req = "SELECT gym_points FROM gym WHERE team_id = '2' ";
$result = $mysqli->query($req);
$req = "SELECT gym_points FROM gym WHERE team_id = '2' ";
$result = $mysqli->query($req);
$total_points=0;
@@ -63,21 +63,21 @@
}
$gym['team']['valor']['average'] = round($total_points / $gym['team']['valor']['gym_owned']);
$gym['team']['valor']['average'] = round($total_points / $gym['team']['valor']['gym_owned']);
// Instinct
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$req = "SELECT count( DISTINCT(gym_id) ) as total FROM gym WHERE team_id = '3' ";
$result = $mysqli->query($req);
$data = $result->fetch_object();
$gym['team']['instinct']['gym_owned'] = $data->total;
$req = "SELECT gym_points FROM gym WHERE team_id = '3' ";
$result = $mysqli->query($req);
$req = "SELECT gym_points FROM gym WHERE team_id = '3' ";
$result = $mysqli->query($req);
$total_points=0;
@@ -92,11 +92,9 @@
// Add the datas in file
$gymsdatas[] = $gym;
$json = json_encode($gymsdatas);
$gymsdatas[] = $gym;
$json = json_encode($gymsdatas);
file_put_contents($gym_file, $json);
?>
?>
@@ -13,7 +13,7 @@
$pokemons = json_decode($pokemon_list_file);
$pokemon_stats['timestamp'] = $timestamp;
$pokemon_stats['timestamp'] = $timestamp;
$req = "SELECT COUNT(*) as total FROM pokemon WHERE disappear_time > (NOW() - INTERVAL 2 HOUR);";
@@ -42,10 +42,8 @@
// Add the datas in file
$pokedatas[] = $pokemon_stats;
$json = json_encode($pokedatas);
$json = json_encode($pokedatas);
file_put_contents($pokemon_file, $json);
?>
?>
@@ -29,8 +29,8 @@
$key = $pokemon['id'];
$pourcent = ($pokemon['total']*100) / $total_pokemons;
$arrondis = round($pourcent , 4);
$pourcent = ($pokemon['total']*100) / $total_pokemons;
$arrondis = round($pourcent , 4);
$pokelist[$key]['rate'] = $arrondis;
@@ -85,6 +85,5 @@
$file_content = json_encode($pokemons);
file_put_contents($pokedex, $file_content);
?>
?>
@@ -7,7 +7,7 @@
// Total lured
// -----------------------------------------------------------------------------------------------------------
$pokestop['timestamp'] = $timestamp;
$pokestop['timestamp'] = $timestamp;
$req = "SELECT COUNT(*) as total FROM pokestop";
$result = $mysqli->query($req);
@@ -26,9 +26,8 @@
// Add the datas in file
$stopdatas[] = $pokestop;
$json = json_encode($stopdatas);
$json = json_encode($stopdatas);
file_put_contents($pokestop_file, $json);
?>
?>
Oops, something went wrong.

0 comments on commit b2464bc

Please sign in to comment.
You can’t perform that action at this time.