Subversion Repositories taios

Rev

Rev 189 | Rev 484 | 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
    {
30
        $post = $page->getBlogPost($ids[$i]);
31
        write('<tr>');
32
        write('<td><a href="../blog/edit-post.php?id=' . $post->ID . '">' . $post->ID . '</a></td>');
33
        if ($post->parent == -1)
34
        {
35
            write('<td style="color: #444444;">No Parent</td>');
36
        }
37
        else
38
        {
39
            write('<td>' . $post->parent->title . '</td>');
40
        }
41
        write('<td><a href="account.php?id=' . $post->author->ID . '">' . $post->author->name . '</a></td>');
42
        write('<td>' . $post->title . '</td>');
189 tom 43
        write('<td>' . str_replace("\n", '<br />', $post->content) . '</td>');
169 tom 44
        write('<td>' . date('j/m/Y H:i', $post->datePosted) . '</td>');
45
        write('<td>' . $post->category . '</td>');
46
        write('<td>' . $post->spam . '</td>');
47
        write('</tr>');
48
    }
49
 
50
    write('</table>');
51
}
52
else
53
{
186 tom 54
    $page->drawError('You do not have permission to access this page.');
169 tom 55
}
56
 
57
$page->drawFooter();
58
 
59
?>
60