Skip to content
Snippets Groups Projects
forumposts.php 562 B
Newer Older
  • Learn to ignore specific revisions
  • <?php
    unset($result);
    require_once("/usr/share/adodb/adodb.inc.php");
    $ForumDB = NewADOConnection('postgres8');
    $ForumDB->Connect('dbname=punbb');
    $ForumDB->SetFetchMode(ADODB_FETCH_ASSOC);
    
    $posts = $ForumDB->GetAll('SELECT t.subject, t.last_poster, t.last_post_id FROM topics AS t INNER JOIN forums AS f ON f.id=t.forum_id LEFT JOIN forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=4) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) ORDER BY t.last_post DESC LIMIT 5');
    
    $smarty->assign('posts', $posts);
    
    $result = $smarty->fetch('forumposts.tpl');
    ?>