@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | * pour intialiser la ou les clauses where d'une requete |
| 112 | 112 | */ |
| 113 | 113 | public function where($champ, $cond, $champ_test, $closure = null) { |
| 114 | - if ( $closure === null) { |
|
| 114 | + if ($closure === null) { |
|
| 115 | 115 | $this->conditions[] = $champ.$cond.$champ_test; |
| 116 | 116 | } |
| 117 | 117 | else { |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | * fonction qui permet de récupérer un select fait sur une table |
| 128 | 128 | */ |
| 129 | 129 | public function get() { |
| 130 | - $requete = $this->req_beginning . implode(",", $this->champs) . " FROM " . implode(",", $this->table); |
|
| 130 | + $requete = $this->req_beginning.implode(",", $this->champs)." FROM ".implode(",", $this->table); |
|
| 131 | 131 | |
| 132 | 132 | if (!empty($this->conditions)) { |
| 133 | - $requete .= " WHERE ". implode(" ", $this->conditions); |
|
| 133 | + $requete .= " WHERE ".implode(" ", $this->conditions); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | $this->unsetQueryBuilder(); |
@@ -145,15 +145,15 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | $datas = []; |
| 147 | 147 | $count = count($this->champs); |
| 148 | - for ($i=0 ; $i<$count ; $i++) { |
|
| 148 | + for ($i = 0; $i < $count; $i++) { |
|
| 149 | 149 | $datas[] = $this->champs[$i]."=:".$this->champs[$i]; |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | //si on a des conditions alors on sera dans un insert |
| 153 | - $requete = $this->req_beginning . implode(",", $this->table) . " SET " . implode(", ", $datas); |
|
| 153 | + $requete = $this->req_beginning.implode(",", $this->table)." SET ".implode(", ", $datas); |
|
| 154 | 154 | |
| 155 | 155 | if (!empty($this->conditions)) { |
| 156 | - $requete .= " WHERE " . implode(" ", $this->conditions); |
|
| 156 | + $requete .= " WHERE ".implode(" ", $this->conditions); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | $this->prepare($requete, $values); |
@@ -164,10 +164,10 @@ discard block |
||
| 164 | 164 | * fonction utilisée pour finir un delete |
| 165 | 165 | */ |
| 166 | 166 | public function del() { |
| 167 | - $requete = $this->req_beginning . implode(",", $this->table); |
|
| 167 | + $requete = $this->req_beginning.implode(",", $this->table); |
|
| 168 | 168 | |
| 169 | 169 | if (!empty($this->conditions)) { |
| 170 | - $requete .= " WHERE " . implode(" ", $this->conditions); |
|
| 170 | + $requete .= " WHERE ".implode(" ", $this->conditions); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | $this->query($requete); |
@@ -76,8 +76,7 @@ |
||
| 76 | 76 | |
| 77 | 77 | if ($id_page != 0) { |
| 78 | 78 | $query = $dbc->query("SELECT balise_title, meta_description, ID_page FROM page WHERE ID_page=".$id_page); |
| 79 | - } |
|
| 80 | - else { |
|
| 79 | + } else { |
|
| 81 | 80 | $query = $dbc->query("SELECT balise_title, meta_description, ID_page FROM page WHERE url LIKE '$url'"); |
| 82 | 81 | } |
| 83 | 82 | |
@@ -17,11 +17,9 @@ discard block |
||
| 17 | 17 | |
| 18 | 18 | if ($type == "error") { |
| 19 | 19 | $icone = "<i class='fa fa-close'></i>"; |
| 20 | - } |
|
| 21 | - else if ($type == "success") { |
|
| 20 | + } else if ($type == "success") { |
|
| 22 | 21 | $icone = "<i class='fa fa-check'></i>"; |
| 23 | - } |
|
| 24 | - else { |
|
| 22 | + } else { |
|
| 25 | 23 | $icone = "<i class='fa fa-info'></i>"; |
| 26 | 24 | } |
| 27 | 25 | |
@@ -43,8 +41,7 @@ discard block |
||
| 43 | 41 | if (strstr($_SERVER['SCRIPT_NAME'], "index.php")) { |
| 44 | 42 | //definit le chemin sachant que l'on part de index.php |
| 45 | 43 | $chemin = str_replace("\\", "/", str_replace("index.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
| 46 | - } |
|
| 47 | - else { |
|
| 44 | + } else { |
|
| 48 | 45 | //definit le chemin sachant que l'on part de admin.php |
| 49 | 46 | $chemin = str_replace("\\", "/", str_replace("admin.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
| 50 | 47 | } |
@@ -28,15 +28,13 @@ discard block |
||
| 28 | 28 | mkdir(ROOT."cache/admin"); |
| 29 | 29 | mkdir(ROOT."cache/app"); |
| 30 | 30 | } |
| 31 | - } |
|
| 32 | - else { |
|
| 31 | + } else { |
|
| 33 | 32 | $this->cache_active = 0; |
| 34 | 33 | } |
| 35 | 34 | |
| 36 | 35 | if ($admin == null) { |
| 37 | 36 | $this->dossier_cache = ROOT."cache/app/"; |
| 38 | - } |
|
| 39 | - else { |
|
| 37 | + } else { |
|
| 40 | 38 | $this->dossier_cache = ROOT."cache/admin/"; |
| 41 | 39 | } |
| 42 | 40 | |
@@ -69,8 +67,7 @@ discard block |
||
| 69 | 67 | $reload_cache = $obj->reload_cache; |
| 70 | 68 | $this->no_cache = $obj->no_cache; |
| 71 | 69 | } |
| 72 | - } |
|
| 73 | - else { |
|
| 70 | + } else { |
|
| 74 | 71 | $value = [ |
| 75 | 72 | "nom_fichier" => $this->page, |
| 76 | 73 | "reload_cache" => 0 |
@@ -101,16 +98,14 @@ discard block |
||
| 101 | 98 | require_once($this->chemin_cache); |
| 102 | 99 | |
| 103 | 100 | return true; |
| 104 | - } |
|
| 105 | - else { |
|
| 101 | + } else { |
|
| 106 | 102 | if ($this->no_cache == null) { |
| 107 | 103 | ob_start(); |
| 108 | 104 | } |
| 109 | 105 | |
| 110 | 106 | return false; |
| 111 | 107 | } |
| 112 | - } |
|
| 113 | - else { |
|
| 108 | + } else { |
|
| 114 | 109 | return false; |
| 115 | 110 | } |
| 116 | 111 | } |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | foreach ($query as $obj) { |
| 22 | 22 | $params = $obj->mdp_params; |
| 23 | 23 | } |
| 24 | - } |
|
| 25 | - else { |
|
| 24 | + } else { |
|
| 26 | 25 | $params = self::$params; |
| 27 | 26 | } |
| 28 | 27 | |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | |
| 75 | 74 | if ($id_identite != null) { |
| 76 | 75 | self::setSaveParams("$taille_bout1, $debut_bout2, $nb_aleatoire_mdp, $taille_bout2, $debut_bout1, ".ChaineCaractere::random(20), $id_identite); |
| 77 | - } |
|
| 78 | - else { |
|
| 76 | + } else { |
|
| 79 | 77 | self::$params = "$taille_bout1, $debut_bout2, $nb_aleatoire_mdp, $taille_bout2, $debut_bout1, ".ChaineCaractere::random(20); |
| 80 | 78 | } |
| 81 | 79 | |
@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | foreach ($query as $obj) { |
| 22 | 22 | $params = $obj->mdp_params; |
| 23 | 23 | } |
| 24 | - } |
|
| 25 | - else { |
|
| 24 | + } else { |
|
| 26 | 25 | $params = self::$params; |
| 27 | 26 | } |
| 28 | 27 | |
@@ -74,8 +73,7 @@ discard block |
||
| 74 | 73 | |
| 75 | 74 | if ($id_identite != null) { |
| 76 | 75 | self::setSaveParams("$taille_bout1, $debut_bout2, $nb_aleatoire_mdp, $taille_bout2, $debut_bout1, ".ChaineCaractere::random(20), $id_identite); |
| 77 | - } |
|
| 78 | - else { |
|
| 76 | + } else { |
|
| 79 | 77 | self::$params = "$taille_bout1, $debut_bout2, $nb_aleatoire_mdp, $taille_bout2, $debut_bout1, ".ChaineCaractere::random(20); |
| 80 | 78 | } |
| 81 | 79 | |
@@ -20,8 +20,12 @@ discard block |
||
| 20 | 20 | //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
| 21 | 21 | public function __construct() { |
| 22 | 22 | //On test si dossier temporaire + modules a la racines existes bien sinon on les crées |
| 23 | - if (!file_exists(ROOT."temp")) mkdir(ROOT."temp"); |
|
| 24 | - if (!file_exists(ROOT."modules")) mkdir(ROOT."modules"); |
|
| 23 | + if (!file_exists(ROOT."temp")) { |
|
| 24 | + mkdir(ROOT."temp"); |
|
| 25 | + } |
|
| 26 | + if (!file_exists(ROOT."modules")) { |
|
| 27 | + mkdir(ROOT."modules"); |
|
| 28 | + } |
|
| 25 | 29 | } |
| 26 | 30 | //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
| 27 | 31 | |
@@ -81,19 +85,16 @@ discard block |
||
| 81 | 85 | |
| 82 | 86 | |
| 83 | 87 | FlashMessage::setFlash("Votre module a bien été ajouté au site.", "success"); |
| 84 | - } |
|
| 85 | - else { |
|
| 88 | + } else { |
|
| 86 | 89 | \core\HTML\flashmessage\FlashMessage::setFlash("Erreur lors du téléchargement du module, veuillez réessayer dans un instant."); |
| 87 | 90 | $this->erreur = true; |
| 88 | 91 | } |
| 89 | - } |
|
| 90 | - else { |
|
| 92 | + } else { |
|
| 91 | 93 | \core\HTML\flashmessage\FlashMessage::setFlash("Erreur lors du téléchargement du module, veuillez réessayer dans un instant."); |
| 92 | 94 | $this->setSupprimerArchiveTemp(); |
| 93 | 95 | $this->erreur = true; |
| 94 | 96 | } |
| 95 | - } |
|
| 96 | - else { |
|
| 97 | + } else { |
|
| 97 | 98 | \core\HTML\flashmessage\FlashMessage::setFlash("Erreur lors du téléchargement du module, veuillez réessayer dans un instant."); |
| 98 | 99 | $this->setSupprimerArchiveTemp(); |
| 99 | 100 | $this->erreur = true; |
@@ -101,18 +102,15 @@ discard block |
||
| 101 | 102 | |
| 102 | 103 | $zip->close(); |
| 103 | 104 | $this->setSupprimerArchiveTemp(); |
| 104 | - } |
|
| 105 | - else { |
|
| 105 | + } else { |
|
| 106 | 106 | FlashMessage::setFlash("Le module n'a pas pu être correctement téléchargé, veuillez réesseyer dans un instant"); |
| 107 | 107 | $this->erreur = true; |
| 108 | 108 | } |
| 109 | - } |
|
| 110 | - else { |
|
| 109 | + } else { |
|
| 111 | 110 | FlashMessage::setFlash("Ce module est déjà présent sur ce site, merci de renommer votre module"); |
| 112 | 111 | $this->erreur = true; |
| 113 | 112 | } |
| 114 | - } |
|
| 115 | - else { |
|
| 113 | + } else { |
|
| 116 | 114 | FlashMessage::setFlash("Le format de votre archive doit obligatoirement être un .zip"); |
| 117 | 115 | $this->erreur = true; |
| 118 | 116 | } |
@@ -150,8 +148,7 @@ discard block |
||
| 150 | 148 | |
| 151 | 149 | FlashMessage::setFlash("Votre module a bien été mis à jour", "success"); |
| 152 | 150 | } |
| 153 | - } |
|
| 154 | - else { |
|
| 151 | + } else { |
|
| 155 | 152 | FlashMessage::setFlash("Impossible de télécharger la mise à jour, veuillez réesseyer dans un instant"); |
| 156 | 153 | } |
| 157 | 154 | } |
@@ -163,8 +160,7 @@ discard block |
||
| 163 | 160 | private function setSupprimerArchiveTemp() { |
| 164 | 161 | if (unlink(TEMPROOT.$this->nom_fichier) == true) { |
| 165 | 162 | return true; |
| 166 | - } |
|
| 167 | - else { |
|
| 163 | + } else { |
|
| 168 | 164 | return false; |
| 169 | 165 | } |
| 170 | 166 | } |
@@ -191,8 +187,7 @@ discard block |
||
| 191 | 187 | ); |
| 192 | 188 | |
| 193 | 189 | $dbc->prepare("UPDATE module SET activer=:activer, installer=:installer WHERE ID_module=:id_module", $value); |
| 194 | - } |
|
| 195 | - else { |
|
| 190 | + } else { |
|
| 196 | 191 | $value = array( |
| 197 | 192 | "id_module" => $id_module, |
| 198 | 193 | ); |
@@ -234,7 +229,11 @@ discard block |
||
| 234 | 229 | $objects = scandir($url); |
| 235 | 230 | foreach ($objects as $object) { |
| 236 | 231 | if ($object != "." && $object != "..") { |
| 237 | - if (filetype($url."/".$object) == "dir") $this->supprimerDossier($url."/".$object); else unlink($url."/".$object); |
|
| 232 | + if (filetype($url."/".$object) == "dir") { |
|
| 233 | + $this->supprimerDossier($url."/".$object); |
|
| 234 | + } else { |
|
| 235 | + unlink($url."/".$object); |
|
| 236 | + } |
|
| 238 | 237 | } |
| 239 | 238 | } |
| 240 | 239 | reset($objects); |
@@ -140,8 +140,7 @@ discard block |
||
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | return $installer; |
| 143 | - } |
|
| 144 | - else { |
|
| 143 | + } else { |
|
| 145 | 144 | return false; |
| 146 | 145 | } |
| 147 | 146 | } |
@@ -160,8 +159,7 @@ discard block |
||
| 160 | 159 | foreach ($query as $obj) { |
| 161 | 160 | if ($obj->activer == 1) { |
| 162 | 161 | return true; |
| 163 | - } |
|
| 164 | - else { |
|
| 162 | + } else { |
|
| 165 | 163 | return false; |
| 166 | 164 | } |
| 167 | 165 | } |
@@ -183,8 +181,7 @@ discard block |
||
| 183 | 181 | foreach ($query as $obj) { |
| 184 | 182 | if ($obj->mettre_jour == 1) { |
| 185 | 183 | return false; |
| 186 | - } |
|
| 187 | - else { |
|
| 184 | + } else { |
|
| 188 | 185 | return true; |
| 189 | 186 | } |
| 190 | 187 | } |
@@ -208,8 +205,7 @@ discard block |
||
| 208 | 205 | //si pas de version a checker, cela veut dire qu'on vient d'installer le module |
| 209 | 206 | //du coup on met le next_check aa la semaine pro |
| 210 | 207 | $set_next = true; |
| 211 | - } |
|
| 212 | - else if (($obj->next_check_version <= $today) && ($obj->mettre_jour != 1)) { |
|
| 208 | + } else if (($obj->next_check_version <= $today) && ($obj->mettre_jour != 1)) { |
|
| 213 | 209 | //avant tout on regarde si on doit delete une vieille version |
| 214 | 210 | if ($obj->delete_old_version == 1) { |
| 215 | 211 | $import = new ImportModule(); |
@@ -246,8 +242,7 @@ discard block |
||
| 246 | 242 | $dbc->prepare("UPDATE module SET mettre_jour=:update, online_version=:online_version WHERE ID_module=:id_module", $value); |
| 247 | 243 | |
| 248 | 244 | $set_next = true; |
| 249 | - } |
|
| 250 | - else { |
|
| 245 | + } else { |
|
| 251 | 246 | $set_next = true; |
| 252 | 247 | } |
| 253 | 248 | } |
@@ -284,8 +279,7 @@ discard block |
||
| 284 | 279 | $this->setListeModuleMettreJour($nom_module, $version, $online_version); |
| 285 | 280 | |
| 286 | 281 | return true; |
| 287 | - } |
|
| 288 | - else { |
|
| 282 | + } else { |
|
| 289 | 283 | return false; |
| 290 | 284 | } |
| 291 | 285 | } |
@@ -59,12 +59,10 @@ |
||
| 59 | 59 | if (in_array($explode[$i], $this->getAllModules())) { |
| 60 | 60 | $this->module = $explode[$i]; |
| 61 | 61 | $debut_url = $explode[$i]; |
| 62 | - } |
|
| 63 | - else if ($i == 1) { |
|
| 62 | + } else if ($i == 1) { |
|
| 64 | 63 | $centre_url = $explode[$i]; |
| 65 | 64 | $this->page = $explode[$i]; |
| 66 | - } |
|
| 67 | - else { |
|
| 65 | + } else { |
|
| 68 | 66 | $this->parametre = $explode[$i]; |
| 69 | 67 | } |
| 70 | 68 | } |
@@ -48,8 +48,7 @@ |
||
| 48 | 48 | if (strlen(utf8_decode($value)) > $limit_char) { |
| 49 | 49 | self::$erreur = true; |
| 50 | 50 | return "<li>$err_char</li>"; |
| 51 | - } |
|
| 52 | - else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) { |
|
| 51 | + } else if ($dbc->rechercherEgalite($nom_table, $champ, $value, $nom_id_table, $value_id_table) == true) { |
|
| 53 | 52 | self::$erreur = true; |
| 54 | 53 | return "<li>$err_egalite</li>"; |
| 55 | 54 | } |