diff --git a/build/api/core/Checker.php b/build/api/core/Checker.php index 0aa6056..65e9262 100644 --- a/build/api/core/Checker.php +++ b/build/api/core/Checker.php @@ -99,6 +99,10 @@ return $checker && is_string($value) && preg_match('/^[\w\.-]+$/ui', $value); break; + case 'lettersutf8': + return $checker && is_string($value) && preg_match('/^[^\W\d]+$/ui', $value); + break; + case 'letters': return $checker && is_string($value) && preg_match('/^[a-z -]+$/i', $value); break; @@ -107,6 +111,10 @@ return $checker && is_numeric($value) && floor($value) == $value && $value >= 0 && $value <= 100; break; + case 'rfid': + return $checker && preg_match('@^[\dA-F]{2}(?:\-[\dA-F]{2}){3,5}$@', $value); + break; + // Tableau non vide case 'array': return $checker && is_array($value) && count($value) > 0; diff --git a/build/orm/core/Rows.php b/build/orm/core/Rows.php index 75de9df..ec66941 100755 --- a/build/orm/core/Rows.php +++ b/build/orm/core/Rows.php @@ -1082,9 +1082,9 @@ $formatted[$i][$index] = floatval( $value ); // String utf8 management elseif( \mb_detect_encoding($value) === 'UTF-8' ) - $formatted[$i][$index] = utf8_encode($value); + $formatted[$i][$index] = $value; else - $formatted[$i][$index] = utf8_encode(utf8_decode($value)); + $formatted[$i][$index] = utf8_encode($value); // Si pas non plus une aggrégation et si indice numérique, on le retire }else if( !preg_match('/^agg_.+/', $index) && is_numeric($index) ) diff --git a/config/modules.json b/config/modules.json index d07240a..e72845b 100755 --- a/config/modules.json +++ b/config/modules.json @@ -92,8 +92,8 @@ "parameters": { "code": { "description": "Code RFID de l'utilisateur.", "type": "rfid" }, "username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)" }, - "firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)" }, - "lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)" }, + "firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)" }, + "lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)" }, "mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail" } }, "output": { @@ -193,8 +193,8 @@ "id_user": { "description": "UID de l'utilisateur.", "type": "id" }, "code": { "description": "Code RFID de l'utilisateur.", "type": "rfid", "optional": true }, "username": { "description": "Identifiant de l'utilisateur.", "type": "varchar(1,30,alphanumeric)", "optional": true }, - "firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true }, - "lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,letters)", "optional": true }, + "firstname": { "description": "Prénom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)", "optional": true }, + "lastname": { "description": "Nom de l'utilisateur.", "type": "varchar(3,30,lettersutf8)", "optional": true }, "mail": { "description": "Adresse mail de l'utilisateur.", "type": "mail", "optional": true }, "password": { "description": "Mot de passe de l'utilisateur.", "type": "text", "optional": true }, "status": { "description": "Status de l'utilisateur.", "type": "status", "optional": true }