This repository was archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathUtil.class.php
More file actions
52 lines (47 loc) · 1.61 KB
/
Util.class.php
File metadata and controls
52 lines (47 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
if (!isset($no_database)) {
require_once('Database.class.php');
}
class Util {
public const DOMAIN='ducksmanager.net';
static function isLocalHost() {
return !isset($_ENV['ENV']) || $_ENV['ENV'] !== 'production';
}
static function magazinesSupprimesInducks() {
$requete_magazines='SELECT Pays, Magazine FROM numeros GROUP BY Pays, Magazine ORDER BY Pays, Magazine';
$resultat_magazines=DM_Core::$d->requete($requete_magazines);
$pays='';
$magazines_inducks= [];
foreach($resultat_magazines as $pays_magazine) {
if ($pays!==$pays_magazine['Pays']) {
$magazines_inducks=Inducks::get_liste_magazines($pays_magazine['Pays']);
}
if (!array_key_exists($pays_magazine['Magazine'], $magazines_inducks)) {
echo $pays_magazine['Pays'] . '/' . $pays_magazine['Magazine'] . ' n\'existe plus<br />';
}
$pays=$pays_magazine['Pays'];
}
}
static function lire_depuis_fichier($nom_fichier) {
$inF = fopen($nom_fichier,"r");
$str='';
if ($inF === false) {
echo 'Le fichier '.$nom_fichier.' n\'existe pas';
}
else {
while (!feof($inF)) {
$str.=fgets($inF, 4096);
}
}
return $str;
}
static function exit_if_not_logged_in() {
if (!isset($_SESSION['user'], $_SESSION['id_user'])) {
header('Location: https://'.self::DOMAIN);
exit(0);
}
}
}
if (isset($_GET['magazines_supprimes'])) {
Util::magazinesSupprimesInducks();
}