0 && $_GET['limit'] < 16) {
$limit = intval($_GET['limit']);
}
/* max. Angezeigte Länge der RSS-Beschreibung = _GET[rdt] */
$rssdecriptiontrunk = intval($backend_rssdecriptiontrunk);
if (isset($_GET['rdt']) && is_numeric($_GET['rdt']) && $_GET['rdt'] > 0) {
$rssdecriptiontrunk = intval($_GET['rdt']);
}
/* max. Angezeigte Länge der Image-Beschreibung = _GET[pdt] */
$imagedescriptiontrunk = intval($backend_imagedescriptiontrunk);
if (isset($_GET['pdt']) && is_numeric($_GET['pdt']) && $_GET['pdt'] > 0) {
$imagedescriptiontrunk = intval($_GET['pdt']);
}
/* max. Angezeigte Länge der einzelnen Item-Beschreibung = _GET[idt] */
$itemdescriptiontrunk = intval($backend_itemdescriptiontrunk);
if (isset($_GET['idt']) && is_numeric($_GET['idt']) && $_GET['idt'] > 0) {
$itemdescriptiontrunk = intval($_GET['idt']);
}
# ## global informations for rss-syndication
$rss = new UniversalFeedCreator();
# $rss->useCached();
$rss->descriptionTruncSize = $rssdecriptiontrunk;
$rss->descriptionHtmlSyndicated = false;
$rss->title = htmlspecialchars($sitename);
$rss->description = htmlspecialchars($backend_title);
$rss->language = $backend_language;
$rss->link = MX_HOME_URL . '/';
$rss->syndicationURL = MX_HOME_URL . '/' . basename(__file__);
$image = new FeedImage();
$image->descriptionTruncSize = $imagedescriptiontrunk;
$image->descriptionHtmlSyndicated = false;
$image->title = $sitename . "-Logo";
$image->url = MX_HOME_URL . "/" . $logo;
$image->link = MX_HOME_URL . '/';
$image->description = "Feed provided by " . MX_HOME_URL . ". Click to visit.";
$rss->image = $image;
# ## end global informations
$modules = sql_query("SELECT title, active FROM " . $prefix . "_modules");
while (list($modulename, $modulactive) = sql_fetch_row($modules)) {
$modcheck[$modulename] = $modulactive;
}
$actions = array("news", "story", "downs", "board", "link", "auswahl", "smf", "all");
$versions = array("RSS0.91", "RSS1.0", "RSS2.0", "OPML", "mbox", "PIE0.1", "ATOM0.3", "HTML", "JS");
function stories ($version)
{
global $rss, $limit, $prefix, $itemdescriptiontrunk, $modcheck;
$heute = time();
$result = sql_query("SELECT sid, title, hometext, UNIX_TIMESTAMP(time)AS date, informant FROM " . $prefix . "_stories where (UNIX_TIMESTAMP(time) <= " . $heute . ") ORDER BY `time` DESC limit " . $limit);
if (!$result) {
echo "An error occured";
} else {
if ((mxModuleAllowed("News")) && ($modcheck['News'])) {
while ($data_stories = sql_fetch_object($result)) {
$item = new FeedItem();
$item->descriptionTruncSize = $itemdescriptiontrunk;
$item->title = strip_tags (rss_bbencode($data_stories->title));
$item->link = MX_HOME_URL . "/modules.php?name=News&file=article&sid=" . $data_stories->sid;
$item->description = strip_tags (rss_bbencode($data_stories->hometext));
$item->date = intval($data_stories->date);
$item->source = MX_HOME_URL . "/modules.php?name=News";
$item->author = $data_stories->informant;
$rss->addItem($item);
}
} else {
moduleerror("News");
}
}
unset ($result, $data_stories);
}
function eBoard ($version)
{
global $rss, $limit, $prefix, $itemdescriptiontrunk, $modcheck ;
if (!@include("modules/eBoard/settings.php")) {
moduleerror("eBoard");
return;
}
$result = sql_query("SELECT a.tid, a.subject, a.message, a.lastpost, a.dateline, b.private, b.userlist FROM " . $table_threads . " AS a LEFT JOIN " . $table_forums . " AS b ON a.fid =b.fid WHERE private='' AND userlist='' ORDER BY a.lastpost DESC limit " . $limit);
if (!$result) {
echo "An error occured";
} else {
if ((mxModuleAllowed("eBoard")) && ($modcheck['eBoard'])) {
while ($data_board = sql_fetch_object($result)) {
$item = new FeedItem();
$item->descriptionTruncSize = $itemdescriptiontrunk;
$item->title = strip_tags(rss_bbencode($data_board->subject));
$item->link = MX_HOME_URL . "/modules.php?op=modload&name=eBoard&file=viewthread&tid=" . $data_board->tid;
$item->description = strip_tags(rss_bbencode($data_board->message));
$datum = substr($data_board->lastpost, 0, (strpos($data_board->lastpost, "|")));
$informant = substr(strrchr($data_board->lastpost, "|"), 1);
$item->date = intval($datum);
$item->source = MX_HOME_URL . "/modules.php?name=eBoard";
$item->author = $informant;
$rss->addItem($item);
}
} else {
moduleerror("eBoard");
}
}
unset ($result, $data_board, $informant, $datum);
}
function links ($version)
{
global $rss, $limit, $prefix, $itemdescriptiontrunk, $modcheck ;
$result = sql_query("select lid, title, description, UNIX_TIMESTAMP(date)AS datum, submitter from " . $prefix . "_links_links order by date DESC limit " . $limit);
if (!$result) {
echo "An error occured";
} else {
if ((mxModuleAllowed("Web_Links")) && ($modcheck['Web_Links'])) {
while ($data_links = sql_fetch_object($result)) {
$item = new FeedItem();
$item->descriptionTruncSize = $itemdescriptiontrunk;
$item->title = strip_tags(rss_bbencode($data_links->title));
$item->link = MX_HOME_URL . "/modules.php?name=Web_Links&l_op=viewlinkdetails&lid=" . $data_links->lid . "&ttitle=" . urlencode(trim($data_links->title));
$item->description = strip_tags(rss_bbencode($data_links->description));
$item->date = intval($data_links->datum);
$item->source = MX_HOME_URL . "/modules.php?name=WebLinks";
$item->author = $data_links->submitter;
$rss->addItem($item);
}
} else {
moduleerror("Web_Links");
}
}
unset ($result, $data_links);
}
function downloads ($version)
{
global $rss, $limit, $prefix, $itemdescriptiontrunk, $modcheck ;
$result = sql_query("select lid, title, description, UNIX_TIMESTAMP(date)AS datum, submitter from " . $prefix . "_downloads_downloads order by date DESC limit " . $limit);
if (!$result) {
echo "An error occured";
} else {
if ((mxModuleAllowed("Downloads")) && ($modcheck['Downloads'])) {
while ($data_down = sql_fetch_object($result)) {
if (($version == "RSS1.0")or($version == "RSS2.0")) {
$data_down->description = rss_bbencode($data_down->description);
$data_down->title = rss_bbencode($data_down->title);
}
$item = new FeedItem();
$item->descriptionTruncSize = $itemdescriptiontrunk;
$item->title = strip_tags(rss_bbencode($data_down->title));
$item->link = MX_HOME_URL . "/modules.php?name=Downloads&d_op=viewdownloaddetails&lid=" . $data_down->lid . "&ttitle=" . urlencode(trim($data_down->title));
$item->description = strip_tags(rss_bbencode($data_down->description));
$item->date = intval($data_down->datum);
$item->source = MX_HOME_URL . "/modules.php?name=Downloads";
$item->author = $data_down->submitter;
$rss->addItem($item);
}
} else {
moduleerror("Downloads");
}
}
unset ($result, $data_down);
}
function simple($version)
{
global $rss, $limit, $prefix, $itemdescriptiontrunk, $scripturl, $modcheck;
if ((mxModuleAllowed("Forum")) && ($modcheck['Forum'])) {
if (!@include("modules/Forum/smf/Settings.php")) {
return;
}
$user_info['query_see_board'] = 'FIND_IN_SET(-1, b.memberGroups)';
$board = "";
# $db_prefix="mx_org_smf_";
# $db_prefix=$prefix."_".$db_prefix;
$scripturl = $boardurl . '/index.php';
$search = array ("''si", // Strip out javascript
"'<[\/\!]*?[^<>]*?>'si", // Strip out html tags
"'([\r\n])[\s]+'", // Strip out white space
"'(\ )+'",
"'&(quot|#34);'i", // Replace html entities
"'&(amp|#38);'i",
"'&(lt|#60);'i",
"'&(gt|#62);'i",
"'&(nbsp|#160);'i",
"'&(iexcl|#161);'i",
"'&(cent|#162);'i",
"'&(pound|#163);'i",
"'&(copy|#169);'i",
"'(\d+);'e"); // evaluate as php
$replace = array ("",
" ",
"\\1",
" ",
"\"",
"&",
"<",
">",
" ",
chr(161),
chr(162),
chr(163),
chr(169),
"chr(\\1)");
$result = sql_query("SELECT
m.smileysEnabled, m.posterTime, m.ID_MSG, m.subject, m.body, t.ID_TOPIC, t.ID_BOARD,
b.name AS bname, t.numReplies, m.ID_MEMBER, IFNULL(mem.realName, m.posterName) AS posterName,
mem.hideEmail, IFNULL(mem.emailAddress, m.posterEmail) AS posterEmail
FROM " . $db_prefix . "topics AS t, " . $db_prefix . "messages AS m, " . $db_prefix . "boards AS b
LEFT JOIN " . $db_prefix . "members AS mem ON (mem.ID_MEMBER = m.ID_MEMBER)
WHERE b.ID_BOARD = t.ID_BOARD
AND m.ID_MSG = t.ID_LAST_MSG
AND FIND_IN_SET(-1, b.memberGroups)
ORDER BY m.ID_MSG DESC
LIMIT " . $limit);
while ($row = sql_fetch_object($result)) {
// Limit the length of the message, if the option is set.
if (!empty($itemdescriptiontrunk) && strlen(str_replace('
', "\n", $row->body)) > $itemdescriptiontrunk)
$row->body = strtr(substr(str_replace('
', "\n", $row->body), 0, $itemdescriptiontrunk - 3), array("\n" => '
')) . '...';
// Being news, this actually makes sense in rss format.
/*if (($version=="RSS1.0")or($version=="RSS2.0"))
{
$row->subject = rss_bbencode($row->subject);
$row->body = rss_bbencode($row->body);
}*/
$item = new FeedItem();
$item->descriptionTruncSize = $itemdescriptiontrunk;
$item->title = preg_replace($search, $replace, $row->subject);
$item->link = MX_HOME_URL . "/modules.php?name=Forum&topic=" . $row->ID_TOPIC . ".msg" . $row->ID_MSG . "#msg" . $row->ID_MSG;
$item->description = preg_replace($search, $replace, $row->body);
$item->date = intval($row->posterTime);
$item->source = MX_HOME_URL . "/modules.php?name=Forum";
$item->author = $row->posterName;
$rss->addItem($item);
}
} else {
moduleerror("Forum");
}
unset ($row);
}
function rss_bbencode($msg)
{
$pattern = '#(\<(img|i?frame|object|i?layer|script|link|embed)[^\&g t;]+([[:space:]]{0,})(src|rel)([[:space:]]{0,})?=([^\>]+)?admin\.php\?[^ \>]+\>)|(\[img\](.+)?(admin\.php\?).+?\[/img\])#si';
if (preg_match($pattern, $msg)) {
mxErrorScreen("found malicious Code in BBCode");
}
$msg = preg_replace("#\[quote\](.*?)\[/quote]#si", "
| Quote |
\\1 |