@@ -30,8 +30,7 @@ discard block |
||
30 | 30 | if (isset($_GET['page'])) { |
31 | 31 | $titre_page = "Administration du site"; |
32 | 32 | $description_page = "Administration du site"; |
33 | - } |
|
34 | - else { |
|
33 | + } else { |
|
35 | 34 | $titre_page = "Administration du site"; |
36 | 35 | $description_page = "Administration du site"; |
37 | 36 | } |
@@ -61,25 +60,21 @@ discard block |
||
61 | 60 | //si c'est un controleur de base on va cerhcer dans core/admin |
62 | 61 | if ($core !== false) { |
63 | 62 | require_once(ROOT.$lien.".php"); |
64 | - } |
|
65 | - else if ($module !== false) { |
|
63 | + } else if ($module !== false) { |
|
66 | 64 | $explode = explode("/", $lien, 3); |
67 | 65 | |
68 | 66 | require_once(ROOT.$explode[0]."/".$explode[1]."/admin/controller/".$explode[2].".php"); |
69 | - } |
|
70 | - else { |
|
67 | + } else { |
|
71 | 68 | require_once("admin/controller/".$lien.".php"); |
72 | 69 | } |
73 | 70 | } |
74 | 71 | //pour la page de login |
75 | 72 | else if ($page == "login") { |
76 | 73 | require("admin/views/template/login_admin.php"); |
77 | - } |
|
78 | - else { |
|
74 | + } else { |
|
79 | 75 | if (!isset($_SESSION["idlogin".CLEF_SITE])) { |
80 | 76 | Connexion::setConnexion(1, WEBROOT."administrator/login"); |
81 | - } |
|
82 | - else { |
|
77 | + } else { |
|
83 | 78 | if (\core\functions\ChaineCaractere::FindInString($page, "modules/") == true) { |
84 | 79 | //utilisé pour initialiser les modules |
85 | 80 | $page_module = $page; |
@@ -94,8 +89,7 @@ discard block |
||
94 | 89 | if (($droit_acces->getDroitAccesPage("gestion-comptes/index") == false) && ($page == "gestion-comptes")) { |
95 | 90 | FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès"); |
96 | 91 | header("location:".WEBROOT."administrator"); |
97 | - } |
|
98 | - else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) { |
|
92 | + } else if (($droit_acces->getDroitAccesPage("gestion-droits-acces/index") == false) && ($page == "gestion-droits-acces")) { |
|
99 | 93 | FlashMessage::setFlash("L'accès à cette page n'est pas activé, veuillez contacter votre administrateur pour y avoir accès"); |
100 | 94 | header("location:".WEBROOT."administrator"); |
101 | 95 | } |
@@ -103,8 +97,7 @@ discard block |
||
103 | 97 | if ($droit_acces->getDroitAccesPage($page) == false) { |
104 | 98 | FlashMessage::setFlash("Vous n'avez pas les droits pour accéder à cette page, contacter votre gérant pour y avoir accès"); |
105 | 99 | header("location:".WEBROOT."administrator"); |
106 | - } |
|
107 | - else { |
|
100 | + } else { |
|
108 | 101 | $cache = new \core\Cache($page, 1); |
109 | 102 | $admin = new Admin($_SESSION["idlogin".CLEF_SITE]); |
110 | 103 | |
@@ -116,14 +109,12 @@ discard block |
||
116 | 109 | } |
117 | 110 | } |
118 | 111 | } |
119 | - } |
|
120 | - else { |
|
112 | + } else { |
|
121 | 113 | Connexion::setConnexion(1, WEBROOT."administrator/login"); |
122 | 114 | |
123 | 115 | if (!isset($_SESSION["idlogin".CLEF_SITE])) { |
124 | 116 | Connexion::setConnexion(1, WEBROOT."administrator/login"); |
125 | - } |
|
126 | - else { |
|
117 | + } else { |
|
127 | 118 | $page = "index"; |
128 | 119 | $admin = new Admin($_SESSION["idlogin".CLEF_SITE]); |
129 | 120 | require(ROOT."admin/controller/initialise_all.php"); |
@@ -38,8 +38,7 @@ discard block |
||
38 | 38 | |
39 | 39 | $contenu->getContenuPage(); |
40 | 40 | $contenu_page = $contenu->getContenu(); |
41 | - } |
|
42 | - else { |
|
41 | + } else { |
|
43 | 42 | $contenu->getHeadPage(1); |
44 | 43 | $titre_page = $contenu->getBaliseTitle(); |
45 | 44 | $description_page = $contenu->getMetaDescription(); |
@@ -75,17 +74,14 @@ discard block |
||
75 | 74 | //si c'est un controleur de base on va cerhcer dans core/admin |
76 | 75 | if ($core !== false) { |
77 | 76 | require_once(ROOT.$lien.".php"); |
78 | - } |
|
79 | - else if ($module !== false) { |
|
77 | + } else if ($module !== false) { |
|
80 | 78 | $explode = explode("/", $lien, 3); |
81 | 79 | |
82 | 80 | require_once(ROOT.$explode[0]."/".$explode[1]."/app/controller/".$explode[2].".php"); |
83 | - } |
|
84 | - else { |
|
81 | + } else { |
|
85 | 82 | require_once("app/controller/".$lien.".php"); |
86 | 83 | } |
87 | - } |
|
88 | - else { |
|
84 | + } else { |
|
89 | 85 | $cache = new \core\Cache($page); |
90 | 86 | |
91 | 87 | $router_module = new RouterModule(); |
@@ -95,8 +91,7 @@ discard block |
||
95 | 91 | if ($router_module->getController() != "") { |
96 | 92 | require_once(MODULEROOT.$router_module->getController()); |
97 | 93 | } |
98 | - } |
|
99 | - else { |
|
94 | + } else { |
|
100 | 95 | $explode = explode("/", $page); |
101 | 96 | $page = "app/views/".end($explode); |
102 | 97 | |
@@ -111,8 +106,7 @@ discard block |
||
111 | 106 | } |
112 | 107 | $cache->setEnd(); |
113 | 108 | } |
114 | - } |
|
115 | - else { |
|
109 | + } else { |
|
116 | 110 | $page = "app/views/index"; |
117 | 111 | require("app/controller/initialise_all.php"); |
118 | 112 | require("app/views/template/principal.php"); |
@@ -47,8 +47,7 @@ discard block |
||
47 | 47 | //$id_liste_droit_acces = $_SESSION['id_liste_droit_acces']; |
48 | 48 | |
49 | 49 | unset($_SESSION['err_ajout_utilisateur']); |
50 | - } |
|
51 | - else { |
|
50 | + } else { |
|
52 | 51 | $nom = null; |
53 | 52 | $prenom = null; |
54 | 53 | $pseudo = null; |
@@ -75,8 +74,7 @@ discard block |
||
75 | 74 | $contenu_page = $_SESSION['contenu']; |
76 | 75 | |
77 | 76 | unset($_SESSION['err_modification_contenu']); |
78 | - } |
|
79 | - else if ($page == "gestion-contenus/modifier-contenu") { |
|
77 | + } else if ($page == "gestion-contenus/modifier-contenu") { |
|
80 | 78 | $id_page_courante = $_GET['id']; |
81 | 79 | |
82 | 80 | $contenu->getHeadPage($id_page_courante); |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | $parent_courant = $contenu->getParent(); |
90 | 88 | $texte_parent_courant = $gestion_contenu->getParentTexte($parent_courant); |
91 | 89 | $contenu_page = $contenu->getContenu(); |
92 | - } |
|
93 | - else { |
|
90 | + } else { |
|
94 | 91 | $balise_title = null; |
95 | 92 | $url = null; |
96 | 93 | $meta_description = null; |
@@ -131,8 +128,7 @@ discard block |
||
131 | 128 | $contenu_dynamique = $config->getContenusDynamique(); |
132 | 129 | $responsive = $config->getResponsive(); |
133 | 130 | $cache_config = $config->getCache(); |
134 | - } |
|
135 | - else { |
|
131 | + } else { |
|
136 | 132 | $config = new \core\Configuration(); |
137 | 133 | $nom_site = $config->getNomSite(); |
138 | 134 | $url_site = $config->getUrlSite(); |
@@ -156,8 +152,7 @@ discard block |
||
156 | 152 | |
157 | 153 | if (isset($_SESSION['err_modification_configini'])) { |
158 | 154 | |
159 | - } |
|
160 | - else { |
|
155 | + } else { |
|
161 | 156 | $developpement = $ini["developpment"]; |
162 | 157 | |
163 | 158 | $db_type_dev = $ini["dev"]["DB_TYPE"]; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | <td> |
48 | 48 | <?php if (\core\modules\GestionModule::getModuleInstaller($gestion_module_page_syst->getNom()[$i]) == true) { ?> |
49 | 49 | <a class="open-popup" popup="popup-delete-module" href="<?=ADMWEBROOT?>controller/core/modules/installation/supprimer?id_module=<?=$gestion_module_page_syst->getIdModule()[$i]?>">Supprimer</a> |
50 | - <?php }else{ ?> |
|
50 | + <?php } else{ ?> |
|
51 | 51 | <a class="installer-module" href="<?=ADMWEBROOT?>controller/core/modules/installation/installer?url=<?=$gestion_module_page_syst->getUrlTelechargement()[$i]?>">Installer</a> |
52 | 52 | <?php }?> |
53 | 53 | </td> |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | <td> |
91 | 91 | <?php if (\core\modules\GestionModule::getModuleInstaller($gestion_module_page->getNom()[$i]) == true) { ?> |
92 | 92 | <a class="supprimer open-popup" popup="popup-delete-module" href="<?=ADMWEBROOT?>controller/core/modules/installation/supprimer?id_module=<?=$gestion_module_page->getIdModule()[$i]?>">Supprimer</a> |
93 | - <?php }else{ ?> |
|
93 | + <?php } else{ ?> |
|
94 | 94 | <a href="<?=ADMWEBROOT?>controller/core/modules/installation/installer?url=<?=$gestion_module_page->getUrlTelechargement()[$i]?>">Installer</a> |
95 | 95 | <?php }?> |
96 | 96 | </td> |
@@ -22,11 +22,9 @@ discard block |
||
22 | 22 | |
23 | 23 | if ($type == "error") { |
24 | 24 | $icone = "<i class='fa fa-close'></i>"; |
25 | - } |
|
26 | - else if ($type == "success") { |
|
25 | + } else if ($type == "success") { |
|
27 | 26 | $icone = "<i class='fa fa-check'></i>"; |
28 | - } |
|
29 | - else { |
|
27 | + } else { |
|
30 | 28 | $icone = "<i class='fa fa-info'></i>"; |
31 | 29 | } |
32 | 30 | |
@@ -55,16 +53,14 @@ discard block |
||
55 | 53 | if (strstr($_SERVER['SCRIPT_NAME'], "index.php")) { |
56 | 54 | //definit le chemin sachant que l'on part de index.php |
57 | 55 | $chemin = str_replace("\\", "/", str_replace("index.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
58 | - } |
|
59 | - else { |
|
56 | + } else { |
|
60 | 57 | //definit le chemin sachant que l'on part de admin.php |
61 | 58 | $chemin = str_replace("\\", "/", str_replace("admin.php", "", $_SERVER['SCRIPT_NAME']).__NAMESPACE__."/view/"); |
62 | 59 | } |
63 | 60 | |
64 | 61 | |
65 | 62 | require("view/index.php"); |
66 | - } |
|
67 | - else { |
|
63 | + } else { |
|
68 | 64 | echo("$icone $type : $message"); |
69 | 65 | } |
70 | 66 | unset($_SESSION['flash']); |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | $explode = explode("/", $this->chemin_image); |
60 | 60 | $this->image = end($explode); |
61 | 61 | return $this->image; |
62 | - } |
|
63 | - else { |
|
62 | + } else { |
|
64 | 63 | $this->erreur = "Impossible de trouver votre image, vuellez réessayer dans un instant"; |
65 | 64 | return false; |
66 | 65 | } |
@@ -90,8 +89,7 @@ discard block |
||
90 | 89 | $this->erreur = "Vous devez obligatoirement ajouter une image"; |
91 | 90 | return false; |
92 | 91 | } |
93 | - } |
|
94 | - else { |
|
92 | + } else { |
|
95 | 93 | //test si il y a deja une img |
96 | 94 | if ($old_image_req != null) { |
97 | 95 | $query = $dbc->query($old_image_req); |
@@ -109,12 +107,10 @@ discard block |
||
109 | 107 | if (!in_array(substr($image, -3), $this->autorized_extention)) { |
110 | 108 | $this->erreur = "Votre image ne comporte pas l'extension jpg, png, jpeg, gif, JPG, PNG, JPEG, GIF"; |
111 | 109 | return false; |
112 | - } |
|
113 | - else if (($infos_img[0] >= $this->width_max) && ($infos_img[1] >= $this->height_max) && ($_FILES[$name]['size'] >= $this->poid_max)) { |
|
110 | + } else if (($infos_img[0] >= $this->width_max) && ($infos_img[1] >= $this->height_max) && ($_FILES[$name]['size'] >= $this->poid_max)) { |
|
114 | 111 | $this->erreur = "Problème dans les dimensions ou taille de l'image."; |
115 | 112 | return false; |
116 | - } |
|
117 | - else { |
|
113 | + } else { |
|
118 | 114 | $uniqid = uniqid(); |
119 | 115 | |
120 | 116 | if (move_uploaded_file($_FILES[$name]['tmp_name'], $this->dossier_image."/".$uniqid.substr($image, -4))) { |
@@ -129,8 +125,7 @@ discard block |
||
129 | 125 | } |
130 | 126 | |
131 | 127 | return true; |
132 | - } |
|
133 | - else { |
|
128 | + } else { |
|
134 | 129 | $this->erreur = "Impossible d'envoyer votre image sur le serveur, veuillez réessayer dans une instant, si l'erreur se reproduit, contactez votre administrateur"; |
135 | 130 | } |
136 | 131 | } |
@@ -157,8 +152,7 @@ discard block |
||
157 | 152 | $image = $this->dossier_image."/".$img_resize; |
158 | 153 | |
159 | 154 | $this->nom_image = $img_resize; |
160 | - } |
|
161 | - else { |
|
155 | + } else { |
|
162 | 156 | |
163 | 157 | $this->nom_image = null; |
164 | 158 | /*$resize = new resize($urlimg); |
@@ -192,8 +186,7 @@ discard block |
||
192 | 186 | unlink($this->dossier_image."/".end($old_image)); |
193 | 187 | return true; |
194 | 188 | } |
195 | - } |
|
196 | - else if ($nom_image != null) { |
|
189 | + } else if ($nom_image != null) { |
|
197 | 190 | |
198 | 191 | if (is_array($nom_image)) { |
199 | 192 | for ($i=0 ; $i<count($nom_image) ; $i++) { |
@@ -201,27 +194,22 @@ discard block |
||
201 | 194 | |
202 | 195 | if (unlink($chemin_img)) { |
203 | 196 | $success = true; |
204 | - } |
|
205 | - else { |
|
197 | + } else { |
|
206 | 198 | if (unlink($this->chemin_image)) { |
207 | 199 | $success = true; |
208 | - } |
|
209 | - else { |
|
200 | + } else { |
|
210 | 201 | $this->erreur = "Impossible de supprimer cette image, veuillez réesayer dans un instant, sinon contacter l'administrateur de votre site"; |
211 | 202 | $success = false; |
212 | 203 | } |
213 | 204 | } |
214 | 205 | } |
215 | - } |
|
216 | - else { |
|
206 | + } else { |
|
217 | 207 | if (unlink($this->dossier_image."/".$nom_image)) { |
218 | 208 | $success = true; |
219 | - } |
|
220 | - else { |
|
209 | + } else { |
|
221 | 210 | if (unlink($this->chemin_image)) { |
222 | 211 | $success = true; |
223 | - } |
|
224 | - else { |
|
212 | + } else { |
|
225 | 213 | $this->erreur = "Impossible de supprimer cette image, veuillez réesayer dans un instant, sinon contacter l'administrateur de votre site"; |
226 | 214 | $success = false; |
227 | 215 | } |
@@ -229,8 +217,7 @@ discard block |
||
229 | 217 | } |
230 | 218 | |
231 | 219 | return $success; |
232 | - } |
|
233 | - else { |
|
220 | + } else { |
|
234 | 221 | $this->erreur = "Impossible de supprimer cette image"; |
235 | 222 | return false; |
236 | 223 | } |
@@ -134,19 +134,19 @@ |
||
134 | 134 | |
135 | 135 | private function getSizeByAuto($newWidth, $newHeight) |
136 | 136 | { |
137 | - if ($this->height < $this->width) |
|
138 | - // *** Image to be resized is wider (landscape) |
|
137 | + if ($this->height < $this->width) { |
|
138 | + // *** Image to be resized is wider (landscape) |
|
139 | 139 | { |
140 | 140 | $optimalWidth = $newWidth; |
141 | - $optimalHeight= $this->getSizeByFixedWidth($newWidth); |
|
142 | 141 | } |
143 | - elseif ($this->height > $this->width) |
|
144 | - // *** Image to be resized is taller (portrait) |
|
142 | + $optimalHeight= $this->getSizeByFixedWidth($newWidth); |
|
143 | + } elseif ($this->height > $this->width) { |
|
144 | + // *** Image to be resized is taller (portrait) |
|
145 | 145 | { |
146 | 146 | $optimalWidth = $this->getSizeByFixedHeight($newHeight); |
147 | - $optimalHeight= $newHeight; |
|
148 | 147 | } |
149 | - else |
|
148 | + $optimalHeight= $newHeight; |
|
149 | + } else |
|
150 | 150 | // *** Image to be resizerd is a square |
151 | 151 | { |
152 | 152 | if ($newHeight < $newWidth) { |
@@ -51,8 +51,7 @@ discard block |
||
51 | 51 | if ($query) { |
52 | 52 | $obj = $query->fetchAll(PDO::FETCH_OBJ); |
53 | 53 | return $obj; |
54 | - } |
|
55 | - else { |
|
54 | + } else { |
|
56 | 55 | FlashMessage::setFlash("Une erreur est survenue en executant cette requette : ".$req); |
57 | 56 | } |
58 | 57 | } |
@@ -66,8 +65,7 @@ discard block |
||
66 | 65 | //si pas de donnees |
67 | 66 | if ($value === null) { |
68 | 67 | $this->getPdo()->query($req); |
69 | - } |
|
70 | - else { |
|
68 | + } else { |
|
71 | 69 | $query = $this->getPdo()->prepare($req); |
72 | 70 | //si on a plusieurs tableaux |
73 | 71 | if (array_key_exists(0, $value)) { |
@@ -76,8 +74,7 @@ discard block |
||
76 | 74 | $err = true; |
77 | 75 | } |
78 | 76 | } |
79 | - } |
|
80 | - else { |
|
77 | + } else { |
|
81 | 78 | if (!$query->execute($value)) { |
82 | 79 | $err = true; |
83 | 80 | } |
@@ -100,8 +97,7 @@ discard block |
||
100 | 97 | public function rechercherEgalite($table, $champ, $value, $id_table=null, $id=null) { |
101 | 98 | if ($id == null) { |
102 | 99 | $query = $this->getPdo()->query("SELECT COUNT($champ) as nb FROM $table WHERE $champ LIKE '$value'"); |
103 | - } |
|
104 | - else { |
|
100 | + } else { |
|
105 | 101 | $query = $this->getPdo()->query("SELECT COUNT($champ) as nb FROM $table WHERE $champ LIKE '$value' AND $id_table != $id"); |
106 | 102 | } |
107 | 103 | |
@@ -109,7 +105,9 @@ discard block |
||
109 | 105 | $nb = $obj["nb"]; |
110 | 106 | } |
111 | 107 | |
112 | - if ($nb == 1) return true; |
|
108 | + if ($nb == 1) { |
|
109 | + return true; |
|
110 | + } |
|
113 | 111 | } |
114 | 112 | //-------------------------- FIN FUNCTION QUI FONT DES REQUETES SUR LA BDD --------------------------------------------// |
115 | 113 | |
@@ -124,8 +122,7 @@ discard block |
||
124 | 122 | |
125 | 123 | if ($query->rowCount() > 0) { |
126 | 124 | return true; |
127 | - } |
|
128 | - else { |
|
125 | + } else { |
|
129 | 126 | return false; |
130 | 127 | } |
131 | 128 | } |
@@ -59,8 +59,7 @@ discard block |
||
59 | 59 | |
60 | 60 | $this->setListeDroitAcces($id_liste_droit_acces, $nom_liste, $nb_droit_acces, $nb_droit_acces_page, $nb_user); |
61 | 61 | } |
62 | - } |
|
63 | - else { |
|
62 | + } else { |
|
64 | 63 | $this->id_liste_droit_acces = $id_liste_droit_acces; |
65 | 64 | } |
66 | 65 | } |
@@ -118,7 +117,9 @@ discard block |
||
118 | 117 | public function getListeDroitAccesDetailDroit($id_liste_droit_acces=null){ |
119 | 118 | $dbc = \core\App::getDb(); |
120 | 119 | |
121 | - if ($id_liste_droit_acces == null) $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
120 | + if ($id_liste_droit_acces == null) { |
|
121 | + $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
122 | + } |
|
122 | 123 | |
123 | 124 | $query = $dbc->query("SELECT * FROM droit_acces, liaison_liste_droit WHERE |
124 | 125 | droit_acces.ID_droit_acces = liaison_liste_droit.ID_droit_acces AND |
@@ -139,7 +140,9 @@ discard block |
||
139 | 140 | public function getListeDroitAccesDetailUser($id_liste_droit_acces=null) { |
140 | 141 | $dbc = \core\App::getDb(); |
141 | 142 | |
142 | - if ($id_liste_droit_acces == null) $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
143 | + if ($id_liste_droit_acces == null) { |
|
144 | + $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
145 | + } |
|
143 | 146 | |
144 | 147 | //récupératin des utilisateurs qui sont dans cette liste |
145 | 148 | $query = $dbc->query("SELECT * FROM identite WHERE liste_droit=".$id_liste_droit_acces); |
@@ -162,7 +165,9 @@ discard block |
||
162 | 165 | public function getListeDroitAccesDetailPage($id_liste_droit_acces=null){ |
163 | 166 | $dbc = \core\App::getDb(); |
164 | 167 | |
165 | - if ($id_liste_droit_acces == null) $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
168 | + if ($id_liste_droit_acces == null) { |
|
169 | + $id_liste_droit_acces = $this->id_liste_droit_acces; |
|
170 | + } |
|
166 | 171 | |
167 | 172 | //récupération des droits d'acces pour les pages |
168 | 173 | $query = $dbc->query("SELECT * FROM liste_droit_acces, droit_acces_page, page WHERE |