diff options
Diffstat (limited to 'controller/Security.php')
-rw-r--r-- | controller/Security.php | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/controller/Security.php b/controller/Security.php index 6ea121c..c53cdc6 100644 --- a/controller/Security.php +++ b/controller/Security.php | |||
@@ -14,10 +14,16 @@ class Security | |||
14 | ); | 14 | ); |
15 | private static $specHtmLawed = ''; // optionnel: faire qu'un certain élément puisse n'avoir que certains attributs | 15 | private static $specHtmLawed = ''; // optionnel: faire qu'un certain élément puisse n'avoir que certains attributs |
16 | 16 | ||
17 | public static function secureString($chaine) | 17 | public static function secureString(string $chaine): string |
18 | { | 18 | { |
19 | $chaine = htmLawed($chaine, self::$configHtmLawed, self::$specHtmLawed); | 19 | $chaine = htmLawed($chaine, self::$configHtmLawed, self::$specHtmLawed); |
20 | $chaine = trim($chaine); // supprimer espaces, tabulations et sauts de ligne en début et fin de chaine (pour l'entrée de l'éditeur) | 20 | $chaine = trim($chaine); // supprimer espaces, tabulations et sauts de ligne en début et fin de chaine (pour l'entrée de l'éditeur) |
21 | return $chaine; | 21 | return $chaine; |
22 | } | 22 | } |
23 | } | 23 | } |
24 | |||
25 | function removeSpacesTabsCRLF(string $chaine): string | ||
26 | { | ||
27 | $cibles = [' ', "\t", "\n", "\r"]; // doubles quotes !! | ||
28 | return(str_replace($cibles, '', $chaine)); | ||
29 | } | ||