Rev 493 | Go to most recent revision | Details | 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 | |||
7 | if (isset($_GET['id'])) |
||
8 | { |
||
9 | $id = $_GET['id']; |
||
10 | } |
||
11 | else if (isset($_POST['id'])) |
||
12 | { |
||
13 | $id = $_POST['id']; |
||
14 | } |
||
15 | else |
||
16 | { |
||
17 | $page->drawError('No ID set.'); |
||
18 | } |
||
19 | |||
20 | $page->checkLoggedIn(); |
||
21 | |||
22 | $post = $page->getBlogPost($id); |
||
23 | if ((!$page->isUserAdmin($page->getLoggedInUser()) && $page->getLoggedInUser()->ID != $post->author->ID) || !$page->isUserNormal($page->getLoggedInUser())) |
||
24 | { |
||
25 | $page->drawError('You do not have permission to access this page.'); |
||
26 | } |
||
27 | |||
28 | $error = ''; |
||
29 | |||
30 | if (isset($_POST['id'])) |
||
31 | { |
||
32 | $title = $_POST['title']; |
||
33 | |||
34 | $page->query('UPDATE BlogPosts SET DatePosted = NOW() WHERE ID = "' . $id . '"'); |
||
35 | $page->redirect('/blog/post.php?id=' . $id); |
||
36 | } |
||
37 | |||
38 | $page->drawHeader(); |
||
39 | $page->drawBlogCategoriesMenu(); |
||
40 | $page->drawMiddle(); |
||
41 | |||
42 | if (!empty($error)) |
||
43 | { |
||
44 | $page->drawError($error, false); |
||
45 | } |
||
46 | |||
47 | ?> |
||
48 | |||
49 | <form action="nowify.php" method="post"> |
||
50 | Press Sumbit if you wish to nowify post <?php echo $post->title; ?>.<br /><br /> |
||
51 | |||
52 | <?php |
||
53 | write('<input type="hidden" name="id" value="' . $id . '" />'); |
||
54 | ?> |
||
55 | |||
56 | <tr> |
||
57 | <td class="bold"></td> |
||
58 | <td><input type="submit" value="Submit" /></td> |
||
59 | </tr> |
||
60 | </table> |
||
61 | </form> |
||
62 | |||
63 | <?php |
||
64 | |||
65 | $page->drawFooter(); |
||
66 | |||
67 | ?> |
||
68 |