Post bearbeitet!
'; } if ($action == 'view'): ?>
= $data['title'] ?>
= nl2br($data['text']) ?>
Kommentare'; if(is_array($result_comments)) { foreach($result_comments as $comment) { ?>
hasRole([ \Bloggr\Roles::ADMIN, \Bloggr\Roles::AUTHOR ])) { header('Location: /'); die(); } } $errors = []; $action = ''; $data = []; $success = false; $title = "404 Not Found"; if (isset($_GET['view'])) { if (isset($_POST['comment'])) { $result = $auth->commentPost($_GET['view'], $_POST['comment']); if (is_array($result)) { $errors = $result; } } $result = $auth->getPost($_GET['view']); $result_comments = $auth->getPostComments($_GET['view']); if(!$result) { array_push($errors, '404 Not Found'); } else { $title = $result['title']; $action = 'view'; $data = $result; } } else if (isset($_GET['new'])) { $action = 'new'; $title = "Neuer Beitrag"; } else if (isset($_GET['edit'])) { $action = 'edit'; $title = "Beitrag bearbeitem"; } else { array_push($errors, '404 Not Found'); } if ($action == 'new' && isset($_POST['new'])) { $result = $auth->newPost($_POST['title'], $_POST['text']); if (is_array($result)) { $errors = $result; } else { header("Location: /post.php?view=".$result); } } $ptitle = ""; $text = ""; if ($action == 'edit' && isset($_POST['edit'])) { $result = $auth->editPost($_GET['edit'], $_POST['title'], $_POST['text']); if (is_array($result)) { $errors = $result; } else { $success = true; } } if ($action == 'edit' && isset($_POST['delete'])) { $result = $auth->removePost($_GET['edit']); if (is_array($result)) { $errors = $result; } else { header("Location: /"); } } if ($action == 'edit') { $result = $auth->getPost($_GET['edit']); if(!$result) { array_push($errors, '404 Not Found'); } else { $data = $result; } } ?>
= nl2br($data['text']) ?>
Kommentare'; if(is_array($result_comments)) { foreach($result_comments as $comment) { ?>