Browse Source

add required fields validation

main
ghost 3 years ago
parent
commit
91f368af58
  1. 12
      src/application/controller/api/post/add.php

12
src/application/controller/api/post/add.php

@ -17,10 +17,16 @@ if (isset($_SESSION['userName'])) { @@ -17,10 +17,16 @@ if (isset($_SESSION['userName'])) {
}
}
if (!isset($_POST['message'])) {
if ($postK && $result = $_twister->newPostMessage($_SESSION['userName'],
$postK,
Filter::post($_POST['message']))) {
$response = [
'success' => false,
'message' => _('Message required')
];
} else if ($postK && $result = $_twister->newPostMessage($_SESSION['userName'],
$postK,
Filter::post($_POST['message']))) {
$response = [
'success' => true,

Loading…
Cancel
Save