-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.php
More file actions
105 lines (88 loc) · 3.11 KB
/
common.php
File metadata and controls
105 lines (88 loc) · 3.11 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
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
<?php
/**
* OGSPY - Mod PAx Superi
*
* @package [Mod] Pax Superi
* @author Machine
* @copyright Copyright © 2016, https://ogsteam.eu/
* @license https://opensource.org/licenses/gpl-license.php GNU Public License
*/
if (! defined('IN_SPYOGAME')) {
exit('Hacking attempt');
}
/**
* @global string $table_prefix Prefixe des tables de la base de donnees.
*/
global $table_prefix;
/**
* @var string Nom du module.
*/
define('MOD_NAME', 'paxsuperi');
// paths
define('MOD_ROOT', 'mod/' . MOD_NAME . '/');
define('MOD_ROOT_MODEL', MOD_ROOT . 'Model/');
define('MOD_ROOT_VUE', MOD_ROOT . 'Vue/');
define('MOD_ROOT_XML', MOD_ROOT . 'Xml/');
define('MOD_ROOT_CORE_PAX', MOD_ROOT . 'Core_Pax/');
define('MOD_ROOT_CORE_OGSPY', MOD_ROOT . 'Core_Ogspy/');
define('MOD_ROOT_CORE_CLASS', MOD_ROOT . 'Class/');
define('TYPE_PLANET', 'planet');
define('TYPE_MOON', 'moon');
// ?toJson=1
// include core pax
include MOD_ROOT_CORE_PAX . 'Constant.php';
include MOD_ROOT_CORE_PAX . 'UrlBuilder.php';
include MOD_ROOT_CORE_PAX . 'XmlManager.php';
include MOD_ROOT_CORE_PAX . 'StepperResponse.php';
include MOD_ROOT_CORE_PAX . 'Setting.php';
include MOD_ROOT_CORE_CLASS . 'AbstractClass.php';
include MOD_ROOT_CORE_CLASS . 'ClassPlayers.php';
include MOD_ROOT_CORE_CLASS . 'ClassAlliances.php';
include MOD_ROOT_CORE_CLASS . 'ClassAlliances_rank.php';
include MOD_ROOT_CORE_CLASS . 'ClassPlayers_rank.php';
include MOD_ROOT_CORE_CLASS . 'ClassUniverse.php';
include MOD_ROOT_CORE_OGSPY . 'Pax_sql_db.php';
include MOD_ROOT_CORE_OGSPY . 'Pax_Model_Abstract.php';
include MOD_ROOT_MODEL . 'Pax_Player_Model.php';
include MOD_ROOT_MODEL . 'Pax_Alliance_Model.php';
include MOD_ROOT_MODEL . 'Pax_Rankings_Player_Model.php';
include MOD_ROOT_MODEL . 'Pax_Rankings_Ally_Model.php';
include MOD_ROOT_MODEL . 'Pax_Astro_Object_Model.php';
// include core pax logger
include MOD_ROOT_CORE_PAX . 'Pax_Logger.php';
// Initialisation du logger global
if (! isset($GLOBALS['pax_logger'])) {
$setting = Setting::getInstance();
$debug = isset($setting->debug) ? (bool) $setting->debug : true; // Utilise la valeur de debug depuis la configuration, true par défaut
$GLOBALS['pax_logger'] = new Pax_Logger($debug);
}
// include core ogspy ( si OK a integrer dans code source )
// include MOD_ROOT_CORE_OGSPY . 'Pax_mysql.php';
// fn util bypass ogspy
/**
* formatage_timestamp_for_rank
*
* change l'horaire du classement avec un horaire compatible pour un affichage dans ogspy
*
* @param int $time timestamp
*
* @return int
*/
function formatage_timestamp_for_rank($time)
{
// / il faut garder le format ogspy ( toutes les 8 heeures ... ) )
$temp = getdate($time);
// on format la date
$temp['seconds'] = 0;
$temp['minutes'] = 0;
if ($temp['hours'] >= 0 && $temp['hours'] < 8) {
$temp['hours'] = 0;
}
if ($temp['hours'] >= 8 && $temp['hours'] < 16) {
$temp['hours'] = 8;
}
if ($temp['hours'] >= 16 && $temp['hours'] < 24) {
$temp['hours'] = 16;
}
return mktime($temp['hours'], $temp['minutes'], $temp['seconds'], $temp['mon'], $temp['mday'], $temp['year']);
}