Exemple #1
0
        if (!isset($attachments[$attachment['pid']])) {
            $attachments[$attachment['pid']] = array();
        }
        $attachments[$attachment['pid']][] = $attachment;
    }
    $query = $db->simple_select("posts", "message, edittime, tid, fid, pid", $firstpostlist, array('order_by' => 'dateline', 'order_dir' => 'desc'));
    while ($post = $db->fetch_array($query)) {
        $parser_options = array("allow_html" => $forumcache[$post['fid']]['allowhtml'], "allow_mycode" => $forumcache[$post['fid']]['allowmycode'], "allow_smilies" => $forumcache[$post['fid']]['allowsmilies'], "allow_imgcode" => $forumcache[$post['fid']]['allowimgcode'], "allow_videocode" => $forumcache[$post['fid']]['allowvideocode'], "filter_badwords" => 1, "filter_cdata" => 1);
        $parsed_message = $parser->parse_message($post['message'], $parser_options);
        if (isset($attachments[$post['pid']]) && is_array($attachments[$post['pid']])) {
            foreach ($attachments[$post['pid']] as $attachment) {
                $ext = get_extension($attachment['filename']);
                $attachment['filename'] = htmlspecialchars_uni($attachment['filename']);
                $attachment['filesize'] = get_friendly_size($attachment['filesize']);
                $attachment['icon'] = get_attachment_icon($ext);
                eval("\$attbit = \"" . $templates->get("postbit_attachments_attachment") . "\";");
                if (stripos($parsed_message, "[attachment=" . $attachment['aid'] . "]") !== false) {
                    $parsed_message = preg_replace("#\\[attachment=" . $attachment['aid'] . "]#si", $attbit, $parsed_message);
                } else {
                    $parsed_message .= "<br />" . $attbit;
                }
            }
        }
        $items[$post['tid']]['description'] = $parsed_message;
        $items[$post['tid']]['updated'] = $post['edittime'];
        $feedgenerator->add_item($items[$post['tid']]);
    }
}
// Then output the feed XML.
$feedgenerator->output_feed();