function processCollectionData($collection, $tf = array(), $orderby = '')
{
    if (count($collection) <= 0) {
        return array();
    }
    require_once libfile('function/discuzcode');
    foreach ($collection as $ctid => &$curvalue) {
        $curvalue['updated'] = $curvalue['lastupdate'] > $tf[$ctid]['lastvisit'] ? 1 : 0;
        $curvalue['tflastvisit'] = $tf[$ctid]['lastvisit'];
        $curvalue['lastupdate'] = dgmdate($curvalue['lastupdate']);
        $curvalue['dateline'] = dgmdate($curvalue['dateline']);
        $curvalue['lastposttime'] = dgmdate($curvalue['lastposttime']);
        $curvalue['avgrate'] = number_format($curvalue['rate'], 1);
        $curvalue['star'] = imgdisplayrate($curvalue['rate']);
        $curvalue['lastposterhtml'] = rawurlencode($curvalue['lastposter']);
        $curvalue['shortdesc'] = cutstr(strip_tags(discuzcode($curvalue['desc'])), 50);
        $curvalue['arraykeyword'] = parse_keyword($curvalue['keyword'], false, false);
        if ($curvalue['arraykeyword']) {
            foreach ($curvalue['arraykeyword'] as $kid => $s_keyword) {
                $curvalue['urlkeyword'][$kid] = rawurlencode($s_keyword);
            }
        }
        if ($orderby == 'commentnum') {
            $curvalue['displaynum'] = $curvalue['commentnum'];
        } elseif ($orderby == 'follownum') {
            $curvalue['displaynum'] = $curvalue['follownum'];
        } else {
            $curvalue['displaynum'] = $curvalue['threadnum'];
        }
    }
    return $collection;
}
Example #2
0
 function output()
 {
     global $_G;
     $noticelang = lang('notification', 'reppost_noticeauthor');
     $noticepreg = '/^' . str_replace(array('\\{actor\\}', '\\{subject\\}', '\\{tid\\}', '\\{pid\\}'), array('(.+?)', '(.+?)', '(\\d+)', '(\\d+)'), preg_quote($noticelang, '/')) . '$/';
     $actorlang = '<a href="home.php?mod=space&uid={actoruid}">{actorusername}</a>';
     $actorpreg = '/^' . str_replace(array('\\{actoruid\\}', '\\{actorusername\\}'), array('(\\d+)', '(.+?)'), preg_quote($actorlang, '/')) . '$/';
     foreach ($GLOBALS['list'] as $_k => $_v) {
         if (preg_match($noticepreg, $_v['note'], $_r)) {
             list(, $actor, $tid, $pid, $subject) = $_r;
             if (preg_match($actorpreg, $actor, $_r)) {
                 list(, $actoruid, $actorusername) = $_r;
             }
             //取出回帖的内容
             include_once libfile('function/forum');
             require_once libfile('function/discuzcode');
             loadforum(null, $tid);
             if ($pid) {
                 $postlist = $this->post = get_post_by_pid($pid, 'message');
                 $GLOBALS['list'][$_k]['message'] = discuzcode($postlist['message']);
             }
             $GLOBALS['list'][$_k]['dateline'] = dgmdate($GLOBALS['list'][$_k]['dateline']);
             $GLOBALS['list'][$_k]['dbdateline'] = $GLOBALS['list'][$_k]['dateline'];
             $GLOBALS['list'][$_k]['notevar'] = array('tid' => $tid, 'pid' => $pid, 'subject' => $subject, 'actoruid' => $actoruid, 'actorusername' => $actorusername);
         }
     }
     $variable = array('hash' => md5(substr(md5($_G['config']['security']['authkey']), 8) . $_G['uid']), 'list' => mobile_core::getvalues(array_values($GLOBALS['list']), array('/^\\d+$/'), array('id', 'uid', 'type', 'new', 'authorid', 'author', 'note', 'dateline', 'from_id', 'from_idtype', 'from_num', 'style', 'rowid', 'notevar', 'message')), 'count' => $GLOBALS['count'], 'perpage' => $GLOBALS['perpage'], 'page' => intval($GLOBALS['page']));
     mobile_core::result(mobile_core::variable($variable));
 }
Example #3
0
 public function viewthread_modoption()
 {
     global $_G;
     if (!$_G['adminid']) {
         return false;
     }
     $usergroupsfeedlist = unserialize($_G['setting']['qqgroup_usergroup_feed_list']);
     if (empty($usergroupsfeedlist) || !in_array($_G['groupid'], $usergroupsfeedlist)) {
         if (self::$util->isfounder($_G['member']) == false) {
             return false;
         }
     }
     $tid = $_G['tid'];
     $title = urlencode(trim($_G['forum_thread']['subject']));
     $post = C::t('forum_post')->fetch_all_by_tid_position($_G['fotum_thread']['posttableid'], $_G['tid'], 1);
     include_once libfile('function/discuzcode');
     $content = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", '', trim($post[0]['message']));
     $content = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", '', $content);
     $content = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", '', $content);
     $content = preg_replace("/\\[hide[=]?(d\\d+)?[,]?(\\d+)?\\]\\s*(.*?)\\s*\\[\\/hide\\]/is", '', $content);
     $content = strip_tags(discuzcode($content, 0, 0, 0));
     $content = preg_replace('%\\[attach\\].*\\[/attach\\]%im', '', $content);
     $content = str_replace('&nbsp;', ' ', $content);
     $content = urlencode(cutstr($content, 50, ''));
     include template('qqgroup:push');
     return trim($return);
 }
 private function _getAnnouncementInfo($res, $id)
 {
     global $_G;
     require_once libfile('function/discuzcode');
     $announce = DzForumAnnouncement::getAnnouncementByUid($id);
     if (!count($announce)) {
         $res = $this->makeErrorInfo($res, 'announcement_nonexistence');
     } else {
         $tempAnnounce = array();
         $tempAnnounce['author'] = $announce['author'];
         $tmp = explode('.', dgmdate($announce['starttime'], 'Y.m'));
         $months[$tmp[0] . $tmp[1]] = $tmp;
         if (!empty($_GET['m']) && $_GET['m'] != dgmdate($announce['starttime'], 'Ym')) {
             continue;
         }
         $tempAnnounce['starttime'] = dgmdate($announce['starttime'], 'd');
         $tempAnnounce['endtime'] = $announce['endtime'] ? dgmdate($announce['endtime'], 'd') : '';
         $tempAnnounce['title'] = WebUtils::emptyHtml($announce['subject']);
         $uid = DzCommonMember::getUidByUsername($announce['author']);
         $tempAnnounce['icon'] = UserUtils::getUserAvatar($uid);
         $announceMessage = $announce['type'] == 1 ? "{$announce[message]}" : $announceMessage;
         $announceMessage = nl2br(discuzcode($announce['message'], 0, 0, 1, 1, 1, 1, 1));
         $announceType = array();
         $announceType['infor'] = WebUtils::emptyHtml($announceMessage);
         $announce['type'] == 1 ? $announceType['type'] = 'url' : ($announceType['type'] = 'text');
         $tempAnnounce['content'] = $announceType;
         $res['body']['list'] = $tempAnnounce;
     }
     return $res;
 }
Example #5
0
 function output()
 {
     global $_G;
     //帖子列表增加图片 -start
     require_once libfile('function/discuzcode');
     foreach ($GLOBALS['data']['my']['threadlist'] as $k => $thread) {
         $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($GLOBALS['data']['my']['threadlist'][$k]['tid'], 0);
         $attachment[$post['pid']] = array();
         $GLOBALS['data']['my']['threadlist'][$k]['pid'] = $post['pid'];
         //TODO:下面的代码直接调用discuzcode时,会报错
         //./source/plugin/mobile/template/discuzcode.htm 文件不存在
         //cp ./source/plugin/mobile/template/mobile/discuzcode.htm ./source/plugin/mobile/template/
         //拷贝一份就可以了,原因未查明
         $GLOBALS['data']['my']['threadlist'][$k]['message'] = discuzcode($post['message']);
         //附件,0无附件 1普通附件 2有图片附件
         if (!empty($post['attachment']) && intval($post['attachment']) == 2) {
             $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = array();
             $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = array();
             require_once libfile('function/attachment');
             $_G['tid'] = $post['tid'];
             parseattach(array_keys($attachment), array(), $attachment);
             $GLOBALS['data']['my']['threadlist'][$k]['attachments'] = $attachment[$post['pid']]['attachments'];
             $GLOBALS['data']['my']['threadlist'][$k]['imagelist'] = $attachment[$post['pid']]['imagelist'];
             unset($_G['tid']);
         }
     }
     //帖子列表增加图片 -end
     $data['forumnames'] = $GLOBALS['data']['my']['forumnames'];
     $data['threadcount'] = $GLOBALS['data']['my']['threadcount'];
     $data['threadlist'] = array_values($GLOBALS['data']['my']['threadlist']);
     $variable = array('data' => $data, 'perpage' => $GLOBALS['perpage']);
     mobile_core::result(mobile_core::variable($variable));
 }
Example #6
0
 public function fetch_thread_replies($count, $tid)
 {
     require_once libfile('function/discuzcode');
     require_once './source/plugin/singcere_waterfall/singcere_waterfall.func.php';
     $list = array();
     $query = DB::query("SELECT * FROM %t WHERE first != 1 AND tid = %d AND invisible >= 0 ORDER BY dateline DESC LIMIT 0, %d", array('forum_post', $tid, $count));
     while (($result = DB::fetch($query)) != false) {
         preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $result['message'], $matchaids);
         $attachs = parseattach($result['tid'], $result['pid'], $matchaids, $result['message'], $skipaids);
         $k = $result['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/ ", "\$attachs[\\1]", $result['message']);
         eval("\$k=\"{$k}\";");
         $k = discuzcode($k, FALSE, FALSE);
         $result['message'] = $k;
         $result['message'] = html2txt($result['message']);
         $list[] = $result;
     }
     return $list;
 }
 private function _check_post_length($message, $length)
 {
     if ($this->param['special'] || $this->thread['special'] || getstatus($this->thread['status'], 3) || !$length) {
         return 0;
     }
     require_once libfile('function/discuzcode');
     $langthread = lang('forum/thread');
     $content = discuzcode($message);
     $content = strip_tags($content);
     $content = str_replace(array(',', '.', '?', '!', $langthread['t_question'], $langthread['t_exclamatory'], $langthread['t_period'], $langthread['t_comma'], '~', $langthread['t_suspension']), '', $content);
     $content = preg_replace('/\\s+/', '', $content);
     $realLength = dstrlen($content);
     $checkQuote = preg_match("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", $message) > 0 || preg_match("/\\[img=(\\d{1,4})[x|\\,](\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/i", $message) > 0 || preg_match("/\\[img\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/img\\]/i", $message) > 0 || preg_match("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $message) > 0;
     if ($checkQuote || $realLength >= $length) {
         return $realLength <= 0 ? 1 : $realLength;
     } else {
         return 0;
     }
 }
 function get_menu_foot($brandresult)
 {
     global $_G;
     $bid = $brandresult['bid'];
     $tid = $brandresult['tid'];
     $perpage = 5;
     $page = intval($_G[sr_page]);
     $page = max(1, intval($page));
     $start = ($page - 1) * $perpage;
     $start = max(0, $start);
     require_once libfile('function/discuzcode');
     $count = C::t('#sanree_brand#forum_post')->count_by_tid_post(0, $tid);
     if ($count > 0) {
         $postthread = C::t('#sanree_brand#forum_post')->fetch_all_by_tid(0, $tid, true, ' desc', ($page - 1) * $perpage, $perpage, 0, 0);
         foreach ($postthread as $key => $val) {
             $postthread[$key]['message'] = discuzcode($val['message'], 0, 0, 0, 1);
             $postthread[$key]['satisfaction'] = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($val['authorid'], $tid) * 20;
             $postthread[$key]['dateline'] = dgmdate($val['dateline']);
             $postthread[$key]['img'] = avatar($val['authorid'], 'middle', 1);
         }
         $murl = $_G['item_detail'] == 'item' ? $is_rewrite ? getburl($brandresult) . '?t' . $extra : getburl($brandresult) . $extra : ($is_rewrite ? getdetailurl($brandresult) . '?t' . $extra : getdetailurl($brandresult) . $extra);
         $multi = multi($count, $perpage, $page, $murl);
     }
     $satisfaction = C::t('#sanree_brand#sanree_brand_voterlog')->getstar_by_tid_uid($_G['uid'], $tid) * 20;
     $seditor = array('fastpost', array('bold', 'color', 'link', 'quote', 'smilies'));
     $selfimg = avatar($_G['uid'], 'middle', 1);
     $wx_prefix = $_G['setting']['attachurl'] . 'category/';
     $appVer = $_G['setting']['version'];
     $dzv = array('X3.2', 'X3.1');
     if (in_array($appVer, $dzv)) {
         list($seccodecheck) = seccheck('publish');
         $dzvflag = true;
         $sectpl = '<div class="rfm"><table><tr><th><sec>: </th><td><span id="sec<hash>" onclick="showMenu({\'ctrlid\':\'sec<hash>\',\'pos\':\'*\'})"><sec></span><br /><div id="sec<hash>_menu" class="p_pop p_opt" style="display:none"><sec></div></td></tr></table></div>';
     } else {
         $seccodecheck = $_G['setting']['seccodestatus'] & 4 && (!$_G['setting']['seccodedata']['minposts'] || getuserprofile('posts') < $_G['setting']['seccodedata']['minposts']);
         $secqaacheck = $_G['setting']['secqaa']['status'] & 2 && (!$_G['setting']['secqaa']['minposts'] || getuserprofile('posts') < $_G['setting']['secqaa']['minposts']);
         $dzvflag = false;
     }
     include templateEx($this->_identifier . ':' . $this->_template . '/srfoot');
     $GLOBALS['srfoot'] = $srfoot;
 }
function viewthread_procpost($post, $lastvisit, $ordertype, $maxposition = 0)
{
    global $_G, $rushreply;
    if (!$_G['forum_newpostanchor'] && $post['dateline'] > $lastvisit) {
        $post['newpostanchor'] = '<a name="newpost"></a>';
        $_G['forum_newpostanchor'] = 1;
    } else {
        $post['newpostanchor'] = '';
    }
    $post['lastpostanchor'] = $ordertype != 1 && $_G['forum_numpost'] == $_G['forum_thread']['replies'] || $ordertype == 1 && $_G['forum_numpost'] == $_G['forum_thread']['replies'] + 2 ? '<a name="lastpost"></a>' : '';
    if (!$post['hotrecommended']) {
        if ($_G['forum_pagebydesc']) {
            if ($ordertype != 1) {
                $post['number'] = $_G['forum_numpost'] + $_G['forum_ppp2']--;
            } else {
                $post['number'] = $post['first'] == 1 ? 1 : $_G['forum_numpost'] - 1 - $_G['forum_ppp2']--;
            }
        } else {
            if ($ordertype != 1) {
                $post['number'] = ++$_G['forum_numpost'];
            } else {
                $post['number'] = $post['first'] == 1 ? 1 : --$_G['forum_numpost'];
                $post['number'] = $post['number'] - 1;
            }
        }
    }
    if ($post['existinfirstpage']) {
        if ($_G['forum_pagebydesc']) {
            $_G['forum_ppp2']--;
        } else {
            if ($ordertype != 1) {
                ++$_G['forum_numpost'];
            } else {
                --$_G['forum_numpost'];
            }
        }
    }
    if ($maxposition) {
        $post['number'] = $post['position'];
    }
    if ($post['hotrecommended']) {
        $post['number'] = -1;
    }
    if (!$_G['forum_thread']['special'] && !$rushreply && !$hiddenreplies && $_G['setting']['threadfilternum'] && getstatus($post['status'], 11)) {
        $post['isWater'] = true;
        if ($_G['setting']['hidefilteredpost'] && !$_G['forum']['noforumhidewater']) {
            $post['inblacklist'] = true;
        }
    } else {
        $_G['allblocked'] = false;
    }
    if ($post['inblacklist']) {
        $_G['blockedpids'][] = $post['pid'];
    }
    $_G['forum_postcount']++;
    $post['dbdateline'] = $post['dateline'];
    $post['dateline'] = dgmdate($post['dateline'], 'u', '9999', getglobal('setting/dateformat') . ' H:i:s');
    $post['groupid'] = $_G['cache']['usergroups'][$post['groupid']] ? $post['groupid'] : 7;
    if ($post['username']) {
        $_G['forum_onlineauthors'][$post['authorid']] = 0;
        $post['usernameenc'] = rawurlencode($post['username']);
        $post['readaccess'] = $_G['cache']['usergroups'][$post['groupid']]['readaccess'];
        if ($_G['cache']['usergroups'][$post['groupid']]['userstatusby'] == 1) {
            $post['authortitle'] = $_G['cache']['usergroups'][$post['groupid']]['grouptitle'];
            $post['stars'] = $_G['cache']['usergroups'][$post['groupid']]['stars'];
        }
        $post['upgradecredit'] = false;
        if ($_G['cache']['usergroups'][$post['groupid']]['type'] == 'member' && $_G['cache']['usergroups'][$post['groupid']]['creditslower'] != 999999999) {
            $post['upgradecredit'] = $_G['cache']['usergroups'][$post['groupid']]['creditslower'] - $post['credits'];
            $post['upgradeprogress'] = 100 - ceil($post['upgradecredit'] / ($_G['cache']['usergroups'][$post['groupid']]['creditslower'] - $_G['cache']['usergroups'][$post['groupid']]['creditshigher']) * 100);
            $post['upgradeprogress'] = min(max($post['upgradeprogress'], 2), 100);
        }
        $post['taobaoas'] = addslashes($post['taobao']);
        $post['regdate'] = dgmdate($post['regdate'], 'd');
        $post['lastdate'] = dgmdate($post['lastvisit'], 'd');
        $post['authoras'] = !$post['anonymous'] ? ' ' . addslashes($post['author']) : '';
        if ($post['medals']) {
            loadcache('medals');
            foreach ($post['medals'] = explode("\t", $post['medals']) as $key => $medalid) {
                list($medalid, $medalexpiration) = explode("|", $medalid);
                if (isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
                    $post['medals'][$key] = $_G['cache']['medals'][$medalid];
                    $post['medals'][$key]['medalid'] = $medalid;
                    $_G['medal_list'][$medalid] = $_G['cache']['medals'][$medalid];
                } else {
                    unset($post['medals'][$key]);
                }
            }
        }
        $post['avatar'] = avatar($post['authorid']);
        $post['groupicon'] = $post['avatar'] ? g_icon($post['groupid'], 1) : '';
        $post['banned'] = $post['status'] & 1;
        $post['warned'] = ($post['status'] & 2) >> 1;
    } else {
        if (!$post['authorid']) {
            $post['useip'] = substr($post['useip'], 0, strrpos($post['useip'], '.')) . '.x';
        }
    }
    $post['attachments'] = array();
    $post['imagelist'] = $post['attachlist'] = '';
    if ($post['attachment']) {
        if (!empty($_G['setting']['guestviewthumb']['flag']) && !$_G['uid'] || $_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) {
            $_G['forum_attachpids'][] = $post['pid'];
            $post['attachment'] = 0;
            if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $post['message'], $matchaids)) {
                $_G['forum_attachtags'][$post['pid']] = $matchaids[1];
            }
        } else {
            $post['message'] = preg_replace("/\\[attach\\](\\d+)\\[\\/attach\\]/i", '', $post['message']);
        }
    }
    if ($_G['setting']['ratelogrecord'] && $post['ratetimes']) {
        $_G['forum_cachepid'][$post['pid']] = $post['pid'];
    }
    if ($_G['setting']['commentnumber'] && ($post['first'] && $_G['setting']['commentfirstpost'] || !$post['first']) && $post['comment']) {
        $_G['forum_cachepid'][$post['pid']] = $post['pid'];
    }
    $post['allowcomment'] = $_G['setting']['commentnumber'] && in_array(1, $_G['setting']['allowpostcomment']) && ($_G['setting']['commentpostself'] || $post['authorid'] != $_G['uid']) && ($post['first'] && $_G['setting']['commentfirstpost'] && in_array($_G['group']['allowcommentpost'], array(1, 3)) || !$post['first'] && in_array($_G['group']['allowcommentpost'], array(2, 3)));
    $forum_allowbbcode = $_G['forum']['allowbbcode'] ? -$post['groupid'] : 0;
    $post['signature'] = $post['usesig'] ? $_G['setting']['sigviewcond'] ? strlen($post['message']) > $_G['setting']['sigviewcond'] ? $post['signature'] : '' : $post['signature'] : '';
    $imgcontent = $post['first'] ? getstatus($_G['forum_thread']['status'], 15) : 0;
    if (!defined('IN_ARCHIVER')) {
        if ($post['first']) {
            if (!defined('IN_MOBILE')) {
                $messageindex = false;
                if (strpos($post['message'], '[/index]') !== FALSE) {
                    $post['message'] = preg_replace("/\\s?\\[index\\](.+?)\\[\\/index\\]\\s?/ies", "parseindex('\\1', '{$post['pid']}')", $post['message']);
                    $messageindex = true;
                    unset($_GET['threadindex']);
                }
                if (strpos($post['message'], '[page]') !== FALSE) {
                    if ($_GET['cp'] != 'all') {
                        $postbg = '';
                        if (strpos($post['message'], '[/postbg]') !== FALSE) {
                            preg_match("/\\s?\\[postbg\\]\\s*([^\\[\\<\r\n;'\"\\?\\(\\)]+?)\\s*\\[\\/postbg\\]\\s?/is", $post['message'], $r);
                            $postbg = $r[0];
                        }
                        $messagearray = explode('[page]', $post['message']);
                        $cp = max(intval($_GET['cp']), 1);
                        $post['message'] = $messagearray[$cp - 1];
                        if ($postbg && strpos($post['message'], '[/postbg]') === FALSE) {
                            $post['message'] = $postbg . $post['message'];
                        }
                        unset($postbg);
                    } else {
                        $cp = 0;
                        $post['message'] = preg_replace("/\\s?\\[page\\]\\s?/is", '', $post['message']);
                    }
                    if ($_GET['cp'] != 'all' && strpos($post['message'], '[/index]') === FALSE && empty($_GET['threadindex']) && !$messageindex) {
                        $_G['forum_posthtml']['footer'][$post['pid']] .= '<div id="threadpage"></div><script type="text/javascript" reload="1">show_threadpage(' . $post['pid'] . ', ' . $cp . ', ' . count($messagearray) . ', ' . ($_GET['from'] == 'preview' ? '1' : '0') . ');</script>';
                    }
                }
            }
        }
        if (!empty($_GET['threadindex'])) {
            $_G['forum_posthtml']['header'][$post['pid']] .= '<div id="threadindex"></div><script type="text/javascript" reload="1">show_threadindex(0, ' . ($_GET['from'] == 'preview' ? '1' : '0') . ');</script>';
        }
        if (!$imgcontent) {
            $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $forum_allowbbcode, $_G['forum']['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0, $_G['forum']['allowhtml'], $_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0, 0, $post['authorid'], $_G['cache']['usergroups'][$post['groupid']]['allowmediacode'] && $_G['forum']['allowmediacode'], $post['pid'], $_G['setting']['lazyload'], $post['dbdateline'], $post['first']);
            if ($post['first']) {
                $_G['relatedlinks'] = '';
                $relatedtype = !$_G['forum_thread']['isgroup'] ? 'forum' : 'group';
                if (!$_G['setting']['relatedlinkstatus']) {
                    $_G['relatedlinks'] = get_related_link($relatedtype);
                } else {
                    $post['message'] = parse_related_link($post['message'], $relatedtype);
                }
                if (strpos($post['message'], '[/begin]') !== FALSE) {
                    $post['message'] = preg_replace("/\\[begin(=\\s*([^\\[\\<\r\n]*?)\\s*,(\\d*),(\\d*),(\\d*),(\\d*))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/begin\\]/ies", $_G['cache']['usergroups'][$post['groupid']]['allowbegincode'] ? "parsebegin('\\2', '\\7', '\\3', '\\4', '\\5', '\\6');" : '', $post['message']);
                }
            }
        }
    }
    if (defined('IN_ARCHIVER') || defined('IN_MOBILE') || !$post['first']) {
        if (strpos($post['message'], '[page]') !== FALSE) {
            $post['message'] = preg_replace("/\\s?\\[page\\]\\s?/is", '', $post['message']);
        }
        if (strpos($post['message'], '[/index]') !== FALSE) {
            $post['message'] = preg_replace("/\\s?\\[index\\](.+?)\\[\\/index\\]\\s?/is", '', $post['message']);
        }
        if (strpos($post['message'], '[/begin]') !== FALSE) {
            $post['message'] = preg_replace("/\\[begin(=\\s*([^\\[\\<\r\n]*?)\\s*,(\\d*),(\\d*),(\\d*),(\\d*))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/begin\\]/ies", '', $post['message']);
        }
    }
    if ($imgcontent) {
        $post['message'] = '<img id="threadimgcontent" src="./' . stringtopic('', $post['tid']) . '">';
    }
    $_G['forum_firstpid'] = intval($_G['forum_firstpid']);
    $post['numbercard'] = viewthread_numbercard($post);
    $post['mobiletype'] = getstatus($post['status'], 4) ? base_convert(getstatus($post['status'], 10) . getstatus($post['status'], 9) . getstatus($post['status'], 8), 2, 10) : 0;
    return $post;
}
Example #10
0
         $groupicon = '<input type="checkbox" class="checkbox" name="deleteicon" value="yes" /> ' . $lang['delete'] . '<br /><img src="' . $groupicon . '?' . random(6) . '" width="48" height="48" />';
     }
     if ($groupbanner) {
         $groupbanner = '<input type="checkbox" class="checkbox" name="deletebanner" value="yes" /> ' . $lang['delete'] . '<br /><img src="' . $groupbanner . '?' . random(6) . '" />';
     }
     showsetting('groups_editgroup_icon', 'iconnew', '', 'file', '', 0, $groupicon);
     showsetting('groups_editgroup_banner', 'bannernew', '', 'file', '', 0, $groupbanner);
     showsubmit('editsubmit');
     showtablefooter();
     showformfooter();
 } else {
     $_GET['jointypenew'] = intval($_GET['jointypenew']);
     $_GET['fupnew'] = intval($_GET['fupnew']);
     $_GET['gviewpermnew'] = intval($_GET['gviewpermnew']);
     require_once libfile('function/discuzcode');
     $_GET['descriptionnew'] = discuzcode(dhtmlspecialchars(censor(trim($_GET['descriptionnew']))), 0, 0, 0, 0, 1, 1, 0, 0, 1);
     $_GET['namenew'] = dhtmlspecialchars(censor(trim($_GET['namenew'])));
     $icondata = array();
     $iconnew = upload_icon_banner($group, $_FILES['iconnew'], 'icon');
     $bannernew = upload_icon_banner($group, $_FILES['bannernew'], 'banner');
     if ($iconnew) {
         $icondata['icon'] = $iconnew;
     }
     if ($bannernew) {
         $icondata['banner'] = $bannernew;
     }
     if ($_GET['deleteicon']) {
         @unlink($_G['setting']['attachurl'] . 'group/' . $group['icon']);
         $icondata['icon'] = '';
     }
     if ($_GET['deletebanner']) {
Example #11
0
function portalcp_get_postmessage($post, $getauthorall = '')
{
    global $_G;
    $forum = C::t('forum_forum')->fetch($post['fid']);
    require_once libfile('function/discuzcode');
    $language = lang('forum/misc');
    if ($forum['type'] == 'sub' && $forum['status'] == 3) {
        loadcache('grouplevels');
        $grouplevel = $_G['grouplevels'][$forum['level']];
        $group_postpolicy = $grouplevel['postpolicy'];
        if (is_array($group_postpolicy)) {
            $forum = array_merge($forum, $group_postpolicy);
        }
    }
    $post['message'] = preg_replace($language['post_edit_regexp'], '', $post['message']);
    $_message = '';
    if ($getauthorall) {
        foreach (C::t('forum_post')->fetch_all_by_tid('tid:' . $post['tid'], $post['tid'], true, '', 0, 0, null, null, $post['authorid']) as $value) {
            if (!$value['first']) {
                $value['message'] = preg_replace("/\\s?\\[quote\\][\n\r]*(.+?)[\n\r]*\\[\\/quote\\]\\s?/is", '', $value['message']);
                $value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0, $forum['allowhtml'], 0, 0, $value['authorid'], $forum['allowmediacode'], $value['pid']);
                portalcp_parse_postattch($value);
                $_message .= '<br /><br />' . $value['message'];
            }
        }
    }
    $msglower = strtolower($post['message']);
    if (strpos($msglower, '[/media]') !== FALSE) {
        $post['message'] = preg_replace("/\\[media=([\\w,]+)\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\]/ies", "parsearticlemedia('\\1', '\\2')", $post['message']);
    }
    if (strpos($msglower, '[/audio]') !== FALSE) {
        $post['message'] = preg_replace("/\\[audio(=1)*\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/audio\\]/ies", "parsearticlemedia('mid,0,0', '\\2')", $post['message']);
    }
    if (strpos($msglower, '[/flash]') !== FALSE) {
        $post['message'] = preg_replace("/\\[flash(=(\\d+),(\\d+))?\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\]/ies", "parsearticlemedia('swf,0,0', '\\4');", $post['message']);
    }
    $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $_G['setting']['showimages'] ? 1 : 0, $forum['allowhtml'], 0, 0, $post['authorid'], $forum['allowmediacode'], $post['pid']);
    portalcp_parse_postattch($post);
    if (strpos($post['message'], '[/flash1]') !== FALSE) {
        $post['message'] = str_replace('[/flash1]', '[/flash]', $post['message']);
    }
    return $post['message'] . $_message;
}
Example #12
0
        $prepage = $pager - 1;
    }
    if ($pager * $pagenum < $counts) {
        $nextpage = $pager + 1;
    }
} elseif ($mobile_action == "mobile_view") {
    $info_id = intval($_G['gp_info_id']);
    if ($info_id) {
        $info = DB::fetch_first("SELECT * FROM " . DB::table('forum_alliance_ar') . " where id={$info_id}");
        if ($info) {
            $xianzai = gmdate('Y-m-d', $_G['timestamp'] + $_G['setting']['timeoffset'] * 3600);
            $info['dateline'] = gmdate('Y-m-d', $info['dateline'] + $_G['setting']['timeoffset'] * 3600);
            if ($info['dateline'] == $xianzai) {
                $info['dateline'] = $php_lang['jintian'];
            }
            $info['summary'] = discuzcode($info['summary'], 1, 0, 0, 0, 1, 1, 0, 0, 1);
            //discuzcode($mythread['summary']);
            $navtitle = $info['title'];
            if ($puseo == 1) {
                $metakeywords = $info['keywords'];
                $metadescription = $info['description'];
            } elseif ($info['click'] == 1) {
                $metakeywords = $info['keywords'];
                $metadescription = $info['description'];
            }
            $info['fl'] = $listclass[$info['cid']];
            if (round($info[total] / $info[voter], 1) != 0) {
                $info[tvs] = "<em>" . round($info[total] / $info[voter] + $info[bonus], 1) . "</em> " . $php_lang['homefen'];
            } else {
                $info[tvs] = $php_lang['zanwupfen'];
            }
function notifymembers($operation, $variable)
{
    global $_G, $lang, $urladd, $conditions, $search_condition;
    if (!empty($_GET['current'])) {
        $subject = $message = '';
        if ($settings = C::t('common_setting')->fetch($variable, true)) {
            $subject = $settings['subject'];
            $message = $settings['message'];
        }
        $setarr = array();
        foreach ($_G['setting']['extcredits'] as $id => $value) {
            if (isset($_GET['extcredits' . $id])) {
                if ($_GET['updatecredittype'] == 0) {
                    $setarr['extcredits' . $id] = $_GET['extcredits' . $id];
                } else {
                    $setarr[] = 'extcredits' . $id;
                }
            }
        }
    } else {
        $current = 0;
        $subject = $_GET['subject'];
        $message = $_GET['message'];
        $subject = trim($subject);
        $message = trim(str_replace("\t", ' ', $message));
        $addmsg = '';
        if ($_GET['notifymembers'] && $_GET['notifymember'] && !($subject && $message)) {
            cpmsg('members_newsletter_sm_invalid', '', 'error');
        }
        if ($operation == 'reward') {
            $serarr = array();
            if ($_GET['updatecredittype'] == 0) {
                if (is_array($_GET['addextcredits']) && !empty($_GET['addextcredits'])) {
                    foreach ($_GET['addextcredits'] as $key => $value) {
                        $value = intval($value);
                        if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) {
                            $setarr['extcredits' . $key] = $value;
                            $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ": " . ($value > 0 ? '<em class="xi1">+' : '<em class="xg1">') . "{$value}</em> " . $_G['setting']['extcredits'][$key]['unit'] . ' &nbsp; ';
                        }
                    }
                }
            } else {
                if (is_array($_GET['resetextcredits']) && !empty($_GET['resetextcredits'])) {
                    foreach ($_GET['resetextcredits'] as $key => $value) {
                        $value = intval($value);
                        if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) {
                            $setarr[] = 'extcredits' . $key;
                            $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ': <em class="xg1">' . cplang('members_reward_clean') . '</em> &nbsp; ';
                        }
                    }
                }
            }
            if ($addmsg) {
                $addmsg = ' &nbsp; <br /><br /><b>' . cplang('members_reward_affect') . ':</b><br \\>' . $addmsg;
            }
            if (!empty($setarr)) {
                $limit = 2000;
                set_time_limit(0);
                $i = 0;
                while (true) {
                    $uids = searchmembers($search_condition, $limit, $i * $limit);
                    $allcount = C::t('common_member_count')->fetch_all($uids);
                    $insertmember = array_diff($uids, array_keys($allcount));
                    foreach ($insertmember as $uid) {
                        C::t('common_member_count')->insert(array('uid' => $uid));
                    }
                    if ($_GET['updatecredittype'] == 0) {
                        C::t('common_member_count')->increase($uids, $setarr);
                    } else {
                        C::t('common_member_count')->clear_extcredits($uids, $setarr);
                    }
                    if (count($uids) < $limit) {
                        break;
                    }
                    $i++;
                }
            } else {
                cpmsg('members_reward_invalid', '', 'error');
            }
            if (!$_GET['notifymembers']) {
                cpmsg('members_reward_succeed', '', 'succeed');
            }
        } elseif ($operation == 'confermedal') {
            $medals = $_GET['medals'];
            if (!empty($medals)) {
                $medalids = array();
                foreach ($medals as $key => $medalid) {
                    $medalids[] = $key;
                }
                $medalsnew = $comma = '';
                $medalsnewarray = $medalidarray = array();
                foreach (C::t('forum_medal')->fetch_all_by_id($medalids) as $medal) {
                    $medal['status'] = empty($medal['expiration']) ? 0 : 1;
                    $medal['expiration'] = empty($medal['expiration']) ? 0 : TIMESTAMP + $medal['expiration'] * 86400;
                    $medal['medal'] = $medal['medalid'] . (empty($medal['expiration']) ? '' : '|' . $medal['expiration']);
                    $medalsnew .= $comma . $medal['medal'];
                    $medalsnewarray[] = $medal;
                    $medalidarray[] = $medal['medalid'];
                    $comma = "\t";
                }
                $uids = searchmembers($search_condition);
                if ($uids) {
                    foreach (C::t('common_member_field_forum')->fetch_all($uids) as $uid => $medalnew) {
                        $usermedal = array();
                        $addmedalnew = '';
                        if (empty($medalnew['medals'])) {
                            $addmedalnew = $medalsnew;
                        } else {
                            foreach ($medalidarray as $medalid) {
                                $usermedal_arr = explode("\t", $medalnew['medals']);
                                foreach ($usermedal_arr as $key => $medalval) {
                                    list($usermedalid, ) = explode("|", $medalval);
                                    $usermedal[] = $usermedalid;
                                }
                                if (!in_array($medalid, $usermedal)) {
                                    $addmedalnew .= $medalid . "\t";
                                }
                            }
                            $addmedalnew .= $medalnew['medals'];
                        }
                        C::t('common_member_field_forum')->update($medalnew['uid'], array('medals' => $addmedalnew), true);
                        foreach ($medalsnewarray as $medalnewarray) {
                            $data = array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid'], 'type' => 0, 'dateline' => $_G['timestamp'], 'expiration' => $medalnewarray['expiration'], 'status' => $medalnewarray['status']);
                            C::t('forum_medallog')->insert($data);
                            C::t('common_member_medal')->insert(array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid']), 0, 1);
                        }
                    }
                }
            }
            if (!$_GET['notifymember']) {
                cpmsg('members_confermedal_succeed', '', 'succeed');
            }
        } elseif ($operation == 'confermagic') {
            $magics = $_GET['magic'];
            $magicnum = $_GET['magicnum'];
            if ($magics) {
                require_once libfile('function/magic');
                $limit = 200;
                set_time_limit(0);
                for ($i = 0; $i > -1; $i++) {
                    $uids = searchmembers($search_condition, $limit, $i * $limit);
                    foreach ($magics as $magicid) {
                        $uparray = $insarray = array();
                        if (empty($magicnum[$magicid])) {
                            continue;
                        }
                        $query = C::t('common_member_magic')->fetch_all($uids ? $uids : -1, $magicid);
                        foreach ($query as $row) {
                            $uparray[] = $row['uid'];
                        }
                        if ($uparray) {
                            C::t('common_member_magic')->increase($uparray, $magicid, array('num' => $magicnum[$magicid]));
                        }
                        $insarray = array_diff($uids, $uparray);
                        if ($insarray) {
                            $sqls = array();
                            foreach ($insarray as $uid) {
                                C::t('common_member_magic')->insert(array('uid' => $uid, 'magicid' => $magicid, 'num' => $magicnum[$magicid]));
                            }
                        }
                        foreach ($uids as $uid) {
                            updatemagiclog($magicid, '3', $magicnum[$magicid], '', $uid);
                        }
                    }
                    if (count($uids) < $limit) {
                        break;
                    }
                }
            }
        }
        C::t('common_setting')->update($variable, array('subject' => $subject, 'message' => $message));
    }
    $pertask = intval($_GET['pertask']);
    $current = $_GET['current'] ? intval($_GET['current']) : 0;
    $continue = FALSE;
    if (!function_exists('sendmail')) {
        include libfile('function/mail');
    }
    if ($_GET['notifymember'] && in_array($_GET['notifymembers'], array('pm', 'notice', 'email', 'mobile'))) {
        $uids = searchmembers($search_condition, $pertask, $current);
        require_once libfile('function/discuzcode');
        $message = in_array($_GET['notifymembers'], array('email', 'notice')) && $_GET['posttype'] ? discuzcode($message, 1, 0, 1, '', '', '', 1) : discuzcode($message, 1, 0);
        $pmuids = array();
        if ($_GET['notifymembers'] == 'pm') {
            $membernum = countmembers($search_condition, $urladd);
            $gpmid = $_GET['gpmid'];
            if (!$gpmid) {
                $pmdata = array('authorid' => $_G['uid'], 'author' => !$_GET['system'] ? $_G['member']['username'] : '', 'dateline' => TIMESTAMP, 'message' => ($subject ? '<b>' . $subject . '</b><br /> &nbsp; ' : '') . $message . $addmsg, 'numbers' => $membernum);
                $gpmid = C::t('common_grouppm')->insert($pmdata, true);
            }
            $urladd .= '&gpmid=' . $gpmid;
        }
        $members = C::t('common_member')->fetch_all($uids);
        if ($_GET['notifymembers'] == 'mobile') {
            $toUids = array_keys($members);
            if ($_G['setting']['cloud_status'] && !empty($toUids)) {
                try {
                    $noticeService = Cloud::loadClass('Service_Client_Notification');
                    $fromType = $_GET['system'] ? 1 : 2;
                    $noticeService->addSiteMasterUserNotify($toUids, $subject, $message, $_G['uid'], $_G['username'], $fromType, TIMESTAMP);
                } catch (Cloud_Service_Client_RestfulException $e) {
                    cpmsg('[' . $e->getCode() . ']' . $e->getMessage(), '', 'error');
                }
            }
        } else {
            foreach ($members as $member) {
                if ($_GET['notifymembers'] == 'pm') {
                    C::t('common_member_grouppm')->insert(array('uid' => $member['uid'], 'gpmid' => $gpmid, 'status' => 0), false, true);
                    $newpm = setstatus(2, 1, $member['newpm']);
                    C::t('common_member')->update($member['uid'], array('newpm' => $newpm));
                } elseif ($_GET['notifymembers'] == 'notice') {
                    notification_add($member['uid'], 'system', 'system_notice', array('subject' => $subject, 'message' => $message . $addmsg, 'from_id' => 0, 'from_idtype' => 'sendnotice'), 1);
                } elseif ($_GET['notifymembers'] == 'email') {
                    if (!sendmail("{$member['username']} <{$member['email']}>", $subject, $message . $addmsg)) {
                        runlog('sendmail', "{$member['email']} sendmail failed.");
                    }
                }
                $log = array();
                if ($_GET['updatecredittype'] == 0) {
                    foreach ($setarr as $key => $val) {
                        if (empty($val)) {
                            continue;
                        }
                        $val = intval($val);
                        $id = intval($key);
                        $id = !$id && substr($key, 0, -1) == 'extcredits' ? intval(substr($key, -1, 1)) : $id;
                        if (0 < $id && $id < 9) {
                            $log['extcredits' . $id] = $val;
                        }
                    }
                    $logtype = 'RPR';
                } else {
                    foreach ($setarr as $val) {
                        if (empty($val)) {
                            continue;
                        }
                        $id = intval($val);
                        $id = !$id && substr($val, 0, -1) == 'extcredits' ? intval(substr($val, -1, 1)) : $id;
                        if (0 < $id && $id < 9) {
                            $log['extcredits' . $id] = '-1';
                        }
                    }
                    $logtype = 'RPZ';
                }
                include_once libfile('function/credit');
                credit_log($member['uid'], $logtype, $member['uid'], $log);
                $continue = TRUE;
            }
        }
    }
    $newsletter_detail = array();
    if ($continue) {
        $next = $current + $pertask;
        $newsletter_detail = array('uid' => $_G['uid'], 'current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition), 'action' => "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}&notifymember={$_GET['notifymember']}&notifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd);
        save_newsletter('newsletter_detail', $newsletter_detail);
        $logaddurl = '';
        foreach ($setarr as $k => $v) {
            if ($_GET['updatecredittype'] == 0) {
                $logaddurl .= '&' . $k . '=' . $v;
            } else {
                $logaddurl .= '&' . $v . '=-1';
            }
        }
        $logaddurl .= '&updatecredittype=' . $_GET['updatecredittype'];
        cpmsg("{$lang['members_newsletter_send']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&system={$_GET['system']}&posttype={$_GET['posttype']}&notifymember={$_GET['notifymember']}&notifymembers=" . rawurlencode($_GET['notifymembers']) . $urladd . $logaddurl, 'loadingform');
    } else {
        del_newsletter('newsletter_detail');
        if ($operation == 'reward' && $_GET['notifymembers'] == 'pm') {
            $message = '';
        } else {
            $message = '_notify';
        }
        cpmsg('members' . ($operation ? '_' . $operation : '') . $message . '_succeed', '', 'succeed');
    }
}
Example #14
0
     if ($_G['setting']['bannedmessages']) {
         $uids = array();
         foreach ($postlist as $post) {
             $uids[] = $post['authorid'];
         }
         $users = C::t('common_member')->fetch_all($uids);
     }
     foreach ($postlist as $k => $post) {
         $post['dateline'] = dgmdate($post['dateline'], 'u');
         if ($_G['setting']['bannedmessages'] && ($post['authorid'] && (!$post['groupid'] || $post['groupid'] == 4 || $post['groupid'] == 5))) {
             $post['message'] = $language['post_banned'];
         } elseif ($post['status'] & 1) {
             $post['message'] = $language['post_single_banned'];
         } else {
             $post['message'] = preg_replace("/\\[hide=?\\d*\\](.*?)\\[\\/hide\\]/is", "[b]{$language['post_hidden']}[/b]", $post['message']);
             $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], $post['htmlon'] & 1, $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], $_G['forum']['jammer']);
         }
         if ($_G['setting']['bannedmessages']) {
             $post['groupid'] = $users[$post['authorid']]['groupid'];
         }
         $postlist[$k] = $post;
     }
 }
 unset($uids, $users);
 if ($_G['group']['allowpostattach'] || $_G['group']['allowpostimage']) {
     $attachlist = getattach(0);
     $attachs = $attachlist['attachs'];
     $imgattachs = $attachlist['imgattachs'];
     unset($attachlist);
 }
 getgpc('infloat') ? include template('forum/post_infloat') : (include template('forum/post'));
     $page = max(1, intval($_GET['page']));
     $start_limit = ($page - 1) * $_G['tpp'];
     $index = C::t('common_searchindex')->fetch_by_searchid_srchmod($searchid, $srchmod);
     if (!$index) {
         showmessage('search_id_invalid');
     }
     $keyword = dhtmlspecialchars($index['keywords']);
     $keyword = $keyword != '' ? str_replace('+', ' ', $keyword) : '';
     $index['keywords'] = rawurlencode($index['keywords']);
     require_once libfile('function/discuzcode');
     $collectionlist = array();
     $maxcollection = $nowcollection = 0;
     $query = C::t('forum_collection')->fetch_all(explode(',', $index['ids']), $orderby, $ascdesc, $start_limit, $_G['tpp']);
     foreach ($query as $value) {
         $value['lastupdate'] = dgmdate($value['lastupdate']);
         $value['shortdesc'] = cutstr(strip_tags(discuzcode($value['desc'])), 50);
         $value['name'] = bat_highlight($value['name'], $keyword);
         $collectionlist[$value['ctid']] = $value;
     }
     $multipage = multi($index['num'], $_G['tpp'], $page, "search.php?mod=collection&searchid={$searchid}&orderby={$orderby}&ascdesc={$ascdesc}&searchsubmit=yes");
     $url_forward = 'search.php?mod=collection&' . $_SERVER['QUERY_STRING'];
     include template('search/collection');
 } else {
     $searchstring = 'collection|title|' . addslashes($srchtxt);
     $searchindex = array('id' => 0, 'dateline' => '0');
     foreach (C::t('common_searchindex')->fetch_all_search($_G['setting']['search']['collection']['searchctrl'], $_G['clientip'], $_G['uid'], $_G['timestamp'], $searchstring, $srchmod) as $index) {
         if ($index['indexvalid'] && $index['dateline'] > $searchindex['dateline']) {
             $searchindex = array('id' => $index['searchid'], 'dateline' => $index['dateline']);
             break;
         } elseif ($_G['adminid'] != '1' && $index['flood']) {
             showmessage('search_ctrl', 'search.php?mod=collection', array('searchctrl' => $_G['setting']['search']['collection']['searchctrl']));
function notifymembers($operation, $variable)
{
    global $_G, $lang, $urladd, $conditions, $search_condition;
    if (!empty($_G['gp_current'])) {
        $subject = $message = '';
        if ($settings = DB::result_first("SELECT svalue FROM " . DB::table('common_setting') . " WHERE skey='{$variable}'")) {
            $settings = unserialize($settings);
            $subject = $settings['subject'];
            $message = $settings['message'];
        }
    } else {
        $current = 0;
        $subject = $_G['gp_subject'];
        $message = $_G['gp_message'];
        $subject = trim($subject);
        $message = trim(str_replace("\t", ' ', $message));
        $message = stripslashes($message);
        $addmsg = '';
        if ($_G['gp_notifymembers'] && $_G['gp_notifymember'] && !($subject && $message)) {
            cpmsg('members_newsletter_sm_invalid', '', 'error');
        }
        if ($operation == 'reward') {
            $updatesql = '';
            if ($_G['gp_updatecredittype'] == 0) {
                if (is_array($_G['gp_addextcredits']) && !empty($_G['gp_addextcredits'])) {
                    foreach ($_G['gp_addextcredits'] as $key => $value) {
                        $value = intval($value);
                        if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) {
                            $updatesql .= ", extcredits{$key}=extcredits{$key}+({$value})";
                            $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ": " . ($value > 0 ? '<em class="xi1">+' : '<em class="xg1">') . "{$value}</em> " . $_G['setting']['extcredits'][$key]['unit'] . ' &nbsp; ';
                        }
                    }
                }
            } else {
                if (is_array($_G['gp_resetextcredits']) && !empty($_G['gp_resetextcredits'])) {
                    foreach ($_G['gp_resetextcredits'] as $key => $value) {
                        $value = intval($value);
                        if (isset($_G['setting']['extcredits'][$key]) && !empty($value)) {
                            $updatesql .= ", extcredits{$key}=0";
                            $addmsg .= $_G['setting']['extcredits'][$key]['title'] . ': <em class="xg1">' . cplang('members_reward_clean') . '</em> &nbsp; ';
                        }
                    }
                }
            }
            if ($addmsg) {
                $addmsg = ' &nbsp; <br /><br /><b>' . cplang('members_reward_affect') . ':</b><br \\>' . $addmsg;
            }
            if (!empty($updatesql)) {
                $limit = 2000;
                set_time_limit(0);
                for ($i = 0; $i > -1; $i++) {
                    $uids = searchmembers($search_condition, $limit, $i * $limit);
                    $conditions = $uids ? 'm.uid IN (' . dimplode($uids) . ')' : '0';
                    $uids_query = DB::query("SELECT m.uid AS m_uid, mc.uid AS mc_uid FROM " . DB::table('common_member') . " m LEFT JOIN " . DB::table('common_member_count') . " mc ON m.uid=mc.uid WHERE {$conditions}");
                    while ($uid_tmp = DB::fetch($uids_query)) {
                        if (empty($uid_tmp['mc_uid'])) {
                            DB::insert('common_member_count', array('uid' => $uid_tmp['m_uid']));
                        }
                    }
                    $uids_conditions = dimplode($uids);
                    DB::query("UPDATE " . DB::table('common_member_count') . " SET uid=uid {$updatesql} WHERE uid IN ({$uids_conditions})", 'UNBUFFTERED');
                    if (count($uids) < $limit) {
                        break;
                    }
                }
            } else {
                cpmsg('members_reward_invalid', '', 'error');
            }
            if (!$_G['gp_notifymembers']) {
                cpmsg('members_reward_succeed', '', 'succeed');
            }
        } elseif ($operation == 'confermedal') {
            $medals = $_G['gp_medals'];
            if (!empty($medals)) {
                $medalids = $comma = '';
                foreach ($medals as $key => $medalid) {
                    $medalids .= "{$comma}'{$key}'";
                    $comma = ',';
                }
                $medalsnew = $comma = '';
                $medalsnewarray = $medalidarray = array();
                $query = DB::query("SELECT medalid, expiration FROM " . DB::table('forum_medal') . " WHERE medalid IN ({$medalids}) ORDER BY displayorder");
                while ($medal = DB::fetch($query)) {
                    $medal['status'] = empty($medal['expiration']) ? 0 : 1;
                    $medal['expiration'] = empty($medal['expiration']) ? 0 : TIMESTAMP + $medal['expiration'] * 86400;
                    $medal['medal'] = $medal['medalid'] . (empty($medal['expiration']) ? '' : '|' . $medal['expiration']);
                    $medalsnew .= $comma . $medal['medal'];
                    $medalsnewarray[] = $medal;
                    $medalidarray[] = $medal['medalid'];
                    $comma = "\t";
                }
                $uids = searchmembers($search_condition);
                if ($uids) {
                    $query = DB::query("SELECT uid, medals FROM " . DB::table('common_member_field_forum') . " WHERE uid IN (" . dimplode($uids) . ")");
                    while ($medalnew = DB::fetch($query)) {
                        $usermedal = array();
                        $addmedalnew = '';
                        if (empty($medalnew['medals'])) {
                            $addmedalnew = $medalsnew;
                        } else {
                            foreach ($medalidarray as $medalid) {
                                $usermedal_arr = explode("\t", $medalnew['medals']);
                                foreach ($usermedal_arr as $key => $medalval) {
                                    list($usermedalid, ) = explode("|", $medalval);
                                    $usermedal[] = $usermedalid;
                                }
                                if (!in_array($medalid, $usermedal)) {
                                    $addmedalnew .= $medalid . "\t";
                                }
                            }
                            $addmedalnew .= $medalnew['medals'];
                        }
                        DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET medals='" . $addmedalnew . "' WHERE uid='" . $medalnew['uid'] . "'", 'UNBUFFTERED');
                        foreach ($medalsnewarray as $medalnewarray) {
                            $data = array('uid' => $medalnew['uid'], 'medalid' => $medalnewarray['medalid'], 'type' => 0, 'dateline' => $_G['timestamp'], 'expiration' => $medalnewarray['expiration'], 'status' => $medalnewarray['status']);
                            DB::insert('forum_medallog', $data);
                        }
                    }
                }
            }
            if (!$_G['gp_notifymembers']) {
                cpmsg('members_confermedal_succeed', '', 'succeed');
            }
        } elseif ($operation == 'confermagic') {
            $magics = $_G['gp_magic'];
            $magicnum = $_G['gp_magicnum'];
            if ($magics) {
                require_once libfile('function/magic');
                $limit = 200;
                set_time_limit(0);
                for ($i = 0; $i > -1; $i++) {
                    $uids = searchmembers($search_condition, $limit, $i * $limit);
                    $conditions = $uids ? 'uid IN (' . dimplode($uids) . ')' : '0';
                    foreach ($magics as $magicid) {
                        $uparray = $insarray = array();
                        if (empty($magicnum[$magicid])) {
                            continue;
                        }
                        $query = DB::query("SELECT uid, magicid FROM " . DB::table('common_member_magic') . " WHERE {$conditions} AND magicid='{$magicid}'");
                        while ($row = DB::fetch($query)) {
                            $uparray[] = $row['uid'];
                        }
                        if ($uparray) {
                            DB::query("UPDATE " . DB::table('common_member_magic') . " SET num=num+{$magicnum[$magicid]} WHERE uid IN (" . dimplode($uparray) . ") AND magicid='{$magicid}'");
                        }
                        $insarray = array_diff($uids, $uparray);
                        if ($insarray) {
                            $sqls = array();
                            $sql = "INSERT INTO " . DB::table('common_member_magic') . " (uid, magicid, num) VALUES ";
                            foreach ($insarray as $uid) {
                                $sqls[] = "('{$uid}', '{$magicid}', '{$magicnum[$magicid]}')";
                            }
                            $sql .= implode(',', $sqls);
                            DB::query($sql);
                        }
                        foreach ($uids as $uid) {
                            updatemagiclog($magicid, '3', $magicnum[$magicid], '', $uid);
                        }
                    }
                    if (count($uids) < $limit) {
                        break;
                    }
                }
            }
        }
        DB::query("REPLACE INTO " . DB::table('common_setting') . " (skey, svalue) VALUES ('{$variable}', '" . addslashes(serialize(array('subject' => $subject, 'message' => $message))) . "')");
    }
    $pertask = intval($_G['gp_pertask']);
    $current = $_G['gp_current'] ? intval($_G['gp_current']) : 0;
    $continue = FALSE;
    if (!function_exists('sendmail')) {
        include libfile('function/mail');
    }
    if ($_G['gp_notifymember'] && in_array($_G['gp_notifymembers'], array('pm', 'notice', 'email'))) {
        $uids = searchmembers($search_condition, $pertask, $current);
        $conditions = $uids ? 'uid IN (' . dimplode($uids) . ')' : '0';
        require_once libfile('function/discuzcode');
        $message = $_G['gp_notifymembers'] == 'email' && $_G['gp_posttype'] ? discuzcode($message, 1, 0, 1, '', '', '', 1) : discuzcode($message, 1, 0);
        $pmuids = array();
        if ($_G['gp_notifymembers'] == 'pm') {
            $membernum = countmembers($search_condition, $urladd);
            $gpmid = empty($_G['gp_gpmid']) ? DB::insert('common_grouppm', array('authorid' => $_G['uid'], 'author' => !$_G['gp_system'] ? $_G['member']['username'] : '', 'dateline' => TIMESTAMP, 'message' => ($subject ? '<b>' . $subject . '</b><br /> &nbsp; ' : '') . addslashes($message) . $addmsg, 'numbers' => $membernum), true) : $_G['gp_gpmid'];
            $urladd .= '&gpmid=' . $gpmid;
        }
        $query = DB::query("SELECT uid, username, groupid, email, newpm FROM " . DB::table('common_member') . " m WHERE {$conditions}");
        while ($member = DB::fetch($query)) {
            if ($_G['gp_notifymembers'] == 'pm') {
                DB::insert('common_member_grouppm', array('uid' => $member['uid'], 'gpmid' => $gpmid, 'status' => 0), false, true);
                $newpm = setstatus(2, 1, $member['newpm']);
                DB::query("UPDATE " . DB::table('common_member') . " SET newpm='{$newpm}' WHERE uid='{$member['uid']}'");
            } elseif ($_G['gp_notifymembers'] == 'notice') {
                notification_add($member['uid'], 'system', 'system_notice', array('subject' => $subject, 'message' => $message . $addmsg), 1);
            } elseif ($_G['gp_notifymembers'] == 'email') {
                sendmail("{$member['username']} <{$member['email']}>", $subject, $message . $addmsg);
            }
            $continue = TRUE;
        }
    }
    $newsletter_detail = array();
    if ($continue) {
        $next = $current + $pertask;
        $newsletter_detail = array('uid' => $_G['uid'], 'current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition), 'action' => "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&notifymember={$_G['gp_notifymember']}&notifymembers=" . rawurlencode($_G['gp_notifymembers']) . $urladd);
        save_newsletter('newsletter_detail', $newsletter_detail);
        cpmsg("{$lang['members_newsletter_send']}: " . cplang('members_newsletter_processing', array('current' => $current, 'next' => $next, 'search_condition' => serialize($search_condition))), "action=members&operation={$operation}&{$operation}submit=yes&current={$next}&pertask={$pertask}&notifymember={$_G['gp_notifymember']}&notifymembers=" . rawurlencode($_G['gp_notifymembers']) . $urladd, 'loadingform');
    } else {
        del_newsletter('newsletter_detail');
        if ($operation == 'reward' && $_G['gp_notifymembers'] == 'pm') {
            $message = '';
        } else {
            $message = '_notify';
        }
        cpmsg('members' . ($operation ? '_' . $operation : '') . $message . '_succeed', '', 'succeed');
    }
}
Example #17
0
 $field = $_G['cache']['profilesetting'][$key];
 if (in_array($field['formtype'], array('text', 'textarea')) || in_array($key, $forumfield)) {
     $censor->check($value);
     if ($censor->modbanned() || $censor->modmoderated()) {
         profile_showerror($key, lang('spacecp', 'profile_censor'));
     }
 }
 if (in_array($key, $forumfield)) {
     if ($key == 'sightml') {
         loadcache(array('smilies', 'smileytypes'));
         $value = cutstr($value, $_G['group']['maxsigsize'], '');
         foreach ($_G['cache']['smilies']['replacearray'] as $skey => $smiley) {
             $_G['cache']['smilies']['replacearray'][$skey] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'] . '/' . $smiley . '[/img]';
         }
         $value = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($value));
         $forum[$key] = discuzcode($value, 1, 0, 0, 0, $_G['group']['allowsigbbcode'], $_G['group']['allowsigimgcode'], 0, 0, 1);
     } elseif ($key == 'customstatus' && $allowcstatus) {
         $forum[$key] = dhtmlspecialchars(trim($value));
     }
     continue;
 } elseif ($field && !$field['available']) {
     continue;
 } elseif ($key == 'timeoffset') {
     C::t('common_member')->update($_G['uid'], array('timeoffset' => intval($value)));
 }
 if ($field['formtype'] == 'file') {
     if (!empty($_FILES[$key]) && $_FILES[$key]['error'] == 0 || !empty($space[$key]) && empty($_GET['deletefile'][$key])) {
         $value = '1';
     } else {
         $value = '';
     }
    if ($debate['affirmvotes'] && $debate['affirmvotes'] > $debate['negavotes']) {
        $debate['affirmvoteswidth'] = 100;
        $debate['negavoteswidth'] = intval($debate['negavotes'] / $debate['affirmvotes'] * 100);
        $debate['negavoteswidth'] = $debate['negavoteswidth'] > 0 ? $debate['negavoteswidth'] : 5;
    } elseif ($debate['negavotes'] && $debate['negavotes'] > $debate['affirmvotes']) {
        $debate['negavoteswidth'] = 100;
        $debate['affirmvoteswidth'] = intval($debate['affirmvotes'] / $debate['negavotes'] * 100);
        $debate['affirmvoteswidth'] = $debate['affirmvoteswidth'] > 0 ? $debate['affirmvoteswidth'] : 5;
    } else {
        $debate['affirmvoteswidth'] = $debate['negavoteswidth'] = 100;
    }
} else {
    $debate['negavoteswidth'] = $debate['affirmvoteswidth'] = 5;
}
if ($debate['umpirepoint']) {
    $debate['umpirepoint'] = discuzcode($debate['umpirepoint'], 0, 0, 0, 1, 1, 1, 0, 0, 0, 0);
}
$debate['umpireurl'] = rawurlencode($debate['umpire']);
list($debate['bestdebater'], $debate['bestdebateruid'], $debate['bestdebaterstand'], $debate['bestdebatervoters'], $debate['bestdebaterreplies']) = explode("\t", $debate['bestdebater']);
$debate['bestdebaterurl'] = rawurlencode($debate['bestdebater']);
$posttable = getposttablebytid($_G['tid']);
$query = DB::query("SELECT author, authorid FROM " . DB::table($posttable) . " p, " . DB::table('forum_debatepost') . " dp\r\n\tWHERE p.tid='{$_G['tid']}' AND p.anonymous='0' AND p.invisible='0' AND dp.stand='1' AND p.pid=dp.pid ORDER BY p.dateline DESC LIMIT 16");
while ($affirmavatar = DB::fetch($query)) {
    if (!isset($debate['affirmavatars'][$affirmavatar['authorid']])) {
        $affirmavatar['avatar'] = avatar($affirmavatar['authorid'], 'small');
        $debate['affirmavatars'][$affirmavatar['authorid']] = $affirmavatar;
    }
}
$query = DB::query("SELECT author, authorid FROM " . DB::table($posttable) . " p, " . DB::table('forum_debatepost') . " dp\r\n\tWHERE p.tid='{$_G['tid']}' AND p.anonymous='0' AND p.invisible='0' AND dp.stand='2' AND p.pid=dp.pid ORDER BY p.dateline DESC LIMIT 16");
while ($negaavatar = DB::fetch($query)) {
    if (!isset($debate['negaavatars'][$negaavatar['authorid']])) {
Example #19
0
$payment = C::t('common_credit_log')->count_stc_by_relatedid($_G['tid'], $_G['setting']['creditstransextra'][1]);
$thread['payers'] = $payment['payers'];
$thread['netprice'] = !$_G['setting']['maxincperthread'] || $_G['setting']['maxincperthread'] && $payment['income'] < $_G['setting']['maxincperthread'] ? floor($thread['price'] * (1 - $_G['setting']['creditstax'])) : 0;
$thread['creditstax'] = sprintf('%1.2f', $_G['setting']['creditstax'] * 100) . '%';
$thread['endtime'] = $_G['setting']['maxchargespan'] ? dgmdate($_G['forum_thread']['dateline'] + $_G['setting']['maxchargespan'] * 3600, 'u') : 0;
$thread['price'] = $_G['forum_thread']['price'];
$firstpost = C::t('forum_post')->fetch_threadpost_by_tid_invisible($_G['tid']);
if ($firstpost) {
    $member = getuserbyuid($firstpost['authorid']);
    $firstpost['groupid'] = $member['groupid'];
}
$pid = $firstpost['pid'];
$freemessage = array();
$freemessage[$pid]['message'] = '';
if (preg_match_all("/\\[free\\](.+?)\\[\\/free\\]/is", $firstpost['message'], $matches)) {
    foreach ($matches[1] as $match) {
        $freemessage[$pid]['message'] .= discuzcode($match, $firstpost['smileyoff'], $firstpost['bbcodeoff'], sprintf('%00b', $firstpost['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'] ? -$firstpost['groupid'] : 0, $_G['forum']['allowimgcode'], $_G['forum']['allowhtml'], $_G['forum']['jammer'] && $post['authorid'] != $_G['uid'] ? 1 : 0, 0, $post['authorid'], $_G['forum']['allowmediacode'], $pid) . '<br />';
    }
}
$attachtags = array();
if ($_G['group']['allowgetattach'] || $_G['group']['allowgetimage']) {
    if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $freemessage[$pid]['message'], $matchaids)) {
        $attachtags[$pid] = $matchaids[1];
    }
}
if ($attachtags) {
    require_once libfile('function/attachment');
    parseattach($pid, $attachtags, $freemessage);
}
$thread['freemessage'] = $freemessage[$pid]['message'];
unset($freemessage);
Example #20
0
     if ($count == 1) {
         dheader('location: ' . $url);
     }
     echo '<div class="infobox"><h4 class="infotitle2">' . $lang['plugins_import_installtype_1'] . ' ' . $_G['gp_dir'] . ' ' . $lang['plugins_import_installtype_2'] . ' ' . $count . ' ' . $lang['plugins_import_installtype_3'] . '</h4>' . $xmls . '</div>';
     exit;
 } else {
     $installtype = $_G['gp_installtype'];
     $dir = $_G['gp_dir'];
     $license = $_G['gp_license'];
     $extra = $installtype ? '_' . $installtype : '';
     $importfile = DISCUZ_ROOT . './source/plugin/' . $dir . '/discuz_plugin_' . $dir . $extra . '.xml';
     $importtxt = @implode('', file($importfile));
     $pluginarray = getimportdata('Discuz! Plugin');
     if (empty($license) && $pluginarray['license']) {
         require_once libfile('function/discuzcode');
         $pluginarray['license'] = discuzcode(dstripslashes(strip_tags($pluginarray['license'])), 1, 0);
         echo '<div class="infobox"><h4 class="infotitle2">' . $pluginarray['plugin']['name'] . ' ' . $pluginarray['plugin']['version'] . ' ' . $lang['plugins_import_license'] . '</h4><div style="text-align:left;line-height:25px;">' . $pluginarray['license'] . '</div><br /><br /><center>' . '<button onclick="location.href=\'' . ADMINSCRIPT . '?action=plugins&operation=import&dir=' . $dir . '&installtype=' . $installtype . '&license=yes\'">' . $lang['plugins_import_agree'] . '</button>&nbsp;&nbsp;' . '<button onclick="location.href=\'' . ADMINSCRIPT . '?action=plugins\'">' . $lang['plugins_import_pass'] . '</button></center></div>';
         exit;
     }
 }
 if (!ispluginkey($pluginarray['plugin']['identifier'])) {
     cpmsg('plugins_edit_identifier_invalid', '', 'error');
 }
 if (!ispluginkey($pluginarray['plugin']['identifier'])) {
     cpmsg('plugins_edit_identifier_invalid', '', 'error');
 }
 if (is_array($pluginarray['vars'])) {
     foreach ($pluginarray['vars'] as $config) {
         if (!ispluginkey($config['variable'])) {
             cpmsg('plugins_import_var_invalid', '', 'error');
         }
            showmessage('forum_nopermission', NULL, 'NOPERM');
        }
    }
    if (!$forum['ismoderator'] || !$alloweditpost || in_array($orig['adminid'], array(1, 2, 3)) && $adminid > $orig['adminid']) {
        showmessage('post_edit_nopermission', NULL, 'HALTED');
    }
    if (!submitcheck('editmessagesubmit', 1)) {
        include template('modcp_editpost');
        exit;
    } else {
        require_once DISCUZ_ROOT . './include/discuzcode.func.php';
        if ($do == 'notupdate') {
            $message = $orig['message'];
            $message = discuzcode($message, 0, 0, 0, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $showimages ? 1 : 0, $forum['allowhtml'], 0, 0, $orig['authorid']);
            showmessage(stripslashes($message));
        } else {
            $message = censor(trim($message));
            if (!$disablepostctrl) {
                if ($maxpostsize && strlen($message) > $maxpostsize) {
                    showmessage('post_message_toolong');
                } elseif ($minpostsize && strlen(preg_replace("/\\[quote\\].+?\\[\\/quote\\]/is", '', $message)) < $minpostsize) {
                    showmessage('post_message_tooshort');
                }
            }
            $query = $db->query("UPDATE {$tablepre}posts SET message='{$message}' WHERE pid='{$pid}'");
            $message = discuzcode($message, 0, 0, 0, $forum['allowsmilies'], $forum['allowbbcode'], $forum['allowimgcode'] && $showimages ? 1 : 0, $forum['allowhtml'], 0, 0, $orig['authorid']);
            showmessage(stripslashes($message));
        }
    }
}
include template('modcp_editpost');
Example #22
0
}
if (!$_G['group']['allowsplitthread']) {
    showmessage('undefined_action', NULL);
}
$posttable = getposttablebytid($_G['tid']);
$posttableid = DB::result_first("SELECT posttableid FROM " . DB::table('forum_thread') . " WHERE tid='{$_G['tid']}'");
if (!submitcheck('modsubmit')) {
    require_once libfile('function/discuzcode');
    $replies = $thread['replies'];
    if ($replies <= 0) {
        showmessage('admin_split_invalid');
    }
    $postlist = array();
    $query = DB::query("SELECT * FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' ORDER BY dateline");
    while ($post = DB::fetch($query)) {
        $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $_G['forum']['allowsmilies'], $_G['forum']['allowbbcode'], $_G['forum']['allowimgcode'], $_G['forum']['allowhtml']);
        $postlist[] = $post;
    }
    include template('forum/topicadmin_action');
} else {
    if (!trim($_G['gp_subject'])) {
        showmessage('admin_split_subject_invalid');
    } elseif (!($nos = explode(',', $_G['gp_split']))) {
        showmessage('admin_split_new_invalid');
    }
    sort($nos);
    $maxno = $nos[count($nos) - 1];
    $maxno = $maxno > $thread['replies'] + 1 ? $thread['replies'] + 1 : $maxno;
    $maxno = max(1, intval($maxno));
    $query = DB::query("SELECT pid FROM " . DB::table($posttable) . " WHERE tid='{$_G['tid']}' AND invisible='0' ORDER BY dateline LIMIT {$maxno}");
    $i = 1;
Example #23
0
 $nicknamenew = $allownickname ? cutstr(censor(dhtmlspecialchars($nicknamenew)), 30) : '';
 $cstatusadd = $allowcstatus ? ', customstatus=\'' . cutstr(censor(dhtmlspecialchars($cstatusnew)), 30) . '\'' : '';
 $gendernew = empty($gendernew) ? 0 : intval($gendernew);
 $locationnew = cutstr(censor(dhtmlspecialchars($locationnew)), 30);
 if ($maxsigsize) {
     if (strlen($signaturenew) > $maxsigsize) {
         showmessage('profile_sig_toolong');
     }
 } else {
     $signaturenew = '';
 }
 $signaturenew = censor($signaturenew);
 $sigstatusnew = $signaturenew ? 1 : 0;
 $bionew = censor(dhtmlspecialchars($bionew));
 $sightmlnew = discuzcode(stripslashes($signaturenew), 1, 0, 0, 0, $allowsigbbcode, $allowsigimgcode, 0, 0, 1);
 $biohtmlnew = discuzcode(stripslashes($bionew), 1, 0, 0, 0, $allowbiobbcode, $allowbioimgcode, 0, 0, 1);
 if ($member['msn'][1]) {
     if (strpos(strtolower($sightmlnew), '[imme]') !== FALSE) {
         $sightmlnew = str_replace('[imme]', "<imme><a target='_blank' href='http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=" . $member['msn'][1] . "@apps.messenger.live.com&mkt=zh-cn' title='MSN'><img style='vertical-align:middle' src='http://messenger.services.live.com/users/" . $member['msn'][1] . "@apps.messenger.live.com/presenceimage?mkt=zh-cn' width='16' height='16' /></a></imme>", $sightmlnew);
     }
     if (strpos(strtolower($biohtmlnew), '[imme]') !== FALSE) {
         $biohtmlnew = str_replace('[imme]', "<imme><a target='_blank' href='http://settings.messenger.live.com/Conversation/IMMe.aspx?invitee=" . $member['msn'][1] . "@apps.messenger.live.com&mkt=zh-cn' title='MSN'><img style='vertical-align:middle' src='http://messenger.services.live.com/users/" . $member['msn'][1] . "@apps.messenger.live.com/presenceimage?mkt=zh-cn' width='16' height='16' /></a></imme>", $biohtmlnew);
     }
 }
 $sightmlnew = addslashes($sightmlnew);
 $biohtmlnew = addslashes($biohtmlnew);
 $membersql = "gender='{$gendernew}', bday='{$bdaynew}', sigstatus='{$sigstatusnew}'";
 $memberfieldsql = "nickname='{$nicknamenew}', site='{$sitenew}', location='{$locationnew}', icq='{$icqnew}', qq='{$qqnew}', yahoo='{$yahoonew}', msn='{$msnnew}', taobao='{$taobaonew}', alipay='{$alipaynew}', bio='{$biohtmlnew}', sightml='{$sightmlnew}' {$cstatusadd}";
 if ($_DCACHE['fields_required'] || $_DCACHE['fields_optional']) {
     $fieldadd = array();
     foreach (array_merge($_DCACHE['fields_required'], $_DCACHE['fields_optional']) as $field) {
Example #24
0
function recyclebinpostshowpostlist($fid, $authors, $starttime, $endtime, $keywords, $start_limit, $lpp)
{
    global $_G, $lang, $posttableid, $security;
    $tids = $fids = array();
    if ($security) {
        $postlist = C::t('#security#security_evilpost')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
    } else {
        $postlist = C::t('forum_post')->fetch_all_by_search($posttableid, null, $keywords, -5, $fid, null, $authors ? explode(',', str_replace(' ', '', $authors)) : null, strtotime($starttime), strtotime($endtime), null, null, $start_limit, $lpp);
    }
    if (empty($postlist)) {
        return false;
    }
    foreach ($postlist as $key => $post) {
        $tids[$post['tid']] = $post['tid'];
        $fids[$post['fid']] = $post['fid'];
    }
    foreach (C::t('forum_thread')->fetch_all_by_tid($tids) as $thread) {
        $thread['tsubject'] = $thread['subject'];
        $threadlist[$thread['tid']] = $thread;
    }
    $query = C::t('forum_forum')->fetch_all_by_fid($fids);
    foreach ($query as $val) {
        $forum = array('fid' => $val['fid'], 'forumname' => $val['name'], 'allowsmilies' => $val['allowsmilies'], 'allowhtml' => $val['allowhtml'], 'allowbbcode' => $val['allowbbcode'], 'allowimgcode' => $val['allowimgcode']);
        $forumlist[$forum['fid']] = $forum;
    }
    foreach ($postlist as $key => $post) {
        $post['message'] = discuzcode($post['message'], $post['smileyoff'], $post['bbcodeoff'], sprintf('%00b', $post['htmlon']), $forumlist[$post['fid']]['allowsmilies'], $forumlist[$post['fid']]['allowbbcode'], $forumlist[$post['fid']]['allowimgcode'], $forumlist[$post['fid']]['allowhtml']);
        $post['dateline'] = dgmdate($post['dateline']);
        if ($post['attachment']) {
            require_once libfile('function/attachment');
            foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $post['tid'], 'pid', $post['pid']) as $attach) {
                $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                $post['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
            }
        }
        showtablerow("id=\"mod_{$post['pid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_1\" value=\"delete\" checked=\"checked\" /><label for=\"mod_{$post['pid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_2\" value=\"undelete\" /><label for=\"mod_{$post['pid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$post['pid']}]\" id=\"mod_{$post['pid']}_3\" value=\"ignore\" /><label for=\"mod_{$post['pid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$post['fid']}\" target=\"_blank\">" . $forumlist[$post['fid']]['forumname'] . "</a> &raquo; <a href=\"forum.php?mod=viewthread&tid={$post['tid']}\" target=\"_blank\">" . $threadlist[$post['tid']]['tsubject'] . "</a>" . ($post['subject'] ? ' &raquo; ' . $post['subject'] : '') . "</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$post['authorid']}\" target=\"_blank\">{$post['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$post['dateline']} &nbsp;&nbsp; IP: {$post['useip']}</p>"));
        showtablerow("id=\"mod_{$post['pid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $post['message'] . '</div>');
        showtablerow("id=\"mod_{$post['pid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['isanonymous']}: " . ($post['anonymous'] ? $lang['yes'] : $lang['no']) . " &nbsp;&nbsp; {$lang['ishtmlon']}: " . ($post['htmlon'] ? $lang['yes'] : $lang['no']));
    }
    return true;
}
        showmessage('post_newthread_succeed', dreferer(), array('coverimg' => ''));
    } elseif ($return == -1) {
        showmessage('post_newthread_mod_succeed', dreferer(), array('coverimg' => ''));
    } elseif ($return == -2) {
        showmessage('post_reply_mod_succeed', dreferer());
    } else {
        showmessage('thread_nonexistence');
    }
} elseif ($_GET['action'] == 'loadsave') {
    $message = '&nbsp;';
    $savepost = C::t('forum_post')->fetch(0, $_GET['pid']);
    if ($savepost) {
        $message = $savepost['message'];
        if ($_GET['type']) {
            require_once libfile('function/discuzcode');
            $message = discuzcode($message, $savepost['smileyoff'], $savepost['bbcodeoff'], $savepost['htmlon']);
        }
        $message = $message ? $message : '&nbsp;';
    }
    include template('common/header_ajax');
    echo $message;
    include template('common/footer_ajax');
    exit;
} elseif ($_GET['action'] == 'replynotice') {
    $tid = intval($_GET['tid']);
    $status = $_GET['op'] == 'ignore' ? 0 : 1;
    if (!empty($tid)) {
        $thread = C::t('forum_thread')->fetch_by_tid_displayorder($tid, 0);
        if ($thread['authorid'] == $_G['uid']) {
            $thread['status'] = setstatus(6, $status, $thread['status']);
            C::t('forum_thread')->update($tid, array('status' => $thread['status']), true);
Example #26
0
 $field = $_G['cache']['profilesetting'][$key];
 if (in_array($field['formtype'], array('text', 'textarea')) || in_array($key, $forumfield)) {
     $censor->check($value);
     if ($censor->modbanned() || $censor->modmoderated()) {
         profile_showerror($key, lang('spacecp', 'profile_censor'));
     }
 }
 if (in_array($key, $forumfield)) {
     if ($key == 'sightml') {
         loadcache(array('smilies', 'smileytypes'));
         $value = cutstr($value, $_G['group']['maxsigsize'], '');
         foreach ($_G['cache']['smilies']['replacearray'] as $skey => $smiley) {
             $_G['cache']['smilies']['replacearray'][$skey] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'] . '/' . $smiley . '[/img]';
         }
         $value = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($value));
         $forum[$key] = addslashes(discuzcode(stripslashes($value), 1, 0, 0, 0, $_G['group']['allowsigbbcode'], $_G['group']['allowsigimgcode'], 0, 0, 1));
     } elseif ($key == 'customstatus' && $allowcstatus) {
         $forum[$key] = dhtmlspecialchars(trim($value));
     }
     continue;
 } elseif ($field && !$field['available']) {
     continue;
 } elseif ($key == 'timeoffset') {
     DB::update('common_member', array('timeoffset' => intval($value)), array('uid' => $_G['uid']));
 }
 if ($field['formtype'] == 'file') {
     if (!empty($_FILES[$key]) && $_FILES[$key]['error'] == 0 || !empty($space[$key]) && empty($_G['gp_deletefile'][$key])) {
         $value = '1';
     } else {
         $value = '';
     }
Example #27
0
     }
 } elseif ($article['idtype'] == 'tid') {
     $common_url = "forum.php?mod=viewthread&tid={$article['id']}";
     $form_url = "forum.php?mod=post&action=reply&tid={$article['id']}&replysubmit=yes&infloat=yes&handlekey=fastpost";
     require_once libfile('function/discuzcode');
     $posttable = empty($thread['posttable']) ? getposttablebytid($article['id']) : $thread['posttable'];
     $_G['tid'] = $article['id'];
     $article['commentnum'] = getcount($posttable, array('tid' => $article['id'], 'first' => '0'));
     if ($article['allowcomment'] && $article['commentnum']) {
         $attachpids = $attachtags = array();
         $_G['group']['allowgetattach'] = $_G['group']['allowgetimage'] = 1;
         foreach (C::t('forum_post')->fetch_all_by_tid('tid:' . $article['id'], $article['id'], true, 'ASC', 0, 20, null, 0) as $value) {
             $value['uid'] = $value['authorid'];
             $value['username'] = $value['author'];
             if ($value['status'] != 1 && !$value['first']) {
                 $value['message'] = discuzcode($value['message'], $value['smileyoff'], $value['bbcodeoff'], $value['htmlon']);
                 $value['cid'] = $value['pid'];
                 $commentlist[$value['pid']] = $value;
                 if ($value['attachment']) {
                     $attachpids[] = $value['pid'];
                     if (preg_match_all("/\\[attach\\](\\d+)\\[\\/attach\\]/i", $value['message'], $matchaids)) {
                         $attachtags[$value['pid']] = $matchaids[1];
                     }
                 }
             }
         }
         if ($attachpids) {
             require_once libfile('function/attachment');
             parseattach($attachpids, $attachtags, $commentlist);
         }
     }
Example #28
0
 public function parseTradeTopic($_G, $post)
 {
     $rows = C::t('forum_thread')->fetch_all_by_tid($_G['tid']);
     $tpids = array();
     if ($rows[$_G['tid']]['special'] == 2) {
         $query = C::t('forum_trade')->fetch_all_thread_goods($_G['tid']);
         foreach ($query as $trade) {
             $tradesaids[] = $trade['aid'];
             $tradespids[] = $trade['pid'];
         }
         $specialadd2 = 1;
         if ($tradespids) {
             foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $_G['tid'], 'pid', $tradespids) as $attach) {
                 if ($attach['isimage'] && is_array($tradesaids) && in_array($attach['aid'], $tradesaids)) {
                     $trades[$attach['pid']]['attachurl'] = ($attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl']) . 'forum/' . $attach['attachment'];
                     $trades[$attach['pid']]['thumb'] = $attach['thumb'] ? getimgthumbname($trades[$attach['pid']]['attachurl']) : $trades[$attach['pid']]['attachurl'];
                     $trades[$attach['pid']]['width'] = $attach['thumb'] && $_G['setting']['thumbwidth'] < $attach['width'] ? $_G['setting']['thumbwidth'] : $attach['width'];
                     $trades[$attach['pid']]['thumb'] = str_replace('forum/', '', $trades[$attach['pid']]['thumb']);
                     $filename = $this->parseTradeTopicImg($trades[$attach['pid']]);
                     $info[] = array('infor' => $filename, 'type' => 1);
                 }
             }
         }
         $tradepostlist = C::t('forum_post')->fetch_all('tid:' . $_G['tid'], $tradespids);
         foreach ($query as $trade) {
             $quality = $trade['quality'] == 1 ? Common::get_unicode_charset('\\u5168\\u65b0\\u5546\\u54c1') : Common::get_unicode_charset('\\u4e8c\\u624b\\u5546\\u54c1');
             $transport = $trade['transport'];
             switch ($trade['transport']) {
                 case 3:
                     $transport = Common::get_unicode_charset('\\u865a\\u62df\\u5546\\u54c1');
                     break;
                 case 2:
                     $transport = '';
                     break;
                 case 0:
                     $transport = Common::get_unicode_charset('\\u7ebf\\u4e0b\\u4ea4\\u6613');
                     break;
             }
             $time = $trade['expiration'] - time();
             $time = explode('.', $time / 3600 / 24);
             $time = intval($time[0]) . Common::get_unicode_charset('\\u5929') . intval(('0.' . $time[1]) * 24) . Common::get_unicode_charset('\\u5c0f\\u65f6');
             $message[] = array('infor' => Common::get_unicode_charset('\\u5546\\u54c1\\u7c7b\\u578b\\u003a') . $quality, 'type' => 0);
             $message[] = array('infor' => Common::get_unicode_charset('\\u8fd0\\u8d39\\u003a') . $transport, 'type' => 0);
             $message[] = array('infor' => Common::get_unicode_charset('\\u5269\\u4f59\\u65f6\\u95f4\\u003a') . $time, 'type' => 0);
             $message[] = array('infor' => Common::get_unicode_charset('\\u5546\\u54c1\\u6570\\u91cf\\u003a') . $trade['amount'], 'type' => 0);
             $message[] = array('infor' => Common::get_unicode_charset('\\u5730\\u70b9\\u003a') . $trade['locus'], 'type' => 0);
             $message[] = array('infor' => Common::get_unicode_charset('\\u7d2f\\u8ba1\\u552e\\u51fa\\u003a') . $trade['totalitems'], 'type' => 0);
         }
         foreach ($tradepostlist as $val) {
             $topicContent = text_replace($val['message']);
             $topicContent = discuzcode($topicContent, $val['smileyoff'], $val['bbcodeoff']);
             $topicContent = str_replace('<img src="static/', '<img src="/static/', $topicContent);
             $val['message'] = text_replace($topicContent);
             $message1 = doContent($val['message'], $tradesaids);
             $message2 = getContentFont($val['message']);
             foreach ($message1 as $k => $v) {
                 if ($v['type'] == 0) {
                     unset($message1[$k]);
                 } else {
                 }
             }
             $message_array2 = explode('|~|', $message2);
             $message2 = str_replace('[', '1', $message2);
             $message2 = str_replace(']', '1', $message2);
             if (is_array($message_array2) && count($message_array2) > 0) {
                 foreach ($message_array2 as $k => $v) {
                     $message[] = array("infor" => $v, "type" => 0);
                     if ($message1[$k]["infor"] && !empty($message1)) {
                         $message[] = $message1[$k];
                     }
                 }
             } else {
                 $message = getContentFont($val['message']);
             }
         }
     }
     return $message;
 }
Example #29
0
     if ($security) {
         $searchresult = C::t('#security#security_evilpost')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']);
     } else {
         $searchresult = C::t('forum_thread')->fetch_all_by_recyclebine($fid, $isgroup, $author, $admins, $pstarttime, $pendtime, $mstarttime, $mendtime, $keywords, ($pagetmp - 1) * $_G['ppp'], $_G['ppp']);
     }
     $issettids = array();
     foreach ($searchresult as $thread) {
         $disabledstr = '';
         if (isset($issettids[$thread['tid']])) {
             $disabledstr = 'disabled';
         } else {
             $issettids[$thread['tid']] = $thread['tid'];
         }
         $post = C::t('forum_post')->fetch_threadpost_by_tid_invisible($thread['tid']);
         $thread = array_merge($thread, $post);
         $thread['message'] = discuzcode($thread['message'], $thread['smileyoff'], $thread['bbcodeoff'], sprintf('%00b', $thread['htmlon']), $thread['allowsmilies'], $thread['allowbbcode'], $thread['allowimgcode'], $thread['allowhtml']);
         $thread['moddateline'] = dgmdate($thread['moddateline']);
         $thread['dateline'] = dgmdate($thread['dateline']);
         if ($thread['attachment']) {
             require_once libfile('function/attachment');
             foreach (C::t('forum_attachment_n')->fetch_all_by_id('tid:' . $thread['tid'], 'tid', $thread['tid']) as $attach) {
                 $_G['setting']['attachurl'] = $attach['remote'] ? $_G['setting']['ftp']['attachurl'] : $_G['setting']['attachurl'];
                 $attach['url'] = $attach['isimage'] ? " {$attach['filename']} (" . sizecount($attach['filesize']) . ")<br /><br /><img src=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" onload=\"if(this.width > 100) {this.resized=true; this.width=100;}\">" : "<a href=\"" . $_G['setting']['attachurl'] . "forum/{$attach['attachment']}\" target=\"_blank\">{$attach['filename']}</a> (" . sizecount($attach['filesize']) . ")";
                 $thread['message'] .= "<br /><br />{$lang['attachment']}: " . attachtype(fileext($attach['filename']) . "\t") . $attach['url'];
             }
         }
         showtablerow("id=\"mod_{$thread['tid']}_row1\"", array('rowspan="3" class="rowform threadopt" style="width:80px;"', 'class="threadtitle"'), array("<ul class=\"nofloat\"><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_1\" value=\"delete\" " . (empty($disabledstr) ? "checked=\"checked\"" : '') . " {$disabledstr} /><label for=\"mod_{$thread['tid']}_1\">{$lang['delete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_2\" value=\"undelete\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_2\">{$lang['undelete']}</label></li><li><input class=\"radio\" type=\"radio\" name=\"moderate[{$thread['tid']}]\" id=\"mod_{$thread['tid']}_3\" value=\"ignore\" {$disabledstr}/><label for=\"mod_{$thread['tid']}_3\">{$lang['ignore']}</label></li></ul>", "<h3><a href=\"forum.php?mod=forumdisplay&fid={$thread['fid']}\" target=\"_blank\">{$thread['forumname']}</a> &raquo; {$thread['subject']}</h3><p><span class=\"bold\">{$lang['author']}:</span> <a href=\"home.php?mod=space&uid={$thread['authorid']}\" target=\"_blank\">{$thread['author']}</a> &nbsp;&nbsp; <span class=\"bold\">{$lang['time']}:</span> {$thread['dateline']} &nbsp;&nbsp; {$lang['threads_replies']}: {$thread['replies']} {$lang['threads_views']}: {$thread['views']}</p>"));
         showtablerow("id=\"mod_{$thread['tid']}_row2\"", 'colspan="2" style="padding: 10px; line-height: 180%;"', '<div style="overflow: auto; overflow-x: hidden; max-height:120px; height:auto !important; height:120px; word-break: break-all;">' . $thread['message'] . '</div>');
         showtablerow("id=\"mod_{$thread['tid']}_row3\"", 'class="threadopt threadtitle" colspan="2"', "{$lang['operator']}: <a href=\"home.php?mod=space&uid={$thread['moduid']}\" target=\"_blank\">{$thread['modusername']}</a> &nbsp;&nbsp; {$lang['recyclebin_delete_time']}: {$thread['moddateline']}&nbsp;&nbsp; {$lang['reason']}: {$thread['reason']}");
     }
 }
Example #30
0
function getblockhtml($blockname, $parameters = array())
{
    global $_G, $space;
    $parameters = empty($parameters) ? array() : $parameters;
    $list = array();
    $sql = $title = $html = $wheresql = $ordersql = $titlemore = $do = $view = $contentclassname = '';
    $contenttagname = 'div';
    $shownum = 6;
    $uid = intval($space['uid']);
    $shownum = empty($parameters['shownum']) ? $shownum : intval($parameters['shownum']);
    switch ($blockname) {
        case 'profile':
            $do = $blockname;
            $managehtml = '';
            $avatar = empty($parameters['banavatar']) ? 'middle' : $parameters['banavatar'];
            $html .= "<div class=\"hm\"><p><a href=\"home.php?mod=space&uid={$uid}\" target=\"__blank\">" . avatar($uid, $avatar) . '</a></p>';
            $html .= "<h2><a href=\"home.php?mod=space&uid={$uid}\" target=\"__blank\">" . $space['username'] . "</a></h2>";
            $html .= '</div><ul class="xl xl2 cl ul_list">';
            $magicinfo = $showmagicgift = false;
            if ($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) {
                $showmagicgift = true;
                $magicinfo = !empty($space['magicgift']) ? unserialize($space['magicgift']) : array();
            }
            if ($space['self']) {
                $html .= '<li class="ul_diy"><a href="home.php?mod=space&diy=yes">' . lang('space', 'block_profile_diy') . '</a></li>';
                $html .= '<li class="ul_msg"><a href="home.php?mod=space&uid=' . $uid . '&do=wall">' . lang('space', 'block_profile_wall') . '</a></li>';
                $html .= '<li class="ul_avt"><a href="home.php?mod=spacecp&ac=avatar">' . lang('space', 'block_profile_avatar') . '</a></li>';
                $html .= '<li class="ul_profile"><a href="home.php?mod=spacecp&ac=profile">' . lang('space', 'block_profile_update') . '</a></li>';
                if ($showmagicgift) {
                    $html .= '<li class="ul_magicgift"><div style="' . 'background: url(' . STATICURL . 'image/magic/gift.small.gif) no-repeat 0 50%;' . '">';
                    if ($magicinfo) {
                        $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=retiregift">' . lang('magic/gift', 'gift_gc') . '</a>';
                    } else {
                        $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=magic&mid=gift">' . lang('magic/gift', 'gift_use') . '</a>';
                    }
                    $html .= '</div></li>';
                }
            } else {
                require_once libfile('function/friend');
                $isfriend = friend_check($uid);
                if (!$isfriend) {
                    $html .= "<li class='ul_add'><a href=\"home.php?mod=spacecp&ac=friend&op=add&uid={$space['uid']}&handlekey=addfriendhk_{$space[uid]}\" id=\"a_friend_li_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_friend_add') . "</a></li>";
                } else {
                    $html .= "<li class='ul_ignore'><a href=\"home.php?mod=spacecp&ac=friend&op=ignore&uid={$space['uid']}&handlekey=ignorefriendhk_{$space[uid]}\" id=\"a_ignore_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_friend_ignore') . "</a></li>";
                }
                $html .= "<li class='ul_msg'><a href=\"home.php?mod=space&uid={$space['uid']}&do=wall\">" . lang('space', 'block_profile_wall_to_me') . "</a></li>";
                $html .= "<li class='ul_poke'><a href=\"home.php?mod=spacecp&ac=poke&op=send&uid={$space['uid']}&handlekey=propokehk_{$space[uid]}\" id=\"a_poke_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_poke') . "</a></li>";
                $html .= "<li class='ul_pm'><a href=\"home.php?mod=spacecp&ac=pm&op=showmsg&handlekey=showmsg_{$space['uid']}&touid={$space['uid']}&pmid=0&daterange=2\" id=\"a_sendpm_{$space['uid']}\" onclick=\"showWindow('showMsgBox', this.href, 'get', 0)\">" . lang('space', 'block_profile_sendmessage') . "</a></li>";
            }
            $html .= '</ul>';
            $encodeusername = rawurlencode($space['username']);
            if (checkperm('allowbanuser')) {
                $managehtml .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username={$encodeusername}&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid={$space['uid']}") . '" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">' . lang('home/template', 'member_manage') . '</a></li>';
            } elseif (checkperm('allowedituser')) {
                $managehtml .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username={$encodeusername}&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid={$space['uid']}") . '" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">' . lang('home/template', 'member_manage') . '</a></li>';
            }
            if ($_G['adminid'] == 1) {
                $managehtml .= "<li><a href=\"forum.php?mod=modcp&action=thread&op=post&do=search&searchsubmit=1&users={$encodeusername}\" id=\"umanageli\" onmouseover=\"showMenu(this.id)\" class=\"showmenu\">" . lang('home/template', 'content_manage') . "</a></li>";
            }
            if (!empty($managehtml)) {
                $html .= '<hr class="da mtn m0" /><ul class="ptn xl xl2 cl">' . $managehtml . '</ul><ul id="usermanageli_menu" class="p_pop" style="width: 80px; display:none;">';
                if (checkperm('allowbanuser')) {
                    $html .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username={$encodeusername}&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid={$space['uid']}") . '" target="_blank">' . lang('home/template', 'user_ban') . '</a></li>';
                }
                if (checkperm('allowedituser')) {
                    $html .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username={$encodeusername}&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid={$space['uid']}") . '" target="_blank">' . lang('home/template', 'user_edit') . '</a></li>';
                }
                $html .= '</ul>';
                if ($_G['adminid'] == 1) {
                    $html .= '<ul id="umanageli_menu" class="p_pop" style="width: 80px; display:none;">';
                    $html .= '<li><a href="admin.php?action=threads&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_post') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=doing&searchsubmit=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_doing') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=blog&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_blog') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=feed&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_feed') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=album&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_album') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=pic&searchsubmit=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_pic') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=comment&searchsubmit=1&authorid=' . $uid . '" target="_blank">' . lang('space', 'manage_comment') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=share&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_share') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=threads&operation=group&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_group_threads') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=prune&searchsubmit=1&operation=group&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_group_prune') . '</a></li>';
                    $html .= '</ul>';
                }
            }
            if ($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) {
                $info = !empty($space['magicgift']) ? unserialize($space['magicgift']) : array();
                if ($space['self']) {
                } elseif ($info) {
                    if ($info['left'] && !in_array($_G['uid'], (array) $info['receiver'])) {
                        $percredit = min($info['percredit'], $info['left']);
                        if ($info['credittype'] == 'credits') {
                            $credittype = lang('core', 'title_credit');
                        } else {
                            $extcredits = str_replace('extcredits', '', $info['credittype']);
                            $credittype = $_G['setting']['extcredits'][$extcredits]['title'];
                        }
                        $html .= '<div id="magicreceivegift">';
                        $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=receivegift&uid=' . $uid . '" title="' . lang('magic/gift', 'gift_receive_gift', array('percredit' => $percredit, 'credittype' => $credittype)) . '">';
                        $html .= '<img src="' . STATICURL . 'image/magic/gift.gif" alt="gift" />';
                        $html .= '</a>';
                        $html .= '</div>';
                    }
                }
            }
            $html = '<div id="pcd">' . $html . '</div>';
            break;
        case 'statistic':
            space_merge($space, 'count');
            $html .= '<p class="mbm xw1">';
            if (empty($parameters['banviews'])) {
                $html .= lang('space', 'space_views', array('views' => $space['views'] ? $space['views'] : '--'));
            }
            $html .= '</p><ul class="xl xl2 cl">';
            if (empty($parameters['bancredits'])) {
                $html .= "<li>" . lang('space', 'credits') . ': <a href="home.php?mod=spacecp&ac=credit">' . ($space['credits'] ? $space['credits'] : '--') . "</a></li>";
                foreach ($_G['setting']['extcredits'] as $extcreditid => $extcredit) {
                    $html .= "<li>" . $extcredit['img'] . $extcredit['title'] . ': <a href="home.php?mod=spacecp&ac=credit">' . ($space['extcredits' . $extcreditid] ? $space['extcredits' . $extcreditid] : '--') . '</a>';
                }
            }
            if (empty($parameters['banfriends'])) {
                $html .= "<li>" . lang('space', 'friends') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=friend&view=me&from=space">' . ($space['friends'] ? $space['friends'] : '--') . "</a></li>";
            }
            if (empty($parameters['banthreads']) && $_G['setting']['allowviewuserthread'] !== false || $_G['adminid'] == 1) {
                $html .= "<li>" . lang('space', 'threads') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=thread&view=me&from=space">' . ($space['threads'] ? $space['threads'] : '--') . "</a></li>";
            }
            if (empty($parameters['banblogs'])) {
                $html .= "<li>" . lang('space', 'blogs') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=blog&view=me&from=space">' . ($space['blogs'] ? $space['blogs'] : '--') . "</a></li>";
            }
            if (empty($parameters['banalbums'])) {
                $html .= "<li>" . lang('space', 'albums') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=album&view=me&from=space">' . ($space['albums'] ? $space['albums'] : '--') . "</a></li>";
            }
            if (empty($parameters['bansharings'])) {
                $html .= "<li>" . lang('space', 'sharings') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=share&view=me&from=space">' . ($space['sharings'] ? $space['sharings'] : '--') . "</a></li>";
            }
            $html .= '</ul>';
            $html = '<div id="pcd">' . $html . '</div>';
            break;
        case 'doing':
            $do = $blockname;
            if (ckprivacy('doing', 'view')) {
                $dolist = array();
                $sql = "SELECT * FROM " . DB::table('home_doing') . " WHERE uid='{$uid}' ORDER BY dateline DESC LIMIT 0,{$shownum}";
                $query = DB::query($sql);
                while ($value = DB::fetch($query)) {
                    if ($value['status'] == 0 || $value['uid'] == $_G['uid']) {
                        $dolist[] = $value;
                    }
                }
                if ($dolist) {
                    foreach ($dolist as $dv) {
                        $doid = $dv['doid'];
                        $_G[gp_key] = $key = random(8);
                        $html .= "<li class=\"pbn bbda\">";
                        $html .= $dv['message'];
                        $html .= "&nbsp;<a href=\"home.php?mod=space&uid={$dv['uid']}&do=doing&view=me&from=space&doid={$dv['doid']}\" target=\"_blank\" class=\"xg1\">" . lang('space', 'block_doing_reply') . "</a>";
                        $html .= "</li>";
                    }
                } else {
                    $html .= "<p class=\"emp\">" . lang('space', 'block_doing_no_content') . "</p>";
                }
            } else {
                $html .= "<p class=\"emp\">" . lang('space', 'block_view_noperm') . "</p>";
            }
            $html = '<ul class="xl">' . $html . '</ul>';
            break;
        case 'blog':
            $do = $blockname;
            $query = DB::query("SELECT bf.*, b.* FROM " . DB::table('home_blog') . " b\r\n\t\t\t\tLEFT JOIN " . DB::table('home_blogfield') . " bf ON bf.blogid=b.blogid\r\n\t\t\t\tWHERE b.uid='{$uid}'\r\n\t\t\t\tORDER BY b.dateline DESC LIMIT 0,{$shownum}");
            while ($value = DB::fetch($query)) {
                if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                    if ($value['pic']) {
                        $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
                    }
                    $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], 150, 0, 0, 0, -1);
                    $html .= lang('space', 'blog_li', array('uid' => $value['uid'], 'blogid' => $value['blogid'], 'subject' => $value['subject'], 'date' => dgmdate($value['dateline'], 'Y-m-d')));
                    if (!isset($parameters['showmessage'])) {
                        $parameters['showmessage'] = true;
                    }
                    if ($parameters['showmessage']) {
                        if ($value['pic']) {
                            $html .= lang('space', 'blog_li_img', array('uid' => $value['uid'], 'blogid' => $value['blogid'], 'src' => $value['pic']));
                        }
                        $html .= "<dd>{$value['message']}</dd>";
                    }
                    $html .= lang('space', 'blog_li_ext', array('uid' => $value['uid'], 'blogid' => $value['blogid'], 'viewnum' => $value['viewnum'], 'replynum' => $value['replynum']));
                    $html .= "</dl>";
                } else {
                    $html .= '<p>' . lang('space', 'block_view_noperm') . '</p>';
                }
            }
            $more = $html ? '<p class="ptm" style="text-align: right;"><a href="home.php?mod=space&uid=' . $uid . '&do=blog&view=me&from=space">' . lang('space', 'viewmore') . '</a></p>' : '';
            $contentclassname = ' xld';
            $html = $html . $more;
            break;
        case 'album':
            $do = $blockname;
            if (ckprivacy('album', 'view')) {
                $query = DB::query("SELECT * FROM " . DB::table('home_album') . " WHERE uid='{$uid}' ORDER BY updatetime DESC LIMIT 0,{$shownum}");
                while ($value = DB::fetch($query)) {
                    if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                        $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
                        $html .= lang('space', 'album_li', array('albumid' => $value['albumid'], 'src' => $value['pic'], 'albumname' => $value['albumname'], 'uid' => $value['uid'], 'picnum' => $value['picnum'], 'date' => dgmdate($value['updatetime'], 'n-j')));
                    }
                }
            } else {
                $html .= '<li>' . lang('space', 'block_view_noperm') . '</li>';
            }
            $html = '<ul class="ml mla cl">' . $html . '</ul>';
            break;
        case 'feed':
            $do = $blockname;
            if (!IS_ROBOT && ckprivacy('feed', 'view')) {
                require_once libfile('function/feed');
                $query = DB::query("SELECT * FROM " . DB::table('home_feed') . " WHERE uid='{$uid}' ORDER BY dateline DESC LIMIT 0,{$shownum}");
                while ($value = DB::fetch($query)) {
                    if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                        $html .= mkfeedhtml(mkfeed($value));
                    }
                }
            }
            $contenttagname = 'ul';
            $contentclassname = ' el';
            $html = empty($html) ? '' : $html;
            break;
        case 'thread':
            $do = $blockname;
            if ($_G['setting']['allowviewuserthread'] !== false) {
                $fidsql = empty($_G['setting']['allowviewuserthread']) ? '' : " AND fid IN({$_G[setting][allowviewuserthread]}) ";
                $query = DB::query("SELECT * FROM " . DB::table('forum_thread') . " WHERE authorid='{$uid}' {$fidsql} AND displayorder>='0' ORDER BY tid DESC LIMIT 0,{$shownum}");
                while ($thread = DB::fetch($query)) {
                    if ($thread['author']) {
                        $html .= "<li><a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\" target=\"_blank\">{$thread['subject']}</a></li>";
                    }
                }
            }
            $html = empty($html) ? '' : '<ul class="xl">' . $html . '</ul>';
            break;
        case 'friend':
            $do = $blockname;
            require_once libfile('function/friend');
            $friendlist = array();
            $friendlist = friend_list($uid, $shownum);
            $fuids = array_keys($friendlist);
            getonlinemember($fuids);
            foreach ($friendlist as $key => $value) {
                $classname = $_G['ols'][$value['fuid']] ? 'gol' : '';
                $html .= '<li><a href="home.php?mod=space&uid=' . $value['fuid'] . '" target="_blank"><em class="' . $classname . '"></em>' . avatar($value['fuid'], 'small') . '</a><p><a href="home.php?mod=space&uid=' . $value[fuid] . '" target="_blank">' . $value['fusername'] . '</a></p></li>';
            }
            $html = '<ul class="ml mls cl">' . $html . '</ul>';
            break;
        case 'visitor':
            $do = 'friend';
            $view = 'visitor';
            $query = DB::query("SELECT * FROM " . DB::table('home_visitor') . " WHERE uid='{$uid}' ORDER BY dateline DESC LIMIT 0,{$shownum}");
            $list = $fuids = array();
            while ($value = DB::fetch($query)) {
                $list[] = $value;
                $fuids[] = $value['vuid'];
            }
            getonlinemember($fuids);
            foreach ($list as $value) {
                $html .= "<li>";
                if ($value['vusername'] == '') {
                    $html .= lang('space', 'visitor_anonymity');
                } else {
                    $html .= lang('space', 'visitor_list', array('uid' => $value['vuid'], 'username' => $value['vusername'], 'class' => $_G['ols'][$value['vuid']] ? 'gol' : '', 'avatar' => avatar($value['vuid'], 'small')));
                }
                $html .= "<span class=\"xg2\">" . dgmdate($value['dateline'], 'u', '9999', 'Y-m-d') . "</span>";
                $html .= "</li>";
            }
            $html = '<ul class="ml mls cl">' . $html . '</ul>';
            break;
        case 'share':
            $do = $blockname;
            if (!IS_ROBOT && ckprivacy('share', 'view')) {
                require_once libfile('function/share');
                $query = DB::query("SELECT * FROM " . DB::table('home_share') . " WHERE uid='{$uid}' ORDER BY dateline DESC LIMIT 0,{$shownum}");
                while ($value = DB::fetch($query)) {
                    $value = mkshare($value);
                    $html .= '<li><em><a href="home.php?mod=space&uid=' . $value['uid'] . '&do=share&id=' . $value['sid'] . '">' . $value['title_template'] . '</a>(' . dgmdate($value['dateline'], 'u') . ')</em><div class="ec cl">';
                    if ($value['image']) {
                        $html .= '<a href="' . $value['image_link'] . '" target="_blank"><img src="' . $value['image'] . '" class="tn" alt="" /></a>';
                    }
                    $html .= '<div class="d">' . $value['body_template'] . '</div>';
                    if ($value['type'] == 'video') {
                        if (!empty($value['body_data']['imgurl'])) {
                            $html .= '<table class="mtm" title="' . lang('space', 'click_play') . '" onclick="javascript:showFlash(\'' . $value['body_data']['host'] . '\', \'' . $value['body_data']['flashvar'] . '\', this, \'' . $value['sid'] . '\');"><tr><td class="vdtn hm" style="background: url(' . $value['body_data']['imgurl'] . ') no-repeat"><img src="' . STATICURL . '/image/common/vds.png" alt="' . lang('space', 'click_play') . '" /></td></tr></table>';
                        } else {
                            $html .= "<img src=\"" . STATICURL . "/image/common/vd.gif\" alt=\"" . lang('space', 'click_play') . "\" onclick=\"javascript:showFlash('{$value['body_data']['host']}', '{$value['body_data']['flashvar']}', this, '{$value['sid']}');\" class=\"tn\" />";
                        }
                    } elseif ($value['type'] == 'music') {
                        $html .= "<img src=\"" . STATICURL . "/image/common/music.gif\" alt=\"" . lang('space', 'click_play') . "\" onclick=\"javascript:showFlash('music', '{$value['body_data']['musicvar']}', this, '{$value['sid']}');\" class=\"tn\" />";
                    } elseif ($value['type'] == 'flash') {
                        $html .= "<img src=\"" . STATICURL . "/image/common/flash.gif\" alt=\"" . lang('space', 'click_view') . "\" onclick=\"javascript:showFlash('flash', '{$value['body_data']['flashaddr']}', this, '{$value['sid']}');\" class=\"tn\" />";
                    }
                    if ($value['body_general']) {
                        $html .= '<div class="quote' . ($value['image'] ? 'z' : '') . "\"><blockquote>{$value['body_general']}</blockquote></div>";
                    }
                    $html .= '</div></li>';
                }
                $html = '<ul class="el">' . $html . '</ul>';
            }
            break;
        case 'wall':
            $do = $blockname;
            $walllist = array();
            if (ckprivacy('wall', 'view')) {
                $query = DB::query("SELECT * FROM " . DB::table('home_comment') . " WHERE id='{$uid}' AND idtype='uid' ORDER BY dateline DESC LIMIT 0,{$shownum}");
                while ($value = DB::fetch($query)) {
                    $value['message'] = strlen($value['message']) > 500 ? getstr($value['message'], 500, 0, 0, 0, -1) . ' ...' : $value['message'];
                    if ($value['status'] == 0 || $value['authorid'] == $_G['uid']) {
                        $walllist[] = $value;
                    }
                }
            }
            $html = '<div class="xld xlda el" id="comment_ul">';
            foreach ($walllist as $key => $value) {
                $op = '';
                if ($value['author']) {
                    $author_avatar = '<a href="home.php?mod=space&uid=' . $value['authorid'] . '" target="_blank">' . avatar($value['authorid'], 'small') . '</a>';
                    $author = '<a href="home.php?mod=space&uid=' . $value['authorid'] . '" id="author_' . $value['cid'] . '" target="_blank">' . $value['author'] . '</a>';
                } else {
                    $author_avatar = '<img src="static/image/magic/hidden.gif" alt="hidden" />';
                    $author = lang('space', 'hidden_username');
                }
                if ($value['authorid'] == $_G['uid']) {
                    $op .= lang('space', 'wall_edit', array('cid' => $value['cid']));
                }
                if ($value['authorid'] == $_G['uid'] || $space['self'] || checkperm('managecomment')) {
                    $op .= lang('space', 'wall_del', array('cid' => $value['cid']));
                }
                if ($value['authorid'] != $_G['uid'] && ($value['idtype'] != 'uid' || $space['self'])) {
                    $op .= lang('space', 'wall_reply', array('cid' => $value['cid']));
                }
                $moderate_need = $value['status'] == 1 ? lang('template', 'moderate_need') : '';
                $date = dgmdate($value['dateline'], 'u');
                $replacearr = array('author' => $author, 'author_avatar' => $author_avatar, 'moderated' => $moderate_need, 'cid' => $value['cid'], 'message' => $value['message'], 'date' => $date, 'op' => $op);
                $html .= lang('space', 'wall_li', $replacearr);
            }
            if (!empty($walllist)) {
                $html .= lang('space', 'wall_more', array('uid' => $uid));
            }
            $html .= '</div>';
            $html = lang('space', 'wall_form', array('uid' => $uid, 'FORMHASH' => FORMHASH)) . '<hr class="da mtm m0">' . $html;
            $titlemore = '<span class="y xw0"><a href="home.php?mod=space&uid=' . $uid . '&do=wall">' . lang('space', 'all') . '</a></span>';
            break;
        case 'group':
            $do = $blockname;
            $view = 'groupthread';
            require_once libfile('function/group');
            $grouplist = mygrouplist($uid, 'lastupdate', array('f.name', 'ff.icon'), $shownum);
            if (empty($grouplist)) {
                $grouplist = array();
            }
            foreach ($grouplist as $groupid => $group) {
                $group['groupid'] = $groupid;
                $html .= lang('space', 'group_li', $group);
            }
            $html = '<ul class="ml mls cl">' . $html . '</ul>';
            break;
        case 'music':
            if (!empty($parameters['mp3list'])) {
                $authcode = substr(md5($_G['authkey'] . $uid), 6, 16);
                $view = $_G['adminid'] == 1 && $_G['setting']['allowquickviewprofile'] ? '&view=admin' : '';
                $querystring = urlencode("home.php?mod=space&uid={$uid}&do=index&op=getmusiclist&hash={$authcode}{$view}&t=" . TIMESTAMP);
                $swfurl = STATICURL . 'image/common/mp3player.swf?config=' . $querystring;
                if (empty($parameters['config']['height']) && $parameters['config']['height'] !== 0) {
                    $parameters['config']['height'] = '200px';
                } else {
                    $parameters['config']['height'] .= 'px';
                }
                $html = "<script language=\"javascript\" type=\"text/javascript\">document.write(AC_FL_RunContent('id', 'mp3player', 'name', 'mp3player', 'devicefont', 'false', 'width', '100%', 'height', '" . $parameters['config']['height'] . "', 'src', '{$swfurl}', 'menu', 'false',  'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent'));</script>";
            } else {
                $html = lang('space', 'music_no_content');
            }
            $html = '<div class="ml mls cl">' . $html . '</div>';
            break;
        default:
            if ($space['self']) {
                $_G['space_group'] = $_G['group'];
            } elseif (empty($_G['space_group'])) {
                $_G['space_group'] = DB::fetch_first("SELECT * FROM " . DB::table('common_usergroup_field') . " WHERE groupid='{$space['groupid']}'");
            }
            require_once libfile('function/discuzcode');
            if ($_G['space_group']['allowspacediyimgcode']) {
                if (empty($_G['cache']['smilies']['loaded'])) {
                    loadcache(array('smilies', 'smileytypes'));
                    foreach ($_G['cache']['smilies']['replacearray'] as $skey => $smiley) {
                        $_G['cache']['smilies']['replacearray'][$skey] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'] . '/' . $smiley . '[/img]';
                    }
                    $_G['cache']['smilies']['loaded'] = 1;
                }
                $parameters['content'] = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], censor(trim($parameters['content'])));
            }
            if ($_G['space_group']['allowspacediybbcode'] || $_G['space_group']['allowspacediyimgcode'] || $_G['space_group']['allowspacediyhtml']) {
                $parameters['content'] = discuzcode($parameters['content'], 1, 0, 1, 0, $_G['space_group']['allowspacediybbcode'], $_G['space_group']['allowspacediyimgcode'], $_G['space_group']['allowspacediyhtml']);
            } else {
                $parameters['content'] = dhtmlspecialchars($parameters['content']);
            }
            $parameters['content'] = nl2br($parameters['content']);
            if (empty($parameters['content'])) {
                $parameters['content'] = lang('space', $blockname);
            }
            $html .= $parameters['content'];
            break;
    }
    if ($_G['setting']['allowviewuserthread'] === false && $blockname == 'thread') {
        $html = '';
    } else {
        if (isset($parameters['title'])) {
            if (empty($parameters['title'])) {
                $title = '';
            } else {
                $view = $view === false ? '' : ($view == '' ? '&view=me' : '&view=' . $view);
                $bnamelink = $do ? '<a href="home.php?mod=space&uid=' . $uid . '&do=' . $do . $view . '">' . stripslashes($parameters['title']) . '</a>' : stripslashes($parameters['title']);
                $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
            }
        } else {
            $view = $view === false ? '' : ($view == '' ? '&view=me' : '&view=' . $view);
            $bnamelink = $do ? '<a href="home.php?mod=space&uid=' . $uid . '&do=' . $do . $view . '">' . getblockdata($blockname) . '</a>' : getblockdata($blockname);
            $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
        }
        $html = $title . '<' . $contenttagname . ' id="' . $blockname . '_content" class="content' . $contentclassname . '">' . $html . '</' . $contenttagname . '>';
    }
    return $html;
}