public static function ActionAddPost() { if (UserModel::isUserLoggedIn() and isset($_POST['title']) and isset($_POST['header']) and isset($_POST['content']) and isset($_POST['photos'])) { $title = $_POST['title']; $header = $_POST['header']; $text = $_POST['content']; $photos = json_decode($_POST['photos']); PostModel::addPost($title, $header, $text, $photos); } header('Location: /event/' . PostModel::getPostsCount()); }