function onNewTopic($iForumId, $sTopicSubject, $sTopicText, $isTopicSticky, $sUser, $sTopicUri, $iPostId) { $fdb = new DbForum(); $oProfile = new BxDolProfile($sUser); $aTopic = $fdb->getTopicByUri($sTopicUri); if (BX_ORCA_INTEGRATION == 'dolphin' && !isAdmin($oProfile->getID())) { defineForumActions(); $aForum = $fdb->getForum($iForumId, false); $iActionId = BX_FORUM_PUBLIC_POST; if (isset($aForum['forum_type']) && 'private' == $aForum['forum_type']) { $iActionId = BX_FORUM_PRIVATE_POST; } checkAction($oProfile->getID(), $iActionId, true); // perform action } $a = array($iForumId, $sTopicSubject, $sTopicText, $isTopicSticky, $sUser); forumAlert('new_topic', $aTopic['topic_id'], $oProfile->getID(), $a); }
/** * topic rss feed, 10 latest posts in the topic * @param $forum_id forum id */ function getRssTopic($topic_uri) { global $gConf; $gConf['topics_per_page'] = 10; $gConf['date_format'] = '%a, %e %b %Y %k:%i:%s GMT'; $fdb = new DbForum(); $t = $fdb->getTopicByUri($topic_uri); $topic_id = (int) $t['topic_id']; if (!$t) { exit; } $a = $fdb->getPosts($topic_id, 0); reset($a); $items = ''; $lastBuildDate = ''; while (list(, $r) = each($a)) { $lp = $fdb->getTopicPost($r['topic_id'], 'last'); $td = strip_tags(substr($r['post_text'], 0, 256)); if (strlen($td) == 256) { $td .= '[...]'; } $tt = substr($td, 0, 32); $lastBuildDate = $lp['when']; $items .= "\n\t\t\t<item>\n\t\t\t\t<title>{$tt}</title>\n\t\t\t\t<link>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['topic'], $t['topic_uri']) . "</link>\n\t\t\t\t<description>{$td}</description>\n\t\t\t\t<pubDate>{$lp['when']}</pubDate>\n\t\t\t\t<guid>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['topic'], $t['topic_uri']) . "#{$r['post_id']}</guid>\n\t\t\t</item>"; } return "\n<rss version=\"2.0\">\n\t<channel>\n\t\t<title>{$t['topic_title']}</title>\n\t\t<link>" . $gConf['url']['base'] . sprintf($gConf['rewrite']['topic'], $t['topic_uri']) . "</link>\n\t\t<description>{$t['topic_title']}</description>\n\t\t<lastBuildDate>{$lastBuildDate}</lastBuildDate>\t\n\t\t{$items}\n\t</channel>\n</rss>"; }