Passed
Push — master ( 44f182...c7a958 )
by Anthony
03:07
created
core/mail/Mail.class.php 3 patches
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.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
     
8 8
     
9 9
         //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
-        public function __construct($mail=null) {
10
+        public function __construct($mail = null) {
11 11
             $this->mail = $mail;
12 12
         }
13 13
         //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
          * @param null $destinataire -> si  null on emet le gerant du site car mail vient depuis l'admin
42 42
          * @return bool
43 43
          */
44
-        public function setEnvoyerMail($sujet, $message, $destinataire=null, $from=null) {
44
+        public function setEnvoyerMail($sujet, $message, $destinataire = null, $from = null) {
45 45
             //on récupere le mail du site
46 46
             $config = new \core\Configuration();
47 47
 
48 48
             if ($from == null) $from = $config->getMailSite();
49 49
 
50
-            $headers = 'Content-type: text/html; charset=utf-8' . "\r\n";
50
+            $headers = 'Content-type: text/html; charset=utf-8'."\r\n";
51 51
             $headers .= "From: ".$from;
52 52
 
53 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
Please login to merge, or discard this patch.
Braces   +6 added lines, -7 removed lines patch added patch discarded remove patch
@@ -27,8 +27,7 @@  discard block
 block discarded – undo
27 27
         public function setVerifierMail() {
28 28
             if (filter_var($this->mail, FILTER_VALIDATE_EMAIL)) {
29 29
                 return true;
30
-            }
31
-            else {
30
+            } else {
32 31
                 return false;
33 32
             }
34 33
         }
@@ -45,7 +44,9 @@  discard block
 block discarded – undo
45 44
             //on récupere le mail du site
46 45
             $config = new \core\Configuration();
47 46
 
48
-            if ($from == null) $from = $config->getMailSite();
47
+            if ($from == null) {
48
+            	$from = $config->getMailSite();
49
+            }
49 50
 
50 51
             $headers = 'Content-type: text/html; charset=utf-8' . "\r\n";
51 52
             $headers .= "From: ".$from;
@@ -53,15 +54,13 @@  discard block
 block discarded – undo
53 54
             //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 55
             if (($destinataire == null) && ($this->mail == null)) {
55 56
                 $destinataire = $config->getMailSite();
56
-            }
57
-            else if ($destinataire == null) {
57
+            } else if ($destinataire == null) {
58 58
                 $destinataire = $this->mail;
59 59
             }
60 60
 
61 61
             if (mail($destinataire, $sujet, $message, $headers)) {
62 62
                 return true;
63
-            }
64
-            else {
63
+            } else {
65 64
                 return false;
66 65
             }
67 66
         }
Please login to merge, or discard this patch.
core/Cache.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 
16 16
 
17 17
 		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
18
-		public function __construct($page, $admin=null) {
18
+		public function __construct($page, $admin = null) {
19 19
 			$config = new Configuration();
20 20
 
21 21
 			//on test si le cache est bien active
@@ -34,10 +34,10 @@  discard block
 block discarded – undo
34 34
 			}
35 35
 
36 36
 			if ($admin == null) {
37
-				$this->dossier_cache =  ROOT."cache/app/";
37
+				$this->dossier_cache = ROOT."cache/app/";
38 38
 			}
39 39
 			else {
40
-				$this->dossier_cache =  ROOT."cache/admin/";
40
+				$this->dossier_cache = ROOT."cache/admin/";
41 41
 			}
42 42
 
43 43
 			$page = ChaineCaractere::setUrl($page);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 		 * fonction qui met en cache le contenu du fichier enregistrer dans le ob
137 137
 		 */
138 138
 		private function setCache($contenu_fichier) {
139
-			$dbc= App::getDb();
139
+			$dbc = App::getDb();
140 140
 
141 141
 			$fichier_cache = $this->chemin_cache;
142 142
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -28,15 +28,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
core/App.class.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2
-    namespace core;
2
+	namespace core;
3 3
 
4
-    class App {
5
-    	private static $database;
4
+	class App {
5
+		private static $database;
6 6
 		private static $erreur;
7 7
     
8 8
     
9
-        //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
-        public function __construct() {
9
+		//-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------//
10
+		public function __construct() {
11 11
             
12
-        }
13
-        //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
12
+		}
13
+		//-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------//
14 14
     
15 15
     
16 16
     
17
-        //-------------------------- GETTER ----------------------------------------------------------------------------//
17
+		//-------------------------- GETTER ----------------------------------------------------------------------------//
18 18
 		public static function getErreur(){
19
-		    return self::$erreur;
19
+			return self::$erreur;
20 20
 		}
21 21
 
22 22
 		/**
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 				return "<li>$err_egalite</li>";
55 55
 			}
56 56
 		}
57
-        //-------------------------- FIN GETTER ----------------------------------------------------------------------------//
57
+		//-------------------------- FIN GETTER ----------------------------------------------------------------------------//
58 58
     
59 59
     
60 60
     
61
-        //-------------------------- SETTER ----------------------------------------------------------------------------//
62
-        //-------------------------- FIN SETTER ----------------------------------------------------------------------------//
63
-    }
64 61
\ No newline at end of file
62
+		//-------------------------- SETTER ----------------------------------------------------------------------------//
63
+		//-------------------------- FIN SETTER ----------------------------------------------------------------------------//
64
+	}
65 65
\ No newline at end of file
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     
16 16
     
17 17
         //-------------------------- GETTER ----------------------------------------------------------------------------//
18
-		public static function getErreur(){
18
+		public static function getErreur() {
19 19
 		    return self::$erreur;
20 20
 		}
21 21
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
 		 */
26 26
 		public static function getDb() {
27 27
 			if (self::$database == null) {
28
-				self::$database =  new Database(DB_TYPE, DB_NAME, DB_USER, DB_PASS, DB_HOST);
28
+				self::$database = new Database(DB_TYPE, DB_NAME, DB_USER, DB_PASS, DB_HOST);
29 29
 			}
30 30
 			return self::$database;
31 31
 		}
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 		 * @param null $value_id_table
43 43
 		 * @return string
44 44
 		 */
45
-		public static function getVerifChamp($nom_table, $nom_id_table, $champ, $value, $limit_char, $err_char, $err_egalite, $value_id_table=null) {
45
+		public static function getVerifChamp($nom_table, $nom_id_table, $champ, $value, $limit_char, $err_char, $err_egalite, $value_id_table = null) {
46 46
 			$dbc = self::getDb();
47 47
 
48 48
 			if (strlen(utf8_decode($value)) > $limit_char) {
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -48,8 +48,7 @@
 block discarded – undo
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
 			}
Please login to merge, or discard this patch.
core/functions/ChaineCaractere.class.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 		public static function random($longueur) {
16 16
 			$string = "";
17 17
 			$chaine = "abcdefghijklmnpqrstuvwxyz0123456789";
18
-			srand((double)microtime()*1000000);
19
-			for($i=0; $i<$longueur; $i++) {
20
-				$string .= $chaine[rand()%strlen($chaine)];
18
+			srand((double)microtime() * 1000000);
19
+			for ($i = 0; $i < $longueur; $i++) {
20
+				$string .= $chaine[rand() % strlen($chaine)];
21 21
 			}
22 22
 			return $string;
23 23
 		}
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 		 * @return mixed
29 29
 		 */
30 30
 		public static function setUrl($url) {
31
-			$search =  array(' ', 'é', '"\"', 'è', '"', '?', '*', "'", '@', ':', '&', '#', 'à', '=', '+', '°', '!', '%', '|', '$', '£');
31
+			$search = array(' ', 'é', '"\"', 'è', '"', '?', '*', "'", '@', ':', '&', '#', 'à', '=', '+', '°', '!', '%', '|', '$', '£');
32 32
 			$replace = array('-', 'e', '-', 'e', '-', '-', '-', '-', '-', '-', '-', '-', 'a', '-', '-', '-', '-', '%', '-', '-', '-');
33 33
 
34 34
 			return strtolower(str_replace($search, $replace, $url));
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
core/auth/Connexion.class.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 				}
58 58
 
59 59
 				//si le compte est archiver (bloqué) l'utilisateur ne peut pas se connecter au site
60
-				if ($archiver  == 1) {
60
+				if ($archiver == 1) {
61 61
 					FlashMessage::setFlash("Votre compte a été bloqué par un administrateur, vous ne pouvez donc pas vous connecter à ce site, veuillez réesseyer ultérieurement");
62 62
 					header("location:$page_retour_err");
63 63
 				}
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 				
70 70
 
71 71
 				//si les mdp sont egaux on redirige ver esace membre sinon ver login avec un mess d'erreur
72
-				if (($valide == 1) && ($archiver  != 1)) {
72
+				if (($valide == 1) && ($archiver != 1)) {
73 73
 					if ($mdp == $mdpbdd) {
74 74
 						$_SESSION['login'] = $pseudo;
75 75
 						$_SESSION["idlogin".CLEF_SITE] = $id;
@@ -79,19 +79,19 @@  discard block
 block discarded – undo
79 79
 						$last_change_mdp = mktime(0, 0, 0, $date_array[1], $date_array[2], $date_array[0]);
80 80
 						$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
81 81
 
82
-						if (($today-$last_change_mdp) > 259200) {
82
+						if (($today - $last_change_mdp) > 259200) {
83 83
 							self::setUpdatelastConnexion($id);
84 84
 
85 85
 							$membre = new Membre($id);
86 86
 							$membre->setMdp($mdpbdd, $mdp_noncrypt, $mdp_noncrypt);
87 87
 
88 88
 							if (isset($_POST['remember'])) {
89
-								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo . $membre->getMdp()), time()+3600*24*3, "/", "", false, true);
89
+								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo.$membre->getMdp()), time() + 3600 * 24 * 3, "/", "", false, true);
90 90
 							}
91 91
 						}
92 92
 						else {
93 93
 							if (isset($_POST['remember'])) {
94
-								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo . $mdpbdd), time()+3600*24*3, "/", "", false, true);
94
+								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo.$mdpbdd), time() + 3600 * 24 * 3, "/", "", false, true);
95 95
 							}
96 96
 						}
97 97
 
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
 							$last_change_mdp = mktime(0, 0, 0, $date_array[1], $date_array[2], $date_array[0]);
144 144
 							$today = mktime(0, 0, 0, date("m"), date("d"), date("Y"));
145 145
 
146
-							if (($today-$last_change_mdp) > 259200) {
146
+							if (($today - $last_change_mdp) > 259200) {
147 147
 								self::setUpdatelastConnexion($obj->ID_identite);
148 148
 
149 149
 								//on refait un nouveau mdp encrypté avec le même mdp
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 								//on detruit le cookie et on le refait avec le mdp regénéré
155 155
 								setcookie("auth".CLEF_SITE, NULL, -1);
156 156
 								$key = sha1($obj->pseudo.$membre->getMdp());
157
-								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time()+3600*24*3, "/", "", false, true);
157
+								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time() + 3600 * 24 * 3, "/", "", false, true);
158 158
 							}
159 159
 							else {
160
-								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time()+3600*24*3, "/", "", false, true);
160
+								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time() + 3600 * 24 * 3, "/", "", false, true);
161 161
 							}
162 162
 						}
163 163
 						else {
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		public static function setUpdatelastConnexion($id_identite) {
205 205
 			$dbc = App::getDb();
206 206
 
207
-			$dbc->prepare("UPDATE identite SET last_change_mdp=:date WHERE ID_identite=:id_identite", array("date"=>date("Y-m-d"),"id_identite"=>$id_identite));
207
+			$dbc->prepare("UPDATE identite SET last_change_mdp=:date WHERE ID_identite=:id_identite", array("date"=>date("Y-m-d"), "id_identite"=>$id_identite));
208 208
 		}
209 209
 
210 210
 		/**
Please login to merge, or discard this patch.
Braces   +10 added lines, -15 removed lines patch added patch discarded remove patch
@@ -44,8 +44,7 @@  discard block
 block discarded – undo
44 44
 			if (!isset($id)) {
45 45
 				FlashMessage::setFlash("Vos identifiants de connexions sont incorrects");
46 46
 				header("location:$page_retour_err");
47
-			}
48
-			else {
47
+			} else {
49 48
 				$config = new Configuration();
50 49
 
51 50
 				//cela veut dire que l'utilisateur doit obligatoirement etre valider pour avoir acces au site
@@ -88,8 +87,7 @@  discard block
 block discarded – undo
88 87
 							if (isset($_POST['remember'])) {
89 88
 								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo . $membre->getMdp()), time()+3600*24*3, "/", "", false, true);
90 89
 							}
91
-						}
92
-						else {
90
+						} else {
93 91
 							if (isset($_POST['remember'])) {
94 92
 								setcookie("auth".CLEF_SITE, $id."-----".sha1($pseudo . $mdpbdd), time()+3600*24*3, "/", "", false, true);
95 93
 							}
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
 
99 97
 						FlashMessage::setFlash("Vous êtes maintenant connecté", "info");
100 98
 						header("location:$page_retour");
101
-					}
102
-					else {
99
+					} else {
103 100
 						FlashMessage::setFlash("Vos identifiants de connexions sont incorrects");
104 101
 						header("location:$page_retour_err");
105 102
 					}
@@ -130,8 +127,7 @@  discard block
 block discarded – undo
130 127
 					if ($obj->archiver == 1) {
131 128
 						setcookie("auth".CLEF_SITE, NULL, -1);
132 129
 						self::setDeconnexion($page_retour);
133
-					}
134
-					else {
130
+					} else {
135 131
 						$key = sha1($obj->pseudo.$obj->mdp);
136 132
 
137 133
 						if ($key == $auth[1]) {
@@ -155,12 +151,10 @@  discard block
 block discarded – undo
155 151
 								setcookie("auth".CLEF_SITE, NULL, -1);
156 152
 								$key = sha1($obj->pseudo.$membre->getMdp());
157 153
 								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time()+3600*24*3, "/", "", false, true);
158
-							}
159
-							else {
154
+							} else {
160 155
 								setcookie("auth".CLEF_SITE, $obj->ID_identite."-----".$key, time()+3600*24*3, "/", "", false, true);
161 156
 							}
162
-						}
163
-						else {
157
+						} else {
164 158
 							if ($obj_connecte == 1) {
165 159
 								self::setDeconnexion($page_retour);
166 160
 							}
@@ -168,8 +162,7 @@  discard block
 block discarded – undo
168 162
 					}
169 163
 
170 164
 				}
171
-			}
172
-			else if (!isset($_SESSION["idlogin".CLEF_SITE])) {
165
+			} else if (!isset($_SESSION["idlogin".CLEF_SITE])) {
173 166
 				if ($obj_connecte == 1) {
174 167
 					FlashMessage::setFlash("Vous devez être connecté pour accéder à cette page");
175 168
 					header("location:".$page_retour);
@@ -216,6 +209,8 @@  discard block
 block discarded – undo
216 209
 			$dbc = App::getDb();
217 210
 
218 211
 			$query = $dbc->query("SELECT last_change_mdp FROM identite WHERE ID_identite=".$id_identite);
219
-			foreach ($query as $obj) return $obj->last_change_mdp;
212
+			foreach ($query as $obj) {
213
+				return $obj->last_change_mdp;
214
+			}
220 215
 		}
221 216
 	}
222 217
\ No newline at end of file
Please login to merge, or discard this patch.
core/auth/Encrypt.class.php 3 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 		
14 14
 		
15 15
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
16
-		public static function getParams($id_identite=null) {
16
+		public static function getParams($id_identite = null) {
17 17
 			if ($id_identite != null) {
18 18
 				$dbc = App::getDb();
19 19
 
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		 * @param $id_identite
39 39
 		 * @return string
40 40
 		 */
41
-		public static function setEncryptMdp($mdp, $id_identite=null) {
41
+		public static function setEncryptMdp($mdp, $id_identite = null) {
42 42
 			$encrypt_str = ChaineCaractere::random(154);
43 43
 
44 44
 			//on cache le mdp
@@ -48,9 +48,9 @@  discard block
 block discarded – undo
48 48
 			$longeur_mdp = strlen($mdp);
49 49
 
50 50
 			//on va couper le mot de passe en 2 suivant un nombre aleatoire
51
-			$nb_aleatoire_mdp = rand(3, $longeur_mdp-2);
52
-			$bout1_mdp = mb_substr($mdp, 0, $longeur_mdp/2, "UTF-8");
53
-			$bout2_mdp = mb_substr($mdp, $longeur_mdp/2, $longeur_mdp, "UTF-8");
51
+			$nb_aleatoire_mdp = rand(3, $longeur_mdp - 2);
52
+			$bout1_mdp = mb_substr($mdp, 0, $longeur_mdp / 2, "UTF-8");
53
+			$bout2_mdp = mb_substr($mdp, $longeur_mdp / 2, $longeur_mdp, "UTF-8");
54 54
 
55 55
 			//on stock la taille des bouts pour pouvoir les décrypter
56 56
 			$taille_bout1 = strlen($bout1_mdp);
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 			//on insere le premier bout aleatoirement dans le hashmdp
60 60
 			//on calcul sa longeur total (celle duhash + la logneur du mdp que l'on va rajouter dedans)
61 61
 			$longueur_hash = strlen($encrypt_str);
62
-			$debut_bout1 = rand(0, $longueur_hash/2);
62
+			$debut_bout1 = rand(0, $longueur_hash / 2);
63 63
 
64 64
 			//on rajouter le premier bout dans le mot de passe + recalcule de la longeur du hash avec le mdp add
65 65
 			$encrypt_str = mb_substr($encrypt_str, 0, $debut_bout1).$bout1_mdp.mb_substr($encrypt_str, $debut_bout1, $longueur_hash);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 			//on insere le second bout aleatoirement dans le hashmdp
68 68
 			//on calcul sa longeur total (celle duhash + la logneur premier bout du mdp que l'on va rajouter dedans)
69 69
 			$longueur_hash = strlen($encrypt_str);
70
-			$debut_bout2 = rand($longueur_hash/2, $longueur_hash);
70
+			$debut_bout2 = rand($longueur_hash / 2, $longueur_hash);
71 71
 
72 72
 			//on rajoute le deuxieme
73 73
 			$mdp_encrypt = mb_substr($encrypt_str, 0, $debut_bout2).$bout2_mdp.mb_substr($encrypt_str, $debut_bout2, $longueur_hash);
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -21,8 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 		//-------------------------- GETTER ----------------------------------------------------------------------------//
16 16
 		/**
17 17
 		 * @param null $id_identite
18
-		 * @return mixed
18
+		 * @return string
19 19
 		 */
20 20
 		public static function getParams($id_identite=null) {
21 21
 			if ($id_identite != null) {
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 		//-------------------------- SETTER ----------------------------------------------------------------------------//
39 39
 		/**
40 40
 		 * fonction qui permet d'encrypter un mot de passe, une fois encrype, on save les params pour le retrouver en bdd
41
-		 * @param $mdp
41
+		 * @param string|null $mdp
42 42
 		 * @param $id_identite
43 43
 		 * @return string
44 44
 		 */
Please login to merge, or discard this patch.
core/auth/login.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
 
8 8
 	if (isset($_POST['admin'])) {
9 9
 		Connexion::setLogin($pseudo, $mdp, WEBROOT."administrator/login", WEBROOT."administrator");
10
-	}
11
-	else {
10
+	} else {
12 11
 		Connexion::setLogin($pseudo, $mdp, WEBROOT."login", WEBROOT."index.php");
13 12
 	}
14 13
 ?>
15 14
\ No newline at end of file
Please login to merge, or discard this patch.
core/auth/changer_mdp.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,20 +18,17 @@
 block discarded – undo
18 18
 		if ($membre->getErreur()) {
19 19
 			FlashMessage::setFlash($membre->getErreur());
20 20
 			header("location:".ADMWEBROOT."gestion-comptes/mon-compte");
21
-		}
22
-		else {
21
+		} else {
23 22
 			Connexion::setDeconnexion(WEBROOT."administrator/login");
24 23
 			FlashMessage::setFlash("Votre mot de passe a été changé avec succès, vous pouvez vous reconnecter avec votre nouveau mot de passe", "info");
25 24
 		}
26
-	}
27
-	else {
25
+	} else {
28 26
 		$membre->setMdp($mdp, $new_mdp, $verif_new_mdp);
29 27
 
30 28
 		if ($membre->getErreur()) {
31 29
 			FlashMessage::setFlash($membre->getErreur());
32 30
 			header("location:index.php");
33
-		}
34
-		else {
31
+		} else {
35 32
 			Connexion::setDeconnexion("index.php?page=login");
36 33
 			FlashMessage::setFlash("Votre mot de passe a été changé avec succès, vous pouvez vous reconnecter avec votre nouveau mot de passe", "info");
37 34
 		}
Please login to merge, or discard this patch.
core/modules/GestionModule.class.php 2 patches
Braces   +7 added lines, -14 removed lines patch added patch discarded remove patch
@@ -121,12 +121,10 @@  discard block
 block discarded – undo
121 121
 
122 122
 				if ($installer == 1) {
123 123
 					return true;
124
-				}
125
-				else {
124
+				} else {
126 125
 					return false;
127 126
 				}
128
-			}
129
-			else {
127
+			} else {
130 128
 				return false;
131 129
 			}
132 130
 		}
@@ -144,8 +142,7 @@  discard block
 block discarded – undo
144 142
 			foreach ($query as $obj) {
145 143
 				if ($obj->activer == 1) {
146 144
 					return true;
147
-				}
148
-				else {
145
+				} else {
149 146
 					return false;
150 147
 				}
151 148
 			}
@@ -165,8 +162,7 @@  discard block
 block discarded – undo
165 162
 			foreach ($query as $obj) {
166 163
 				if ($obj->mettre_jour == 1) {
167 164
 					return false;
168
-				}
169
-				else {
165
+				} else {
170 166
 					return true;
171 167
 				}
172 168
 			}
@@ -189,8 +185,7 @@  discard block
 block discarded – undo
189 185
 						//si pas de version a checker, cela veut dire qu'on vient d'installer le module
190 186
 						//du coup on met le next_check aa la semaine pro
191 187
 						$set_next = true;
192
-					}
193
-					else if (($obj->next_check_version <= $today) && ($obj->mettre_jour != 1)) {
188
+					} else if (($obj->next_check_version <= $today) && ($obj->mettre_jour != 1)) {
194 189
 						//avant tout on regarde si on doit delete une vieille version
195 190
 						if ($obj->delete_old_version == 1) {
196 191
 							$import = new ImportModule();
@@ -232,8 +227,7 @@  discard block
 block discarded – undo
232 227
 								$dbc->prepare("UPDATE module SET mettre_jour=:update, online_version=:online_version WHERE ID_module=:id_module", $value);
233 228
 
234 229
 								$set_next = true;
235
-							}
236
-							else {
230
+							} else {
237 231
 								$set_next = true;
238 232
 							}
239 233
 						}
@@ -266,8 +260,7 @@  discard block
 block discarded – undo
266 260
 				$this->setListeModuleMettreJour($nom_module, $version, $online_version);
267 261
 
268 262
 				return true;
269
-			}
270
-			else {
263
+			} else {
271 264
 				return false;
272 265
 			}
273 266
 		}
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -198,12 +198,12 @@  discard block
 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);
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		
271 271
 		
272 272
 		//-------------------------- SETTER ----------------------------------------------------------------------------//
273
-		private function setListeModuleActiver($id_module, $url, $version, $nom, $icone=null, $url_telechargement=null) {
273
+		private function setListeModuleActiver($id_module, $url, $version, $nom, $icone = null, $url_telechargement = null) {
274 274
 			$this->id_module = $id_module;
275 275
 			$this->url = $url;
276 276
 			$this->nom = $nom;
Please login to merge, or discard this patch.