Exemplo n.º 1
0
<?php

$Authen = new ExtendedAuthenticationEngine();
if (!$Authen->isAuthorized(3)) {
    header('Location: ?mod=mod_adminpage');
    die;
}
$E = new BlogEngine();
$post = $E->getPost($_POST["POST_ID"]);
$LoginData = $Authen->getLoginData();
if ($LoginData["USER_ID"] != $post->getPostOwner() && !$Authen->isAuthorized(4)) {
    header('Location: ?mod=mod_adminpage');
} else {
    $data = $E->delPost($_POST["POST_ID"]);
    if ($data) {
        header("Location: ?mod=mod_adminpage");
    } else {
        echo "Delete Post Failed";
    }
}
Exemplo n.º 2
0
<html>
	<head>
		<title>Welcome To My Blog</title>
		<meta charset="UTF-8">
		<style>
			<?php 
MWF_ViewLoader::Load("mod_core_design", "base_css");
?>
		</style>
	</head>
	<body>
		<?php 
MWF_ViewLoader::Load("mod_core_design", "headerbar");
?>
		<?php 
if ($Authen->isAuthorized(1)) {
    echo '<p><a href="?mod=mod_adminpage&view=add_entry">Create new blog entry</a></p>';
}
?>
		<hr>
<?php 
if (!isset($_GET["page"])) {
    $page = 1;
} else {
    $page = $_GET["page"];
}
if (!isset($_GET["per_page"])) {
    $per_page = 30;
} else {
    $per_page = $_GET["per_page"];
}
Exemplo n.º 3
0
<?php

$Authen = new ExtendedAuthenticationEngine();
if (!$Authen->isAuthorized(1)) {
    header('Location: ?mod=mod_adminpage');
    die;
}
$blogengine = new BlogEngine();
$PostData = new PostData(NULL, $_POST["title"], $_POST["data"], NULL);
// New Post Object with Given Data ($_POST)
$success = $blogengine->newPost($PostData);
if (!$success) {
    header('Location: ?mod=mod_adminpage&view=add_entry&success=0');
} else {
    header('Location: ?mod=mod_adminpage');
}