Rev 493 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
485 | muzer | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
5 | $page = new Taios_Page('Nowify', '../'); |
||
6 | |||
493 | tom | 7 | if (isset($_GET['id'])) { |
485 | muzer | 8 | $id = $_GET['id']; |
493 | tom | 9 | } else if (isset($_POST['id'])) { |
485 | muzer | 10 | $id = $_POST['id']; |
493 | tom | 11 | } else { |
485 | muzer | 12 | $page->drawError('No ID set.'); |
13 | } |
||
14 | |||
15 | $page->checkLoggedIn(); |
||
16 | |||
17 | $post = $page->getBlogPost($id); |
||
493 | tom | 18 | if ((!$page->isUserAdmin($page->getLoggedInUser()) && $page->getLoggedInUser()->ID != $post->author->ID) || !$page->isUserNormal($page->getLoggedInUser())) { |
485 | muzer | 19 | $page->drawError('You do not have permission to access this page.'); |
20 | } |
||
21 | |||
22 | $error = ''; |
||
23 | |||
24 | if (isset($_POST['id'])) |
||
25 | { |
||
26 | $title = $_POST['title']; |
||
27 | |||
493 | tom | 28 | $page->query("UPDATE BlogPosts SET DatePosted = NOW() WHERE ID = ?", array($id)); |
485 | muzer | 29 | $page->redirect('/blog/post.php?id=' . $id); |
30 | } |
||
31 | |||
32 | $page->drawHeader(); |
||
33 | $page->drawBlogCategoriesMenu(); |
||
34 | $page->drawMiddle(); |
||
35 | |||
493 | tom | 36 | if (!empty($error)) { |
485 | muzer | 37 | $page->drawError($error, false); |
38 | } |
||
39 | |||
40 | ?> |
||
41 | |||
42 | <form action="nowify.php" method="post"> |
||
522 | muzer | 43 | Press Sumbit if you wish to nowify post <?php echo htmlentities($post->title, ENT_QUOTES); ?>.<br /><br /> |
485 | muzer | 44 | |
45 | <?php |
||
46 | write('<input type="hidden" name="id" value="' . $id . '" />'); |
||
47 | ?> |
||
48 | |||
49 | <tr> |
||
50 | <td class="bold"></td> |
||
51 | <td><input type="submit" value="Submit" /></td> |
||
52 | </tr> |
||
53 | </table> |
||
54 | </form> |
||
55 | |||
56 | <?php |
||
57 | |||
58 | $page->drawFooter(); |
||
59 | |||
60 | ?> |