ensure text and at are string in api to create scheduled
This commit is contained in:
parent
87a04742a3
commit
69bf62f115
|
@ -272,6 +272,26 @@ namespace controllers\publics;
|
||||||
return $this->json($return);
|
return $this->json($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!is_string($at))
|
||||||
|
{
|
||||||
|
$return = self::DEFAULT_RETURN;
|
||||||
|
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
|
||||||
|
$return['message'] = self::ERROR_MESSAGES['INVALID_PARAMETER'] . ' : at must be a string.';
|
||||||
|
$this->auto_http_code(false);
|
||||||
|
|
||||||
|
return $this->json($return);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($text))
|
||||||
|
{
|
||||||
|
$return = self::DEFAULT_RETURN;
|
||||||
|
$return['error'] = self::ERROR_CODES['INVALID_PARAMETER'];
|
||||||
|
$return['message'] = self::ERROR_MESSAGES['INVALID_PARAMETER'] . ' : text must be a string.';
|
||||||
|
$this->auto_http_code(false);
|
||||||
|
|
||||||
|
return $this->json($return);
|
||||||
|
}
|
||||||
|
|
||||||
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s'))
|
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s'))
|
||||||
{
|
{
|
||||||
$return = self::DEFAULT_RETURN;
|
$return = self::DEFAULT_RETURN;
|
||||||
|
@ -282,6 +302,9 @@ namespace controllers\publics;
|
||||||
return $this->json($return);
|
return $this->json($return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$at = (string) $at;
|
||||||
|
$text = (string) $text;
|
||||||
|
|
||||||
if (($this->user['settings']['mms'] ?? false) && $mms)
|
if (($this->user['settings']['mms'] ?? false) && $mms)
|
||||||
{
|
{
|
||||||
$return = self::DEFAULT_RETURN;
|
$return = self::DEFAULT_RETURN;
|
||||||
|
|
|
@ -298,6 +298,27 @@ namespace controllers\publics;
|
||||||
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($at))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'Vous ne pouvez pas créer un Sms sans date.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($at))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'La date doit être valide.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($text))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'Votre message doit être un texte.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s') && !\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i'))
|
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s') && !\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i'))
|
||||||
{
|
{
|
||||||
\FlashMessage\FlashMessage::push('danger', 'Vous devez fournir une date valide.');
|
\FlashMessage\FlashMessage::push('danger', 'Vous devez fournir une date valide.');
|
||||||
|
@ -435,6 +456,27 @@ namespace controllers\publics;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($at))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'Vous ne pouvez pas créer un Sms sans date.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($at))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'La date doit être valide.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_string($text))
|
||||||
|
{
|
||||||
|
\FlashMessage\FlashMessage::push('danger', 'Votre message doit être un texte.');
|
||||||
|
|
||||||
|
return $this->redirect(\descartes\Router::url('Scheduled', 'add'));
|
||||||
|
}
|
||||||
|
|
||||||
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s') && !\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i'))
|
if (!\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i:s') && !\controllers\internals\Tool::validate_date($at, 'Y-m-d H:i'))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Reference in New Issue