Passed
Push — master ( c7a958...af38e3 )
by Anthony
03:25
created
core/mail/Mail.class.php 1 patch
Indentation   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -1,69 +1,69 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-    namespace core\mail;
3
+	namespace core\mail;
4 4
         
5
-    class Mail {
6
-        private $mail;
5
+	class Mail {
6
+		private $mail;
7 7
     
8 8
     
9
-        //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
-        public function __construct($mail = null) {
11
-            $this->mail = $mail;
12
-        }
13
-        //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
9
+		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
+		public function __construct($mail = null) {
11
+			$this->mail = $mail;
12
+		}
13
+		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
14 14
     
15 15
     
16 16
     
17
-        //-------------------------- GETTER ----------------------------------------------------------------------------//
18
-        //-------------------------- FIN GETTER ----------------------------------------------------------------------------//
17
+		//-------------------------- GETTER ----------------------------------------------------------------------------//
18
+		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
19 19
 
20 20
 
21 21
     
22
-        //-------------------------- SETTER ----------------------------------------------------------------------------//
23
-        /**
24
-         * fonction qui permet de valider si un E-mail est valide
25
-         * @return bool
26
-         */
27
-        public function setVerifierMail() {
28
-            if (filter_var($this->mail, FILTER_VALIDATE_EMAIL)) {
29
-                return true;
30
-            }
31
-            else {
32
-                return false;
33
-            }
34
-        }
22
+		//-------------------------- SETTER ----------------------------------------------------------------------------//
23
+		/**
24
+		 * fonction qui permet de valider si un E-mail est valide
25
+		 * @return bool
26
+		 */
27
+		public function setVerifierMail() {
28
+			if (filter_var($this->mail, FILTER_VALIDATE_EMAIL)) {
29
+				return true;
30
+			}
31
+			else {
32
+				return false;
33
+			}
34
+		}
35 35
 
36
-        /**
37
-         * fonction qui permet d'envoyer un mail
38
-         * @param $sujet
39
-         * @param $message
40
-         * @param null $destinataire -> si  null on envoi un mail au gerant du site
41
-         * @param null $destinataire -> si  null on emet le gerant du site car mail vient depuis l'admin
42
-         * @return bool
43
-         */
44
-        public function setEnvoyerMail($sujet, $message, $destinataire = null, $from = null) {
45
-            //on récupere le mail du site
46
-            $config = new \core\Configuration();
36
+		/**
37
+		 * fonction qui permet d'envoyer un mail
38
+		 * @param $sujet
39
+		 * @param $message
40
+		 * @param null $destinataire -> si  null on envoi un mail au gerant du site
41
+		 * @param null $destinataire -> si  null on emet le gerant du site car mail vient depuis l'admin
42
+		 * @return bool
43
+		 */
44
+		public function setEnvoyerMail($sujet, $message, $destinataire = null, $from = null) {
45
+			//on récupere le mail du site
46
+			$config = new \core\Configuration();
47 47
 
48
-            if ($from == null) $from = $config->getMailSite();
48
+			if ($from == null) $from = $config->getMailSite();
49 49
 
50
-            $headers = 'Content-type: text/html; charset=utf-8'."\r\n";
51
-            $headers .= "From: ".$from;
50
+			$headers = 'Content-type: text/html; charset=utf-8'."\r\n";
51
+			$headers .= "From: ".$from;
52 52
 
53
-            //si pas de destinataire on envoi le mail au gérant du site car c'est un mail envoyé par le site lui même
54
-            if (($destinataire == null) && ($this->mail == null)) {
55
-                $destinataire = $config->getMailSite();
56
-            }
57
-            else if ($destinataire == null) {
58
-                $destinataire = $this->mail;
59
-            }
53
+			//si pas de destinataire on envoi le mail au gérant du site car c'est un mail envoyé par le site lui même
54
+			if (($destinataire == null) && ($this->mail == null)) {
55
+				$destinataire = $config->getMailSite();
56
+			}
57
+			else if ($destinataire == null) {
58
+				$destinataire = $this->mail;
59
+			}
60 60
 
61
-            if (mail($destinataire, $sujet, $message, $headers)) {
62
-                return true;
63
-            }
64
-            else {
65
-                return false;
66
-            }
67
-        }
68
-        //-------------------------- FIN SETTER ----------------------------------------------------------------------------//
69
-    }
70 61
\ No newline at end of file
62
+			if (mail($destinataire, $sujet, $message, $headers)) {
63
+				return true;
64
+			}
65
+			else {
66
+				return false;
67
+			}
68
+		}
69
+		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
70
+	}
71 71
\ No newline at end of file
Please login to merge, or discard this patch.
core/Configuration.class.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    namespace core;
2
+	namespace core;
3 3
 
4 4
 
5 5
 	class Configuration {
6 6
 		//pour la configuration générale du site
7
-        private $nom_site; //-> nom du site
8
-        private $mail_site; //-> pour le gérant du site contact@nomdedomaine;com
9
-        private $gerant_site; //->nom du gérant du site
10
-        private $url_site; //-> url de site
11
-        private $mail_administrateur; //-> mail de l'administrateur [email protected]
7
+		private $nom_site; //-> nom du site
8
+		private $mail_site; //-> pour le gérant du site contact@nomdedomaine;com
9
+		private $gerant_site; //->nom du gérant du site
10
+		private $url_site; //-> url de site
11
+		private $mail_administrateur; //-> mail de l'administrateur [email protected]
12 12
 		private $last_save; //-> derniere sauvegarde de la bdd
13 13
 		private $acces_admin; //-> si == 1 on a acces à l'admin
14 14
 		private $contenu_dynamique; //->savoir si es contenus sont dynamique (stockés in DB)
@@ -21,24 +21,24 @@  discard block
 block discarded – undo
21 21
 		private $activer_connexion;
22 22
 
23 23
 
24
-        //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
25
-        public function __construct() {
26
-            $dbc = \core\App::getDb();
24
+		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
25
+		public function __construct() {
26
+			$dbc = \core\App::getDb();
27 27
 
28 28
 			//pour la configuration générale du site
29
-            $query = $dbc->query("SELECT * FROM configuration WHERE ID_configuration=1");
30
-            foreach ($query as $obj) {
31
-                $this->nom_site = $obj->nom_site;
32
-                $this->mail_site = $obj->mail_site;
33
-                $this->gerant_site = $obj->gerant_site;
34
-                $this->url_site = $obj->url_site;
35
-                $this->mail_administrateur = $obj->mail_administrateur;
36
-                $this->last_save = $obj->last_save;
29
+			$query = $dbc->query("SELECT * FROM configuration WHERE ID_configuration=1");
30
+			foreach ($query as $obj) {
31
+				$this->nom_site = $obj->nom_site;
32
+				$this->mail_site = $obj->mail_site;
33
+				$this->gerant_site = $obj->gerant_site;
34
+				$this->url_site = $obj->url_site;
35
+				$this->mail_administrateur = $obj->mail_administrateur;
36
+				$this->last_save = $obj->last_save;
37 37
 				$this->acces_admin = $obj->acces_admin;
38 38
 				$this->contenu_dynamique = $obj->contenu_dynamique;
39 39
 				$this->responsive = $obj->responsive;
40 40
 				$this->cache = $obj->cache;
41
-            }
41
+			}
42 42
 
43 43
 			//pour la configuration des comptes
44 44
 			$query = $dbc->query("SELECT * FROM configuration_compte WHERE ID_configuration_compte=1");
@@ -47,31 +47,31 @@  discard block
 block discarded – undo
47 47
 				$this->activer_inscription = $obj->activer_inscription;
48 48
 				$this->activer_connexion = $obj->activer_connexion;
49 49
 			}
50
-        }
51
-        //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
50
+		}
51
+		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
52 52
 
53 53
 
54 54
 
55
-        //-------------------------- GETTER ----------------------------------------------------------------------------//
55
+		//-------------------------- GETTER ----------------------------------------------------------------------------//
56 56
 		//pour la configuration générale du site
57
-        public function getNomSite() {
58
-            return $this->nom_site;
59
-        }
60
-        public function getMailSite() {
61
-            return $this->mail_site;
62
-        }
63
-        public function getGerantSite() {
64
-            return $this->gerant_site;
65
-        }
66
-        public function getUrlSite() {
67
-            return $this->url_site;
68
-        }
69
-        public function getMailAdministrateur() {
70
-            return $this->mail_administrateur;
71
-        }
72
-        public function getLastSave() {
73
-            return $this->last_save;
74
-        }
57
+		public function getNomSite() {
58
+			return $this->nom_site;
59
+		}
60
+		public function getMailSite() {
61
+			return $this->mail_site;
62
+		}
63
+		public function getGerantSite() {
64
+			return $this->gerant_site;
65
+		}
66
+		public function getUrlSite() {
67
+			return $this->url_site;
68
+		}
69
+		public function getMailAdministrateur() {
70
+			return $this->mail_administrateur;
71
+		}
72
+		public function getLastSave() {
73
+			return $this->last_save;
74
+		}
75 75
 		public function getAccesAdmin() {
76 76
 			return $this->acces_admin;
77 77
 		}
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 		public function getActiverConnexion() {
96 96
 			return $this->activer_connexion;
97 97
 		}
98
-        //-------------------------- FIN GETTER ----------------------------------------------------------------------------//
98
+		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
99 99
 
100 100
 
101 101
 
102
-        //-------------------------- SETTER ----------------------------------------------------------------------------//
102
+		//-------------------------- SETTER ----------------------------------------------------------------------------//
103 103
 		/**
104 104
 		 * fonction qui permet de mettre à jour la date de la derniere save de la bdd
105 105
 		 * + supprimer la sauverde ancienne d'il y a 1 mois
@@ -123,5 +123,5 @@  discard block
 block discarded – undo
123 123
 				unlink(ROOT."bdd_backup/".$nom_save);
124 124
 			}
125 125
 		}
126
-        //-------------------------- FIN SETTER ----------------------------------------------------------------------------//
127
-    }
128 126
\ No newline at end of file
127
+		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
128
+	}
129 129
\ No newline at end of file
Please login to merge, or discard this patch.
core/modules/GestionModule.class.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -198,12 +198,12 @@
 block discarded – undo
198 198
 						}
199 199
 
200 200
 						//on recupere le nom du dossier + extention
201
-						$explode  = explode(".", $obj->url_telechargement);
201
+						$explode = explode(".", $obj->url_telechargement);
202 202
 						array_pop($explode);
203 203
 
204 204
 						$version_txt = implode(".", $explode)."_version.txt";
205 205
 
206
-						if(file_get_contents($version_txt) !== "") {
206
+						if (file_get_contents($version_txt) !== "") {
207 207
 
208 208
 							//online pour bdd
209 209
 							$version_online_txt = file_get_contents($version_txt);
Please login to merge, or discard this patch.
core/images/Resize.class.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
 			private function crop($optimalWidth, $optimalHeight, $newWidth, $newHeight)
196 196
 			{
197 197
 				// *** Find center - this will be used for the crop
198
-				$cropStartX = ( $optimalWidth / 2) - ( $newWidth /2 );
199
-				$cropStartY = ( $optimalHeight/ 2) - ( $newHeight/2 );
198
+				$cropStartX = ($optimalWidth / 2) - ($newWidth / 2);
199
+				$cropStartY = ($optimalHeight / 2) - ($newHeight / 2);
200 200
 
201 201
 				$crop = $this->imageResized;
202 202
 
203 203
 				// *** Now crop from center to exact requested size
204
-				$this->imageResized = imagecreatetruecolor($newWidth , $newHeight);
205
-				imagecopyresampled($this->imageResized, $crop , 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight , $newWidth, $newHeight);
204
+				$this->imageResized = imagecreatetruecolor($newWidth, $newHeight);
205
+				imagecopyresampled($this->imageResized, $crop, 0, 0, $cropStartX, $cropStartY, $newWidth, $newHeight, $newWidth, $newHeight);
206 206
 			}
207 207
 
208 208
 			## --------------------------------------------------------
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
 			 * @param string $savePath
211 211
 			 * @param string $imageQuality
212 212
 			 */
213
-			public function saveImage($savePath, $imageQuality="100")
213
+			public function saveImage($savePath, $imageQuality = "100")
214 214
 			{
215 215
 				// *** Get extension
216 216
         		$extension = strrchr($savePath, '.');
217 217
        			$extension = strtolower($extension);
218 218
 
219
-				switch($extension)
219
+				switch ($extension)
220 220
 				{
221 221
 					case '.jpg':
222 222
 					case '.jpeg':
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -139,19 +139,19 @@
 block discarded – undo
139 139
 
140 140
 			private function getSizeByAuto($newWidth, $newHeight)
141 141
 			{
142
-				if ($this->height < $this->width)
143
-				// *** Image to be resized is wider (landscape)
142
+				if ($this->height < $this->width) {
143
+								// *** Image to be resized is wider (landscape)
144 144
 				{
145 145
 					$optimalWidth = $newWidth;
146
-					$optimalHeight = $this->getSizeByFixedWidth($newWidth);
147 146
 				}
148
-				elseif ($this->height > $this->width)
149
-				// *** Image to be resized is taller (portrait)
147
+					$optimalHeight = $this->getSizeByFixedWidth($newWidth);
148
+				} elseif ($this->height > $this->width) {
149
+								// *** Image to be resized is taller (portrait)
150 150
 				{
151 151
 					$optimalWidth = $this->getSizeByFixedHeight($newHeight);
152
-					$optimalHeight = $newHeight;
153 152
 				}
154
-				else
153
+					$optimalHeight = $newHeight;
154
+				} else
155 155
 				// *** Image to be resizerd is a square
156 156
 				{
157 157
 					if ($newHeight < $newWidth) {
Please login to merge, or discard this patch.
core/auth/Membre.class.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -36,8 +36,7 @@  discard block
 block discarded – undo
36 36
 
37 37
 					if ($obj->img_profil == "") {
38 38
 						$this->img = $this->debut_lien."defaut.png";
39
-					}
40
-					else {
39
+					} else {
41 40
 						$this->img = $obj->img_profil;
42 41
 					}
43 42
 				}
@@ -122,16 +121,13 @@  discard block
 block discarded – undo
122 121
 			if (strlen($new_pseudo) < 5) {
123 122
 				$err = "Votre pseudo est trop court";
124 123
 				$this->erreur = $err;
125
-			}
126
-			else if (strlen($new_pseudo) > 15) {
124
+			} else if (strlen($new_pseudo) > 15) {
127 125
 				$err = "Votre pseudo est trop long";
128 126
 				$this->erreur = $err;
129
-			}
130
-			else if ($new_pseudo == $pseudo_bdd) {
127
+			} else if ($new_pseudo == $pseudo_bdd) {
131 128
 				$err = "Ce pseudo est déjà utilisé, veuillez en choisir un autre";
132 129
 				$this->erreur = $err;
133
-			}
134
-			else {
130
+			} else {
135 131
 				$dbc->query("UPDATE identite set pseudo=$new_pseudo WHERE ID_identite=".$_SESSION["idlogin".CLEF_SITE]);
136 132
 				$this->pseudo = $new_pseudo;
137 133
 			}
@@ -152,24 +148,20 @@  discard block
 block discarded – undo
152 148
 			if (md5($old_mdp) != $mdp) {
153 149
 				$err = "Votre mot de passe est incorrect";
154 150
 				$this->erreur = $err;
155
-			}
156
-			else {
151
+			} else {
157 152
 				if ($new_mdp != $verif_new_mdp) {
158 153
 					$err = "Vos mots de passe sont différents";
159 154
 					$this->erreur = $err;
160
-				}
161
-				else {
155
+				} else {
162 156
 					$testmdp = $this->testpassword($new_mdp);
163 157
 					
164 158
 					if (strlen($new_mdp) < 5) {
165 159
 						$err = "Votre mot de passe est trop court";
166 160
 						$this->erreur = $err;
167
-					}
168
-					else if ($testmdp < 40) {
161
+					} else if ($testmdp < 40) {
169 162
 						$err = "Votre mot de passe est trop simple";
170 163
 						$this->erreur = $err;
171
-					}
172
-					else {
164
+					} else {
173 165
 						$mdpok = Encrypt::setEncryptMdp($new_mdp, $this->id_identite);
174 166
 						//le nouveau mdp est bon on update
175 167
 						$dbc->query("UPDATE identite SET mdp='$mdpok' WHERE ID_identite=".$this->id_identite);
@@ -199,16 +191,13 @@  discard block
 block discarded – undo
199 191
 				if ($lettre >= 'a' && $lettre <= 'z') {
200 192
 					$point = $point + 1;
201 193
 					$point_min = 1;
202
-				}
203
-				else if ($lettre >= 'A' && $lettre <= 'Z') {
194
+				} else if ($lettre >= 'A' && $lettre <= 'Z') {
204 195
 					$point = $point + 2;
205 196
 					$point_maj = 2;
206
-				}
207
-				else if ($lettre >= '0' && $lettre <= '9') {
197
+				} else if ($lettre >= '0' && $lettre <= '9') {
208 198
 					$point = $point + 3;
209 199
 					$point_chiffre = 3;
210
-				}
211
-				else {
200
+				} else {
212 201
 					$point = $point + 5;
213 202
 					$point_caracteres = 5;
214 203
 				}
Please login to merge, or discard this patch.
core/auth/Encrypt.class.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@
 block discarded – undo
17 17
 		 * @param null $id_identite
18 18
 		 * @return mixed
19 19
 		 */
20
-		public static function getParams($id_identite=null) {
20
+		public static function getParams($id_identite = null) {
21 21
 			if ($id_identite != null) {
22 22
 				$dbc = App::getDb();
23 23
 
Please login to merge, or discard this patch.
core/form/FormValidator.class.php 1 patch
Indentation   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -1,48 +1,48 @@
 block discarded – undo
1 1
 <?php
2
-    namespace core\form;
2
+	namespace core\form;
3 3
 
4
-    class FormValidator {
5
-        private $datas = [];
6
-        private $errors = [];
4
+	class FormValidator {
5
+		private $datas = [];
6
+		private $errors = [];
7 7
 
8 8
 
9
-        //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
-        public function __construct($datas) {
11
-            $this->datas = $datas;
12
-        }
13
-        //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
9
+		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
+		public function __construct($datas) {
11
+			$this->datas = $datas;
12
+		}
13
+		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
14 14
 
15 15
 
16
-        //-------------------------- GETTER ----------------------------------------------------------------------------//
17
-        public function Check($name, $rule, $option = null) {
18
-            $validator = "validate".ucfirst($rule);
16
+		//-------------------------- GETTER ----------------------------------------------------------------------------//
17
+		public function Check($name, $rule, $option = null) {
18
+			$validator = "validate".ucfirst($rule);
19 19
 
20
-            if (!$this->$validator($name, $option)) {
21
-                $this->errors[$name] = "Le champ $name n'a pas été rempli correctement";
22
-            }
23
-        }
20
+			if (!$this->$validator($name, $option)) {
21
+				$this->errors[$name] = "Le champ $name n'a pas été rempli correctement";
22
+			}
23
+		}
24 24
 
25
-        public function getErrors() {
26
-            if (!empty($this->errors)) {
27
-                $errors = "<ul>";
28
-                foreach ($this->errors as $error) {
29
-                    $errors .= "<li>".$error."</li>";
30
-                }
31
-                $errors .= "</ul>";
25
+		public function getErrors() {
26
+			if (!empty($this->errors)) {
27
+				$errors = "<ul>";
28
+				foreach ($this->errors as $error) {
29
+					$errors .= "<li>".$error."</li>";
30
+				}
31
+				$errors .= "</ul>";
32 32
 
33
-                return $errors;
34
-            }
35
-        }
36
-        //-------------------------- FIN GETTER ----------------------------------------------------------------------------//
33
+				return $errors;
34
+			}
35
+		}
36
+		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
37 37
 
38 38
 
39
-        //-------------------------- SETTER ----------------------------------------------------------------------------//
40
-        public function validateRequired($name) {
41
-            return array_key_exists($name, $this->datas) && $this->datas[$name] != "";
42
-        }
39
+		//-------------------------- SETTER ----------------------------------------------------------------------------//
40
+		public function validateRequired($name) {
41
+			return array_key_exists($name, $this->datas) && $this->datas[$name] != "";
42
+		}
43 43
 
44
-        public function validateEmail($name) {
45
-            return array_key_exists($name, $this->datas) && filter_var($this->datas[$name], FILTER_VALIDATE_EMAIL);
46
-        }
47
-        //-------------------------- FIN SETTER ----------------------------------------------------------------------------//
48
-    }
49 44
\ No newline at end of file
45
+		public function validateEmail($name) {
46
+			return array_key_exists($name, $this->datas) && filter_var($this->datas[$name], FILTER_VALIDATE_EMAIL);
47
+		}
48
+		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
49
+	}
50 50
\ No newline at end of file
Please login to merge, or discard this patch.