hasRole([ \Bloggr\Roles::ADMIN, \Bloggr\Roles::AUTHOR ])) { header('Location: /'); die(); } } $errors = []; $action = ''; $data = []; $success = false; if (isset($_GET['view'])) { $result = $auth->getPost($_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; } } if (isset($_POST['login'])) { $login = $auth->login($_POST['user'], $_POST['password']); if (is_array($login)) { $errors = $login; } else { header('Location: /'); } } ?> Neuer Beitrag - <?= (defined("SITE_TITLE")) ? SITE_TITLE : 'A Bloggr Site' ?>
Home $value): ?>
Post bearbeitet!
'; } if ($action == 'view'): ?>

Titel:

Text:

Author:

Neuer Beitrag


Beitrag Bearbeiten