@@ -33,6 +33,9 @@ discard block |
||
33 | 33 | return $bloc_editable; |
34 | 34 | } |
35 | 35 | |
36 | + /** |
|
37 | + * @param integer $parent |
|
38 | + */ |
|
36 | 39 | private function getOrdrePage($parent) { |
37 | 40 | if (($parent != "") || ($parent != 0)) { |
38 | 41 | $dbc = \core\App::getDb(); |
@@ -66,13 +69,13 @@ discard block |
||
66 | 69 | } |
67 | 70 | |
68 | 71 | /** |
69 | - * @param $nom_table |
|
70 | - * @param $nom_id_table |
|
71 | - * @param $champ |
|
72 | + * @param string $nom_table |
|
73 | + * @param string $nom_id_table |
|
74 | + * @param string $champ |
|
72 | 75 | * @param $value |
73 | - * @param $limit_char |
|
74 | - * @param $err_char |
|
75 | - * @param $err_egalite |
|
76 | + * @param integer $limit_char |
|
77 | + * @param string $err_char |
|
78 | + * @param string $err_egalite |
|
76 | 79 | * @param null $value_id_table |
77 | 80 | * @return string |
78 | 81 | * fonction qui permet de vérifier qu'il n'y ait pas d'erreur dans le champ spécifié ni de doublons |
@@ -52,7 +52,9 @@ discard block |
||
52 | 52 | private function getParentId($parent) { |
53 | 53 | $dbc = \core\App::getDb(); |
54 | 54 | |
55 | - if ($parent == "") return 0; |
|
55 | + if ($parent == "") { |
|
56 | + return 0; |
|
57 | + } |
|
56 | 58 | |
57 | 59 | $query = $dbc->select("ID_page")->from("page")->where("titre", " LIKE ", '"%'.$parent.'%"', "", true)->get(); |
58 | 60 | |
@@ -83,8 +85,7 @@ discard block |
||
83 | 85 | if (strlen(utf8_decode($value)) > $limit_char) { |
84 | 86 | $this->erreur = true; |
85 | 87 | return "<li>$err_char</li>"; |
86 | - } |
|
87 | - else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) { |
|
88 | + } else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) { |
|
88 | 89 | $this->erreur = true; |
89 | 90 | return "<li>$err_egalite</li>"; |
90 | 91 | } |
@@ -167,13 +168,11 @@ discard block |
||
167 | 168 | if ($parent == "") { |
168 | 169 | $this->setAjoutLienNavigation("ID_page", $this->id_page, 1); |
169 | 170 | } |
170 | - } |
|
171 | - else { |
|
171 | + } else { |
|
172 | 172 | FlashMessage::setFlash("Impossible de créer cette page, veuillez réeseyer dans un moment. Si le problème persiste contactez votre administrateur."); |
173 | 173 | $this->erreur = true; |
174 | 174 | } |
175 | - } |
|
176 | - else { |
|
175 | + } else { |
|
177 | 176 | $this->setErreurContenus($balise_title, $url, $meta_description, $titre_page, $parent, $err_balise_title, $err_url, $err_meta_description, $err_titre_page); |
178 | 177 | $this->erreur = true; |
179 | 178 | } |
@@ -219,8 +218,7 @@ discard block |
||
219 | 218 | if ($parent == "") { |
220 | 219 | $this->setAjoutLienNavigation("ID_page", $this->id_page, 1); |
221 | 220 | } |
222 | - } |
|
223 | - else { |
|
221 | + } else { |
|
224 | 222 | $this->setErreurContenus($balise_title, $url, $titre_page, $parent, $err_balise_title, $err_url, $err_titre_page); |
225 | 223 | $this->erreur = true; |
226 | 224 | } |
@@ -284,8 +282,7 @@ discard block |
||
284 | 282 | ->set(); |
285 | 283 | |
286 | 284 | $this->setModifierLienNavigation("ID_page", $id_page, $this->getParentId($parent), $affiche); |
287 | - } |
|
288 | - else { |
|
285 | + } else { |
|
289 | 286 | $this->setErreurContenus($balise_title, $url, $meta_description, $titre_page, $parent, $err_balise_title, $err_url, $err_meta_description, $err_titre_page); |
290 | 287 | } |
291 | 288 | } |
@@ -334,8 +331,7 @@ discard block |
||
334 | 331 | FlashMessage::setFlash("Impossible de supprimer cette page, veuillez contacter votre administrateur pour corriger ce problème"); |
335 | 332 | $this->erreur = true; |
336 | 333 | } |
337 | - } |
|
338 | - else { |
|
334 | + } else { |
|
339 | 335 | FlashMessage::setFlash("Impossible de supprimer cette page, veuillez contacter votre administrateur pour corriger ce problème"); |
340 | 336 | $this->erreur = true; |
341 | 337 | } |
@@ -361,8 +357,7 @@ discard block |
||
361 | 357 | if ($parent != "") { |
362 | 358 | $nav = new Navigation(); |
363 | 359 | $nav->setSupprimerLien($id, $id_page); |
364 | - } |
|
365 | - else if (($affiche == 1) && ($parent == "")) { |
|
360 | + } else if (($affiche == 1) && ($parent == "")) { |
|
366 | 361 | $this->setAjoutLienNavigation($id, $id_page, $affiche); |
367 | 362 | } |
368 | 363 | } |
@@ -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() { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | public function getRessourceConstruire() { |
46 | 46 | return $this->ressource_construire; |
47 | 47 | } |
48 | - public function getInfoBatiment(){ |
|
48 | + public function getInfoBatiment() { |
|
49 | 49 | return $this->info_batiment; |
50 | 50 | } |
51 | 51 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | if ((is_array($query)) && (count($query) > 0)) { |
78 | 78 | foreach ($query as $obj) { |
79 | 79 | if ($obj->construction == 1) { |
80 | - return $obj->niveau-1; |
|
80 | + return $obj->niveau - 1; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | return $obj->niveau; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if ($niveau > 0) { |
146 | 146 | $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $niveau)->get(); |
147 | 147 | |
148 | - if ((is_array($query)) && (count($query) > 0)){ |
|
148 | + if ((is_array($query)) && (count($query) > 0)) { |
|
149 | 149 | foreach ($query as $obj) { |
150 | 150 | return $obj->stockage; |
151 | 151 | } |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | if (($construction[1] == true) && ($this->niveau_batiment > 1)) { |
236 | 236 | $this->niveau_batiment = $this->niveau_batiment + 1; |
237 | 237 | } |
238 | - $max_level = $this->getInfoUpgradeBatiment(); |
|
238 | + $max_level = $this->getInfoUpgradeBatiment(); |
|
239 | 239 | } |
240 | 240 | else { |
241 | 241 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
@@ -307,12 +307,12 @@ discard block |
||
307 | 307 | $id_batiment = $obj->ID_batiment; |
308 | 308 | } |
309 | 309 | |
310 | - if ($this->date_fin_construction-$today <= 0) { |
|
310 | + if ($this->date_fin_construction - $today <= 0) { |
|
311 | 311 | $this->setTerminerConstruction($id_batiment); |
312 | 312 | } |
313 | 313 | else { |
314 | 314 | Bataille::setValues([ |
315 | - "date_fin_construction" => $this->date_fin_construction-$today, |
|
315 | + "date_fin_construction" => $this->date_fin_construction - $today, |
|
316 | 316 | "nom_batiment_construction" => $this->nom_batiment_construction |
317 | 317 | ]); |
318 | 318 | } |
@@ -361,7 +361,7 @@ discard block |
||
361 | 361 | //et compare la liste des batiments qu'il faut pour construire le batiment |
362 | 362 | //a ceux qui sont deja construit dans la base |
363 | 363 | //si tous les batments qu'il faut son batis on autorise la construction du batiment |
364 | - for ($i=0 ; $i<$c_all_batiment ; $i++) { |
|
364 | + for ($i = 0; $i < $c_all_batiment; $i++) { |
|
365 | 365 | if (!in_array($all_batiment[$i], $batiment_construit)) { |
366 | 366 | $query = $dbc1->select("pour_construire") |
367 | 367 | ->select("temps_construction") |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | private function getRessourceConstruireBatiment($nom_batiment_sql, $niveau) { |
426 | 426 | $dbc1 = Bataille::getDb(); |
427 | 427 | |
428 | - $niveau = $niveau+1; |
|
428 | + $niveau = $niveau + 1; |
|
429 | 429 | |
430 | 430 | $query = $dbc1->select("ressource_construire")->from($nom_batiment_sql)->where("ID_".$nom_batiment_sql, "=", $niveau)->get(); |
431 | 431 | |
@@ -458,7 +458,7 @@ discard block |
||
458 | 458 | */ |
459 | 459 | private function getTestBatimentConstruction($nom_batiment) { |
460 | 460 | if (ChaineCaractere::FindInString($nom_batiment, " en construction") == true) { |
461 | - return [substr($nom_batiment, 0, (0-strlen(" en construction"))), true]; |
|
461 | + return [substr($nom_batiment, 0, (0 - strlen(" en construction"))), true]; |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | return [$nom_batiment, false]; |
@@ -473,7 +473,7 @@ discard block |
||
473 | 473 | $dbc1 = Bataille::getDb(); |
474 | 474 | |
475 | 475 | //récupération du temps et des ressources pour construire |
476 | - $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1)->get(); |
|
476 | + $query = $dbc1->select()->from($this->nom_batiment_sql)->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1)->get(); |
|
477 | 477 | |
478 | 478 | //si on a quelque chose cela veut dire qu'on est pas encore au lvl max du batiment |
479 | 479 | if ((is_array($query)) && (count($query) > 0)) { |
@@ -484,11 +484,11 @@ discard block |
||
484 | 484 | |
485 | 485 | //récupération des éléments particulier à un batiment |
486 | 486 | if ($this->nom_batiment_sql == "entrepot") { |
487 | - $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment+1)->get(); |
|
487 | + $query = $dbc1->select("stockage")->from("entrepot")->where("ID_entrepot", "=", $this->niveau_batiment + 1)->get(); |
|
488 | 488 | |
489 | - if ((is_array($query)) && (count($query) > 0)){ |
|
489 | + if ((is_array($query)) && (count($query) > 0)) { |
|
490 | 490 | foreach ($query as $obj) { |
491 | - $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ". $obj->stockage; |
|
491 | + $this->info_batiment = "Capacité de l'entrepôt au prochain niveau : ".$obj->stockage; |
|
492 | 492 | } |
493 | 493 | } |
494 | 494 | } |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | $query = $dbc1->select("ressource_construire") |
550 | 550 | ->select("temps_construction") |
551 | 551 | ->from($this->nom_batiment_sql) |
552 | - ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment+1) |
|
552 | + ->where("ID_".$this->nom_batiment_sql, "=", $this->niveau_batiment + 1) |
|
553 | 553 | ->get(); |
554 | 554 | |
555 | 555 | foreach ($query as $obj) { |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | |
560 | 560 | //on insere la construction dans la table batiment si new batiment |
561 | 561 | if ($un_batiment == 0) { |
562 | - $dbc->insert("niveau", $this->niveau_batiment+1) |
|
562 | + $dbc->insert("niveau", $this->niveau_batiment + 1) |
|
563 | 563 | ->insert("emplacement", $emplacement) |
564 | 564 | ->insert("nom_batiment", $nom_batiment) |
565 | 565 | ->insert("nom_batiment_sql", $this->nom_batiment_sql) |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $this->id_batiment = $dbc->lastInsertId(); |
572 | 572 | } |
573 | 573 | else { |
574 | - $dbc->update("niveau", $this->niveau_batiment+1) |
|
574 | + $dbc->update("niveau", $this->niveau_batiment + 1) |
|
575 | 575 | ->update("construction", 1) |
576 | 576 | ->from("_bataille_batiment") |
577 | 577 | ->where("ID_batiment", "=", $this->id_batiment, "AND") |
@@ -586,7 +586,7 @@ discard block |
||
586 | 586 | $today = $today->getTimestamp(); |
587 | 587 | |
588 | 588 | //date de la fin de la construction en seconde |
589 | - $fin_construction = $today+$temps_construction; |
|
589 | + $fin_construction = $today + $temps_construction; |
|
590 | 590 | |
591 | 591 | $dbc->insert("date_fin", $fin_construction) |
592 | 592 | ->insert("emplacement_construction", $emplacement) |
@@ -82,8 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | return $obj->niveau; |
84 | 84 | } |
85 | - } |
|
86 | - else { |
|
85 | + } else { |
|
87 | 86 | return 0; |
88 | 87 | } |
89 | 88 | } |
@@ -96,10 +95,18 @@ discard block |
||
96 | 95 | public function getProduction($ressource) { |
97 | 96 | $dbc1 = Bataille::getDb(); |
98 | 97 | |
99 | - if ($ressource == "eau") $nom_batiment = "centrale_eau"; |
|
100 | - if ($ressource == "electricite") $nom_batiment = "centrale_electrique"; |
|
101 | - if ($ressource == "fuel") $nom_batiment = "station_pompage_fuel"; |
|
102 | - if ($ressource == "fer") $nom_batiment = "station_forage"; |
|
98 | + if ($ressource == "eau") { |
|
99 | + $nom_batiment = "centrale_eau"; |
|
100 | + } |
|
101 | + if ($ressource == "electricite") { |
|
102 | + $nom_batiment = "centrale_electrique"; |
|
103 | + } |
|
104 | + if ($ressource == "fuel") { |
|
105 | + $nom_batiment = "station_pompage_fuel"; |
|
106 | + } |
|
107 | + if ($ressource == "fer") { |
|
108 | + $nom_batiment = "station_forage"; |
|
109 | + } |
|
103 | 110 | |
104 | 111 | $niveau = $this->getNiveauBatiment($nom_batiment); |
105 | 112 | |
@@ -120,15 +127,13 @@ discard block |
||
120 | 127 | foreach ($query as $obj) { |
121 | 128 | $prod_addon = $obj->production; |
122 | 129 | } |
123 | - } |
|
124 | - else { |
|
130 | + } else { |
|
125 | 131 | $prod_addon = 0; |
126 | 132 | } |
127 | 133 | |
128 | 134 | return $prod + $prod_addon; |
129 | 135 | } |
130 | - } |
|
131 | - else { |
|
136 | + } else { |
|
132 | 137 | return 20; |
133 | 138 | } |
134 | 139 | } |
@@ -150,8 +155,7 @@ discard block |
||
150 | 155 | return $obj->stockage; |
151 | 156 | } |
152 | 157 | } |
153 | - } |
|
154 | - else { |
|
158 | + } else { |
|
155 | 159 | return 1000; |
156 | 160 | } |
157 | 161 | } |
@@ -236,8 +240,7 @@ discard block |
||
236 | 240 | $this->niveau_batiment = $this->niveau_batiment + 1; |
237 | 241 | } |
238 | 242 | $max_level = $this->getInfoUpgradeBatiment(); |
239 | - } |
|
240 | - else { |
|
243 | + } else { |
|
241 | 244 | //on test voir si le bat est au niveau max et si il peut avoir un addon |
242 | 245 | if (ChaineCaractere::FindInString($nom_batiment, "addon")) { |
243 | 246 | $query = $dbc1->select("nom_table")->from("liste_batiment")->where("nom", "=", $nom_batiment)->get(); |
@@ -250,12 +253,10 @@ discard block |
||
250 | 253 | $this->niveau_batiment = 0; |
251 | 254 | |
252 | 255 | $max_level = $this->getInfoUpgradeBatiment(); |
253 | - } |
|
254 | - else { |
|
256 | + } else { |
|
255 | 257 | $max_level = 0; |
256 | 258 | } |
257 | - } |
|
258 | - else { |
|
259 | + } else { |
|
259 | 260 | $max_level = 0; |
260 | 261 | } |
261 | 262 | } |
@@ -309,8 +310,7 @@ discard block |
||
309 | 310 | |
310 | 311 | if ($this->date_fin_construction-$today <= 0) { |
311 | 312 | $this->setTerminerConstruction($id_batiment); |
312 | - } |
|
313 | - else { |
|
313 | + } else { |
|
314 | 314 | Bataille::setValues([ |
315 | 315 | "date_fin_construction" => $this->date_fin_construction-$today, |
316 | 316 | "nom_batiment_construction" => $this->nom_batiment_construction |
@@ -373,8 +373,7 @@ discard block |
||
373 | 373 | foreach ($query as $obj) { |
374 | 374 | if ($obj->pour_construire != null) { |
375 | 375 | $pour_construire = unserialize($obj->pour_construire); |
376 | - } |
|
377 | - else { |
|
376 | + } else { |
|
378 | 377 | $pour_construire = []; |
379 | 378 | } |
380 | 379 | |
@@ -397,11 +396,9 @@ discard block |
||
397 | 396 | ]; |
398 | 397 | } |
399 | 398 | } |
400 | - } |
|
401 | - else if (count($pour_construire) > 1) { |
|
399 | + } else if (count($pour_construire) > 1) { |
|
402 | 400 | //TODO si besoin de plus d'un seul batiment pour etre construit |
403 | - } |
|
404 | - else { |
|
401 | + } else { |
|
405 | 402 | $ressource = $this->getRessourceConstruireBatiment($all_batiment[$i], 0); |
406 | 403 | |
407 | 404 | $batiment_construire[] = [ |
@@ -531,8 +528,7 @@ discard block |
||
531 | 528 | $ressource = $this->getRessourceConstruireBatiment($nom_batiment_sql, 0); |
532 | 529 | $this->nom_batiment_sql = $nom_batiment_sql; |
533 | 530 | $this->niveau_batiment = 0; |
534 | - } |
|
535 | - else { |
|
531 | + } else { |
|
536 | 532 | //si c'est le lvl 0 de l'addon |
537 | 533 | if ($this->niveau_batiment == 0) { |
538 | 534 | $un_batiment = 0; |
@@ -543,8 +539,7 @@ discard block |
||
543 | 539 | //si pas assez de ressource |
544 | 540 | if (in_array("rouge", $ressource[0])) { |
545 | 541 | FlashMessage::setFlash("Pas assez de ressources pour construire ce batiment"); |
546 | - } |
|
547 | - else { |
|
542 | + } else { |
|
548 | 543 | //recuperation du temps de construction |
549 | 544 | $query = $dbc1->select("ressource_construire") |
550 | 545 | ->select("temps_construction") |
@@ -569,8 +564,7 @@ discard block |
||
569 | 564 | ->set(); |
570 | 565 | |
571 | 566 | $this->id_batiment = $dbc->lastInsertId(); |
572 | - } |
|
573 | - else { |
|
567 | + } else { |
|
574 | 568 | $dbc->update("niveau", $this->niveau_batiment+1) |
575 | 569 | ->update("construction", 1) |
576 | 570 | ->from("_bataille_batiment") |
@@ -598,8 +592,7 @@ discard block |
||
598 | 592 | //on retire les ressources de la base |
599 | 593 | Bataille::getRessource()->setRetirerRessource($ressource_construction[2], $ressource_construction[3], $ressource_construction[0], $ressource_construction[1]); |
600 | 594 | } |
601 | - } |
|
602 | - else { |
|
595 | + } else { |
|
603 | 596 | FlashMessage::setFlash("Un batiment est déjà en construction, vous ne pouvez pas en construire un autre !"); |
604 | 597 | } |
605 | 598 | } |
@@ -1,5 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | - if (!isset($page_root)) $page_root = "index.php"; |
|
2 | + if (!isset($page_root)) { |
|
3 | + $page_root = "index.php"; |
|
4 | + } |
|
3 | 5 | |
4 | 6 | //-------------------------- CONSTANTE POUR LES ROUTES ----------------------------------------------------------------------------// |
5 | 7 | //definit le chemin vers la racine du projet (depuis racine serveur web |
@@ -46,15 +48,13 @@ discard block |
||
46 | 48 | if (($ini["installation"] == 1) && ($page_root != "installation.php")) { |
47 | 49 | header("location:".WEBROOT."installation-ribs"); |
48 | 50 | } |
49 | - } |
|
50 | - else { |
|
51 | + } else { |
|
51 | 52 | header("location:".WEBROOT."installation"); |
52 | 53 | } |
53 | 54 | |
54 | 55 | if ($ini["developpment"] == 1) { |
55 | 56 | $tab = "dev"; |
56 | - } |
|
57 | - else { |
|
57 | + } else { |
|
58 | 58 | $tab = "prod"; |
59 | 59 | } |
60 | 60 |
@@ -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 |
@@ -120,7 +120,7 @@ |
||
120 | 120 | public static function getTestAssezRessourceBase($nom_ressource, $ressource) { |
121 | 121 | $f = "get".ucfirst($nom_ressource); |
122 | 122 | |
123 | - if ($ressource > Bataille::getRessource()->$f()) { |
|
123 | + if ($ressource > Bataille::getRessource()->$f()) { |
|
124 | 124 | /*echo("$nom_ressource $ressource ".Bataille::getRessource()->getEau()." ---");*/ |
125 | 125 | return [$ressource, "rouge"]; |
126 | 126 | } |
@@ -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") |
@@ -81,8 +81,7 @@ discard block |
||
81 | 81 | "niveau" => $obj->niveau, |
82 | 82 | "emplacement" => $i |
83 | 83 | ]; |
84 | - } |
|
85 | - else { |
|
84 | + } else { |
|
86 | 85 | $batiments[] = [ |
87 | 86 | "nom_batiment" => $obj->nom_batiment, |
88 | 87 | "nom_batiment_sql" => $obj->nom_batiment_sql, |
@@ -91,8 +90,7 @@ discard block |
||
91 | 90 | ]; |
92 | 91 | } |
93 | 92 | } |
94 | - } |
|
95 | - else { |
|
93 | + } else { |
|
96 | 94 | $batiments[] = [ |
97 | 95 | "nom_batiment" => "A construire", |
98 | 96 | "nom_batiment_sql" => "a_construire", |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | $last_co = new \DateTime($last_co); |
86 | 86 | $last_co = $last_co->getTimestamp(); |
87 | 87 | |
88 | - $diff_temps = $today-$last_co; |
|
88 | + $diff_temps = $today - $last_co; |
|
89 | 89 | |
90 | 90 | //si la derniere actualisation ou connexion est supérieur à 30 sec |
91 | 91 | if ($diff_temps > 180) { |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | private function setAddRessource($nom_ressource, $ressrouce, $diff_temps) { |
106 | 106 | $dbc = App::getDb(); |
107 | 107 | |
108 | - $ressource = $ressrouce+(round((Bataille::getBatiment()->getProduction($nom_ressource)/3600)*$diff_temps)); |
|
108 | + $ressource = $ressrouce + (round((Bataille::getBatiment()->getProduction($nom_ressource) / 3600) * $diff_temps)); |
|
109 | 109 | $stockage_max = Bataille::getBatiment()->getStockageEntrepot(); |
110 | 110 | |
111 | 111 | if ($ressource > $stockage_max) { |
@@ -133,11 +133,11 @@ discard block |
||
133 | 133 | public function setRetirerRessource($eau, $electricite, $fer, $fuel, $nourriture) { |
134 | 134 | $dbc = App::getDb(); |
135 | 135 | |
136 | - $eau = $this->getEau()-$eau; |
|
137 | - $electricite = $this->getElectricite()-$electricite; |
|
138 | - $fer = $this->getFer()-$fer; |
|
139 | - $fuel = $this->getFuel()-$fuel; |
|
140 | - $nourriture = $this->getNourriture()-$nourriture; |
|
136 | + $eau = $this->getEau() - $eau; |
|
137 | + $electricite = $this->getElectricite() - $electricite; |
|
138 | + $fer = $this->getFer() - $fer; |
|
139 | + $fuel = $this->getFuel() - $fuel; |
|
140 | + $nourriture = $this->getNourriture() - $nourriture; |
|
141 | 141 | |
142 | 142 | |
143 | 143 | $dbc->update("eau", $eau) |
@@ -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 |