Subversion Repositories taios

Rev

Rev 126 | Rev 128 | 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
 
127 tom 3
function getParentID()
4
{
5
    if (isset($_GET['id']))
6
    {
7
        return $_GET['id'];
8
    }
9
    else
10
    {
11
        return -1;
12
    }
13
}
14
 
100 freddie 15
require '../_taios.php';
16
 
17
$page = new Taios_Page('Blog Posts', '../');
18
 
120 tom 19
$error = '';
103 freddie 20
 
120 tom 21
$title = $_POST['title'];
22
$content = $_POST['content'];
23
$parentID = $_POST['parentID'];
24
$category = $_POST['category'];
25
 
26
if (empty($title))
100 freddie 27
{
120 tom 28
    $error = "No Title Specified";
29
}
30
else if (empty($content))
31
{
32
    $error = "No Content Specified";
33
}
34
else if (empty($parentID))
35
{
36
    $error = "No Parent ID Specified";
37
}
38
else
39
{
40
    $page->query('INSERT INTO BlogPosts VALUES(0, ' . $parentID . ', "' . $page->getLoggedInUser()->ID . '", "' . $title . '", "' . $content . '", NOW(), "' . $category . '", 0)');
100 freddie 41
    $page->redirect('index.php');
42
}
43
 
44
$page->drawHeader();
45
$page->drawBlogCategoriesMenu();
46
$page->drawMiddle();
47
 
126 tom 48
if (!empty($error))
49
{
50
    $page->drawError($error, false);
51
}
52
 
100 freddie 53
?>
54
 
125 tom 55
<form action="add-post.php" method="post">
100 freddie 56
<table>
57
<tr>
58
<td class="bold">Title: </td>
59
<td><input type="text" name="title" /></td>
60
</tr>
61
<tr>
62
<td class="bold">Content: </td>
124 tom 63
<td><textarea name="content" style="width: 500px; height: 300px;"></textarea></td>
100 freddie 64
</tr>
65
<tr>
66
<td class="bold">Catagory: </td>
120 tom 67
<td><input type="text" name="category" /></td>
100 freddie 68
</tr>
69
 
70
<?php
127 tom 71
write('<input type="hidden" name="parentID" value="' . getParentID() . '"/>');
100 freddie 72
?>
73
 
74
<tr>
75
<td class="bold"></td>
76
<td><input type="submit" value="Post" /></td>
77
</tr>
78
</table>
79
</form>
80
 
81
<?php
82
 
83
$page->drawFooter();
84
 
85
?>