/** * topic rss feed, 10 latest posts in the topic * @param $forum_id forum id */ function getRssTopic($topic_id) { global $gConf; $topic_id = (int) $topic_id; $gConf['topics_per_page'] = 10; $gConf['date_format'] = '%a, %e %b %Y %k:%i:%s GMT'; $fdb = new DbForum(); $t = $fdb->getTopic($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 .= <<<EOF \t\t\t<item> \t\t\t\t<title>{$tt}</title> \t\t\t\t<link>{$gConf['url']['base']}index.php?action=goto&topic_id={$r['topic_id']}</link> \t\t\t\t<description>{$td}</description> \t\t\t\t<pubDate>{$lp['when']}</pubDate> \t\t\t\t<guid>{$gConf['url']['base']}index.php?action=goto&topic_id={$r['topic_id']}</guid> \t\t\t</item> EOF; } return <<<EOF <rss version="2.0"> \t<channel> \t\t<title>{$t['topic_title']}</title> \t\t<link>{$gConf['url']['base']}index.php?action=goto&topic_id={$topic_id}</link> \t\t<description>{$t['topic_title']}</description> \t\t<lastBuildDate>{$lastBuildDate}</lastBuildDate>\t \t\t{$items} \t</channel> </rss> EOF; }
/** * delete post * @param $post_id post id * @param $topic_id topic id * @param $forum_id forum id */ function deletePostXML($post_id, $topic_id, $forum_id) { $no_access = true; $fdb = new DbForum(); $f = $fdb->getForumByPostId($post_id); if ($this->_checkUserPerm('', $f['forum_type'], 'del', $f['forum_id'])) { $no_access = false; } if ($no_access && $fdb->getPostUser((int) $post_id) == $this->_getLoginUserName()) { if ($this->_checkUserPerm('', 'own', 'del', $f['forum_id'])) { $no_access = false; } } if ($no_access) { return <<<EOF <html> <body> <script language="javascript" type="text/javascript"> \twindow.parent.document.f.accessDenied(); </script> </body> </html> EOF; } // delete post here $fdb->deletePost($post_id); $exists = $fdb->getTopic($topic_id) ? 1 : 0; return <<<EOF <html> <body> <script language="javascript" type="text/javascript"> \twindow.parent.document.f.deleteSuccess('{$f['forum_id']}', '{$topic_id}', {$exists}); </script> </body> </html> EOF; }