-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcommon.php
executable file
·115 lines (96 loc) · 3.16 KB
/
common.php
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* Main file which do includes et set up all data for the application
* @package OGSpy
* @subpackage main
* @author Kyser
* @copyright Copyright © 2007, https://ogsteam.eu/
* @license https:///opensource.org/licenses/gpl-license.php GNU Public License
* @version 3.3.8 */
if (!defined('IN_SPYOGAME')) {
die("Hacking attempt");
}
//Récupération des paramètres de connexion à la base de données
if (file_exists("parameters/id.php")) {
require_once "parameters/id.php";
} else {
if (!defined("OGSPY_INSTALLED") && !defined("INSTALL_IN_PROGRESS") && !defined("UPGRADE_IN_PROGRESS")) {
header("Location: install/index.php?lang=fr");
exit();
} elseif (file_exists('../parameters/id.php')) {
require_once '../parameters/id.php';
}
}
//Appel des fonctions
require_once __DIR__ . '/vendor/autoload.php';
require_once "includes/functions.php";
require_once "includes/config.php";
require_once "includes/mysql.php";
require_once "includes/log.php";
require_once "includes/galaxy.php";
require_once "includes/user.php";
require_once "includes/sessions.php";
require_once "includes/help.php";
require_once "includes/mod.php";
require_once "includes/ogame.php";
require_once "includes/chart_js.php";
if (defined("OGSPY_INSTALLED")) {
require_once "includes/mail.php";
require_once "includes/token.php";
require_once "includes/cache.php";
}
//Récupération des valeur GET, POST, COOKIE
extract($_GET, EXTR_PREFIX_ALL, "pub");
extract($_POST, EXTR_PREFIX_ALL, "pub");
extract($_COOKIE, EXTR_PREFIX_ALL, "pub");
foreach ($_GET as $secvalue) {
if (!check_getvalue($secvalue)) {
die("I don't like you...");
}
}
foreach ($_POST as $secvalue) {
if (!check_postvalue($secvalue)) {
header("Location: index.php");
die();
}
}
//Language File
if (!isset($ui_lang)) { // Checks the ui_lang value from parameters file
$ui_lang = $pub_lang ?? "fr";
//If no language is available in id.php file we take fr by default
}
require_once "lang/lang_main.php";
// ajout fichier clef unique
if (!defined("INSTALL_IN_PROGRESS") && !defined("UPGRADE_IN_PROGRESS")) {
if (file_exists('parameters/key.php')) {
require_once 'parameters/key.php';
} else {
generate_key();
}
}
//Connexion à la base de donnnées
if (!defined("INSTALL_IN_PROGRESS")) {
// appel de l instance en cours
$db = sql_db::getInstance($db_host, $db_user, $db_password, $db_database);
if (!$db->db_connect_id) {
die("Impossible de se connecter à la base de données");
}
//Récupération et encodage de l'adresse ip
$user_ip = encode_ip($_SERVER['REMOTE_ADDR']);
// initialisation des variables en cache
init_serverconfig();
init_mod_cache();
if (!defined("UPGRADE_IN_PROGRESS")) {
session();
maintenance_action();
}
/* Exception Handler */
$whoops = new \Whoops\Run;
$whoops->allowQuit(true);
$whoops->writeToOutput(true); //Passer à autre
if (!$server_config['log_phperror']) {
$whoops->silenceErrorsInPaths('mod/*', E_ALL);
}
$whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler());
$whoops->register();
}