Rev 125 | Rev 127 | 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 | |||
| 126 | tom | 36 | if (!empty($error)) |
| 37 | { |
||
| 38 | $page->drawError($error, false); |
||
| 39 | } |
||
| 40 | |||
| 100 | freddie | 41 | ?> |
| 42 | |||
| 125 | tom | 43 | <form action="add-post.php" method="post"> |
| 100 | freddie | 44 | <table> |
| 45 | <tr> |
||
| 46 | <td class="bold">Title: </td> |
||
| 47 | <td><input type="text" name="title" /></td> |
||
| 48 | </tr> |
||
| 49 | <tr> |
||
| 50 | <td class="bold">Content: </td> |
||
| 124 | tom | 51 | <td><textarea name="content" style="width: 500px; height: 300px;"></textarea></td> |
| 100 | freddie | 52 | </tr> |
| 53 | <tr> |
||
| 54 | <td class="bold">Catagory: </td> |
||
| 120 | tom | 55 | <td><input type="text" name="category" /></td> |
| 100 | freddie | 56 | </tr> |
| 57 | |||
| 58 | <?php |
||
| 59 | write('<input type="hidden" name="parentID" value="' . $_GET['id'] . '"/>'); |
||
| 60 | ?> |
||
| 61 | |||
| 62 | <tr> |
||
| 63 | <td class="bold"></td> |
||
| 64 | <td><input type="submit" value="Post" /></td> |
||
| 65 | </tr> |
||
| 66 | </table> |
||
| 67 | </form> |
||
| 68 | |||
| 69 | <?php |
||
| 70 | |||
| 71 | $page->drawFooter(); |
||
| 72 | |||
| 73 | ?> |