Zeile 1 | Zeile 1 |
---|
<?php /** * MyBB 1.4
|
<?php /** * MyBB 1.4
|
* Copyright � 2008 MyBB Group, All Rights Reserved
| * Copyright © 2008 MyBB Group, All Rights Reserved
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* * Website: http://www.mybboard.net * License: http://www.mybboard.net/about/license *
|
* $Id: syndication.php 4111 2008-08-13 06:14:12Z Tikitiki $
| * $Id: syndication.php 4847 2010-03-30 01:41:16Z RyanGordon $
|
*/
define("IN_MYBB", 1);
| */
define("IN_MYBB", 1);
|
Zeile 33 | Zeile 33 |
---|
{ $thread_limit = 50; }
|
{ $thread_limit = 50; }
|
else if(!$thread_limit)
| else if(!$thread_limit || $thread_limit < 0)
|
{ $thread_limit = 20; }
| { $thread_limit = 20; }
|
Zeile 58 | Zeile 58 |
---|
// If there are any, add SQL to exclude them. if($unviewableforums) {
|
// If there are any, add SQL to exclude them. if($unviewableforums) {
|
$unviewable .= " AND f.fid NOT IN($unviewableforums)";
| $unviewable .= " AND fid NOT IN($unviewableforums)";
|
}
if($inactiveforums) {
|
}
if($inactiveforums) {
|
$unviewable .= " AND f.fid NOT IN($inactiveforums)";
| $unviewable .= " AND fid NOT IN($inactiveforums)";
|
}
// If there are no forums to syndicate, syndicate all viewable. if(!empty($forumlist)) {
|
}
// If there are no forums to syndicate, syndicate all viewable. if(!empty($forumlist)) {
|
$forum_ids = "'-1'"; foreach($forumlist as $fid) { $forum_ids .= ",'".intval($fid)."'"; } $forumlist = "AND f.fid IN ($forum_ids) $unviewable";
| $forum_ids = "'-1'"; foreach($forumlist as $fid) { $forum_ids .= ",'".intval($fid)."'"; } $forumlist = "AND fid IN ($forum_ids) $unviewable";
|
} else {
|
} else {
|
$forumlist = $unviewable; $all_forums = 1;
| $forumlist = $unviewable; $all_forums = 1;
|
}
// Find out which title to add to the feed. $title = $mybb->settings['bbname'];
|
}
// Find out which title to add to the feed. $title = $mybb->settings['bbname'];
|
$query = $db->simple_select("forums f", "f.name, f.fid", "1=1 ".$forumlist);
| $query = $db->simple_select("forums", "name, fid, allowhtml, allowmycode, allowsmilies, allowimgcode", "1=1 ".$forumlist);
|
$comma = " - "; while($forum = $db->fetch_array($query)) {
|
$comma = " - "; while($forum = $db->fetch_array($query)) {
|
$title .= $comma.$forum['name']; $forumcache[$forum['fid']] = $forum; $comma = ", ";
| $title .= $comma.$forum['name']; $forumcache[$forum['fid']] = $forum; $comma = ", ";
|
}
// If syndicating all forums then cut the title back to "All Forums" if($all_forums) {
|
}
// If syndicating all forums then cut the title back to "All Forums" if($all_forums) {
|
$title = $mybb->settings['bbname']." - ".$lang->all_forums;
| $title = $mybb->settings['bbname']." - ".$lang->all_forums;
|
}
|
}
|
// Get the threads to syndicate. $query = $db->query(" SELECT t.tid, t.dateline, p.edittime, t.subject, f.allowhtml, f.allowmycode, f.allowsmilies, f.allowimgcode, f.name, p.message, u.username, p.smilieoff, f.fid FROM ".TABLE_PREFIX."threads t LEFT JOIN ".TABLE_PREFIX."forums f ON (f.fid=t.fid) LEFT JOIN ".TABLE_PREFIX."posts p ON (p.pid=t.firstpost) LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=p.uid) WHERE t.visible=1 AND t.closed NOT LIKE 'moved|%' ".$forumlist." ORDER BY t.dateline DESC LIMIT 0, ".$thread_limit );
| |
// Set the feed type. $feedgenerator->set_feed_format($mybb->input['type']);
|
// Set the feed type. $feedgenerator->set_feed_format($mybb->input['type']);
|
|
|
// Set the channel header. $channel = array(
|
// Set the channel header. $channel = array(
|
"title" => $title, "link" => $mybb->settings['bburl']."/", "date" => TIME_NOW, "description" => $mybb->settings['bbname']." - ".$mybb->settings['bburl']
| "title" => $title, "link" => $mybb->settings['bburl']."/", "date" => time(), "description" => $mybb->settings['bbname']." - ".$mybb->settings['bburl']
|
); $feedgenerator->set_channel($channel);
|
); $feedgenerator->set_channel($channel);
|
| // Get the threads to syndicate. $query = $db->simple_select("threads", "subject, tid, dateline, firstpost", "visible='1' AND closed NOT LIKE 'moved|%' ".$forumlist, array('order_by' => 'dateline', 'order_dir' => 'DESC', 'limit' => $thread_limit));
|
// Loop through all the threads. while($thread = $db->fetch_array($query)) {
|
// Loop through all the threads. while($thread = $db->fetch_array($query)) {
|
$thread['link'] = $channel['link'].get_thread_link($thread['tid']); if($forumcache[$thread['fid']]) { if($thread['smilieoff']) { $thread['allowsmilies'] = 0; } // Set up the parser options.
| $items[$thread['tid']] = array( "title" => $thread['subject'], "link" => $channel['link'].get_thread_link($thread['tid']), "date" => $thread['dateline'], ); $firstposts[] = $thread['firstpost']; }
if(!empty($firstposts)) { $firstpostlist = "pid IN(".$db->escape_string(implode(',', $firstposts)).")"; $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(
|
$parser_options = array(
|
"allow_html" => $thread['allowhtml'], "allow_mycode" => $thread['allowmycode'], "allow_smilies" => $thread['allowsmilies'], "allow_imgcode" => $thread['allowimgcode'],
| "allow_html" => $forumcache[$post['fid']]['allowhtml'], "allow_mycode" => $forumcache[$post['fid']]['allowmycode'], "allow_smilies" => $forumcache[$post['fid']]['allowsmilies'], "allow_imgcode" => $forumcache[$post['fid']]['allowimgcode'],
|
"filter_badwords" => 1 );
|
"filter_badwords" => 1 );
|
$thread['message'] = $parser->parse_message($thread['message'], $parser_options); $item = array( 'updated' => $thread['edittime'], 'author' => $thread['username'], 'title' => $thread['subject'], 'name' => $thread['forumname'], 'description' => $thread['message'], 'date' => $thread['dateline'], 'link' => $thread['link'] );
| $parsed_message = $parser->parse_message($post['message'], $parser_options);
$query2 = $db->simple_select("attachments", "*", "pid=".$post['pid']); while($attachment = $db->fetch_array($query2)) { $ext = get_extension($attachment['filename']); $attachment['icon'] = get_attachment_icon($ext); if($ext == "jpeg" || $ext == "gif" || $ext == "bmp" || $ext == "png" || $ext == "jpg") { if(stripos($parsed_message, "[attachment=".$attachment['aid']."]") !== false) { eval("\$attbit = \"".$templates->get("postbit_attachments_thumbnails_thumbnail")."\";"); $parsed_message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $parsed_message); } } else { if(stripos($parsed_message, "[attachment=".$attachment['aid']."]") !== false) { eval("\$attbit = \"".$templates->get("postbit_attachments_attachment")."\";"); $parsed_message = preg_replace("#\[attachment=".$attachment['aid']."]#si", $attbit, $parsed_message); } } }
|
|
|
$feedgenerator->add_item($item);
| $items[$post['tid']]['description'] = $parsed_message; $items[$post['tid']]['updated'] = $post['edittime']; $feedgenerator->add_item($items[$post['tid']]);
|
} }
| } }
|