function getXxxPostsXML($wp, $sDbFunc, $sTitle, $sAddXml = '') { global $gConf; global $f; $ui = array(); $fdb = new DbForum(); $adb = new DbAdmin(); if (!$this->_admin) { if ($wp) { $GLOBALS['f']->setTitle('<![CDATA[' . $sTitle . ']]>'); $li = $GLOBALS['f']->_getLoginInfo($u); return $this->addHeaderFooter($li, "<posts></posts>"); } else { return "<root><posts></posts></root>"; } } // check user permissions to delete or edit posts $gl_allow_edit = 1; $gl_allow_del = 1; $gl_allow_hide_posts = 1; $gl_allow_unhide_posts = 1; $gl_allow_clear_report = 1; $gl_allow_download = 1; $u = $f->_getLoginUser(); $a = $adb->{$sDbFunc}($u); reset($a); $p = ''; while (list(, $r) = each($a)) { // acquire user info if (!$ui[$r['user']]) { $aa = $f->_getUserInfo($r['user']); encode_post_text($aa['role']); $ui[$r['user']] = array('posts' => $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar'], 'url' => $aa['profile_url'], 'onclick' => $aa['profile_onclick'], 'role' => $aa['role']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; $files = $GLOBALS['f']->_getAttachmentsXML($r['post_id']); encode_post_text($r['post_text']); $p .= <<<EOF <post id="{$r['post_id']}" force_show="1"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<allow_hide_posts>{$gl_allow_hide_posts}</allow_hide_posts> \t<allow_unhide_posts>{$gl_allow_unhide_posts}</allow_unhide_posts> <allow_download>{$gl_allow_download}</allow_download> {$sAddXml} \t<points>{$r['votes']}</points> <hidden>{$r['hidden']}</hidden> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t\t<url>{$ui[$r['user']]['url']}</url> \t\t<onclick>{$ui[$r['user']]['onclick']}</onclick> <role>{$ui[$r['user']]['role']}</role> \t</user> <attachments>{$files}</attachments> \t<min_point>{$gConf['min_point']}</min_point> </post> EOF; $rr = $r; } if ($wp) { $GLOBALS['f']->setTitle('<![CDATA[' . $sTitle . ']]>'); $li = $GLOBALS['f']->_getLoginInfo($u); return $this->addHeaderFooter($li, "<posts><topic><title>{$sTitle}</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts>"); } else { $cu = $this->getUrlsXml(); return "<root>{$cu}<posts><topic><title>{$sTitle}</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts></root>"; } }
/** * returns topic posts XML * @param $topic_id * @param $wp return whole page XML */ function getPostsXML($topic_id, $wp) { global $gConf; $ui = array(); $fdb = new DbForum(); $u = $this->_getLoginUser(); // check user permission to read this topic posts $forum_type = $fdb->getForumTypeByTopicId($topic_id); if (!$this->_checkUserPerm($u, $forum_type, 'read')) { return $this->_no_access($wp); } $this->setTrackTopic($topic_id); // check user permissions to delete or edit posts $gl_allow_edit = 0; $gl_allow_del = 0; if ($this->_checkUserPerm($u, $forum_type, 'edit')) { $gl_allow_edit = 1; } if ($this->_checkUserPerm($u, $forum_type, 'del')) { $gl_allow_del = 1; } $a = $fdb->getPosts($topic_id, $u); reset($a); $p = ''; while (list(, $r) = each($a)) { // acquire user info if (!$ui[$r['user']]) { $aa = $this->_getUserInfo($r['user']); $ui[$r['user']] = array('posts' => $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar'], 'url' => $aa['profile_url'], 'onclick' => $aa['profile_onclick']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; if (!$allow_edit && $r['user'] == $u) { if ($this->_checkUserPerm($r['user'], 'own', 'edit')) { $allow_edit = 1; } } if (!$allow_del && $r['user'] == $u) { if ($this->_checkUserPerm($r['user'], 'own', 'del')) { $allow_del = 1; } } encode_post_text($r['post_text'], $wp, 1); $p .= <<<EOF <post id="{$r['post_id']}" force_show="0"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<points>{$r['votes']}</points> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t\t<url>{$ui[$r['user']]['url']}</url> \t\t<onclick>{$ui[$r['user']]['onclick']}</onclick> \t</user> \t<min_point>{$gConf['min_point']}</min_point> </post> EOF; $rr = $r; } $t = $fdb->getTopic($rr['topic_id']); $cat_title = $fdb->getCatTitle($t['cat_id']); encode_post_text($cat_title, $wp); $x0 = <<<EOF <cat> \t<id>{$t['cat_id']}</id> \t<title>{$cat_title}</title> </cat> EOF; encode_post_text($t['forum_title'], $wp); encode_post_text($t['forum_desc'], $wp); $x1 = <<<EOF <forum> \t<id>{$rr['forum_id']}</id> \t<title>{$t['forum_title']}</title> \t<desc>{$t['forum_desc']}</desc> \t<type>{$f['forum_type']}</type> \t<href>javascript:void(0);</href> \t<onclick>return f.selectForum({$t['forum_id']});</onclick> </forum> EOF; encode_post_text($t['topic_title'], $wp, 1); $x2 = <<<EOF <topic> \t<id>{$rr['topic_id']}</id> \t<title>{$t['topic_title']}</title> <locked>{$t['topic_locked']}</locked> </topic> EOF; if ($wp) { $li = $this->_getLoginInfo($u); return $this->addHeaderFooter($li, "<posts>{$x0}{$x1}{$x2}{$p}</posts>"); } else { $cu = $this->getUrlsXml(); $li = $this->_getLoginInfo($u); return "<root><logininfo>" . array2xml($li) . "</logininfo>{$cu}<posts>{$x0}{$x1}{$x2}{$p}</posts></root>"; } }
/** * returns reported posts XML */ function getReportedPostsXML() { global $gConf; global $f; $ui = array(); $fdb = new DbForum(); $adb = new DbAdmin(); if (!$this->_admin) { return "<root><posts></posts></root>"; } // check user permissions to delete or edit posts $gl_allow_edit = 1; $gl_allow_del = 1; $u = $f->_getLoginUser(); $a = $adb->getReportedPosts($u); reset($a); $p = ''; while (list(, $r) = each($a)) { // acquire user info if (!$ui[$r['user']]) { $aa = $f->_getUserInfo($r['user']); $ui[$r['user']] = array('posts' => $fdb->getUserPosts($r['user']), 'avatar' => $aa['avatar']); } $allow_edit = $gl_allow_edit; $allow_del = $gl_allow_del; encode_post_text($r['post_text']); $p .= <<<EOF <post id="{$r['post_id']}" force_show="1"> \t<text>{$r['post_text']}</text> \t<when>{$r['when']}</when> \t<allow_edit>{$allow_edit}</allow_edit> \t<allow_del>{$allow_del}</allow_del> \t<points>{$r['votes']}</points> \t<vote_user_point>{$r['vote_user_point']}</vote_user_point>\t \t<user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}"> \t\t<avatar>{$ui[$r['user']]['avatar']}</avatar> \t</user> \t<min_point>{$gConf['min_point']}</min_point> </post> EOF; $rr = $r; } $cu = $this->getUrlsXml(); return "<root>{$cu}<posts><topic><title>Reported Posts</title><id>0</id></topic><forum><id>0</id></forum>{$p}</posts></root>"; }
<?php if ($_GET['orca_integration'] && preg_match('/^[0-9a-z]+$/', $_GET['orca_integration'])) { define('BX_ORCA_INTEGRATION', $_GET['orca_integration']); } else { define('BX_ORCA_INTEGRATION', 'dolphin'); } $aPathInfo = pathinfo(__FILE__); require_once $aPathInfo['dirname'] . '/inc/header.inc.php'; if (!class_exists('Thing')) { require_once $GLOBALS['gConf']['dir']['classes'] . 'Thing.php'; } require_once $GLOBALS['gConf']['dir']['classes'] . 'ThingPage.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'Mistake.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'BxXslTransform.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'BxDb.php'; require_once $GLOBALS['gConf']['dir']['classes'] . 'DbForum.php'; $oFDB = new DbForum(); $oMemberMenu = bx_instance('BxDolMemberMenu'); $aLinkInfo = array('item_img_src' => getTemplateIcon('modules/boonex/forum/|orca.gif'), 'item_img_alt' => _t('_bx_forums'), 'item_link' => $GLOBALS['site']['url'] . 'forum/', 'item_onclick' => null, 'item_title' => _t('_bx_forums'), 'extra_info' => $oFDB->getUserPosts(getNickName())); return $oMemberMenu->getGetExtraMenuLink($aLinkInfo);