forked from halo-battle/game
Ajout d'une étape de linting dans DroneCi (#3)
Corrige un doublons laissé par le rebase semi-manuel Ajout d'une étape de linting dans DroneCi Fix linting Co-authored-by: Nigel Sheldon <nigelsheldon@live.fr> Reviewed-on: https://gitea.nemunai.re/halo-battle/game/pulls/3
This commit is contained in:
parent
5b17a7dbd7
commit
dd61d3b66b
263 changed files with 45327 additions and 42695 deletions
|
|
@ -1,8 +1,11 @@
|
|||
<?php
|
||||
if(!defined('ONYX')) exit;
|
||||
if (!defined('ONYX')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (empty($sess->values["connected"]) && !defined("xCSRF"))
|
||||
define("xCSRF", true);
|
||||
if (empty($sess->values["connected"]) && !defined("xCSRF")) {
|
||||
define("xCSRF", true);
|
||||
}
|
||||
|
||||
//A passer a True pour dev tranquillou (pas d'envois de mail, pas de https,...)
|
||||
define("DEV", getenv("DEV"));
|
||||
|
|
@ -21,22 +24,21 @@ $SESS = new Session();
|
|||
|
||||
//Extraction des données en cache pour le header, sinon création du cache
|
||||
$header = Cache::read("headerNB");
|
||||
if (empty($header))
|
||||
{
|
||||
$bdd = new BDD();
|
||||
if (empty($header)) {
|
||||
$bdd = new BDD();
|
||||
|
||||
$nbcovie = $bdd->unique_query("SELECT COUNT(id) AS covenants FROM $table_user WHERE race = 'covenant';");
|
||||
$nbhumain = $bdd->unique_query("SELECT COUNT(id) AS humains FROM $table_user WHERE race = 'humain';");
|
||||
$enligne = $bdd->unique_query("SELECT COUNT(session) AS enligne FROM sessions WHERE active = true AND var != '0';");
|
||||
$infos = $bdd->query("SELECT * FROM $table_infoshead ORDER BY id DESC;");
|
||||
$msgdem = $bdd->unique_query("SELECT titre FROM $table_messages_demarrage ORDER BY id DESC LIMIT 1;");
|
||||
$nbcovie = $bdd->unique_query("SELECT COUNT(id) AS covenants FROM $table_user WHERE race = 'covenant';");
|
||||
$nbhumain = $bdd->unique_query("SELECT COUNT(id) AS humains FROM $table_user WHERE race = 'humain';");
|
||||
$enligne = $bdd->unique_query("SELECT COUNT(session) AS enligne FROM sessions WHERE active = true AND var != '0';");
|
||||
$infos = $bdd->query("SELECT * FROM $table_infoshead ORDER BY id DESC;");
|
||||
$msgdem = $bdd->unique_query("SELECT titre FROM $table_messages_demarrage ORDER BY id DESC LIMIT 1;");
|
||||
|
||||
$bdd->deconnexion();
|
||||
$bdd->deconnexion();
|
||||
|
||||
Cache::set("headerNB", array("count" => array($nbcovie["covenants"], $nbhumain["humains"], "cette", $enligne["enligne"]), "infos" => $infos, "messagedemarrage" => $msgdem["titre"]));
|
||||
unset($nbcovie, $nbhumain, $enligne, $infos, $msgdem, $bdd);
|
||||
Cache::set("headerNB", array("count" => array($nbcovie["covenants"], $nbhumain["humains"], "cette", $enligne["enligne"]), "infos" => $infos, "messagedemarrage" => $msgdem["titre"]));
|
||||
unset($nbcovie, $nbhumain, $enligne, $infos, $msgdem, $bdd);
|
||||
|
||||
$header = Cache::read("headerNB");
|
||||
$header = Cache::read("headerNB");
|
||||
}
|
||||
$template->assign("header", $header);
|
||||
$template->assign("version", $VAR["version"]);
|
||||
|
|
@ -49,15 +51,18 @@ define("debut_d_univers", true); //Constante pour savoir si l'on offre ou pas un
|
|||
define("nb_signatures", 4);
|
||||
|
||||
//Si l'on est pas connecté, on garde le header pour comparer lors de la connexion
|
||||
if (!empty($sess->values["connected"]))
|
||||
unset($header);
|
||||
if (!empty($sess->values["connected"])) {
|
||||
unset($header);
|
||||
}
|
||||
|
||||
//Evite les attaques CSRF
|
||||
if (DEV) { $protocole = "http"; } else { $protocole = "https"; }
|
||||
if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^'.$protocole.'://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF")))
|
||||
{
|
||||
elog("Possibilité d'attaque CSRF\n".var_export($_REQUEST, TRUE), 2);
|
||||
unset($_POST, $_GET);
|
||||
$_GET = $_POST = array();
|
||||
if (DEV) {
|
||||
$protocole = "http";
|
||||
} else {
|
||||
$protocole = "https";
|
||||
}
|
||||
if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^'.$protocole.'://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF"))) {
|
||||
elog("Possibilité d'attaque CSRF\n".var_export($_REQUEST, true), 2);
|
||||
unset($_POST, $_GET);
|
||||
$_GET = $_POST = array();
|
||||
}
|
||||
?>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue