Permalink
Browse files

Scrutinizer Auto-Fixes (#306)

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
  • Loading branch information...
scrutinizer-auto-fixer authored and Obihoernchen committed Aug 15, 2017
1 parent f691b8c commit 2ee34950987b73809406022f577e7d6382be5765
@@ -38,7 +38,7 @@
if (isset($_SERVER['HTTP_HOST'])) {
if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) {
define('HOST_URL', $_SERVER['HTTP_X_FORWARDED_PROTO'] . '://'.$_SERVER['HTTP_HOST'].$subdirectory);
define('HOST_URL', $_SERVER['HTTP_X_FORWARDED_PROTO'].'://'.$_SERVER['HTTP_HOST'].$subdirectory);
} else if (isset($_SERVER['REQUEST_SCHEME'])) {
define('HOST_URL', $_SERVER['REQUEST_SCHEME'].'://'.$_SERVER['HTTP_HOST'].$subdirectory);
} else {
@@ -3,7 +3,7 @@
// This file only include other files to have only 1 entry in your crontabs.
// ------------------------------------------------------------------------
$config_file = dirname(__FILE__).'/../../config.php';
$config_file = dirname(__FILE__).'/../../config.php';
include_once($config_file);
@@ -23,7 +23,7 @@
# 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');
@@ -32,10 +32,10 @@
// Update dashboard data
// the following files are updated every run
$gym_file = SYS_PATH.'/core/json/gym.stats.json';
$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json';
$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json';
$pokedex_counts_file = SYS_PATH.'/core/json/pokedex.counts.json';
$gym_file = SYS_PATH.'/core/json/gym.stats.json';
$pokestop_file = SYS_PATH.'/core/json/pokestop.stats.json';
$pokemonstats_file = SYS_PATH.'/core/json/pokemon.stats.json';
$pokedex_counts_file = SYS_PATH.'/core/json/pokedex.counts.json';
if (is_file($gym_file)) {
$gymsdatas = json_decode(file_get_contents($gym_file), true);
@@ -10,8 +10,8 @@
// Include & load the variables
// ############################
$variables = SYS_PATH.'/core/json/variables.json';
$config = json_decode(file_get_contents($variables));
$variables = SYS_PATH.'/core/json/variables.json';
$config = json_decode(file_get_contents($variables));
// Include & load locales (because it's REALLY REALLY REALLY IMPORTANT TO HAVE A FULLY TRANSLATE DASHBOARD )
@@ -24,15 +24,15 @@
// Check if there's a pokemon stat file
// ####################################
$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
$stats = json_decode(file_get_contents($stats_file));
$stats_file = SYS_PATH.'/core/json/pokemon.stats.json';
$stats = json_decode(file_get_contents($stats_file));
$now = time();
$yesterday = $now-86400;
$lastweek = $now-604800;
$now = time();
$yesterday = $now - 86400;
$lastweek = $now - 604800;
$i=0;
$i = 0;
$labels_global = array();
$total = array();
$labels = array();
@@ -59,12 +59,12 @@
foreach ($stats as $data) {
if ($data->timestamp > $lastweek) {
$labels_global[] = '"'.date('D H:i', $data->timestamp).'"';
$total[] = $data->pokemon_now;
$labels_global[] = '"'.date('D H:i', $data->timestamp).'"';
$total[] = $data->pokemon_now;
}
if ($data->timestamp > $yesterday) {
$labels[] = '"'.date('H:i', $data->timestamp ).'"';
$labels[] = '"'.date('H:i', $data->timestamp).'"';
if (isset($data->rarity_spawn->{'Very common'})) {
$veco[] = $data->rarity_spawn->{'Very common'};
@@ -93,47 +93,47 @@
}
$stats_file = SYS_PATH.'/core/json/gym.stats.json';
$stats = json_decode(file_get_contents($stats_file));
$stats_file = SYS_PATH.'/core/json/gym.stats.json';
$stats = json_decode(file_get_contents($stats_file));
foreach ($stats as $data) {
if ($data->timestamp > $lastweek) {
$labels_gym[] = '"'.date('D H:i', $data->timestamp).'"';
$labels_gym[] = '"'.date('D H:i', $data->timestamp).'"';
$mystic_average[] = $data->team->mystic->average;
$mystic_average[] = $data->team->mystic->average;
$mystic_owned[] = $data->team->mystic->gym_owned;
$valor_average[] = $data->team->valor->average;
$valor_owned[] = $data->team->valor->gym_owned;
$valor_owned[] = $data->team->valor->gym_owned;
$instinct_average[] = $data->team->instinct->average;
$instinct_owned[] = $data->team->instinct->gym_owned;
$instinct_average[] = $data->team->instinct->average;
$instinct_owned[] = $data->team->instinct->gym_owned;
}
}
$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
$stats = json_decode(file_get_contents($stats_file));
$stats_file = SYS_PATH.'/core/json/pokestop.stats.json';
$stats = json_decode(file_get_contents($stats_file));
foreach ($stats as $data) {
if ($data->timestamp > $lastweek) {
$labels_stops[] = '"'.date('D H:i', $data->timestamp).'"';
$lure[] = $data->lured;
$labels_stops[] = '"'.date('D H:i', $data->timestamp).'"';
$lure[] = $data->lured;
}
}
if ($config->system->captcha_support) {
$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
$stats = json_decode(file_get_contents($stats_file));
$stats_file = SYS_PATH.'/core/json/captcha.stats.json';
$stats = json_decode(file_get_contents($stats_file));
foreach ($stats as $data) {
if ($data->timestamp > $lastweek) {
$labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"';
$captcha_accs[] = $data->captcha_accs;
$labels_captcha[] = '"'.date('D H:i', $data->timestamp).'"';
$captcha_accs[] = $data->captcha_accs;
}
}
}
@@ -30,8 +30,8 @@
# Polar Graph datas
$pokemon_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json');
$pokemons = json_decode($pokemon_file);
$pokemon_file = file_get_contents(SYS_PATH.'/core/json/pokedex.json');
$pokemons = json_decode($pokemon_file);
$atk = $pokemons->pokemon->$pokemon_id->atk;
$def = $pokemons->pokemon->$pokemon_id->def;
@@ -40,7 +40,7 @@
?>
var pokemon_id = '<?= (int)$pokemon_id ?>';
var pokemon_id = '<?= (int) $pokemon_id ?>';
Chart.defaults.global.legend.display = false;
@@ -10,8 +10,8 @@
// Include & load the variables
// ############################
$variables = SYS_PATH.'/core/json/variables.json';
$config = json_decode(file_get_contents($variables));
$variables = SYS_PATH.'/core/json/variables.json';
$config = json_decode(file_get_contents($variables));
// Load the locale elements
############################
@@ -29,7 +29,7 @@
$trainer_lvl = [];
# For all 3 teams
for ($teamid = 1; $teamid <= 3; $teamid++) {
$req = "SELECT level, count(level) AS count FROM trainer WHERE team = '".$teamid."' GROUP BY level";
$req = "SELECT level, count(level) AS count FROM trainer WHERE team = '".$teamid."' GROUP BY level";
if ($result = $mysqli->query($req)) {
# build level=>count array
$data = [];
@@ -42,7 +42,7 @@
# fill empty levels counts with 0
for ($i = 5; $i <= 40; $i++) {
if (!isset($data[$i])) {
$data[$i]=0;
$data[$i] = 0;
}
}
# sort array again
@@ -19,7 +19,8 @@
*
* @return array Sorted list of "accept" options
*/
$sortAccept = function ($header) {
$sortAccept = function ($header)
{
$matches = array();
foreach (explode(',', $header) as $option) {
$option = array_map('trim', explode(';', $option));
@@ -52,7 +53,8 @@
*
* @return string|NULL a matched option, or NULL if no match
*/
$matchAccept = function ($header, $supported) use ($sortAccept) {
$matchAccept = function ($header, $supported) use ($sortAccept)
{
$matches = $sortAccept($header);
foreach ($matches as $key => $q) {
if (isset($supported[$key])) {
@@ -83,7 +85,8 @@
*
* @return string The negotiated language result or the supplied default.
*/
$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept) {
$negotiateLanguage = function ($supported, $default = 'en-US') use ($matchAccept)
{
$supp = array();
foreach ($supported as $lang => $isSupported) {
if ($isSupported) {
@@ -190,8 +193,8 @@
// Resolve candy_id to candy_name
if (isset($pokemon->candy_id)) {
$candy_id = $pokemon->candy_id;
$pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name;
$candy_id = $pokemon->candy_id;
$pokemon->candy_name = $pokemon_trans->pokemon->$candy_id->name;
unset($pokemon->candy_id);
}
// Convert move numbers to names
@@ -236,8 +239,8 @@
// Translate typecolors array keys as well
$types_temp = new stdClass();
foreach ($pokemons->typecolors as $type => $color) {
$type_trans = $pokemon_trans->types->$type;
$types_temp->$type_trans = $color;
$type_trans = $pokemon_trans->types->$type;
$types_temp->$type_trans = $color;
}
// Replace typecolors array with translated one
$pokemons->typecolors = $types_temp;
@@ -22,11 +22,11 @@ function db_test()
{
$lock_msg = '';
$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);
// Pokemon Test
$req = "SELECT COUNT(*) as total FROM pokemon";
$result = $mysqli->query($req);
$req = "SELECT COUNT(*) as total FROM pokemon";
$result = $mysqli->query($req);
if (!is_object($result)) {
$lock_msg .= "Error: No Pokémon database found<br>";
@@ -40,8 +40,8 @@ function db_test()
}
// Gym Test
$req = "SELECT COUNT(*) as total FROM gym";
$result = $mysqli->query($req);
$req = "SELECT COUNT(*) as total FROM gym";
$result = $mysqli->query($req);
if (!is_object($result)) {
$lock_msg .= "Error: No Gym database found<br>";
@@ -56,8 +56,8 @@ function db_test()
// Pokéstop Test
$req = "SELECT COUNT(*) as total FROM pokestop";
$result = $mysqli->query($req);
$req = "SELECT COUNT(*) as total FROM pokestop";
$result = $mysqli->query($req);
if (!is_object($result)) {
$lock_msg .= "Error: No Pokestop database found<br>";
@@ -17,9 +17,9 @@
<div class="col-sm-1 hidden-xs">
<?php if ($pokemon->id-1 > 0) { ?>
<?php if ($pokemon->id - 1 > 0) { ?>
<p class="nav-links"><a href="pokemon/<?= $pokemon->id-1 ?>"><i class="fa fa-chevron-left"></i></a></p>
<p class="nav-links"><a href="pokemon/<?= $pokemon->id - 1 ?>"><i class="fa fa-chevron-left"></i></a></p>
<?php }?>
@@ -41,9 +41,9 @@
<div class="col-sm-1 hidden-xs">
<?php if ($pokemon->id+1 < $config->system->max_pokemon) { ?>
<?php if ($pokemon->id + 1 < $config->system->max_pokemon) { ?>
<p class="nav-links"><a href="pokemon/<?= $pokemon->id+1 ?>"><i class="fa fa-chevron-right"></i></a></p>
<p class="nav-links"><a href="pokemon/<?= $pokemon->id + 1 ?>"><i class="fa fa-chevron-right"></i></a></p>
<?php } ?>
</div>
@@ -120,10 +120,10 @@
</tr>
<tr>
<td class="col-md-8 col-xs-8"><?php if (isset($pokemon->protected_gyms)) {
echo "<strong>" . $locales->POKEMON_GYM . $pokemon->name . "</strong> :";
echo "<strong>".$locales->POKEMON_GYM.$pokemon->name."</strong> :";
} ?></td>
<td class="col-md-4 col-xs-4"><?php if (isset($pokemon->protected_gyms)) {
echo $pokemon->protected_gyms ;
echo $pokemon->protected_gyms;
}?></td>
</tr>
</table>
@@ -100,7 +100,7 @@
<script type="text/javascript">
<?=
$trainerName = "";
if (isset($_GET['name']) && $_GET['name']!="") {
if (isset($_GET['name']) && $_GET['name'] != "") {
$trainerName = htmlentities($_GET['name']);
}

0 comments on commit 2ee3495

Please sign in to comment.