Пример #1
0
 function addHeaderFooter(&$li, $content)
 {
     global $gConf, $l;
     global $glBeforeContent;
     global $glAfterContent;
     global $glAddToHeadSection;
     $ret = '';
     $ret .= "<root>\n";
     $l('JHJldCAuPSAnPGRpc2FibGVfYm9vbmV4X2Zvb3RlcnM+JyAuICFnZXRQYXJhbSgnZW5hYmxlX2RvbHBoaW5fZm9vdGVyJykgLiAnPC9kaXNhYmxlX2Jvb25leF9mb290ZXJzPic7');
     $ret .= '<index_begin><![CDATA[' . $GLOBALS['glIndexBegin'] . ']]></index_begin>';
     $ret .= '<index_end><![CDATA[' . $GLOBALS['glIndexEnd'] . ']]></index_end>';
     $ret .= '<before_content><![CDATA[' . $glBeforeContent . ']]></before_content>';
     $ret .= '<after_content><![CDATA[' . $glAfterContent . ']]></after_content>';
     $ret .= '<add_to_head_section><![CDATA[' . $glAddToHeadSection . ']]></add_to_head_section>';
     $ret .= "<min_point>{$gConf['min_point']}</min_point>\n";
     $ret .= "<base>{$gConf['url']['base']}</base>\n";
     $ret .= "<title>" . (isset($gConf['title']) && $gConf['title'] ? $gConf['title'] : $gConf['def_title']) . "</title>\n";
     $integration_xml = '';
     @(include $gConf['dir']['base'] . 'integrations/' . BX_ORCA_INTEGRATION . '/xml.php');
     $ret .= $integration_xml;
     $ret .= $this->getUrlsXml();
     if (is_array($li)) {
         $ret .= "<logininfo>";
         reset($li);
         while (list($k, $v) = each($li)) {
             if ('role' == $k) {
                 encode_post_text($v);
             } elseif ('profile_title' == $k) {
                 encode_post_text($v);
             }
             $ret .= "<{$k}>{$v}</{$k}>";
         }
         $ret .= "</logininfo>";
         if (1 == $li['admin']) {
             $ret .= $this->getLangsXml();
         }
     }
     $ret .= "<page>\n";
     $ret .= $content;
     $ret .= "</page>\n";
     $ret .= "</root>\n";
     return $ret;
 }
Пример #2
0
    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>";
        }
    }
Пример #3
0
    /**
     * 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>";
    }
Пример #4
0
    function getLivePostsXML($count = 10, $ts = 0)
    {
        global $gConf;
        $ret = '';
        $fdb = new DbForum();
        $a = $fdb->getLivePosts($count, $ts);
        reset($a);
        $ui = array();
        while (list(, $r) = each($a)) {
            // acquire user info
            if (!isset($ui[$r['user']])) {
                $aa = $this->_getUserInfo($r['user']);
                $ui[$r['user']] = array('avatar' => $aa['avatar'], 'url' => $aa['profile_url'], 'onclick' => $aa['profile_onclick']);
            }
            $this->_buld_topic_desc($r['post_text']);
            encode_post_text($r['topic_title'], 0, 1);
            encode_post_text($r['forum_title'], 0);
            encode_post_text($r['cat_name'], 0);
            $r['when'] = $this->_format_when($r['sec']);
            $ret .= <<<EOF
<post id="{$r['post_id']}" ts="{$r['ts']}">
\t<text>{$r['post_text']}</text>
\t<user>{$r['user']}</user>
    <date>{$r['when']}</date>

    <avatar>{$ui[$r['user']]['avatar']}</avatar>
    <profile>{$ui[$r['user']]['url']}</profile>
    <onclick>{$ui[$r['user']]['onclick']}</onclick>

\t<topic id="{$r['topic_id']}">{$r['topic_title']}</topic>
\t<forum id="{$r['forum_id']}">{$r['forum_title']}</forum>
\t<cat id="{$r['cat_id']}">{$r['cat_name']}</cat>
\t<base>{$gConf['url']['base']}</base>
</post>
EOF;
        }
        return $ret;
    }
Пример #5
0
 function _getAttachmentsXML($post_id)
 {
     $attachments = $this->fdb->getAttachments($post_id);
     $files = '';
     foreach ($attachments as $file) {
         encode_post_text($file['att_name']);
         $isImage = 0 == strncmp('image/', $file['att_type'], 6) ? 1 : 0;
         $files .= '<file image="' . $isImage . '" hash="' . $file['att_hash'] . '" size="' . orca_format_bytes($file['att_size']) . '" downloads="' . $file['att_downloads'] . '">' . $file['att_name'] . '</file>';
     }
     return $files;
 }
Пример #6
0
 function _getAttachmentsXML($post_id)
 {
     $attachments = $this->fdb->getAttachments($post_id);
     $files = '';
     foreach ($attachments as $file) {
         encode_post_text($file['att_name']);
         $files .= '<file hash="' . $file['att_hash'] . '" size="' . orca_format_bytes($file['att_size']) . '" downloads="' . $file['att_downloads'] . '">' . $file['att_name'] . '</file>';
     }
     return $files;
 }