Skip to content

Commit a2f6f48

Browse files
committed
Update for OGSpy 3.3.8 + PHP8
Retrait Table Mod_user_config de ce mod #3
1 parent a543877 commit a2f6f48

16 files changed

+165
-155
lines changed

.editorconfig

+36-36
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
# This file is for unifying the coding style for different editors and IDEs
2-
# editorconfig.org
3-
4-
root = true
5-
6-
[*]
7-
end_of_line = lf
8-
charset = utf-8
9-
trim_trailing_whitespace = true
10-
insert_final_newline = true
11-
12-
# Spaces in coffee
13-
[**.coffee]
14-
indent_style = space
15-
indent_size = 2
16-
17-
[**.js]
18-
indent_style = space
19-
indent_size = 2
20-
21-
# Tabs in less
22-
[**.less]
23-
indent_style = tab
24-
indent_size = 2
25-
26-
[**.css]
27-
indent_style = tab
28-
indent_size = 2
29-
30-
[**.php]
31-
indent_style = space
32-
indent_size = 4
33-
34-
[**.html]
35-
indent_style = tab
36-
indent_size = 2
1+
# This file is for unifying the coding style for different editors and IDEs
2+
# editorconfig.org
3+
4+
root = true
5+
6+
[*]
7+
end_of_line = lf
8+
charset = utf-8
9+
trim_trailing_whitespace = true
10+
insert_final_newline = true
11+
12+
# Spaces in coffee
13+
[**.coffee]
14+
indent_style = space
15+
indent_size = 2
16+
17+
[**.js]
18+
indent_style = space
19+
indent_size = 2
20+
21+
# Tabs in less
22+
[**.less]
23+
indent_style = tab
24+
indent_size = 2
25+
26+
[**.css]
27+
indent_style = tab
28+
indent_size = 2
29+
30+
[**.php]
31+
indent_style = space
32+
indent_size = 4
33+
34+
[**.html]
35+
indent_style = tab
36+
indent_size = 2

admin.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@
135135
echo help("attaques_Administration");
136136
echo "</font></b></legend>";
137137
// Formulaire des paramètres du module
138-
echo "<form name='form1' style=\"margin:0px;padding:0px; align-content: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
138+
echo "<form name='form1' style=\"margin:0px;padding:0px; alignment: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
139139
echo "<table width='60%' border='0'>
140140
<tr>
141141
<td class='c' colspan='2'>Paramètres du module</td>
@@ -179,7 +179,7 @@
179179

180180
// Formulaire des BBcodes
181181
echo "<br />";
182-
echo "<form name='form2' style='margin:0px;padding:0px;align-content: center' action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
182+
echo "<form name='form2' style='margin:0px;padding:0px;alignment: center' action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
183183
echo "<table width='60%' border='0'>
184184
<tr>
185185
<td class='c' colspan='6'>BBCodes&nbsp;" . help("attaques_bbcolor") . "&nbsp;</td>
@@ -314,7 +314,7 @@
314314
if ($inval_id > 0) {
315315
//On serialize l'array pour le transmettre par $_POST dans le form
316316
$trans_id = json_encode($id);
317-
echo "<form name='form4' style=\"margin:0;padding:0; align-content: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
317+
echo "<form name='form4' style=\"margin:0;padding:0; alignment: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
318318
echo "<table width='60%' border='0'><tr>";
319319
echo "<th>Des données n'appartenant à aucun joueur actif ont été trouvées;
320320
dans la base de données</th>";
@@ -327,7 +327,7 @@
327327
}
328328

329329
//Connexion Xtense2
330-
echo "<form name='form5' style=\"margin:0;padding:0; align-content: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
330+
echo "<form name='form5' style=\"margin:0;padding:0; alignment: center;\" action='index.php?action=attaques&page=admin' enctype='multipart/form-data' method='post'>";
331331
echo "<table width='60%' border='0'>
332332
<tr>
333333
<td class='c' colspan='5'>Xtense&nbsp;" . help("attaques_xtense") . "&nbsp;</td>

archives.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ function selectionner() {
6969
$nb_result = $db->sql_numrows($result);
7070

7171
if ($nb_result == 0) {
72-
$date_from = date("M Y", $date_from);
72+
$date_from = strftime("%b %Y", $date_from);
7373

7474
echo "<fieldset><legend><b><span style=\"color: #0080FF; \">Archives des attaques du mois de " . $date_from . "</span></b></legend>";
7575
echo "<span style=\"color: #FF0000; \">Vous n'avez pas de resultat pour cette date</span>";
7676
echo "</fieldset><br><br>";
7777
} else {
7878
list($archives_nb_attaques, $archives_date, $archives_metal, $archives_cristal, $archives_deut, $archives_pertes, $archives_recy_metal, $archives_recy_cristal, $archives_id) = $db->sql_fetch_row($resultgains);
7979

80-
$date_from = date("M Y", $date_from);
80+
$date_from = strftime("%b %Y", $date_from);
8181

8282
//On fait les calculs du total des gains, et la rentabilité, et du total des recyclages
8383
$total_gains = $archives_metal + $archives_cristal + $archives_deut;

attack_include.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ function mod_get_user_option($user_id, $param)
6262

6363
$query = "SELECT `value` FROM `" . TABLE_MOD_USER_CFG . "` WHERE `mod`='Attaques' and `user_id`=" . $user_id . " and `config`='" . $param . "'";
6464
$result = $db->sql_query($query);
65-
$user_config = $db->sql_fetch_row($result);
66-
$user_value = $user_config['value'];
6765

68-
return $user_value;
66+
if ($db->sql_numrows() > 0) {
67+
$userConfig = $db->sql_fetch_row($result);
68+
$userValue = $userConfig['value'];
69+
return $userValue;
70+
}
71+
72+
return false;
6973
}
7074

7175
/**

attaques.php

+16-10
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
$septjours = $date - 7;
2626
$yesterday = $date - 1;
2727

28-
if ($septjours < 1) $septjours = 1;
29-
if ($yesterday < 1) $yesterday = 1;
28+
$septjours = $septjours ?? 1;
29+
$yesterday = $yesterday ?? 1;
3030

3131

3232
//On verifie si il y a des attaques qui ne sont pas du mois actuel
@@ -59,8 +59,8 @@
5959

6060
list($metal_recy, $cristal_recy) = $db->sql_fetch_row($resultrecy);
6161
// Sql Fetch Row can set values to null if no result
62-
if ($metal_recy == null) $metal_recy = 0;
63-
if ($cristal_recy == null) $cristal_recy = 0;
62+
$metal_recy = $metal_recy ?? 0;
63+
$cristal_recy = $cristal_recy ?? 0;
6464

6565
//On sauvegarde les résultats
6666
$query = "INSERT INTO " . TABLE_ATTAQUES_ARCHIVES . " (`archives_user_id` , `archives_nb_attaques` , `archives_date` , `archives_metal` , `archives_cristal` , `archives_deut` , `archives_pertes`, `archives_recy_metal`, `archives_recy_cristal` )
@@ -80,7 +80,7 @@
8080
$bbcode .= "du 01/" . $month . "/" . $year . " au 31/" . $month . "/" . $year . "\n\n";
8181

8282
while (list($attack_coord, $attack_date, $attack_metal, $attack_cristal, $attack_deut, $attack_pertes) = $db->sql_fetch_row($list)) {
83-
$attack_date = date("d M Y H:i", $attack_date);
83+
$attack_date = date('d M Y H:i:s', $attack_date);
8484
$bbcode .= "Le " . $attack_date . " victoire en " . $attack_coord . ".\n";
8585
$bbcode .= "[color=" . $bbcolor['m_g'] . "]" . $attack_metal . "[/color] de métal, [color=" . $bbcolor['c_g'] . "]" . $attack_cristal . "[/color] de cristal et [color=" . $bbcolor['d_g'] . "]" . $attack_deut . "[/color] de deutérium ont été rapportés.\n";
8686
$bbcode .= "Les pertes s'&eacute;lèvent à [color=" . $bbcolor['perte'] . "]" . $attack_pertes . "[/color].\n\n";
@@ -102,7 +102,7 @@
102102
//On ajoute l'action dans le log
103103
$line = "La listes des attaques de " . $user_data['user_name'] . " a &eacute;t&eacute; supprimée. Les gains ont été archivés dans le module de gestion des attaques";
104104
$fichier = "log_" . date("ymd") . '.log';
105-
$line = "/*" . date("d/m/Y H:i:s") . '*/ ' . $line;
105+
$line = "/*" . date("d m Y H:i:s") . '*/ ' . $line;
106106
write_file(PATH_LOG_TODAY . $fichier, "a", $line);
107107

108108
exit;
@@ -147,8 +147,9 @@
147147

148148
$result = $db->sql_query($query);
149149
$users = array();
150-
while ($row = $db->sql_fetch_row($result))
150+
while ($row = $db->sql_fetch_row($result)) {
151151
$users[$row[0]] = $row[1];
152+
}
152153

153154
// Si un utilisateur a été sélectionné, on vérifie que l'on peut afficher les rapports de celui-ci
154155
if (isset($pub_user_id) && isset($users[$pub_user_id]))
@@ -228,8 +229,8 @@
228229
$resultgains = $db->sql_query($query);
229230

230231
//On récupère la date au bon format
231-
$pub_date_from = date("d M Y H:i", $pub_date_from);
232-
$pub_date_to = date("d M Y H:i", $pub_date_to);
232+
$pub_date_from = date('d M Y', $pub_date_from);
233+
$pub_date_to = date('d M Y', $pub_date_to);
233234

234235

235236
//Création du field pour choisir l'affichage (attaque du jour, de la semaine ou du mois
@@ -276,6 +277,11 @@
276277
//Résultat requete
277278
list($attack_metal, $attack_cristal, $attack_deut, $attack_pertes) = $db->sql_fetch_row($resultgains);
278279

280+
// Valeurs par défaut
281+
$attack_metal = $attack_metal ?? 0;
282+
$attack_cristal = $attack_cristal ?? 0;
283+
$attack_deut = $attack_deut ?? 0;
284+
$attack_pertes = $attack_pertes ?? 0;
279285

280286
//Calcul des gains totaux
281287
$totalgains = $attack_metal + $attack_cristal + $attack_deut;
@@ -330,7 +336,7 @@
330336
echo "<tr>";
331337

332338
while (list($attack_coord, $attack_date, $attack_metal, $attack_cristal, $attack_deut, $attack_pertes, $attack_id) = $db->sql_fetch_row($result)) {
333-
$attack_date = date("d M Y H:i", $attack_date);
339+
$attack_date = strftime("%d %b %Y %Hh%M", $attack_date);
334340
$attack_metal = number_format($attack_metal, 0, ',', ' ');
335341
$attack_cristal = number_format($attack_cristal, 0, ',', ' ');
336342
$attack_deut = number_format($attack_deut, 0, ',', ' ');

bbcode.php

+40-20
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
$nb_recy = $db->sql_numrows($recyclages);
6666

6767
//On récupère la date au bon format
68-
$pub_date_from = date("d M Y", $pub_date_from);
69-
$pub_date_to = date("d M Y", $pub_date_to);
68+
$pub_date_from = date('d M Y', $pub_date_from);
69+
$pub_date_to = date('d M Y', $pub_date_to);
7070

7171
//Création du field pour choisir l'affichage (attaque du jour, de la semaine ou du mois
7272
echo "<fieldset><legend><b><font color='#0080FF'>Date d'affichage des attaques et des recyclages en BBCode ";
@@ -97,15 +97,19 @@
9797
$bbcode .= "du " . $pub_date_from . " au " . $pub_date_to . "\n\n";
9898

9999
//Résultat requete
100-
while (list($attack_coord, $attack_date, $attack_metal, $attack_cristal, $attack_deut, $attack_pertes) = $db->sql_fetch_row($attaques)) {
101-
$attack_date = date("d M Y H:i", $attack_date);
102-
$attack_metal = number_format($attack_metal, 0, ',', ' ');
103-
$attack_cristal = number_format($attack_cristal, 0, ',', ' ');
104-
$attack_deut = number_format($attack_deut, 0, ',', ' ');
105-
$attack_pertes = number_format($attack_pertes, 0, ',', ' ');
106-
$bbcode .= "Le " . $attack_date . " victoire en " . $attack_coord . ".\n";
107-
$bbcode .= "[color=" . $bbcolor['m_g'] . "]" . $attack_metal . "[/color] de métal, [color=" . $bbcolor['c_g'] . "]" . $attack_cristal . "[/color] de cristal et [color=" . $bbcolor['d_g'] . "]" . $attack_deut . "[/color] de deuterium ont été rapportés.\n";
108-
$bbcode .= "Les pertes s'élèvent à [color=" . $bbcolor['perte'] . "]" . $attack_pertes . "[/color].\n\n";
100+
if ($nb_attack > 0) {
101+
while (list($attack_coord, $attack_date, $attack_metal, $attack_cristal, $attack_deut, $attack_pertes) = $db->sql_fetch_row($attaques)) {
102+
$attack_date = date('d M Y H:i', $attack_date);
103+
$attack_metal = number_format($attack_metal, 0, ',', ' ');
104+
$attack_cristal = number_format($attack_cristal, 0, ',', ' ');
105+
$attack_deut = number_format($attack_deut, 0, ',', ' ');
106+
$attack_pertes = number_format($attack_pertes, 0, ',', ' ');
107+
$bbcode .= "Le " . $attack_date . " victoire en " . $attack_coord . ".\n";
108+
$bbcode .= "[color=" . $bbcolor['m_g'] . "]" . $attack_metal . "[/color] de métal, [color=" . $bbcolor['c_g'] . "]" . $attack_cristal . "[/color] de cristal et [color=" . $bbcolor['d_g'] . "]" . $attack_deut . "[/color] de deuterium ont été rapportés.\n";
109+
$bbcode .= "Les pertes s'élèvent à [color=" . $bbcolor['perte'] . "]" . $attack_pertes . "[/color].\n\n";
110+
}
111+
} else {
112+
$bbcode = "Aucune Attaque enregistrée sur la période\n";
109113
}
110114
$bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url]";
111115

@@ -124,12 +128,16 @@
124128
$bbcode .= "du " . $pub_date_from . " au " . $pub_date_to . "\n\n";
125129

126130
//Résultat requete
127-
while (list($recy_coord, $recy_date, $recy_metal, $recy_cristal,) = $db->sql_fetch_row($recyclages)) {
128-
$recy_date = date("d M Y H:i", $recy_date);
129-
$recy_metal = number_format($recy_metal, 0, ',', ' ');
130-
$recy_cristal = number_format($recy_cristal, 0, ',', ' ');
131-
$bbcode .= "Le " . $recy_date . " recyclage en " . $recy_coord . ".\n";
132-
$bbcode .= "[color=" . $bbcolor['m_r'] . "]" . $recy_metal . "[/color] de métal, [color=" . $bbcolor['c_r'] . "]" . $recy_cristal . "[/color] de cristal ont été recyclés.\n\n";
131+
if ($nb_recy > 0) {
132+
while (list($recy_coord, $recy_date, $recy_metal, $recy_cristal,) = $db->sql_fetch_row($recyclages)) {
133+
$recy_date = date('d M Y H:i', $recy_date);
134+
$recy_metal = number_format($recy_metal, 0, ',', ' ');
135+
$recy_cristal = number_format($recy_cristal, 0, ',', ' ');
136+
$bbcode .= "Le " . $recy_date . " recyclage en " . $recy_coord . ".\n";
137+
$bbcode .= "[color=" . $bbcolor['m_r'] . "]" . $recy_metal . "[/color] de métal, [color=" . $bbcolor['c_r'] . "]" . $recy_cristal . "[/color] de cristal ont été recyclés.\n\n";
138+
}
139+
} else {
140+
$bbcode = "Aucun Recyclage enregistré sur la période\n";
133141
}
134142
$bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url]";
135143

@@ -148,6 +156,14 @@
148156
list($attack_metal, $attack_cristal, $attack_deut, $attack_pertes) = $db->sql_fetch_row($resultgains);
149157
list($recy_metal, $recy_cristal) = $db->sql_fetch_row($resultgains_recy);
150158

159+
// Valeurs par Défaut si retour = null
160+
$attack_metal = $attack_metal ?? 0;
161+
$attack_cristal = $attack_cristal ?? 0;
162+
$attack_deut = $attack_deut ?? 0;
163+
$attack_pertes = $attack_pertes ?? 0;
164+
$recy_metal = $attack_cristal ?? 0;
165+
$recy_cristal = $attack_cristal ?? 0;
166+
151167
//Calcul des gains totaux
152168
$totalgains = $attack_metal + $attack_cristal + $attack_deut + $recy_metal + $recy_cristal;
153169

@@ -176,8 +192,12 @@
176192
$bbcode .= "Nombre de recyclages durant cette periode : " . $nb_recy . "\n\n";
177193
$bbcode .= "Metal recyclé : [color=" . $bbcolor['m_r'] . "]" . $recy_metal . "[/color]\n";
178194
$bbcode .= "Cristal recyclé : [color=" . $bbcolor['c_r'] . "]" . $recy_cristal . "[/color]\n\n";
179-
if ($renta > 0) $bbcode .= "Rentabilité : [color=" . $bbcolor['renta'] . "]" . $renta . "[/color]\n\n";
180-
else $bbcode .= "Rentabilité : [color=" . $bbcolor['perte'] . "]" . $renta . "[/color]\n\n";
195+
if ($renta > 0) {
196+
$bbcode .= "Rentabilité : [color=" . $bbcolor['renta'] . "]" . $renta . "[/color]\n\n";
197+
}else {
198+
$bbcode .= "Rentabilité : [color=" . $bbcolor['perte'] . "]" . $renta . "[/color]\n\n";
199+
}
200+
181201
$bbcode .= "[url=http://www.ogsteam.eu/]Généré par OGSpy et le module de gestion des attaques[/url]";
182202

183203

@@ -191,4 +211,4 @@
191211
echo "<br>";
192212
echo "</fieldset>";
193213
echo "<br/>";
194-
?>
214+
?>

bilan.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@
9191

9292

9393
//On récupère la date au bon format
94-
$pub_date_from = date("d M Y H:i", $pub_date_from);
95-
$pub_date_to = date("d M Y H:i", $pub_date_to);
94+
$pub_date_from = date('d M Y', $pub_date_from);
95+
$pub_date_to = date('d M Y', $pub_date_to);
9696

9797

9898
//Création du field pour choisir l'affichage (attaque du jour, de la semaine ou du mois
@@ -140,6 +140,14 @@
140140
//Résultat requete
141141
list($recy_metal, $recy_cristal) = $db->sql_fetch_row($resultgainsrecy);
142142

143+
// Valeurs par Défaut si retour = null
144+
$attack_metal = $attack_metal ?? 0;
145+
$attack_cristal = $attack_cristal ?? 0;
146+
$attack_deut = $attack_deut ?? 0;
147+
$attack_pertes = $attack_pertes ?? 0;
148+
$recy_metal = $attack_cristal ?? 0;
149+
$recy_cristal = $attack_cristal ?? 0;
150+
143151
//Calcul des gains totaux
144152
$totalgains = $attack_metal + $attack_cristal + $attack_deut;
145153

0 commit comments

Comments
 (0)