Exemple #1
0
$query = $db->simple_select("forums", "name, fid, allowhtml, allowmycode, allowsmilies, allowimgcode, allowvideocode", "1=1 " . $forumlist);
$comma = " - ";
while ($forum = $db->fetch_array($query)) {
    $title .= $comma . $forum['name'];
    $forumcache[$forum['fid']] = $forum;
    $comma = $lang->comma;
}
// If syndicating all forums then cut the title back to "All Forums"
if ($all_forums) {
    $title = $mybb->settings['bbname'] . " - " . $lang->all_forums;
}
// Set the feed type.
$feedgenerator->set_feed_format($mybb->input['type']);
// Set the channel header.
$channel = array("title" => $title, "link" => $mybb->settings['bburl'] . "/", "date" => time(), "description" => $mybb->settings['bbname'] . " - " . $mybb->settings['bburl']);
$feedgenerator->set_channel($channel);
$permsql = "";
$onlyusfids = array();
// Check group permissions if we can't view threads not started by us
$group_permissions = forum_permissions();
foreach ($group_permissions as $fid => $forum_permissions) {
    if ($forum_permissions['canonlyviewownthreads'] == 1) {
        $onlyusfids[] = $fid;
    }
}
if (!empty($onlyusfids)) {
    $permsql .= "AND ((fid IN(" . implode(',', $onlyusfids) . ") AND uid='{$mybb->user['uid']}') OR fid NOT IN(" . implode(',', $onlyusfids) . "))";
}
// Get the threads to syndicate.
$query = $db->simple_select("threads", "subject, tid, dateline, firstpost", "visible='1' AND closed NOT LIKE 'moved|%' {$permsql} {$forumlist}", array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => $thread_limit));
// Loop through all the threads.