Subversion Repositories taios

Rev

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

Rev Author Line No. Line
169 tom 1
<?php
2
 
3
require '../_taios.php';
4
 
5
$page = new Taios_Page('Manage All Blog Posts', '../');
6
$page->drawHeader();
7
$page->drawMiddle();
8
 
9
$page->checkLoggedIn();
10
 
11
if ($page->isUserAdmin($page->getLoggedInUser()))
12
{
13
    write('<p class="bold">Use this to manage all the blog posts on the Tim32 Website.</p><br />');
14
 
15
    write('<table>');
16
    write('<tr>');
17
    write('<td class="bold">ID</td>');
18
    write('<td class="bold">Parent</td>');
19
    write('<td class="bold">Author</td>');
20
    write('<td class="bold">Title</td>');
21
    write('<td class="bold">Content</td>');
22
    write('<td class="bold">Date Posted</td>');
23
    write('<td class="bold">Category</td>');
24
    write('<td class="bold">Spam</td>');
25
    write('</tr>');
26
 
190 tom 27
    $ids = $page->findIDs('BlogPosts', 'ORDER BY DatePosted DESC');
169 tom 28
    for ($i = 0; $i < count($ids); $i++)
29
    {
466 tom 30
        $id_str = $ids[$i];
31
        if (!empty($id_str))
169 tom 32
        {
466 tom 33
            $post = $page->getBlogPost($id_str);
34
            write('<tr>');
35
            write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
36
            if ($post->parent == -1)
37
            {
38
                write('<td style="color: #444444;">No Parent</td>');
39
            }
40
            else
41
            {
42
                write('<td>' . $post->parent->title . '</td>');
43
            }
44
            write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
45
            write('<td>' . $post->title . '</td>');
46
            write('<td>' . str_replace("\n", '<br />', $post->content) . '</td>');
47
            write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>');
48
            write('<td>' . $post->category . '</td>');
49
            write('<td>' . $post->spam . '</td>');
50
            write('</tr>');
169 tom 51
        }
52
    }
53
 
54
    write('</table>');
55
}
56
else
57
{
186 tom 58
    $page->drawError('You do not have permission to access this page.');
169 tom 59
}
60
 
61
$page->drawFooter();
62
 
63
?>
64