@@ -43,13 +43,13 @@ |
||
43 | 43 | //-------------------------- GETTER ----------------------------------------------------------------------------// |
44 | 44 | |
45 | 45 | public function getOldImage() { |
46 | - return $this->old_image; |
|
46 | + return $this->old_image; |
|
47 | 47 | } |
48 | 48 | public function getCheminImage() { |
49 | - return $this->chemin_image; |
|
49 | + return $this->chemin_image; |
|
50 | 50 | } |
51 | 51 | public function getErreur() { |
52 | - return $this->erreur; |
|
52 | + return $this->erreur; |
|
53 | 53 | } |
54 | 54 | public function getNomImage() { |
55 | 55 | return $this->nom_image; |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | { |
22 | 22 | // *** Class variables |
23 | 23 | private $image; |
24 | - private $width; |
|
25 | - private $height; |
|
24 | + private $width; |
|
25 | + private $height; |
|
26 | 26 | private $imageResized; |
27 | 27 | |
28 | 28 | function __construct($fileName) |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | // *** Open up the file |
31 | 31 | $this->image = $this->openImage($fileName); |
32 | 32 | |
33 | - // *** Get width and height |
|
34 | - $this->width = imagesx($this->image); |
|
35 | - $this->height = imagesy($this->image); |
|
33 | + // *** Get width and height |
|
34 | + $this->width = imagesx($this->image); |
|
35 | + $this->height = imagesy($this->image); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | ## -------------------------------------------------------- |
@@ -206,8 +206,8 @@ discard block |
||
206 | 206 | public function saveImage($savePath, $imageQuality="100") |
207 | 207 | { |
208 | 208 | // *** Get extension |
209 | - $extension = strrchr($savePath, '.'); |
|
210 | - $extension = strtolower($extension); |
|
209 | + $extension = strrchr($savePath, '.'); |
|
210 | + $extension = strtolower($extension); |
|
211 | 211 | |
212 | 212 | switch($extension) |
213 | 213 | { |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | - namespace core\admin\droitsacces; |
|
2 | + namespace core\admin\droitsacces; |
|
3 | 3 | |
4 | - use core\App; |
|
4 | + use core\App; |
|
5 | 5 | |
6 | 6 | class GestionDroitAcces extends DroitAcces { |
7 | 7 | //pour les droit_acces standard |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | |
26 | 26 | |
27 | - //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
27 | + //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
28 | 28 | public function __construct($id_liste_droit_acces=null) { |
29 | 29 | $dbc = App::getDb(); |
30 | 30 | |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $this->id_liste_droit_acces = $id_liste_droit_acces; |
65 | 65 | } |
66 | 66 | } |
67 | - //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
67 | + //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
68 | 68 | |
69 | 69 | |
70 | 70 | |
71 | - //-------------------------- GETTER ----------------------------------------------------------------------------// |
|
71 | + //-------------------------- GETTER ----------------------------------------------------------------------------// |
|
72 | 72 | //pour les droit_acces standard |
73 | 73 | public function getIdListeDroitAcces() { |
74 | 74 | return $this->id_liste_droit_acces; |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | return $this->pseudo; |
109 | 109 | } |
110 | 110 | public function getNbUser(){ |
111 | - return $this->nb_user; |
|
111 | + return $this->nb_user; |
|
112 | 112 | } |
113 | 113 | |
114 | 114 | /** |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param $id_liste_droit_acces |
117 | 117 | */ |
118 | 118 | public function getListeDroitAccesDetailDroit($id_liste_droit_acces=null){ |
119 | - $dbc = \core\App::getDb(); |
|
119 | + $dbc = \core\App::getDb(); |
|
120 | 120 | |
121 | 121 | if ($id_liste_droit_acces == null) $id_liste_droit_acces = $this->id_liste_droit_acces; |
122 | 122 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @param $id_liste_droit_acces |
161 | 161 | */ |
162 | 162 | public function getListeDroitAccesDetailPage($id_liste_droit_acces=null){ |
163 | - $dbc = \core\App::getDb(); |
|
163 | + $dbc = \core\App::getDb(); |
|
164 | 164 | |
165 | 165 | if ($id_liste_droit_acces == null) $id_liste_droit_acces = $this->id_liste_droit_acces; |
166 | 166 | |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | $this->setListeDroitAccesDetailPage($id_page, $titre_page); |
180 | 180 | } |
181 | 181 | } |
182 | - //-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
182 | + //-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
183 | 183 | |
184 | 184 | |
185 | 185 | |
186 | - //-------------------------- SETTER ----------------------------------------------------------------------------// |
|
186 | + //-------------------------- SETTER ----------------------------------------------------------------------------// |
|
187 | 187 | private function setListeDroitAcces($id_liste_droit_acces, $nom_liste, $nb_droit_acces, $nb_droit_acces_page, $nb_user){ |
188 | 188 | $this->id_liste_droit_acces = $id_liste_droit_acces; |
189 | 189 | $this->nom_liste = $nom_liste; |
@@ -205,4 +205,4 @@ discard block |
||
205 | 205 | $this->prenom = $prenom; |
206 | 206 | } |
207 | 207 | //-------------------------- FIN SETTER ----------------------------------------------------------------------------// |
208 | - } |
|
209 | 208 | \ No newline at end of file |
209 | + } |
|
210 | 210 | \ No newline at end of file |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | - namespace core\admin\droitsacces; |
|
2 | + namespace core\admin\droitsacces; |
|
3 | 3 | |
4 | 4 | use core\App; |
5 | 5 | |
6 | 6 | class DroitAcces { |
7 | - private $logged; |
|
7 | + private $logged; |
|
8 | 8 | |
9 | 9 | //pour la table identite |
10 | 10 | private $id_identite; |
@@ -21,10 +21,10 @@ discard block |
||
21 | 21 | |
22 | 22 | |
23 | 23 | //-------------------------- CONSTRUCTEUR ----------------------------------------------------------------------------// |
24 | - public function __construct() { |
|
24 | + public function __construct() { |
|
25 | 25 | $dbc = \core\App::getDb(); |
26 | 26 | |
27 | - if (isset($_SESSION["idlogin".CLEF_SITE])) { |
|
27 | + if (isset($_SESSION["idlogin".CLEF_SITE])) { |
|
28 | 28 | $this->logged = true; |
29 | 29 | $this->id_identite = $_SESSION["idlogin".CLEF_SITE]; |
30 | 30 | |
@@ -44,36 +44,36 @@ discard block |
||
44 | 44 | else { |
45 | 45 | $this->logged = false; |
46 | 46 | } |
47 | - } |
|
48 | - //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
47 | + } |
|
48 | + //-------------------------- FIN CONSTRUCTEUR ----------------------------------------------------------------------------// |
|
49 | 49 | |
50 | 50 | |
51 | 51 | |
52 | - //-------------------------- GETTER ----------------------------------------------------------------------------// |
|
52 | + //-------------------------- GETTER ----------------------------------------------------------------------------// |
|
53 | 53 | public function getLogged(){ |
54 | - return $this->logged; |
|
54 | + return $this->logged; |
|
55 | 55 | } |
56 | 56 | public function getSuperAdmin(){ |
57 | - return $this->super_admin; |
|
57 | + return $this->super_admin; |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | //pour la table liste_droit_acces |
61 | 61 | public function getIdListeDroitAcces(){ |
62 | - return $this->id_liste_droit_acces; |
|
62 | + return $this->id_liste_droit_acces; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | //pour les droits sur la gestion des contenus |
66 | 66 | public function getModifSeo(){ |
67 | - return $this->modif_seo; |
|
67 | + return $this->modif_seo; |
|
68 | 68 | } |
69 | 69 | public function getModifContenu(){ |
70 | - return $this->modif_contenu; |
|
70 | + return $this->modif_contenu; |
|
71 | 71 | } |
72 | 72 | public function getModifNavigation(){ |
73 | - return $this->modif_navigation; |
|
73 | + return $this->modif_navigation; |
|
74 | 74 | } |
75 | 75 | public function getSupprimerPage(){ |
76 | - return $this->supprimer_page; |
|
76 | + return $this->supprimer_page; |
|
77 | 77 | } |
78 | 78 | |
79 | 79 | //autres getter |
@@ -240,11 +240,11 @@ discard block |
||
240 | 240 | return true; |
241 | 241 | } |
242 | 242 | } |
243 | - //-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
243 | + //-------------------------- FIN GETTER ----------------------------------------------------------------------------// |
|
244 | 244 | |
245 | 245 | |
246 | 246 | |
247 | - //-------------------------- SETTER ----------------------------------------------------------------------------// |
|
247 | + //-------------------------- SETTER ----------------------------------------------------------------------------// |
|
248 | 248 | |
249 | - //-------------------------- FIN SETTER ----------------------------------------------------------------------------// |
|
250 | - } |
|
251 | 249 | \ No newline at end of file |
250 | + //-------------------------- FIN SETTER ----------------------------------------------------------------------------// |
|
251 | + } |
|
252 | 252 | \ No newline at end of file |
@@ -1,69 +1,69 @@ |
||
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 |
@@ -1,22 +1,22 @@ discard block |
||
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 |
||
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 |
@@ -1,14 +1,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -1,48 +1,48 @@ |
||
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 |