@@ -368,7 +368,7 @@ |
||
368 | 368 | |
369 | 369 | /** |
370 | 370 | * @param $nom_batiment_sql |
371 | - * @param $niveau |
|
371 | + * @param integer $niveau |
|
372 | 372 | * @return array |
373 | 373 | * recuperation des ressources nécéssaire pour construire le batiment |
374 | 374 | */ |
@@ -46,7 +46,7 @@ |
||
46 | 46 | return $this->ressource_construire; |
47 | 47 | } |
48 | 48 | public function getInfoBatiment(){ |
49 | - return $this->info_batiment; |
|
49 | + return $this->info_batiment; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getNomBatimentConstruction() { |
@@ -3,7 +3,6 @@ |
||
3 | 3 | use core\App; |
4 | 4 | use core\functions\ChaineCaractere; |
5 | 5 | use core\HTML\flashmessage\FlashMessage; |
6 | - use Nette\Utils\DateTime; |
|
7 | 6 | |
8 | 7 | class Batiment { |
9 | 8 | //pour quand on recup un batiment |
@@ -91,8 +91,7 @@ discard block |
||
91 | 91 | |
92 | 92 | return $obj->niveau; |
93 | 93 | } |
94 | - } |
|
95 | - else { |
|
94 | + } else { |
|
96 | 95 | return 0; |
97 | 96 | } |
98 | 97 | } |
@@ -109,10 +108,18 @@ discard block |
||
109 | 108 | $id_base = Bataille::getIdBase(); |
110 | 109 | } |
111 | 110 | |
112 | - if ($ressource == "eau") $nom_batiment = "centrale_eau"; |
|
113 | - if ($ressource == "electricite") $nom_batiment = "centrale_electrique"; |
|
114 | - if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel"; |
|
115 | - if ($ressource == "fer") $nom_batiment = "station_forage"; |
|
111 | + if ($ressource == "eau") { |
|
112 | + $nom_batiment = "centrale_eau"; |
|
113 | + } |
|
114 | + if ($ressource == "electricite") { |
|
115 | + $nom_batiment = "centrale_electrique"; |
|
116 | + } |
|
117 | + if ($ressource == "fuel") { |
|
118 | + $nom_batiment = "station_pompage_fuel"; |
|
119 | + } |
|
120 | + if ($ressource == "fer") { |
|
121 | + $nom_batiment = "station_forage"; |
|
122 | + } |
|
116 | 123 | |
117 | 124 | $niveau = $this->getNiveauBatiment($nom_batiment, $id_base); |
118 | 125 | |
@@ -126,8 +133,7 @@ discard block |
||
126 | 133 | |
127 | 134 | return $prod; |
128 | 135 | } |
129 | - } |
|
130 | - else { |
|
136 | + } else { |
|
131 | 137 | return 20; |
132 | 138 | } |
133 | 139 | } |
@@ -153,8 +159,7 @@ discard block |
||
153 | 159 | return $obj->stockage; |
154 | 160 | } |
155 | 161 | } |
156 | - } |
|
157 | - else { |
|
162 | + } else { |
|
158 | 163 | return 1000; |
159 | 164 | } |
160 | 165 | } |
@@ -190,8 +195,7 @@ discard block |
||
190 | 195 | } |
191 | 196 | $niveau_batiment_base = $this->niveau_batiment; |
192 | 197 | $max_level = $this->getInfoUpgradeBatiment(); |
193 | - } |
|
194 | - else { |
|
198 | + } else { |
|
195 | 199 | $max_level = 0; |
196 | 200 | } |
197 | 201 | |
@@ -244,8 +248,7 @@ discard block |
||
244 | 248 | |
245 | 249 | if ($this->date_fin_construction-$today <= 0) { |
246 | 250 | $this->setTerminerConstruction($id_batiment); |
247 | - } |
|
248 | - else { |
|
251 | + } else { |
|
249 | 252 | Bataille::setValues([ |
250 | 253 | "date_fin_construction" => $this->date_fin_construction-$today, |
251 | 254 | "nom_batiment_construction" => $this->nom_batiment_construction |
@@ -308,8 +311,7 @@ discard block |
||
308 | 311 | foreach ($query as $obj) { |
309 | 312 | if ($obj->pour_construire != null) { |
310 | 313 | $pour_construire = unserialize($obj->pour_construire); |
311 | - } |
|
312 | - else { |
|
314 | + } else { |
|
313 | 315 | $pour_construire = []; |
314 | 316 | } |
315 | 317 | |
@@ -332,21 +334,18 @@ discard block |
||
332 | 334 | ]; |
333 | 335 | } |
334 | 336 | } |
335 | - } |
|
336 | - else if (count($pour_construire) > 1) { |
|
337 | + } else if (count($pour_construire) > 1) { |
|
337 | 338 | $ok_construction = false; |
338 | 339 | //test si tous les batiments sont construits et on le niveau nécéssaire |
339 | 340 | for ($j=0 ; $j<count($pour_construire) ; $j++) { |
340 | 341 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
341 | 342 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
342 | 343 | $ok_construction = true; |
343 | - } |
|
344 | - else { |
|
344 | + } else { |
|
345 | 345 | $ok_construction = false; |
346 | 346 | break; |
347 | 347 | } |
348 | - } |
|
349 | - else { |
|
348 | + } else { |
|
350 | 349 | $ok_construction = false; |
351 | 350 | break; |
352 | 351 | } |
@@ -363,8 +362,7 @@ discard block |
||
363 | 362 | "temps_construction" => $temps_construction |
364 | 363 | ]; |
365 | 364 | } |
366 | - } |
|
367 | - else { |
|
365 | + } else { |
|
368 | 366 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
369 | 367 | |
370 | 368 | $batiment_construire[] = [ |
@@ -473,8 +471,7 @@ discard block |
||
473 | 471 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ; |
474 | 472 | } |
475 | 473 | } |
476 | - } |
|
477 | - else { |
|
474 | + } else { |
|
478 | 475 | $this->info_batiment = ""; |
479 | 476 | $this->info_batiment_next = ""; |
480 | 477 | } |
@@ -519,8 +516,7 @@ discard block |
||
519 | 516 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
520 | 517 | $this->nom_batiment_sql = $nom_batiment_sql; |
521 | 518 | $this->niveau_batiment = 0; |
522 | - } |
|
523 | - else { |
|
519 | + } else { |
|
524 | 520 | //si c'est le lvl 0 de l'addon |
525 | 521 | if ($this->niveau_batiment == 0) { |
526 | 522 | $un_batiment = 0; |
@@ -531,8 +527,7 @@ discard block |
||
531 | 527 | //si pas assez de ressource |
532 | 528 | if (in_array("rouge", $ressource[0])) { |
533 | 529 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
534 | - } |
|
535 | - else { |
|
530 | + } else { |
|
536 | 531 | //recuperation du temps de construction |
537 | 532 | $query = $dbc1->select("ressource_construire") |
538 | 533 | ->select("temps_construction") |
@@ -557,8 +552,7 @@ discard block |
||
557 | 552 | ->set(); |
558 | 553 | |
559 | 554 | $this->id_batiment = $dbc->lastInsertId(); |
560 | - } |
|
561 | - else { |
|
555 | + } else { |
|
562 | 556 | $dbc->update("niveau", $this->niveau_batiment+1) |
563 | 557 | ->update("construction", 1) |
564 | 558 | ->from("_bataille_batiment") |
@@ -585,8 +579,7 @@ discard block |
||
585 | 579 | //on retire les ressources de la base |
586 | 580 | Bataille::getRessource()->setUpdateRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1], 0, "-"); |
587 | 581 | } |
588 | - } |
|
589 | - else { |
|
582 | + } else { |
|
590 | 583 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
591 | 584 | } |
592 | 585 | } |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | public function getRessourceConstruire() { |
48 | 48 | return $this->ressource_construire; |
49 | 49 | } |
50 | - public function getInfoBatiment(){ |
|
50 | + public function getInfoBatiment() { |
|
51 | 51 | return $this->info_batiment; |
52 | 52 | } |
53 | - public function getInfoBatimentNext(){ |
|
53 | + public function getInfoBatimentNext() { |
|
54 | 54 | return $this->info_batiment_next; |
55 | 55 | } |
56 | 56 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | if ((is_array($query)) && (count($query) > 0)) { |
87 | 87 | foreach ($query as $obj) { |
88 | 88 | if ($obj->construction == 1) { |
89 | - return $obj->niveau-1; |
|
89 | + return $obj->niveau - 1; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | return $obj->niveau; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | if ($niveau > 0) { |
149 | 149 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
150 | 150 | |
151 | - if ((is_array($query)) && (count($query) > 0)){ |
|
151 | + if ((is_array($query)) && (count($query) > 0)) { |
|
152 | 152 | foreach ($query as $obj) { |
153 | 153 | return $obj->stockage; |
154 | 154 | } |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $this->niveau_batiment = 0; |
203 | 203 | } |
204 | 204 | |
205 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
205 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
206 | 206 | |
207 | 207 | //permet de savoir si le batiment produit bien des ressoures |
208 | 208 | $batiment_production = []; |
@@ -250,12 +250,12 @@ discard block |
||
250 | 250 | $id_batiment = $obj->ID_batiment; |
251 | 251 | } |
252 | 252 | |
253 | - if ($this->date_fin_construction-$today <= 0) { |
|
253 | + if ($this->date_fin_construction - $today <= 0) { |
|
254 | 254 | $this->setTerminerConstruction($id_batiment); |
255 | 255 | } |
256 | 256 | else { |
257 | 257 | Bataille::setValues([ |
258 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
258 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
259 | 259 | "nom_batiment_construction" => $this->nom_batiment_construction |
260 | 260 | ]); |
261 | 261 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | //et compare la liste des batiments qu'il faut pour construire le batiment |
305 | 305 | //a ceux qui sont deja construit dans la base |
306 | 306 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
307 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
307 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
308 | 308 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
309 | 309 | $query = $dbc1->select("pour_construire") |
310 | 310 | ->select("temps_construction") |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | else if (count($pour_construire) > 1) { |
345 | 345 | $ok_construction = false; |
346 | 346 | //test si tous les batiments sont construits et on le niveau nécéssaire |
347 | - for ($j=0 ; $j<count($pour_construire) ; $j++) { |
|
347 | + for ($j = 0; $j < count($pour_construire); $j++) { |
|
348 | 348 | if (in_array($pour_construire[$j][1], $batiment_construit)) { |
349 | 349 | if ($pour_construire[$j][2] <= $this->getNiveauBatiment($pour_construire[$j][1])) { |
350 | 350 | $ok_construction = true; |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
397 | 397 | $dbc1 = Bataille::getDb(); |
398 | 398 | |
399 | - $niveau = $niveau+1; |
|
399 | + $niveau = $niveau + 1; |
|
400 | 400 | |
401 | 401 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
402 | 402 | |
@@ -429,7 +429,7 @@ discard block |
||
429 | 429 | */ |
430 | 430 | private function getTestBatimentConstruction($nom_batiment) { |
431 | 431 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
432 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
432 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
433 | 433 | } |
434 | 434 | |
435 | 435 | return [$nom_batiment, false]; |
@@ -443,7 +443,7 @@ discard block |
||
443 | 443 | $dbc1 = Bataille::getDb(); |
444 | 444 | |
445 | 445 | //récupération du temps et des ressources pour construire |
446 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
446 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
447 | 447 | |
448 | 448 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
449 | 449 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment) |
465 | 465 | ->get(); |
466 | 466 | |
467 | - if ((is_array($query)) && (count($query) > 0)){ |
|
467 | + if ((is_array($query)) && (count($query) > 0)) { |
|
468 | 468 | foreach ($query as $obj) { |
469 | 469 | $this->info_batiment = $xml->$nom_batiment_sql->phrase.$obj->$champ.$xml->$nom_batiment_sql->complement; |
470 | 470 | } |
@@ -473,10 +473,10 @@ discard block |
||
473 | 473 | //récupération de la phrase pour le niveau suivant |
474 | 474 | $query = $dbc1->select($xml->$nom_batiment_sql->champ) |
475 | 475 | ->from($this->nom_batiment_sql) |
476 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
476 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
477 | 477 | ->get(); |
478 | 478 | |
479 | - if ((is_array($query)) && (count($query) > 0)){ |
|
479 | + if ((is_array($query)) && (count($query) > 0)) { |
|
480 | 480 | foreach ($query as $obj) { |
481 | 481 | $this->info_batiment_next = $xml->$nom_batiment_sql->phrase_suivant.$obj->$champ.$xml->$nom_batiment_sql->complement; |
482 | 482 | } |
@@ -545,7 +545,7 @@ discard block |
||
545 | 545 | $query = $dbc1->select("ressource_construire") |
546 | 546 | ->select("temps_construction") |
547 | 547 | ->from($this->nom_batiment_sql) |
548 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
548 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
549 | 549 | ->get(); |
550 | 550 | |
551 | 551 | foreach ($query as $obj) { |
@@ -555,7 +555,7 @@ discard block |
||
555 | 555 | |
556 | 556 | //on insere la construction dans la table batiment si new batiment |
557 | 557 | if ($un_batiment == 0) { |
558 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
558 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
559 | 559 | ->insert("emplacement", $emplacement) |
560 | 560 | ->insert("nom_batiment", $nom_batiment) |
561 | 561 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | $this->id_batiment = $dbc->lastInsertId(); |
568 | 568 | } |
569 | 569 | else { |
570 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
570 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
571 | 571 | ->update("construction", 1) |
572 | 572 | ->from("_bataille_batiment") |
573 | 573 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | $today = Bataille::getToday(); |
582 | 582 | |
583 | 583 | //date de la fin de la construction en seconde |
584 | - $fin_construction = $today+$temps_construction; |
|
584 | + $fin_construction = $today + $temps_construction; |
|
585 | 585 | |
586 | 586 | $dbc->insert("date_fin", $fin_construction) |
587 | 587 | ->insert("emplacement_construction", $emplacement) |
@@ -24,7 +24,7 @@ |
||
24 | 24 | |
25 | 25 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
26 | 26 | public static function getValues() { |
27 | - return ["bataille" => self::$values]; |
|
27 | + return ["bataille" => self::$values]; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | //initilisation of all classes of battle |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | public static function getTestAssezRessourceBase($nom_ressource, $ressource) { |
198 | 198 | $f = "get".ucfirst($nom_ressource); |
199 | 199 | |
200 | - if ($ressource > Bataille::getRessource()->$f()) { |
|
200 | + if ($ressource > Bataille::getRessource()->$f()) { |
|
201 | 201 | /*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/ |
202 | 202 | return [ |
203 | 203 | "ressource" => $ressource, |
@@ -224,10 +224,10 @@ discard block |
||
224 | 224 | |
225 | 225 | //calcul des distances séparant les deux bases en x et y |
226 | 226 | //cette dstance sera multipliée par 15 sur x et y puis ajoutée pour avoir le temps du trajte en seconde |
227 | - $calc_x = abs($base_joueur['posx']-$base_autre['posx']); |
|
228 | - $calc_y = abs($base_joueur['posy']-$base_autre['posy']); |
|
227 | + $calc_x = abs($base_joueur['posx'] - $base_autre['posx']); |
|
228 | + $calc_y = abs($base_joueur['posy'] - $base_autre['posy']); |
|
229 | 229 | |
230 | - $temps_voyage = (($calc_x*70)+($calc_y*70))/$vitesse; |
|
230 | + $temps_voyage = (($calc_x * 70) + ($calc_y * 70)) / $vitesse; |
|
231 | 231 | |
232 | 232 | return $temps_voyage; |
233 | 233 | } |
@@ -124,7 +124,9 @@ discard block |
||
124 | 124 | ->get(); |
125 | 125 | |
126 | 126 | if ((is_array($query)) && (count($query) == 1)) { |
127 | - foreach ($query as $obj) return $obj->ID_base; |
|
127 | + foreach ($query as $obj) { |
|
128 | + return $obj->ID_base; |
|
129 | + } |
|
128 | 130 | } |
129 | 131 | } |
130 | 132 | |
@@ -169,8 +171,7 @@ discard block |
||
169 | 171 | |
170 | 172 | if ($id_base === null) { |
171 | 173 | $query = $dbc->select()->from("_bataille_last_connexion")->where("ID_identite", "=", self::getIdIdentite())->get(); |
172 | - } |
|
173 | - else { |
|
174 | + } else { |
|
174 | 175 | $query = $dbc->select("_bataille_last_connexion.last_connexion")->from("_bataille_base") |
175 | 176 | ->from("_bataille_last_connexion") |
176 | 177 | ->from("identite") |
@@ -272,7 +273,9 @@ discard block |
||
272 | 273 | ->get(); |
273 | 274 | |
274 | 275 | if ((is_array($query)) && (count($query) == 1)) { |
275 | - foreach ($query as $obj) return $obj->ID_base; |
|
276 | + foreach ($query as $obj) { |
|
277 | + return $obj->ID_base; |
|
278 | + } |
|
276 | 279 | } |
277 | 280 | |
278 | 281 | return 0; |
@@ -288,7 +291,9 @@ discard block |
||
288 | 291 | $query = $dbc->select("nombre_joueur")->from("_bataille_nombre_joueur")->where("ID_nombre_joueur", "=", 1)->get(); |
289 | 292 | |
290 | 293 | if ((is_array($query)) && (count($query) == 1)) { |
291 | - foreach ($query as $obj) return $obj->nombre_joueur; |
|
294 | + foreach ($query as $obj) { |
|
295 | + return $obj->nombre_joueur; |
|
296 | + } |
|
292 | 297 | } |
293 | 298 | |
294 | 299 | return 0; |
@@ -306,7 +311,9 @@ discard block |
||
306 | 311 | $query = $dbc->select($param)->from("configuration")->where("ID_configuration", "=", 1)->get(); |
307 | 312 | |
308 | 313 | if ((is_array($query)) && (count($query) == 1)) { |
309 | - foreach ($query as $obj) return $obj->$param; |
|
314 | + foreach ($query as $obj) { |
|
315 | + return $obj->$param; |
|
316 | + } |
|
310 | 317 | } |
311 | 318 | } |
312 | 319 | //-------------------------- END GETTER ----------------------------------------------------------------------------// |
@@ -322,11 +329,12 @@ discard block |
||
322 | 329 | |
323 | 330 | if ($id_base === null) { |
324 | 331 | $id_identite = self::getIdIdentite(); |
325 | - } |
|
326 | - else { |
|
332 | + } else { |
|
327 | 333 | $query = $dbc->select("ID_identite")->from("_bataille_base")->where("ID_base", "=", $id_base)->get(); |
328 | 334 | |
329 | - foreach ($query as $obj) $id_identite = $obj->ID_identite; |
|
335 | + foreach ($query as $obj) { |
|
336 | + $id_identite = $obj->ID_identite; |
|
337 | + } |
|
330 | 338 | } |
331 | 339 | |
332 | 340 | $dbc->update("last_connexion", date("Y-m-d H:i:s")) |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | /** |
163 | 163 | * @param null $id_base -> sert si definit a recuperer l'id identite de la abse en question |
164 | - * @return mixed |
|
164 | + * @return string|null |
|
165 | 165 | * recupere la date de la derniere connexion |
166 | 166 | */ |
167 | 167 | public static function getLastConnexion($id_base = null) { |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
191 | - * @param $nom_ressource |
|
191 | + * @param string $nom_ressource |
|
192 | 192 | * @param $ressource |
193 | 193 | * @return array |
194 | 194 | * fonction qui permet de renvyer la couleur rouge si pas assez de ressource pour construire le batiment |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | |
214 | 214 | /** |
215 | 215 | * @param $id_base |
216 | - * @param null $vitesse = vitesse de l'unité en question |
|
216 | + * @param integer $vitesse = vitesse de l'unité en question |
|
217 | 217 | * @return number |
218 | 218 | * fonction qui renvoi le temps de trajet entre la base du joueur et une autre base en secondes |
219 | 219 | */ |
@@ -295,8 +295,8 @@ discard block |
||
295 | 295 | } |
296 | 296 | |
297 | 297 | /** |
298 | - * @param $param |
|
299 | - * @return mixed |
|
298 | + * @param string $param |
|
299 | + * @return integer |
|
300 | 300 | * fonction qui sert à récupérer un parametre spécifique pour un batiment |
301 | 301 | * par exemple la vitesse d'un marchand ou le nombred'emplacment de la base |
302 | 302 | */ |
@@ -15,7 +15,7 @@ |
||
15 | 15 | |
16 | 16 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
17 | 17 | public function getBatiments(){ |
18 | - return $this->batiments; |
|
18 | + return $this->batiments; |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** |
@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | |
15 | 15 | |
16 | 16 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
17 | - public function getBatiments(){ |
|
17 | + public function getBatiments() { |
|
18 | 18 | return $this->batiments; |
19 | 19 | } |
20 | 20 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | |
67 | 67 | $nombre_emplacement = Bataille::getNombreEmplacementBase(); |
68 | 68 | |
69 | - for ($i=1 ; $i<($nombre_emplacement+1) ; $i++) { |
|
69 | + for ($i = 1; $i < ($nombre_emplacement + 1); $i++) { |
|
70 | 70 | $query = $dbc->select()->from("_bataille_batiment")->where("ID_base", "=", Bataille::getIdBase(), "AND") |
71 | 71 | ->where("emplacement", "=", $i) |
72 | 72 | ->orderBy("emplacement") |
@@ -84,8 +84,7 @@ |
||
84 | 84 | "posx" => $obj->posx, |
85 | 85 | "posy" => $obj->posy, |
86 | 86 | ]; |
87 | - } |
|
88 | - else { |
|
87 | + } else { |
|
89 | 88 | $batiments[] = [ |
90 | 89 | "nom_batiment" => $obj->nom_batiment, |
91 | 90 | "nom_batiment_sql" => $obj->nom_batiment_sql, |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | return $this->message; |
77 | 77 | } |
78 | 78 | public function getDateMessage(){ |
79 | - return $this->date_message; |
|
79 | + return $this->date_message; |
|
80 | 80 | } |
81 | 81 | public function getUrl(){ |
82 | - return $this->url; |
|
82 | + return $this->url; |
|
83 | 83 | } |
84 | 84 | public function getIdExpediteur() { |
85 | 85 | return $this->id_expediteur; |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | return $this->pseudo_receveur; |
95 | 95 | } |
96 | 96 | public function getValues(){ |
97 | - return ["messagerie" => $this->values]; |
|
97 | + return ["messagerie" => $this->values]; |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | /** |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | public function getMessage() { |
77 | 77 | return $this->message; |
78 | 78 | } |
79 | - public function getDateMessage(){ |
|
79 | + public function getDateMessage() { |
|
80 | 80 | return $this->date_message; |
81 | 81 | } |
82 | - public function getUrl(){ |
|
82 | + public function getUrl() { |
|
83 | 83 | return $this->url; |
84 | 84 | } |
85 | 85 | public function getIdExpediteur() { |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | public function getPseudoReceveur() { |
95 | 95 | return $this->pseudo_receveur; |
96 | 96 | } |
97 | - public function getValues(){ |
|
97 | + public function getValues() { |
|
98 | 98 | return ["messagerie" => $this->values]; |
99 | 99 | } |
100 | 100 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | $destinataires = explode(",", $destinataire); |
292 | 292 | $c = count($destinataires); |
293 | 293 | |
294 | - for ($i=0 ; $i<$c ; $i++) { |
|
294 | + for ($i = 0; $i < $c; $i++) { |
|
295 | 295 | if ($this->getIdIdentiteExist($destinataires[$i]) !== false) { |
296 | 296 | $destinataires[] = $this->getIdIdentiteExist($destinataires[$i]); |
297 | 297 | } |
@@ -33,11 +33,9 @@ discard block |
||
33 | 33 | if ($type_boite !== null) { |
34 | 34 | if ($type_boite == "boite réception") { |
35 | 35 | $this->getBoiteReception(); |
36 | - } |
|
37 | - else if ($type_boite == "messages envoyés") { |
|
36 | + } else if ($type_boite == "messages envoyés") { |
|
38 | 37 | $this->getMessagesEnvoyes(); |
39 | - } |
|
40 | - else if ($type_boite == "messages supprimés") { |
|
38 | + } else if ($type_boite == "messages supprimés") { |
|
41 | 39 | $this->getMessageSupprimes(); |
42 | 40 | } |
43 | 41 | |
@@ -240,8 +238,7 @@ discard block |
||
240 | 238 | "supprimer" => $obj->supprimer |
241 | 239 | ]; |
242 | 240 | } |
243 | - } |
|
244 | - else { |
|
241 | + } else { |
|
245 | 242 | return false; |
246 | 243 | } |
247 | 244 | } |
@@ -294,17 +291,14 @@ discard block |
||
294 | 291 | for ($i=0 ; $i<$c ; $i++) { |
295 | 292 | if ($this->getIdIdentiteExist($destinataires[$i]) !== false) { |
296 | 293 | $destinataires[] = $this->getIdIdentiteExist($destinataires[$i]); |
297 | - } |
|
298 | - else { |
|
294 | + } else { |
|
299 | 295 | return false; |
300 | 296 | } |
301 | 297 | } |
302 | - } |
|
303 | - else { |
|
298 | + } else { |
|
304 | 299 | if ($this->getIdIdentiteExist($destinataire) !== false) { |
305 | 300 | $destinataires[] = $this->getIdIdentiteExist($destinataire); |
306 | - } |
|
307 | - else { |
|
301 | + } else { |
|
308 | 302 | return false; |
309 | 303 | } |
310 | 304 | } |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | if (isset($_GET['page'])) { |
36 | 36 | $titre_page = "Administration du site"; |
37 | 37 | $description_page = "Administration du site"; |
38 | - } |
|
39 | - else { |
|
38 | + } else { |
|
40 | 39 | $titre_page = "Administration du site"; |
41 | 40 | $description_page = "Administration du site"; |
42 | 41 | } |
@@ -66,25 +65,21 @@ discard block |
||
66 | 65 | //si c'est un controleur de base on va cerhcer dans core/admin |
67 | 66 | if ($core !== false) { |
68 | 67 | require_once(ROOT.$lien.".php"); |
69 | - } |
|
70 | - else if ($module !== false) { |
|
68 | + } else if ($module !== false) { |
|
71 | 69 | $explode = explode("/", $lien, 3); |
72 | 70 | |
73 | 71 | require_once(ROOT.$explode[0]."/".$explode[1]."/admin/controller/".$explode[2].".php"); |
74 | - } |
|
75 | - else { |
|
72 | + } else { |
|
76 | 73 | require_once("admin/controller/".$lien.".php"); |
77 | 74 | } |
78 | 75 | } |
79 | 76 | //pour la page de login |
80 | 77 | else if ($page == "login") { |
81 | 78 | require("admin/views/template/login_admin.php"); |
82 | - } |
|
83 | - else { |
|
79 | + } else { |
|
84 | 80 | if (!isset($_SESSION["idlogin".CLEF_SITE])) { |
85 | 81 | Connexion::setObgConnecte(WEBROOT."administrator/login"); |
86 | - } |
|
87 | - else { |
|
82 | + } else { |
|
88 | 83 | if (\core\functions\ChaineCaractere::FindInString($page, "modules/") == true) { |
89 | 84 | //utilisé pour initialiser les modules |
90 | 85 | $page_module = $page; |
@@ -99,8 +94,7 @@ discard block |
||
99 | 94 | if (($droit_acces->getDroitAccesPage("gestion-comptes/index") == false) && ($page == "gestion-comptes")) { |
100 | 95 | FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès"); |
101 | 96 | header("location:".WEBROOT."administrator"); |
102 | - } |
|
103 | - else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) { |
|
97 | + } else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) { |
|
104 | 98 | FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès"); |
105 | 99 | header("location:".WEBROOT."administrator"); |
106 | 100 | } |
@@ -108,8 +102,7 @@ discard block |
||
108 | 102 | if (($droit_acces->getDroitAccesPage($page) == false) && (!isset($page_module))) { |
109 | 103 | FlashMessage::setFlash("Vous n'avez pas les droits pour accéder à cette page, contacter votre gérant pour y avoir accès"); |
110 | 104 | header("location:".WEBROOT."administrator"); |
111 | - } |
|
112 | - else { |
|
105 | + } else { |
|
113 | 106 | $cache = new \core\Cache($page, 1); |
114 | 107 | $admin = new Admin($_SESSION["idlogin".CLEF_SITE]); |
115 | 108 | |
@@ -121,14 +114,12 @@ discard block |
||
121 | 114 | } |
122 | 115 | } |
123 | 116 | } |
124 | - } |
|
125 | - else { |
|
117 | + } else { |
|
126 | 118 | Connexion::setObgConnecte(WEBROOT."administrator/login"); |
127 | 119 | |
128 | 120 | if (!isset($_SESSION["idlogin".CLEF_SITE])) { |
129 | 121 | Connexion::setObgConnecte(WEBROOT."administrator/login"); |
130 | - } |
|
131 | - else { |
|
122 | + } else { |
|
132 | 123 | $page = "index"; |
133 | 124 | $admin = new Admin($_SESSION["idlogin".CLEF_SITE]); |
134 | 125 | require(ROOT."admin/controller/initialise_all.php"); |
@@ -35,8 +35,7 @@ discard block |
||
35 | 35 | if ((isset($_GET['page'])) && ($_GET['page'] != null)) { |
36 | 36 | $page = $_GET['page']; |
37 | 37 | $contenu->getHeadPage(0, $page); |
38 | - } |
|
39 | - else { |
|
38 | + } else { |
|
40 | 39 | $contenu->getHeadPage(1); |
41 | 40 | } |
42 | 41 | |
@@ -70,17 +69,14 @@ discard block |
||
70 | 69 | //si c'est un controleur de base on va cerhcer dans core/admin |
71 | 70 | if ($core !== false) { |
72 | 71 | require_once(ROOT.$lien.".php"); |
73 | - } |
|
74 | - else if ($module !== false) { |
|
72 | + } else if ($module !== false) { |
|
75 | 73 | $explode = explode("/", $lien, 3); |
76 | 74 | |
77 | 75 | require_once(ROOT.$explode[0]."/".$explode[1]."/app/controller/".$explode[2].".php"); |
78 | - } |
|
79 | - else { |
|
76 | + } else { |
|
80 | 77 | require_once("app/controller/".$lien.".php"); |
81 | 78 | } |
82 | - } |
|
83 | - else { |
|
79 | + } else { |
|
84 | 80 | $cache = new \core\Cache($page); |
85 | 81 | |
86 | 82 | $router_module = new RouterModule(); |
@@ -98,8 +94,7 @@ discard block |
||
98 | 94 | echo("<pre>"); |
99 | 95 | print_r($arr); |
100 | 96 | echo("</pre>"); |
101 | - } |
|
102 | - else { |
|
97 | + } else { |
|
103 | 98 | $contenu->getContenuPage(); |
104 | 99 | $contenu_page = $contenu->getContenu(); |
105 | 100 | |
@@ -122,8 +117,7 @@ discard block |
||
122 | 117 | } |
123 | 118 | $cache->setEnd(); |
124 | 119 | } |
125 | - } |
|
126 | - else { |
|
120 | + } else { |
|
127 | 121 | $contenu->getContenuPage(); |
128 | 122 | $contenu_page = $contenu->getContenu(); |
129 | 123 |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | if (isset($_POST['admin'])) { |
6 | 6 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0); |
7 | - } |
|
8 | - else { |
|
7 | + } else { |
|
9 | 8 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0); |
10 | 9 | } |
11 | 10 | \ No newline at end of file |
@@ -4,7 +4,6 @@ |
||
4 | 4 | |
5 | 5 | if (isset($_POST['admin'])) { |
6 | 6 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator", 0); |
7 | - } |
|
8 | - else { |
|
7 | + } else { |
|
9 | 8 | \core\auth\Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php", 0); |
10 | 9 | } |
11 | 10 | \ No newline at end of file |
@@ -7,8 +7,7 @@ |
||
7 | 7 | |
8 | 8 | if ($validator->getErrors() !== null) { |
9 | 9 | \core\HTML\flashmessage\FlashMessage::setFlash($validator->getErrors()); |
10 | - } |
|
11 | - else { |
|
10 | + } else { |
|
12 | 11 | $type = $_POST["type"]; |
13 | 12 | $objet = $_POST['objet']." de la part de ".$_SERVER['HTTP_HOST']; |
14 | 13 | $demande = $_POST['demande']; |