/** * returns flagged topics XML * @param $wp return whole page XML */ function getMyFlagsXML($wp) { global $gConf; $user = $this->getLoginUser(); $fdb = new DbForum(); $f = $fdb->getForum($forum_id); if (!$user) { return $this->_no_access($wp); } $x1 = <<<EOF <forum> \t<title>Flagged topics</title> \t<desc>Topics you have flagged</desc> </forum> EOF; $x2 = ''; $user_last_act = (int) $fdb->getUserLastActivity($user); $a = $fdb->getMyFlaggedTopics($user); reset($a); $t = ''; while (list(, $r) = each($a)) { $lp = $fdb->getTopicPost($r['topic_id'], 'last'); $fp = $fdb->getTopicPost($r['topic_id'], 'first'); $td = $fdb->getTopicDesc($r['topic_id']); $this->_buld_topic_desc($td); if (!$user) { $new_topic = 0; } else { $new_topic = $this->isNewTopic($r['topic_id'], $r['last_post_when'], $user_last_act) ? 1 : 0; } encode_post_text($r['topic_title'], $wp, 1); $t .= <<<EOF <topic id="{$r['topic_id']}" new="{$new_topic}" lpt="{$r['last_post_when']}" lut="{$user_last_act}"> \t<url>javascript:return vod(0);</url> \t<onclick>return f.selectTopic({$r['topic_id']});</onclick> \t<title>{$r['topic_title']}</title> \t<desc>{$td}</desc> \t<count>{$r['count_posts']}</count> \t<last_u>{$lp['user']}</last_u> \t<last_d>{$lp['when']}</last_d> \t<first_u>{$fp['user']}</first_u> \t<first_d>{$fp['when']}</first_d> </topic> EOF; } $p = ''; $num = $fdb->getTopicsNum($forum_id); for ($i = 0; $i < $num; $i += $gConf['topics_per_page']) { $p .= '<p c="' . ($start >= $i && $start < $i + $gConf['topics_per_page'] ? 1 : 0) . '" start="' . $i . '">' . ($i / $gConf['topics_per_page'] + 1) . '</p>'; } if ($wp) { $li = $this->_getLoginInfo(); return $this->addHeaderFooter($li, "<topics><pages>{$p}</pages>{$x2}{$x1}{$t}</topics>"); } else { $cu = $this->getUrlsXml(); return "<root>{$cu}<topics><pages>{$p}</pages>{$x2}{$x1}{$t}</topics></root>"; } }