|
|
@ -1,12 +1,13 @@
|
|
|
|
<?php
|
|
|
|
<?php
|
|
|
|
namespace config;
|
|
|
|
namespace config;
|
|
|
|
|
|
|
|
use model\ValidationException;
|
|
|
|
|
|
|
|
|
|
|
|
class Validation
|
|
|
|
class Validation
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public static function val_action($action)
|
|
|
|
public static function val_action($action)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!isset($action)) {
|
|
|
|
if (!isset($action)) {
|
|
|
|
throw new \Exception('pas d\'action');
|
|
|
|
throw new ValidationException('pas d\'action');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -15,13 +16,13 @@ class Validation
|
|
|
|
if ($jeu == '' || !filter_var($jeu, FILTER_SANITIZE_STRING)) {
|
|
|
|
if ($jeu == '' || !filter_var($jeu, FILTER_SANITIZE_STRING)) {
|
|
|
|
$dVueErreur[] = 'Aucun jeu selectionné';
|
|
|
|
$dVueErreur[] = 'Aucun jeu selectionné';
|
|
|
|
$jeu = 0;
|
|
|
|
$jeu = 0;
|
|
|
|
throw new \Exception("Erreur jeu");
|
|
|
|
throw new ValidationException("Erreur jeu");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($difficulty == '' || !filter_var($difficulty, FILTER_VALIDATE_INT)) {
|
|
|
|
if ($difficulty == '' || !filter_var($difficulty, FILTER_VALIDATE_INT)) {
|
|
|
|
$dVueErreur[] = "Aucune difficultée séléctionnée";
|
|
|
|
$dVueErreur[] = "Aucune difficultée séléctionnée";
|
|
|
|
$difficulty = 0;
|
|
|
|
$difficulty = 0;
|
|
|
|
throw new \Exception("Erreur difficulté");
|
|
|
|
throw new ValidationException("Erreur difficulté");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -30,14 +31,14 @@ class Validation
|
|
|
|
if ($user == '' || !filter_var($user, FILTER_SANITIZE_STRING)) {
|
|
|
|
if ($user == '' || !filter_var($user, FILTER_SANITIZE_STRING)) {
|
|
|
|
$dVueErreur[] = 'Identifiant invalide';
|
|
|
|
$dVueErreur[] = 'Identifiant invalide';
|
|
|
|
$jeu = 0;
|
|
|
|
$jeu = 0;
|
|
|
|
throw new \Exception("Erreur identifiant");
|
|
|
|
throw new ValidationException("Erreur identifiant");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static function valCodeInvitation(string &$codeInvitation, &$dVueErreur){
|
|
|
|
public static function valCodeInvitation(string &$codeInvitation, &$dVueErreur){
|
|
|
|
if($codeInvitation == ''){
|
|
|
|
if($codeInvitation == ''){
|
|
|
|
$dVueErreur[] = 'Code d\'invitation invalide';
|
|
|
|
$dVueErreur[] = 'Code d\'invitation invalide';
|
|
|
|
throw new \Exception("Code d'invitation invalide");
|
|
|
|
throw new ValidationException("Code d'invitation invalide");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return htmlspecialchars($codeInvitation);
|
|
|
|
return htmlspecialchars($codeInvitation);
|
|
|
|
}
|
|
|
|
}
|
|
|
|