Subversion Repositories taios

Rev

Rev 493 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php

require '../_taios.php';

$page = new Taios_Page('Nowify', '../');

if (isset($_GET['id'])) {
    $id = $_GET['id'];
} else if (isset($_POST['id'])) {
    $id = $_POST['id'];
} else {
    $page->drawError('No ID set.');
}

$page->checkLoggedIn();

$post = $page->getBlogPost($id);
if ((!$page->isUserAdmin($page->getLoggedInUser()) && $page->getLoggedInUser()->ID != $post->author->ID) || !$page->isUserNormal($page->getLoggedInUser())) {
    $page->drawError('You do not have permission to access this page.');
}

$error = '';

if (isset($_POST['id']))
{
    $title = $_POST['title'];

    $page->query("UPDATE BlogPosts SET DatePosted = NOW() WHERE ID = ?", array($id));
    $page->redirect('/blog/post.php?id=' . $id);
}

$page->drawHeader();
$page->drawBlogCategoriesMenu();
$page->drawMiddle();

if (!empty($error)) {
    $page->drawError($error, false);
}

?>

<form action="nowify.php" method="post">
Press Sumbit if you wish to nowify post <?php echo htmlentities($post->title, ENT_QUOTES); ?>.<br /><br />

<?php
write('<input type="hidden" name="id" value="' . $id . '" />');
?>

<tr>
<td class="bold"></td>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
</form>

<?php

$page->drawFooter();

?>