test filter_id slash

This commit is contained in:
Fred Tempez 2024-03-21 15:42:17 +01:00
parent fd51122918
commit f18d4eee1d
1 changed files with 22 additions and 22 deletions

View File

@ -29,13 +29,13 @@ class helper
// La traduction existe déjà dans le core // La traduction existe déjà dans le core
/* /*
if (array_key_exists($text, core::$dialog) === false && !empty($text)) { if (array_key_exists($text, core::$dialog) === false && !empty($text)) {
$dialogues = json_decode(file_get_contents('core/module/install/ressource/i18n/fr_FR.json' ), true); $dialogues = json_decode(file_get_contents('core/module/install/ressource/i18n/fr_FR.json' ), true);
$data = array_merge($dialogues,[$text => '']); $data = array_merge($dialogues,[$text => '']);
file_put_contents ('core/module/install/ressource/i18n/fr_FR.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX); file_put_contents ('core/module/install/ressource/i18n/fr_FR.json', json_encode($data, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT), LOCK_EX);
} }
*/ */
return (array_key_exists($text, core::$dialog) && !empty(core::$dialog[$text]) ? core::$dialog[$text] : $text); return (array_key_exists($text, core::$dialog) && !empty (core::$dialog[$text]) ? core::$dialog[$text] : $text);
} }
/** /**
@ -57,7 +57,7 @@ class helper
if (!file_exists('site/i18n/' . $to . '.json')) { if (!file_exists('site/i18n/' . $to . '.json')) {
file_put_contents('site/i18n/' . $to . '.json', json_encode([])); file_put_contents('site/i18n/' . $to . '.json', json_encode([]));
} }
if (!empty($text)) { if (!empty ($text)) {
//Lecture des données en ligne //Lecture des données en ligne
$data = json_decode(file_get_contents('site/i18n/' . $to . '.json'), true); $data = json_decode(file_get_contents('site/i18n/' . $to . '.json'), true);
// Mode traduction // Mode traduction
@ -92,9 +92,9 @@ class helper
public static function getIp($anon = 4) public static function getIp($anon = 4)
{ {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) { if (!empty ($_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP']; $ip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { } elseif (!empty ($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$ip = $_SERVER['HTTP_X_FORWARDED_FOR']; $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else { } else {
$ip = $_SERVER['REMOTE_ADDR']; $ip = $_SERVER['REMOTE_ADDR'];
@ -156,7 +156,7 @@ class helper
public static function arraycolumn($array, $column, $sort = null) public static function arraycolumn($array, $column, $sort = null)
{ {
$newArray = []; $newArray = [];
if (empty($array) === false) { if (empty ($array) === false) {
$newArray = array_map(function ($element) use ($column) { $newArray = array_map(function ($element) use ($column) {
return $element[$column]; return $element[$column];
}, $array); }, $array);
@ -193,7 +193,7 @@ class helper
{ {
// Creation du ZIP // Creation du ZIP
$baseName = str_replace('/', '', helper::baseUrl(false, false)); $baseName = str_replace('/', '', helper::baseUrl(false, false));
$baseName = empty($baseName) ? 'ZwiiCMS' : $baseName; $baseName = empty ($baseName) ? 'ZwiiCMS' : $baseName;
$fileName = $baseName . '-backup-' . date('Y-m-d-H-i-s', time()) . '.zip'; $fileName = $baseName . '-backup-' . date('Y-m-d-H-i-s', time()) . '.zip';
$zip = new ZipArchive(); $zip = new ZipArchive();
$zip->open($folder . $fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE); $zip->open($folder . $fileName, ZipArchive::CREATE | ZipArchive::OVERWRITE);
@ -295,7 +295,7 @@ class helper
public static function isHttps() public static function isHttps()
{ {
if ( if (
(empty($_SERVER['HTTPS']) === false and $_SERVER['HTTPS'] !== 'off') (empty ($_SERVER['HTTPS']) === false and $_SERVER['HTTPS'] !== 'off')
or $_SERVER['SERVER_PORT'] === 443 or $_SERVER['SERVER_PORT'] === 443
) { ) {
return true; return true;
@ -367,8 +367,8 @@ class helper
{ {
$version = helper::getOnlineVersion($channel); $version = helper::getOnlineVersion($channel);
$update = false; $update = false;
if (!empty($version)) { if (!empty ($version)) {
$update = version_compare(common::ZWII_VERSION, $version) == -1; $update = version_compare(common::ZWII_VERSION, $version) == -1;
} }
return $update; return $update;
} }
@ -390,10 +390,10 @@ class helper
'text' => self::relativeLuminanceW3C($rgba) > .22 ? "#222" : "#DDD", 'text' => self::relativeLuminanceW3C($rgba) > .22 ? "#222" : "#DDD",
'rgb' => 'rgb(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ')', 'rgb' => 'rgb(' . $rgba[0] . ',' . $rgba[1] . ',' . $rgba[2] . ')',
'invert' => 'rgba (' . 'invert' => 'rgba (' .
($rgba[0] < 128 ? 255 : 0) . ',' . ($rgba[0] < 128 ? 255 : 0) . ',' .
($rgba[1] < 128 ? 255 : 0) . ',' . ($rgba[1] < 128 ? 255 : 0) . ',' .
($rgba[1] < 128 ? 255 : 0) . ',' . ($rgba[1] < 128 ? 255 : 0) . ',' .
($rgba[0] < 128 ? 255 : 0) . ')' ($rgba[0] < 128 ? 255 : 0) . ')'
]; ];
} }
@ -434,8 +434,8 @@ class helper
$text = mb_strtolower($text, 'UTF-8'); $text = mb_strtolower($text, 'UTF-8');
$text = strip_tags( $text = strip_tags(
str_replace( str_replace(
explode(',', 'á,à,â,ä,ã,å,ç,é,è,ê,ë,í,ì,î,ï,ñ,ó,ò,ô,ö,õ,ú,ù,û,ü,ý,ÿ,\',", '), explode(',', 'á,à,â,ä,ã,å,ç,é,è,ê,ë,í,ì,î,ï,ñ,ó,ò,ô,ö,õ,ú,ù,û,ü,ý,ÿ,\',", ,//'),
explode(',', 'a,a,a,a,a,a,c,e,e,e,e,i,i,i,i,n,o,o,o,o,o,u,u,u,u,y,y,-,-,-'), explode(',', 'a,a,a,a,a,a,c,e,e,e,e,i,i,i,i,n,o,o,o,o,o,u,u,u,u,y,y,-,-,-,-'),
$text $text
) )
); );
@ -445,7 +445,7 @@ class helper
// Supprime les tirets en fin de chaine (emoji en fin de nom) // Supprime les tirets en fin de chaine (emoji en fin de nom)
$text = rtrim($text, '-'); $text = rtrim($text, '-');
// Cas où un identifiant est vide // Cas où un identifiant est vide
if (empty($text)) { if (empty ($text)) {
$text = uniqid(''); $text = uniqid('');
} }
// Un ID ne peut pas être un entier, pour éviter les conflits avec le système de pagination // Un ID ne peut pas être un entier, pour éviter les conflits avec le système de pagination