hasRole([ \Bloggr\Roles::ADMIN, \Bloggr\Roles::AUTHOR ])) { header('Location: /'); die(); } } $errors = []; $action = ''; $data = []; $success = false; if (isset($_GET['view'])) { if (isset($_POST['comment'])) { $result = $auth->commentPost($_GET['view'], $_POST['comment']); } $result = $auth->getPost($_GET['view']); $result_comments = $auth->getPostComments($_GET['view']); if(!$result) { array_push($errors, '404 Not Found'); } else { $action = 'view'; $data = $result; } } else if (isset($_GET['new'])) { $action = 'new'; } else if (isset($_GET['edit'])) { $action = 'edit'; } 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); } } $title = ""; $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') { $result = $auth->getPost($_GET['edit']); if(!$result) { array_push($errors, '404 Not Found'); } else { $data = $result; } } ?> Neuer Beitrag - <?= (defined("SITE_TITLE")) ? SITE_TITLE : 'A Bloggr Site' ?>
Home $value): ?>
Post bearbeitet!
'; } if ($action == 'view'): if ($auth->canEditPost($data["id"]) == true) echo 'Edit Post'; ?>

Titel:

Text:

Author:

Last edit at

isLoggedIn()) { ?>

-

Neuer Beitrag


Beitrag Bearbeiten