Subversion Repositories taios

Rev

Rev 165 | Rev 169 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
157 freddie 1
<?php
2
 
3
require '../_taios.php';
4
 
5
$page = new Taios_Page('Blog Posts', '../');
6
 
7
if (!isset($_GET['id']))
8
    $id = $_GET['id'];
9
else if (!isset($_POST['id']))
10
    $id = $_POST['id'];
11
else
12
    $page->redirect("index.php");
13
 
14
$page->checkLoggedIn();
15
 
16
$post = $page->getBlogPost($id);
17
if (!$page->isUserAdmin($page->getLoggedInUser()) && $page->getLoggedInUser()->ID != $post->author->ID)
18
{
19
    $page->drawError('You do not have permission to access this page.');
20
}
21
 
22
$error = '';
23
 
24
if (isset($_POST['id']))
25
{
26
    $title = $_POST['title'];
27
    $content = $_POST['content'];
28
    $category = $_POST['category'];
29
 
30
    if (empty($title))
31
    {
32
        $error = "No Title Specified";
33
    }
34
    else if (empty($content))
35
    {
36
        $error = "No Content Specified";
37
    }
38
    else
39
    {
167 freddie 40
    //    $page->query('update table BlogPosts set Content="' . $content . '", Title="' . $title . '", Category="' . $category . '" where ID=' . $id);
157 freddie 41
        $page->redirect('index.php');
42
    }
43
}
44
 
45
$page->drawHeader();
46
$page->drawBlogCategoriesMenu();
47
$page->drawMiddle();
48
 
49
if (!empty($error))
50
{
51
    $page->drawError($error, false);
52
}
53
 
54
?>
55
 
56
<form action="add-post.php?id=<?php echo getParentID(); ?>" method="post">
57
<table>
58
<tr>
59
<td class="bold">Title: </td>
162 freddie 60
<td><input type="text" name="title" value="<?php echo $post->title; ?>/></td>
157 freddie 61
</tr>
62
<tr>
63
<td class="bold">Content: </td>
161 freddie 64
<td><textarea name="content" style="width: 500px; height: 300px;"><?php echo $post->content; ?></textarea></td>
157 freddie 65
</tr>
66
<tr>
67
<td class="bold">Catagory: </td>
68
<td><input type="text" name="category" /><?php echo $post->category; ?></td>
69
</tr>
70
 
71
<?php
72
write('<input type="hidden" name="is" value="' . $id . '" />');
73
?>
74
 
75
<tr>
76
<td class="bold"></td>
77
<td><input type="submit" value="Post" /></td>
78
</tr>
79
</table>
80
</form>
81
 
82
<?php
83
 
84
$page->drawFooter();
85
 
86
?>
87