Seite 1 von 1

RSS-Feed-Anpassung Foren-Zugriffsrechte

Verfasst: 24.02.2006 13:28
von rkern
hallo,

da ich nicht damit zufrieden war, dass der RSS-Feed immer nur die öffentlichen Foren ausliefert, habe ich einen Patch für rdf.php geschrieben.

Sinn des Patches ist es, bei permanent angemeldeten Nutzern in der Firefox-RSS-Unterstützung die vom Nutzer lesbaren Foren auszuliefern.

Basis ist die rdf.php von phpBB.de.

Suche folgende Zeilen:

Code: Alles auswählen

// SQL statement to fetch active topics of public forums
$sql = "SELECT t.topic_id, t.topic_title, p.post_id, p.post_time, pt.post_text, pt.bbcode_uid, f.forum_name
    FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " AS pt, " . FORUMS_TABLE . " AS f
    WHERE
        f.forum_id = t.forum_id
            AND f.auth_view = " . AUTH_ALL . "
            AND p.topic_id = t.topic_id
            AND p.post_id = $sql_post_id_field
            AND pt.post_id = p.post_id
            $sql_where
    ORDER BY $sql_orderby LIMIT $count";
$topics_query = $db->sql_query($sql);
und ersetze durch:

Code: Alles auswählen

// SQL statement to fetch readable forums
$sql = "SELECT f.forum_id FROM ". FORUMS_TABLE ." AS f
        WHERE f.forum_id >= 0
            $sql_where";
$forum_query = $db->sql_query($sql);
if ( !$forum_query )
{
    die("Failed obtaining list of readable forums");
}
else
{
    $forums = $db->sql_fetchrowset($forum_query);
    $fid_new = array();
    for ($i = 0; $i < count($forums); $i++)
    {
        $fid = $forums[$i]['forum_id'];
        $auth = auth(AUTH_READ, $fid, $userdata);
        if ($auth['auth_read'])
                $fid_new[] = $fid;
    }
}
$fid = $fid_new;
$sql_where = " AND f.forum_id IN (" . implode($fid, ", ") . ")";

// SQL statement to fetch active topics of
$sql = "SELECT t.topic_id, t.topic_title, p.post_id, p.post_time, pt.post_text, pt.bbcode_uid, f.forum_name
    FROM " . TOPICS_TABLE . " AS t, " . POSTS_TABLE . " AS p, " . POSTS_TEXT_TABLE . " AS pt, " . FORUMS_TABLE . " AS f
    WHERE
        f.forum_id = t.forum_id
            AND p.topic_id = t.topic_id
            AND p.post_id = $sql_post_id_field
            AND pt.post_id = p.post_id
            $sql_where
    ORDER BY $sql_orderby LIMIT $count";
$topics_query = $db->sql_query($sql);
mfg Ralph