Exemple #1
0
 /**
  * profile xml
  *
  * @param    $u     username
  * @param    $wp    return whole page XML
  */
 function showProfile($u, $wp)
 {
     $a = $this->_getUserInfo($u);
     $as = $this->fdb->getUserStat(filter_to_db($u));
     $a['username'] = $u;
     $a['posts'] = (int) $as['posts'];
     $a['user_last_post'] = orca_format_date($as['user_last_post']);
     $a['last_online'] = orca_format_date($this->fdb->getUserLastOnlineTime(filter_to_db($u)));
     encode_post_text($as['role']);
     $a['role'] = $as['role'];
     $p = array2xml($a);
     if ($wp) {
         if ($a) {
             $this->setTitle("<![CDATA[{$u}]]>");
         }
         $li = $this->_getLoginInfo();
         return $this->addHeaderFooter($li, "<profile>{$p}</profile>");
     } else {
         $cu = $this->getUrlsXml();
         return "<root>{$cu}<profile>{$p}</profile></root>";
     }
 }
Exemple #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 (!isset($ui[$r['user']]) && ($aa = $f->_getUserInfoReadyArray($r['user']))) {
                $ui[$r['user']] = $aa;
            }
            $allow_edit = $gl_allow_edit;
            $allow_del = $gl_allow_del;
            $files = $GLOBALS['f']->_getAttachmentsXML($r['post_id']);
            encode_post_text($r['post_text']);
            $r['when'] = orca_format_date($r['when']);
            $p .= <<<EOF
<post id="{$r['post_id']}"  force_show="1">
    <text>{$r['post_text']}</text>
    <when>{$r['when']}</when>
    <allow_edit>{$allow_edit}</allow_edit>
    <allow_del>{$allow_del}</allow_del>
    <allow_hide_posts>{$gl_allow_hide_posts}</allow_hide_posts>
    <allow_unhide_posts>{$gl_allow_unhide_posts}</allow_unhide_posts>
    <allow_download>{$gl_allow_download}</allow_download>
    {$sAddXml}
    <points>{$r['votes']}</points>
    <hidden>{$r['hidden']}</hidden>
    <vote_user_point>{$r['vote_user_point']}</vote_user_point>
    <user posts="{$ui[$r['user']]['posts']}" name="{$r['user']}">
        <avatar>{$ui[$r['user']]['avatar']}</avatar>
        <url>{$ui[$r['user']]['url']}</url>
        <title>{$ui[$r['user']]['title']}</title>
        <onclick>{$ui[$r['user']]['onclick']}</onclick>
        <role>{$ui[$r['user']]['role']}</role>
    </user>
    <attachments>{$files}</attachments>
    <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>";
        }
    }