Rev 121 | Rev 123 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
100 | freddie | 1 | <?php |
2 | |||
3 | require '../_taios.php'; |
||
4 | |||
5 | $page = new Taios_Page('Blog Posts', '../'); |
||
6 | |||
120 | tom | 7 | $error = ''; |
103 | freddie | 8 | |
120 | tom | 9 | $title = $_POST['title']; |
10 | $content = $_POST['content']; |
||
11 | $parentID = $_POST['parentID']; |
||
12 | $category = $_POST['category']; |
||
13 | |||
14 | if (empty($title)) |
||
100 | freddie | 15 | { |
120 | tom | 16 | $error = "No Title Specified"; |
17 | } |
||
18 | else if (empty($content)) |
||
19 | { |
||
20 | $error = "No Content Specified"; |
||
21 | } |
||
22 | else if (empty($parentID)) |
||
23 | { |
||
24 | $error = "No Parent ID Specified"; |
||
25 | } |
||
26 | else |
||
27 | { |
||
28 | $page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)'); |
||
100 | freddie | 29 | $page->redirect('index.php'); |
30 | } |
||
31 | |||
32 | $page->drawHeader(); |
||
33 | $page->drawBlogCategoriesMenu(); |
||
34 | $page->drawMiddle(); |
||
35 | |||
36 | if ($page->isUserGM($page->getLoggedInUser())) |
||
37 | { |
||
38 | write('<p class="bold"><a href="add-post.php">Add Post</a></p>'); |
||
39 | write('<br />'); |
||
40 | } |
||
41 | |||
42 | ?> |
||
43 | |||
120 | tom | 44 | <form action="post-add.php" method="post"> |
100 | freddie | 45 | <table> |
46 | <tr> |
||
47 | <td class="bold">Title: </td> |
||
48 | <td><input type="text" name="title" /></td> |
||
49 | </tr> |
||
50 | <tr> |
||
51 | <td class="bold">Content: </td> |
||
122 | tom | 52 | <td><textarea name="content" style="width: 600xp; height: 400px;"></textarea></td> |
100 | freddie | 53 | </tr> |
54 | <tr> |
||
55 | <td class="bold">Catagory: </td> |
||
120 | tom | 56 | <td><input type="text" name="category" /></td> |
100 | freddie | 57 | </tr> |
58 | |||
59 | <?php |
||
60 | write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>'); |
||
61 | ?> |
||
62 | |||
63 | <tr> |
||
64 | <td class="bold"></td> |
||
65 | <td><input type="submit" value="Post" /></td> |
||
66 | </tr> |
||
67 | </table> |
||
68 | </form> |
||
69 | |||
70 | <?php |
||
71 | |||
72 | $page->drawFooter(); |
||
73 | |||
74 | ?> |