Subversion Repositories taios

Rev

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