Example #1
0
 public static function getAlbumImagePic($value)
 {
     loadcache('albumcategory');
     require_once DISCUZ_ROOT . './source/function/function_home.php';
     if ($value['friend'] != 4 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
         $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
     } elseif ($value['picnum']) {
         $value['pic'] = STATICURL . 'image/common/nopublish.gif';
     } else {
         $value['pic'] = '';
     }
     return $value['pic'];
 }
Example #2
0
 }
 $actives = array($_GET['view'] => ' class="a"');
 if ($need_count) {
     if ($searchkey = stripsearchkey($_GET['searchkey'])) {
         $searchsubject = $searchkey;
         $searchkey = dhtmlspecialchars($searchkey);
     }
     $catid = empty($_GET['catid']) ? 0 : intval($_GET['catid']);
     $count = C::t('home_blog')->count_all_by_search(null, $uids, null, null, $gthot, null, null, null, null, null, $privacyfriend, null, null, null, $classid, $catid, $searchsubject, true, $status);
     if ($count) {
         $query = C::t('home_blog')->fetch_all_by_search(1, null, $uids, null, null, $gthot, null, null, null, null, null, $privacyfriend, null, null, null, 'dateline', 'DESC', $start, $perpage, $classid, $catid, $searchsubject, $f_index, false, $status);
     }
 }
 if ($count) {
     foreach ($query as $value) {
         if (ckfriend($value['uid'], $value['friend'], $value['target_ids']) && ($value['status'] == 0 || $value['uid'] == $_G['uid'] || $_G['adminid'] == 1)) {
             if (!empty($stickblogs) && in_array($value['blogid'], $stickblogs)) {
                 continue;
             }
             if ($value['friend'] == 4) {
                 $value['message'] = $value['pic'] = '';
             } else {
                 $value['message'] = getstr($value['message'], $summarylen, 0, 0, 0, -1);
             }
             $value['message'] = preg_replace("/&[a-z]+\\;/i", '', $value['message']);
             if ($value['pic']) {
                 $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
             }
             $value['dateline'] = dgmdate($value['dateline']);
             $list[] = $value;
         } else {
Example #3
0
 }
 $sql .= $friend ? " AND a.friend = '{$friend}'" : '';
 $orderby = $orderby ? "a.{$orderby}" : 'a.updatetime';
 $ordersc = $ordersc ? "{$ordersc}" : 'DESC';
 if ($_G['adminid'] == 2 && $endtime - $starttime > 86400 * 16 || $_G['adminid'] == 3 && $endtime - $starttime > 86400 * 8) {
     $error = 'album_mod_range_illegal';
 }
 if (!$error) {
     if ($detail) {
         $_G['gp_perpage'] = intval($_G['gp_perpage']) < 1 ? 20 : intval($_G['gp_perpage']);
         $perpage = $_G['gp_pp'] ? $_G['gp_pp'] : $_G['gp_perpage'];
         $query = DB::query("SELECT * FROM " . DB::table('home_album') . " a WHERE 1 {$sql} ORDER BY {$orderby} {$ordersc} LIMIT " . ($page - 1) * $perpage . ",{$perpage}");
         $albums = '';
         include_once libfile('function/home');
         while ($album = DB::fetch($query)) {
             if ($album['friend'] != 4 && ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
                 $album['pic'] = pic_cover_get($album['pic'], $album['picflag']);
             } else {
                 $album['pic'] = STATICURL . 'image/common/nopublish.gif';
             }
             $album['updatetime'] = dgmdate($album['updatetime']);
             switch ($album['friend']) {
                 case '0':
                     $privacy_name = $lang[setting_home_privacy_alluser];
                     break;
                 case '1':
                     $privacy_name = $lang[setting_home_privacy_friend];
                     break;
                 case '2':
                     $privacy_name = $lang[setting_home_privacy_specified_friend];
                     break;
Example #4
0
function ckfriend_album($album)
{
    global $_G, $space;
    if ($_G['adminid'] != 1) {
        if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
            if (empty($_G['uid'])) {
                showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1));
            }
            require_once libfile('function/friend');
            $isfriend = friend_check($album['uid']);
            space_merge($space, 'count');
            space_merge($space, 'profile');
            $_G['privacy'] = 1;
            require_once libfile('space/profile', 'include');
            include template('home/space_privacy');
            exit;
        } elseif (!$space['self'] && $album['friend'] == 4) {
            $cookiename = "view_pwd_album_{$album['albumid']}";
            $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename];
            if ($cookievalue != md5(md5($album['password']))) {
                $invalue = $album;
                include template('home/misc_inputpwd');
                exit;
            }
        }
    }
}
Example #5
0
function ckfriend_album($album)
{
    global $_SGLOBAL, $_SC, $_SCONFIG, $_SCOOKIE, $space, $_SN;
    if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
        //没有权限
        include template('space_privacy');
        exit;
    } elseif (!$space['self'] && $album['friend'] == 4) {
        //密码输入问题
        $cookiename = "view_pwd_album_{$album['albumid']}";
        $cookievalue = empty($_SCOOKIE[$cookiename]) ? '' : $_SCOOKIE[$cookiename];
        if ($cookievalue != md5(md5($album['password']))) {
            $invalue = $album;
            include template('do_inputpwd');
            exit;
        }
    }
}
Example #6
0
function ckfriend_album($album)
{
    global $_SGLOBAL;
    if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
        $result = array('flag' => 'no_privilege');
        returnvalue($result);
        exit;
    } elseif ($album['uid'] != $_SGLOBAL['supe_uid'] && $album['friend'] == 4) {
        $result = array('flag' => 'need_password');
        returnvalue($result);
        exit;
    }
}
Example #7
0
    //个人动态
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if (ckfriend($value) && ckicon_uid($value)) {
            realname_set($value['uid'], $value['username']);
            $feed_list[] = $value;
        }
        $count++;
    }
    //分页
    $multi = smulti($start, $perpage, $count, $theurl);
} else {
    //好友动态
    $space['filter_icon'] = empty($space['privacy']['filter_icon']) ? array() : array_keys($space['privacy']['filter_icon']);
    while ($value = $_SGLOBAL['db']->fetch_array($query)) {
        if (empty($feed_list[$value['hash_data']][$value['uid']])) {
            if (ckfriend($value) && ckicon_uid($value)) {
                realname_set($value['uid'], $value['username']);
                $feed_list[$value['hash_data']][$value['uid']] = $value;
            }
        }
        $count++;
    }
}
$olfriendlist = $visitorlist = $task = $ols = $birthlist = $myapp = array();
$namestatus = $addfriendcount = $mtaginvitecount = $myinvitecount = $pokecount = $newreport = 0;
if ($space['self'] && empty($start)) {
    //好友申请
    $addfriendcount = getcount('friend', array('fuid' => $space['uid'], 'status' => 0));
    //群组邀请
    $mtaginvitecount = getcount('mtaginvite', array('uid' => $space['uid']));
    //应用请求
Example #8
0
//echo 111111111111111111111111111111111111111111;
//print_r($HrefString);
//echo "----matchstring: $MatchString----tmpstring: $TmpString----username: $HrefString\n";

		$blog['message'] = str_replace($TmpString, $HrefString, $blog['message']);
		
		}
	//将日志中的图片进行绝对路径化。  end
*/
//检查权限 start
if (empty($blog)) {
    $result = array('flag' => 'blog_not_exist');
    returnblog($result);
}
//检查好友权限
if (!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids'])) {
    //没有权限
    $result = array('flag' => 'no_privilege');
    returnblog($result);
} elseif ($userid != $blog['uid'] && $blog['friend'] == 4) {
    //密码输入问题
    $result = array('flag' => 'need_password');
    returnblog($result);
}
//检查权限 end
realname_set($blog['uid'], $blog[username]);
realname_get();
//访问统计
if ($userid != $blog['uid']) {
    $_SGLOBAL['db']->query("UPDATE " . tname('blog') . " SET viewnum=viewnum+1 WHERE blogid='{$blog['blogid']}'");
    inserttable('log', array('id' => $userid, 'idtype' => 'uid'));
function add_comment($message, $id, $idtype, $cid = 0)
{
    global $_G, $bbcode;
    $allowcomment = false;
    switch ($idtype) {
        case 'uid':
            $allowcomment = helper_access::check_module('wall');
            break;
        case 'picid':
            $allowcomment = helper_access::check_module('album');
            break;
        case 'blogid':
            $allowcomment = helper_access::check_module('blog');
            break;
        case 'sid':
            $allowcomment = helper_access::check_module('share');
            break;
    }
    if (!$allowcomment) {
        showmessage('quickclear_noperm');
    }
    $summay = getstr($message, 150, 0, 0, 0, -1);
    $comment = array();
    if ($cid) {
        $comment = C::t('home_comment')->fetch_by_id_idtype($id, $idtype, $cid);
        if ($comment && $comment['authorid'] != $_G['uid']) {
            $comment['message'] = preg_replace("/\\<div class=\"quote\"\\>\\<blockquote\\>.*?\\<\\/blockquote\\>\\<\\/div\\>/is", '', $comment['message']);
            $comment['message'] = $bbcode->html2bbcode($comment['message']);
            $message = "<div class=\"quote\"><blockquote><b>" . $comment['author'] . "</b>: " . getstr($comment['message'], 150, 0, 0, 2, 1) . '</blockquote></div>' . $message;
            if ($comment['idtype'] == 'uid') {
                $id = $comment['authorid'];
            }
        } else {
            $comment = array();
        }
    }
    $hotarr = array();
    $stattype = '';
    $tospace = $pic = $blog = $album = $share = $poll = array();
    switch ($idtype) {
        case 'uid':
            $tospace = getuserbyuid($id);
            $stattype = 'wall';
            break;
        case 'picid':
            $pic = C::t('home_pic')->fetch($id);
            if (empty($pic)) {
                showmessage('view_images_do_not_exist');
            }
            $picfield = C::t('home_picfield')->fetch($id);
            $pic['hotuser'] = $picfield['hotuser'];
            $tospace = getuserbyuid($pic['uid']);
            $album = array();
            if ($pic['albumid']) {
                $query = C::t('home_album')->fetch($pic['albumid']);
                if (!$query['albumid']) {
                    C::t('home_pic')->update_for_albumid($albumid, array('albumid' => 0));
                }
            }
            if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) {
                showmessage('no_privilege_ckfriend_pic');
            } elseif (!$tospace['self'] && $album['friend'] == 4) {
                $cookiename = "view_pwd_album_{$album['albumid']}";
                $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename];
                if ($cookievalue != md5(md5($album['password']))) {
                    showmessage('no_privilege_ckpassword_pic');
                }
            }
            $hotarr = array('picid', $pic['picid'], $pic['hotuser']);
            $stattype = 'piccomment';
            break;
        case 'blogid':
            $blog = array_merge(C::t('home_blog')->fetch($id), C::t('home_blogfield')->fetch_targetids_by_blogid($id));
            if (empty($blog)) {
                showmessage('view_to_info_did_not_exist');
            }
            $tospace = getuserbyuid($blog['uid']);
            if (!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids'])) {
                showmessage('no_privilege_ckfriend_blog');
            } elseif (!$tospace['self'] && $blog['friend'] == 4) {
                $cookiename = "view_pwd_blog_{$blog['blogid']}";
                $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename];
                if ($cookievalue != md5(md5($blog['password']))) {
                    showmessage('no_privilege_ckpassword_blog');
                }
            }
            if (!empty($blog['noreply'])) {
                showmessage('do_not_accept_comments');
            }
            if ($blog['target_ids']) {
                $blog['target_ids'] .= ",{$blog['uid']}";
            }
            $hotarr = array('blogid', $blog['blogid'], $blog['hotuser']);
            $stattype = 'blogcomment';
            break;
        case 'sid':
            $share = C::t('home_share')->fetch($id);
            if (empty($share)) {
                showmessage('sharing_does_not_exist');
            }
            $tospace = getuserbyuid($share['uid']);
            $hotarr = array('sid', $share['sid'], $share['hotuser']);
            $stattype = 'sharecomment';
            break;
        default:
            showmessage('non_normal_operation');
            break;
    }
    if (empty($tospace)) {
        showmessage('space_does_not_exist', '', array(), array('return' => true));
    }
    if (isblacklist($tospace['uid'])) {
        showmessage('is_blacklist');
    }
    if ($hotarr && $tospace['uid'] != $_G['uid']) {
        hot_update($hotarr[0], $hotarr[1], $hotarr[2]);
    }
    $fs = array();
    $fs['icon'] = 'comment';
    $fs['target_ids'] = '';
    $fs['friend'] = '';
    $fs['body_template'] = '';
    $fs['body_data'] = array();
    $fs['body_general'] = '';
    $fs['images'] = array();
    $fs['image_links'] = array();
    switch ($idtype) {
        case 'uid':
            $fs['icon'] = 'wall';
            $fs['title_template'] = 'feed_comment_space';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>");
            break;
        case 'picid':
            $fs['title_template'] = 'feed_comment_image';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>");
            $fs['body_template'] = '{pic_title}';
            $fs['body_data'] = array('pic_title' => $pic['title']);
            $fs['body_general'] = $summay;
            $fs['images'] = array(pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote']));
            $fs['image_links'] = array("home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$pic['picid']}");
            $fs['target_ids'] = $album['target_ids'];
            $fs['friend'] = $album['friend'];
            break;
        case 'blogid':
            C::t('home_blog')->increase($id, 0, array('replynum' => 1));
            $fs['title_template'] = 'feed_comment_blog';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'blog' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}\">{$blog['subject']}</a>");
            $fs['target_ids'] = $blog['target_ids'];
            $fs['friend'] = $blog['friend'];
            break;
        case 'sid':
            $fs['title_template'] = 'feed_comment_share';
            $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'share' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}\">" . str_replace(lang('spacecp', 'share_action'), '', $share['title_template']) . "</a>");
            break;
    }
    $message = censor($message);
    if (censormod($message)) {
        $comment_status = 1;
    } else {
        $comment_status = 0;
    }
    $setarr = array('uid' => $tospace['uid'], 'id' => $id, 'idtype' => $idtype, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'dateline' => $_G['timestamp'], 'message' => $message, 'ip' => $_G['clientip'], 'port' => $_G['remoteport'], 'status' => $comment_status);
    $cid = C::t('home_comment')->insert($setarr, true);
    $action = 'comment';
    $becomment = 'getcomment';
    $note = $q_note = '';
    $note_values = $q_values = array();
    switch ($idtype) {
        case 'uid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=wall&cid={$cid}";
            $note_type = 'wall';
            $note = 'wall';
            $note_values = array('url' => $n_url);
            $q_note = 'wall_reply';
            $q_values = array('url' => $n_url);
            if ($comment) {
                $msg = 'note_wall_reply_success';
                $magvalues = array('username' => $tospace['username']);
                $becomment = '';
            } else {
                $msg = 'do_success';
                $magvalues = array();
                $becomment = 'getguestbook';
            }
            $action = 'guestbook';
            break;
        case 'picid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'pic_comment';
            $note_values = array('url' => $n_url);
            $q_note = 'pic_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
        case 'blogid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'blog_comment';
            $note_values = array('url' => $n_url, 'subject' => $blog['subject']);
            $q_note = 'blog_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
        case 'sid':
            $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}&cid={$cid}";
            $note_type = 'comment';
            $note = 'share_comment';
            $note_values = array('url' => $n_url);
            $q_note = 'share_comment_reply';
            $q_values = array('url' => $n_url);
            $msg = 'do_success';
            $magvalues = array();
            break;
    }
    if (empty($comment)) {
        if ($tospace['uid'] != $_G['uid']) {
            if (ckprivacy('comment', 'feed')) {
                require_once libfile('function/feed');
                $fs['title_data']['hash_data'] = "{$idtype}{$id}";
                feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'], $fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']);
            }
            $note_values['from_id'] = $id;
            $note_values['from_idtype'] = $idtype;
            $note_values['url'] .= "&goto=new#comment_{$cid}_li";
            notification_add($tospace['uid'], $note_type, $note, $note_values);
        }
    } elseif ($comment['authorid'] != $_G['uid']) {
        notification_add($comment['authorid'], $note_type, $q_note, $q_values);
    }
    if ($comment_status == 1) {
        updatemoderate($idtype . '_cid', $cid);
        manage_addnotify('verifycommontes');
    }
    if ($stattype) {
        include_once libfile('function/stat');
        updatestat($stattype);
    }
    if ($tospace['uid'] != $_G['uid']) {
        $needle = $id;
        if ($idtype != 'uid') {
            $needle = $idtype . $id;
        } else {
            $needle = $tospace['uid'];
        }
        updatecreditbyaction($action, 0, array(), $needle);
        if ($becomment) {
            if ($idtype == 'uid') {
                $needle = $_G['uid'];
            }
            updatecreditbyaction($becomment, $tospace['uid'], array(), $needle);
        }
    }
    C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']), 'UNBUFFERED');
    $magvalues['cid'] = $cid;
    return array('cid' => $cid, 'msg' => $msg, 'magvalues' => $magvalues);
}
Example #10
0
function getblockhtml($blockname, $parameters = array())
{
    global $_G, $space;
    $parameters = empty($parameters) ? array() : $parameters;
    $list = array();
    $sql = $title = $html = $wheresql = $ordersql = $titlemore = $do = $contentclassname = '';
    $view = $from = false;
    $contenttagname = 'div';
    $shownum = 6;
    $uid = intval($space['uid']);
    $shownum = empty($parameters['shownum']) ? $shownum : intval($parameters['shownum']);
    switch ($blockname) {
        case 'personalinfo':
            $do = 'profile';
            space_merge($space, 'profile');
            require_once libfile('function/friend');
            $isfriend = friend_check($space['uid']);
            require_once libfile('function/spacecp');
            loadcache('profilesetting');
            include_once libfile('function/profile');
            $profiles = array();
            $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array();
            foreach ($_G['cache']['profilesetting'] as $fieldid => $field) {
                if (!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) {
                    continue;
                }
                if ($field['available'] && $field['invisible'] != '1' && strlen($space[$fieldid]) > 0 && ($field['showinthread'] || $field['showincard'] || ($space['self'] || empty($privacy[$fieldid]) || $isfriend && $privacy[$fieldid] == 1))) {
                    $val = profile_show($fieldid, $space);
                    if ($val !== false) {
                        if ($fieldid == 'realname' && $_G['uid'] != $space['uid'] && !ckrealname(1)) {
                            continue;
                        }
                        if ($field['formtype'] == 'file' && $val) {
                            $imgurl = getglobal('setting/attachurl') . './profile/' . $val;
                            $val = '<span><a href="' . $imgurl . '" target="_blank"><img src="' . $imgurl . '"  style="max-width: 300px;" /></a></span>';
                        }
                        if ($val == '') {
                            $val = '';
                        }
                        $html .= '<li><em>' . $field['title'] . '</em>' . $val . '</li>';
                    }
                }
            }
            $html = $html ? $html : '<li>' . lang('space', 'block_view_profileinfo_noperm') . '</li>';
            $html = '<ul id="pprl" class="mbm pbm bbda cl">' . $html . $more . '</ul>';
            $more = lang('space', 'block_profile_all', array('uid' => $uid));
            $html = $html . $more;
            $titlemore = $space['self'] ? lang('space', 'block_profile_edit') : '';
            break;
        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>';
            $memberfieldforum = C::t('common_member_field_forum')->fetch($space['uid']);
            $space['medals'] = $memberfieldforum['medals'];
            unset($memberfieldforum);
            $usermedals = $medal_detial = $usermedalmenus = '';
            if ($space['medals']) {
                loadcache('medals');
                foreach ($space['medals'] = explode("\t", $space['medals']) as $key => $medalid) {
                    list($medalid, $medalexpiration) = explode("|", $medalid);
                    if (isset($_G['cache']['medals'][$medalid]) && (!$medalexpiration || $medalexpiration > TIMESTAMP)) {
                        $usermedals .= '<img src="' . STATICURL . 'image/common/' . $_G['cache']['medals'][$medalid]['image'] . '" id="md_' . $medalid . '" alt="' . $_G['cache']['medals'][$medalid]['name'] . '\'" onmouseover="showMenu({\'ctrlid\':this.id, \'menuid\':\'md_' . $medalid . '_menu\', \'pos\':\'12!\'});" />&nbsp;';
                        $usermedalmenus .= '
						<div id="md_' . $medalid . '_menu" class="tip tip_4" style="display: none;">
							<div class="tip_horn"></div>
							<div class="tip_c">
								<h4>' . $_G['cache']['medals'][$medalid]['name'] . '</h4>
								<p>' . $_G['cache']['medals'][$medalid]['description'] . '</p>
							</div>
						</div>';
                    }
                }
                if ($usermedals) {
                    $usermedals = '<p class="md_ctrl"><a href="home.php?mod=medal">' . $usermedals . '</a></p>' . $usermedalmenus;
                }
            }
            $html .= "<h2 class=\"mbn\"><a href=\"home.php?mod=space&uid={$uid}\" target=\"_blank\">" . $space['username'] . "</a></h2>{$usermedals}";
            $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']) ? dunserialize($space['magicgift']) : array();
            }
            if (helper_access::check_module('follow')) {
                $html .= '<li class="ul_broadcast"><a href="home.php?mod=space&uid=' . $uid . '">' . lang('space', 'block_profile_follow') . '</a></li>';
            }
            if ($space['self']) {
                $html .= '<li class="ul_diy"><a href="home.php?mod=space&do=index&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);
                $follow = C::t('home_follow')->fetch_by_uid_followuid($_G['uid'], $uid);
                if ($follow) {
                    $html .= "<li class='ul_flw'><a href=\"home.php?mod=spacecp&ac=follow&op=del&fuid={$space['uid']}\" id=\"followmod\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'follow_cancle_follow') . "</a></li>";
                } else {
                    $html .= "<li class='ul_flw'><a href=\"home.php?mod=spacecp&ac=follow&op=add&hash=" . FORMHASH . "&fuid={$space['uid']}\" id=\"followmod\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'follow_follow_ta') . "</a></li>";
                }
                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="forum.php?mod=modcp&action=thread&op=post&searchsubmit=1&do=search&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_post') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=doing&searchsubmit=1&detail=1&search=true&fromumanage=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_doing') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=blog&searchsubmit=1&detail=1&search=true&fromumanage=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_blog') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=feed&searchsubmit=1&detail=1&fromumanage=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_feed') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=album&searchsubmit=1&detail=1&search=true&fromumanage=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_album') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=pic&searchsubmit=1&detail=1&search=true&fromumanage=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_pic') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=comment&searchsubmit=1&detail=1&fromumanage=1&authorid=' . $uid . '" target="_blank">' . lang('space', 'manage_comment') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=share&searchsubmit=1&detail=1&search=true&fromumanage=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_share') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=threads&operation=group&searchsubmit=1&detail=1&search=true&fromumanage=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_group_threads') . '</a></li>';
                    $html .= '<li><a href="admin.php?action=prune&operation=group&searchsubmit=1&detail=1&fromumanage=1&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']) ? dunserialize($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>' . $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['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'] !== -1 || $_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>' . $html . '</div>';
            break;
        case 'doing':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            if (ckprivacy('doing', 'view')) {
                $dolist = array();
                $query = C::t('home_doing')->fetch_all_by_uid_doid(array($uid), '', 'dateline', 0, $shownum, false, true);
                foreach ($query as $value) {
                    if ($value['status'] == 0 || $value['uid'] == $_G['uid']) {
                        $dolist[] = $value;
                    }
                }
                if ($dolist) {
                    foreach ($dolist as $dv) {
                        $doid = $dv['doid'];
                        $_GET[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') . ($space['self'] ? lang('space', 'block_doing_no_content_publish', $space) : '') . "</p>";
                }
            } else {
                $html .= "<p class=\"emp\">" . lang('space', 'block_view_noperm') . "</p>";
            }
            $html = '<ul class="xl">' . $html . '</ul>';
            break;
        case 'stickblog':
            space_merge($space, 'profile');
            $stickblogs = explode(',', $space['stickblogs']);
            if (!empty($stickblogs)) {
                $bids = array_slice($stickblogs, 0, $shownum);
                if (count($bids)) {
                    if (!isset($parameters['showmessage'])) {
                        $parameters['showmessage'] = 150;
                    }
                    $data_blog = C::t('home_blog')->fetch_all($bids);
                    if ($parameters['showmessage'] > 0) {
                        $data_blogfield = C::t('home_blogfield')->fetch_all($bids);
                    }
                    foreach ($data_blog as $curblogid => $value) {
                        if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                            if ($parameters['showmessage'] > 0) {
                                $value = array_merge($value, (array) $data_blogfield[$curblogid]);
                            }
                            if ($value['pic']) {
                                $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
                            }
                            $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], $parameters['showmessage'], 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 (!empty($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 'blog':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            if (!isset($parameters['showmessage'])) {
                $parameters['showmessage'] = 150;
            }
            $data_blog = C::t('home_blog')->fetch_all_by_uid($uid, 'dateline', 0, $shownum);
            $blogids = array_keys($data_blog);
            $data_blogfield = C::t('home_blogfield')->fetch_all($blogids);
            foreach ($data_blog as $curblogid => $value) {
                if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                    $value = array_merge($value, (array) $data_blogfield[$curblogid]);
                    if ($value['pic']) {
                        $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
                    }
                    $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], $parameters['showmessage'], 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 (!empty($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>';
                }
            }
            if ($html) {
                $more = '<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>';
            } else {
                $html = '<p class="emp">' . lang('space', 'block_blog_no_content') . ($space['self'] ? lang('space', 'block_blog_no_content_publish', $space) : '') . '</p>';
                $more = '';
            }
            $contentclassname = ' xld';
            $html = $html . $more;
            break;
        case 'album':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            if (ckprivacy('album', 'view')) {
                $query = C::t('home_album')->fetch_all_by_uid($uid, 'updatetime', 0, $shownum);
                foreach ($query as $value) {
                    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')));
                    }
                }
                if (!$html) {
                    $html = '<p class="emp">' . lang('space', 'block_album_no_content') . ($space['self'] ? lang('space', 'block_album_no_content_publish', $space) : '') . '</p>';
                }
            } else {
                $html .= '<li>' . lang('space', 'block_view_noperm') . '</li>';
            }
            $html = '<ul class="ml cl">' . $html . '</ul>';
            break;
        case 'feed':
            $do = 'home';
            $view = 'me';
            $from = 'space';
            if (!IS_ROBOT && ckprivacy('feed', 'view')) {
                require_once libfile('function/feed');
                $query = C::t('home_feed')->fetch_all_by_uid_dateline($uid, false, 0, $shownum);
                foreach ($query as $value) {
                    if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
                        $html .= mkfeedhtml(mkfeed($value));
                    }
                }
            }
            $contenttagname = 'ul';
            $contentclassname = ' el';
            $html = !$html ? '<p class="emp">' . lang('space', 'block_feed_no_content') . '</p>' : $html;
            break;
        case 'thread':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            if ($_G['setting']['allowviewuserthread'] !== -1) {
                $fidsql = empty($_G['setting']['allowviewuserthread']) ? '' : " AND fid IN({$_G[setting][allowviewuserthread]}) ";
                $viewfids = str_replace("'", '', $_G['setting']['allowviewuserthread']);
                if (!empty($viewfids)) {
                    $viewfids = explode(',', $viewfids);
                }
                foreach (C::t('forum_thread')->fetch_all_by_authorid_displayorder($uid, 0, '>=', null, '', 0, $shownum) as $thread) {
                    if (!empty($viewfids) && $_G['adminid'] != 1 && !in_array($thread['fid'], $viewfids)) {
                        continue;
                    }
                    if ($thread['author']) {
                        $html .= "<li><a href=\"forum.php?mod=viewthread&tid={$thread['tid']}\" target=\"_blank\">{$thread['subject']}</a></li>";
                    }
                }
            }
            $html = !$html ? '<p class="emp">' . lang('space', 'block_thread_no_content') . ($space['self'] ? lang('space', 'block_thread_no_content_publish', $space) : '') . '</p>' : '<ul class="xl">' . $html . '</ul>';
            break;
        case 'friend':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            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" class="avt"><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 = !$html ? '<p class="emp">' . lang('space', 'block_friend_no_content') . ($space['self'] ? lang('space', 'block_friend_no_content_publish', $space) : '') . '</p>' : '<ul class="ml mls cl">' . $html . '</ul>';
            break;
        case 'visitor':
            if ($space['self']) {
                $do = 'friend';
                $view = 'visitor';
            }
            $list = $fuids = array();
            foreach (C::t('home_visitor')->fetch_all_by_uid($uid, $shownum) as $value) {
                $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 = !$html ? '<p class="emp">' . lang('space', 'block_visitor_no_content') . ($space['self'] ? lang('space', 'block_visitor_no_content_publish', $space) : '') . '</p>' : '<ul class="ml mls cl">' . $html . '</ul>';
            break;
        case 'share':
            $do = $blockname;
            $view = 'me';
            $from = 'space';
            if (!IS_ROBOT && ckprivacy('share', 'view')) {
                require_once libfile('function/share');
                foreach (C::t('home_share')->fetch_all_by_uid($uid, 0, $shownum) as $value) {
                    $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 = !$html ? '<p class="emp">' . lang('space', 'block_share_no_content') . '</p>' : '<ul class="el">' . $html . '</ul>';
            }
            break;
        case 'wall':
            $do = $blockname;
            $walllist = array();
            if (ckprivacy('wall', 'view')) {
                $query = C::t('home_comment')->fetch_all_by_id_idtype($uid, 'uid', 0, $shownum, '', 'DESC');
                foreach ($query as $value) {
                    $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;
                    }
                }
            }
            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 = $_G['setting']['anonymoustext'];
                }
                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);
            }
            $html = !empty($walllist) ? $html . lang('space', 'wall_more', array('uid' => $uid)) : '<p class="emp">' . lang('space', 'block_wall_no_content') . '</p>';
            $html = '<div class="xld xlda el" id="comment_ul">' . $html . '</div>';
            if (helper_access::check_module('wall')) {
                $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':
            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 = !$html ? '<p class="emp">' . lang('space', 'block_group_no_content') . ($space['self'] ? lang('space', $_G['group']['allowbuildgroup'] ? 'block_group_no_content_publish' : 'block_group_no_content_join', $space) : '') . '</p>' : '<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;
        case 'myapp':
            $html = '';
            $listclass = 'ptm ml mls cl';
            $userapps = C::t('home_userapp')->fetch_all_by_uid_appid($uid, 0, 'menuorder', 'DESC', 0, $shownum);
            $appids = array();
            foreach ($userapps as $app) {
                $appids[$app['appid']] = $app['appid'];
            }
            if (!empty($appids)) {
                $myapps = C::t('common_myapp')->fetch_all($appids);
            }
            foreach ($userapps as $value) {
                $value['iconstatus'] = $myapps[$value['appid']]['iconstatus'];
                if (!empty($value['appname'])) {
                    $replace = array('appid' => $value['appid'], 'appname' => $value['appname']);
                    $parameters['logotype'] = !empty($parameters['logotype']) && in_array($parameters['logotype'], array('icon', 'logo')) ? $parameters['logotype'] : 'logo';
                    if ($parameters['logotype'] == 'icon') {
                        $listclass = 'xl xl1 cl';
                        $replace['icon'] = getmyappiconpath($value['appid'], $value['iconstatus']);
                    }
                    $html .= lang('space', 'myapp_li_' . $parameters['logotype'], $replace);
                }
            }
            $html = !$html ? '<p class="emp">' . lang('space', 'block_myapp_no_content') . ($space['self'] ? lang('space', 'block_myapp_no_content_publish', $space) : '') . '</p>' : '<ul class="' . $listclass . '">' . $html . '</ul>';
            break;
        case 'block1':
        case 'block2':
        case 'block3':
        case 'block4':
        case 'block5':
            if ($space['self']) {
                $_G['space_group'] = $_G['group'];
            } elseif (empty($_G['space_group'])) {
                $_G['space_group'] = C::t('common_usergroup_field')->fetch($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'], 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;
        default:
            return false;
    }
    if (isset($parameters['title'])) {
        if (empty($parameters['title'])) {
            $title = '';
        } else {
            $view = $view === false ? '' : '&view=' . $view;
            $from = $from === false ? '' : '&from=' . $from;
            $bnamelink = $do ? '<a href="home.php?mod=space&uid=' . $uid . '&do=' . $do . $view . $from . '">' . $parameters['title'] . '</a>' : $parameters['title'];
            $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
        }
    } else {
        $view = $view === false ? '' : '&view=' . $view;
        $from = $from === false ? '' : '&from=' . $from;
        $bnamelink = $do ? '<a href="home.php?mod=space&uid=' . $uid . '&do=' . $do . $view . $from . '">' . getblockdata($blockname) . '</a>' : getblockdata($blockname);
        $title = lang('space', 'block_title', array('bname' => $bnamelink, 'more' => $titlemore));
    }
    $html = $title . '<' . $contenttagname . ' id="' . $blockname . '_content" class="dxb_bc' . $contentclassname . '">' . $html . '</' . $contenttagname . '>';
    return $html;
}
Example #11
0
function getblockhtml($blockname, $parameters = array())
{
    global $_G, $space;
    $parameters = empty($parameters) ? array() : $parameters;
    $list = array();
    $sql = $title = $html = $wheresql = $ordersql = '';
    $shownum = 6;
    $uid = intval($space['uid']);
    $shownum = empty($parameters['shownum']) ? $shownum : intval($parameters['shownum']);
    switch ($blockname) {
        case 'profile':
            $html .= '<div class="avt avtm">' . avatar($space['uid'], 'middle');
            $html .= '<h2>' . $space['username'] . '</h2>';
            $html .= '</div><ul class="xl xl2 cl">';
            if ($space['self']) {
                $html .= '<li><a href="home.php?mod=space&diy=yes">' . lang('space', 'block_profile_diy') . '</a></li>';
                $html .= '<li><a href="home.php?mod=space&do=wall">' . lang('space', 'block_profile_wall') . '</a></li>';
                $html .= '<li><a href="home.php?mod=spacecp&ac=avatar">' . lang('space', 'block_profile_avatar') . '</a></li>';
                $html .= '<li><a href="home.php?mod=spacecp&ac=profile">' . lang('space', 'block_profile_update') . '</a></li>';
            } else {
                require_once libfile('function/friend');
                $isfriend = friend_check($space['uid']);
                if (!$isfriend) {
                    $html .= "<li><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><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><a href=\"home.php?mod=space&uid={$space['uid']}&do=wall\">" . lang('space', 'block_profile_wall_to_me') . "</a></li>";
                $html .= "<li><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><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>';
            $html = '<div class="content"><div id="pcd">' . $html . '</div></div>';
            break;
        case 'doing':
            $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)) {
                $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>";
            }
            $html = '<div class="content"><ul class="xl">' . $html . '</ul></div>';
            break;
        case 'blog':
            $query = DB::query("SELECT bf.*, b.* FROM " . DB::table('home_blog') . " b\n\t\t\t\tLEFT JOIN " . DB::table('home_blogfield') . " bf ON bf.blogid=b.blogid\n\t\t\t\tWHERE b.uid='{$uid}'\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, 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 ($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=' . $space['uid'] . '&do=blog&view=me&from=space">' . lang('space', 'viewmore') . '</a></p>' : '';
            $html = '<div class="content xld">' . $html . $more . '</div>';
            break;
        case 'album':
            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 = '<div class="content"><ul class="ml mla cl">' . $html . '</ul></div>';
            break;
        case 'feed':
            if (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));
                    }
                }
            }
            $html = empty($html) ? '' : '<ul class="content el">' . $html . '</ul>';
            break;
        case 'thread':
            if ($_G['setting']['allowviewuserthread']) {
                $fidsql = " AND fid IN({$_G[setting][allowviewuserthread]}) ";
            } else {
                $fidsql = '';
            }
            $query = DB::query("SELECT * FROM " . DB::table('forum_thread') . " WHERE authorid='{$uid}' {$fidsql} ORDER BY tid DESC LIMIT 0,{$shownum}");
            while ($thread = DB::fetch($query)) {
                if ($thread['author']) {
                    $html .= "<li><a target=\"_blank\" href=\"forum.php?mod=viewthread&tid={$thread['tid']}\">{$thread['subject']}</a></li>";
                }
            }
            $html = empty($html) ? '' : '<div class="content cl"><ul class="xl">' . $html . '</ul></div>';
            break;
        case 'friend':
            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 = '<div class="content"><ul class="ml mls cl">' . $html . '</ul></div>';
            break;
        case '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') . "</span>";
                $html .= "</li>";
            }
            $html = '<div class="content"><ul class="ml mls cl">' . $html . '</ul></div>';
            break;
        case 'share':
            if (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>' . $value['title_template'] . '(' . 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="' . IMGDIR . '/vds.png" alt="' . lang('space', 'click_play') . '" /></td></tr></table>';
                        } else {
                            $html .= "<img src=\"" . IMGDIR . "/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=\"" . IMGDIR . "/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=\"" . IMGDIR . "/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 = '<div class="content"><ul class="el">' . $html . '</ul></div>';
            }
            break;
        case 'wall':
            $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, 0, -1) . ' ...' : $value['message'];
                    $walllist[] = $value;
                }
            }
            $html = '<div class="xld xlda" 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']));
                }
                $date = dgmdate($value['dateline'], 'u');
                $replacearr = array('author' => $author, 'author_avatar' => $author_avatar, 'cid' => $value['cid'], 'message' => $value['message'], 'date' => $date, 'op' => $op);
                $html .= lang('space', 'wall_li', $replacearr);
            }
            $html .= '</div>';
            $html = '<div class="content">' . lang('space', 'wall_form', array('uid' => $uid, 'FORMHASH' => FORMHASH)) . $html . '</div>';
            break;
        case 'group':
            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 = '<div class="content"><ul class="ml mls cl">' . $html . '</ul></div>';
            break;
        case 'music':
            if (!empty($parameters['mp3list'])) {
                $authcode = substr(md5($_G['authkey'] . $uid), 6, 16);
                $querystring = urlencode("home.php?mod=space&do=index&op=getmusiclist&uid={$uid}&hash={$authcode}&t=" . TIMESTAMP);
                $swfurl = STATICURL . 'image/common/mp3player.swf?config=' . $querystring;
                $html = "<script language=\"javascript\" type=\"text/javascript\">document.write(AC_FL_RunContent('id', 'mp3player', 'name', 'mp3player', 'devicefont', 'false', 'width', '100%', 'height', '220px', 'src', '{$swfurl}', 'menu', 'false',  'allowScriptAccess', 'sameDomain', 'swLiveConnect', 'true', 'wmode', 'transparent'));</script>";
            } else {
                $html = lang('space', 'music_no_content');
            }
            $html = '<div class="content"><div class="ml mls cl">' . $html . '</div></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'], 0, 1);
            } else {
                $parameters['content'] = dhtmlspecialchars($parameters['content']);
            }
            if (empty($parameters['content'])) {
                $parameters['content'] = lang('space', $blockname);
            }
            $html .= '<div class="content">' . $parameters['content'] . '</div>';
            break;
    }
    if (isset($parameters['title'])) {
        $title = empty($parameters['title']) ? '' : lang('space', 'block_title', array('bname' => stripslashes($parameters['title'])));
    } else {
        $title = lang('space', 'block_title', array('bname' => getblockdata($blockname)));
    }
    $html = $title . $html;
    return $html;
}
Example #12
0
include_once '../iauth_verify_forward.php';
$userid = intval(iauth_verify());
include_once '../../../common.php';
$Message = empty($_POST['message']) ? '' : getstr($_POST['message']);
$BlogId = empty($_POST['blogid']) ? 0 : intval($_POST['blogid']);
$Message .= ' ';
/*$userid = 18;
	$username = '******';
	$Message = '88888';
	$BlogId = 89;
	$_SGLOBAL['supe_uid'] = $userid;
	$_SGLOBAL['supe_username'] = $username;*/
getmember();
$query = $_SGLOBAL['db']->query("SELECT bf.target_ids, b.* FROM " . tname('blog') . " b left join " . tname('blogfield') . " bf  on b.blogid=bf.blogid where b.blogid={$BlogId} ");
$blog = $_SGLOBAL['db']->fetch_array($query);
if (!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids']) || $blog['noreply'] == 1) {
    $arrs = array('flag' => 'no_privilege');
} else {
    //处理评论的@功能 Add by xuxing 2012-12-6 start
    //提取AT用户
    preg_match_all("/[@](.*)[(]([\\d]+)[)]\\s/U", $Message, $matches, PREG_SET_ORDER);
    foreach ($matches as $value) {
        $TmpString = $value[0];
        $TmpName = $value[1];
        $UserId = $value[2];
        $result = $_SGLOBAL['db']->query("select uid,username,name from " . tname('space') . " where uid={$UserId}");
        if ($rs = $_SGLOBAL['db']->fetch_array($result)) {
            $realname = $rs['name'];
            if (empty($realname)) {
                $realname = $rs['username'];
            }
Example #13
0
                 $list['today'][] = $value;
             } elseif ($value['dateline'] >= $_G['home_today'] - 3600 * 24) {
                 $list['yesterday'][] = $value;
             } else {
                 $theday = dgmdate($value['dateline'], 'Y-m-d');
                 $list[$theday][] = $value;
             }
         }
         $count++;
     }
 } else {
     $hash_datas = array();
     $more_list = array();
     $uid_feedcount = array();
     while ($value = DB::fetch($query)) {
         if (!isset($hotlist[$value['feedid']]) && !isset($hotlist_all[$value['feedid']]) && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
             $value = mkfeed($value);
             if (ckicon_uid($value)) {
                 if ($value['dateline'] >= $_G['home_today']) {
                     $dkey = 'today';
                 } elseif ($value['dateline'] >= $_G['home_today'] - 3600 * 24) {
                     $dkey = 'yesterday';
                 } else {
                     $dkey = dgmdate($value['dateline'], 'Y-m-d');
                 }
                 $maxshownum = 3;
                 if (empty($value['uid'])) {
                     $maxshownum = 10;
                 }
                 if (empty($value['hash_data'])) {
                     if (empty($feed_users[$dkey][$value['uid']])) {
Example #14
0
         $theurl .= "&classid={$classid}";
     }
     //设置权限
     $_GET['friend'] = intval($_GET['friend']);
     if ($_GET['friend']) {
         $wheresql .= " AND b.friend='{$_GET['friend']}'";
         $theurl .= "&friend={$_GET['friend']}";
     }
     $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('blog') . " b WHERE {$wheresql}"), 0);
     if ($count) {
         $query = $_SGLOBAL['db']->query("SELECT bf.message, bf.target_ids, b.* FROM " . tname('blog') . " b {$f_index}\r\n\t\t\t\tLEFT JOIN " . tname('blogfield') . " bf ON bf.blogid=b.blogid\r\n\t\t\t\tWHERE {$wheresql}\r\n\t\t\t\tORDER BY b.dateline DESC LIMIT {$start},{$perpage}");
     }
 }
 if ($count) {
     while ($value = $_SGLOBAL['db']->fetch_array($query)) {
         if (ckfriend($value)) {
             realname_set($value['uid'], $value['username']);
             $value['message'] = $value['friend'] == 4 ? '' : getstr($value['message'], $summarylen, 0, 0, 0, 0, -1);
             $value['pic'] = mkpicurl($value);
             $list[] = $value;
             $userlist[$value['uid']] = $value['username'];
         } else {
             $pricount++;
         }
     }
 }
 //分页
 $multi = multi($count, $perpage, $page, $theurl);
 //实名
 realname_get();
 include_once template("space_blog_list");
Example #15
0
         $wheresql .= " AND b.subject LIKE '%{$searchkey}%'";
         $theurl .= "&searchkey={$_GET['searchkey']}";
         cksearch($theurl);
     }
     $count = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname('bwzt') . " b WHERE {$wheresql}"), 0);
     //更新统计
     if ($wheresql == "b.uid='{$space['uid']}'" && $space['bwztnum'] != $count) {
         updatetable('space', array('bwztnum' => $count), array('uid' => $space['uid']));
     }
     if ($count) {
         $query = $_SGLOBAL['db']->query("SELECT bf.message, bf.target_ids, bf.magiccolor, b.*, s.name FROM " . tname('bwzt') . " b {$f_index}\n\t\t\t\tLEFT JOIN " . tname('space') . " s ON s.uid=b.uid\n\t\t\t\tLEFT JOIN " . tname('bwztfield') . " bf ON bf.bwztid=b.bwztid\n\t\t\t\tWHERE {$wheresql}\n\t\t\t\tORDER BY {$ordersql} DESC LIMIT {$start},{$perpage}");
     }
 }
 if ($count) {
     while ($value = $_SGLOBAL['db']->fetch_array($query)) {
         if (ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
             realname_set($value['uid'], $value['username']);
             if ($value['friend'] == 4) {
                 $value['message'] = $value['pic'] = '';
             } else {
                 $value['message'] = strip_tags($value['message']);
                 //剥去字符串中的 HTML 标签
                 $value['message'] = getstr($value['message'], $summarylen, 0, 0, 0, 0, -1);
             }
             if ($value['pic']) {
                 $value['pic'] = pic_cover_get($value['pic'], $value['picflag']);
             }
             $value['pics'] = json_decode($value['pics']);
             //json解密picurls
             //增加发布者头像地址
             $value['avatar_url'] = avatar($value['uid'], 'middle', TRUE);
Example #16
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;
}
Example #17
0
     $hotarr = array('blogid', $blog['blogid'], $blog['hotuser']);
     $stattype = 'blogcomment';
     //统计
     break;
 case 'bwztid':
     //读取咨询
     $query = $_SGLOBAL['db']->query("SELECT b.*, bf.target_ids, bf.hotuser\n\t\t\t\tFROM " . tname('bwzt') . " b\n\t\t\t\tLEFT JOIN " . tname('bwztfield') . " bf ON bf.bwztid=b.bwztid\n\t\t\t\tWHERE b.bwztid='{$id}'");
     $bwzt = $_SGLOBAL['db']->fetch_array($query);
     //咨询不存在
     if (empty($bwzt)) {
         showmessage('view_to_info_did_not_exist');
     }
     //检索空间
     $tospace = getspace($bwzt['uid']);
     //验证隐私
     if (!ckfriend($bwzt['uid'], $bwzt['friend'], $bwzt['target_ids'])) {
         //没有权限
         showmessage('no_privilege');
     } elseif (!$tospace['self'] && $bwzt['friend'] == 4) {
         //密码输入问题
         $cookiename = "view_pwd_bwzt_{$bwzt['bwztid']}";
         $cookievalue = empty($_SCOOKIE[$cookiename]) ? '' : $_SCOOKIE[$cookiename];
         if ($cookievalue != md5(md5($bwzt['password']))) {
             showmessage('no_privilege');
         }
     }
     //是否允许评论
     if (!empty($bwzt['noreply'])) {
         showmessage('do_not_accept_comments');
     }
     if ($bwzt['target_ids']) {
Example #18
0
//feed
foreach ($feedlist as $key => $value) {
    $feedlist[$key] = mkfeed($value);
}
//ᄌ￐ᅡ채ᅮ￑￈￈ᄊ￈
if (!$space['self'] && $_SGLOBAL['supe_uid']) {
    include_once S_ROOT . './source/function_cp.php';
    addfriendnum($space['uid'], $space['username']);
}
@(include_once S_ROOT . './data/data_profilefield.php');
$fields = empty($_SGLOBAL['profilefield']) ? array() : $_SGLOBAL['profilefield'];
//ᄌᄊ¢ᅲᅧ￁ᅬ
$base_farr = $contact_farr = array();
$query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceinfo') . " WHERE uid='{$space['uid']}'");
while ($value = $_SGLOBAL['db']->fetch_array($query)) {
    $v_friend = ckfriend($value['uid'], $value['friend']);
    if ($value['type'] == 'base' || $value['type'] == 'contact') {
        if (!$v_friend) {
            $space[$value['subtype']] = '';
        }
    } else {
        if ($v_friend) {
            $space[$value['type']][] = $value;
        }
    }
}
//ᄏᄆ휴ᅧ￁ᅬᅧᅦᄋ￱ᅮ￐
$space['profile_base'] = 0;
foreach (array('sex', 'birthday', 'blood', 'marry', 'residecity', 'birthcity', 'signature') as $value) {
    if ($space[$value]) {
        $space['profile_base'] = 1;
Example #19
0
     while ($value = DB::fetch($query)) {
         $value['istoday'] = 0;
         if ($value['birthmonth'] == $n_month && $value['birthday'] == $n_day) {
             $value['istoday'] = 1;
         }
         $key = sprintf("%02d", $value['birthmonth']) . sprintf("%02d", $value['birthday']);
         $birthlist[$key][] = $value;
         ksort($birthlist);
     }
 }
 if ($_G['setting']['feedhotnum'] > 0 && ($_GET['view'] == 'we' || $_GET['view'] == 'all')) {
     $hotlist_all = array();
     $hotstarttime = $_G['timestamp'] - $_G['setting']['feedhotday'] * 3600 * 24;
     $query = DB::query("SELECT * FROM " . DB::table('home_feed') . " USE INDEX(hot) WHERE dateline>='{$hotstarttime}' ORDER BY hot DESC LIMIT 0,10");
     while ($value = DB::fetch($query)) {
         if ($value['hot'] > 0 && ckfriend($value['uid'], $value['friend'], $value['target_ids'])) {
             if (empty($hotlist)) {
                 $hotlist[$value['feedid']] = $value;
             } else {
                 $hotlist_all[$value['feedid']] = $value;
             }
         }
     }
     $nexthotnum = $_G['setting']['feedhotnum'] - 1;
     if ($nexthotnum > 0) {
         if (count($hotlist_all) > $nexthotnum) {
             $hotlist_key = array_rand($hotlist_all, $nexthotnum);
             if ($nexthotnum == 1) {
                 $hotlist[$hotlist_key] = $hotlist_all[$hotlist_key];
             } else {
                 foreach ($hotlist_key as $key) {