$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 = '';
}
if ($val == '') $val = '';
$html .= '
'.$field['title'].''.$val.'';
}
}
}
$html = $html ? $html : ''.lang('space', 'block_view_profileinfo_noperm').'';
$html = '';
$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 .= "".avatar($uid,$avatar).'
';
$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 .= '
';
$usermedalmenus .= '
';
}
}
if($usermedals) {
$usermedals = '
'.$usermedals.'
'.$usermedalmenus;
}
}
$html .= "
$usermedals";
$html .= '
';
$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 .= '- '.lang('space', 'block_profile_follow').'
';
}
if ($space['self']) {
$html .= '- '.lang('space', 'block_profile_diy').'
';
$html .= '- '.lang('space', 'block_profile_wall').'
';
$html .= '- '.lang('space', 'block_profile_avatar').'
';
$html .= '- '.lang('space', 'block_profile_update').'
';
if($showmagicgift) {
$html .= '';
}
} 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 .= "- ".lang('space', 'follow_cancle_follow')."
";
} else {
$html .= "- ".lang('space', 'follow_follow_ta')."
";
}
if (!$isfriend) {
$html .= "- ".lang('space', 'block_profile_friend_add')."
";
} else {
$html .= "- ".lang('space', 'block_profile_friend_ignore')."
";
}
$html .= "- ".lang('space', 'block_profile_wall_to_me')."
";
$html .= "- ".lang('space', 'block_profile_poke')."
";
$html .= "- ".lang('space', 'block_profile_sendmessage')."
";
}
$html .= '
';
$encodeusername = rawurlencode($space['username']);
if(checkperm('allowbanuser')) {
$managehtml .= '';
} elseif (checkperm('allowedituser')) {
$managehtml .= '';
}
if($_G['adminid'] == 1) {
$managehtml .= "";
}
if(!empty($managehtml)) {
$html .= '
';
if($_G['adminid'] == 1) {
$html .= '';
}
}
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 .= '';
}
}
}
$html = ''.$html.'
';
break;
case 'statistic':
space_merge($space, 'count');
$html .= '';
if(empty($parameters['banviews'])) $html .= lang('space', 'space_views', array('views' => $space['views'] ? $space['views'] : '--'));
$html .= '
';
$html = ''.$html.'
';
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 .= "";
$html .= $dv['message'];
$html .= " ".lang('space', 'block_doing_reply')."";
$html .= "";
}
} else {
$html .= "".lang('space', 'block_doing_no_content').($space['self'] ? lang('space', 'block_doing_no_content_publish', $space) : '')."
";
}
} else {
$html .= "".lang('space', 'block_view_noperm')."
";
}
$html = '';
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 .= "$value[message]";
}
$html .= lang('space', 'blog_li_ext', array('uid'=>$value['uid'],'blogid'=>$value['blogid'],'viewnum'=>$value['viewnum'],'replynum'=>$value['replynum']));
$html .= "";
} else {
$html .= ''.lang('space','block_view_noperm').'
';
}
}
}
}
$more = $html ? ''.lang('space', 'viewmore').'
' : '';
$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 .= "$value[message]";
}
$html .= lang('space', 'blog_li_ext', array('uid'=>$value['uid'],'blogid'=>$value['blogid'],'viewnum'=>$value['viewnum'],'replynum'=>$value['replynum']));
$html .= "";
} else {
$html .= ''.lang('space','block_view_noperm').'
';
}
}
if($html) {
$more = ''.lang('space', 'viewmore').'
';
} else {
$html = ''.lang('space','block_blog_no_content').($space['self'] ? lang('space', 'block_blog_no_content_publish', $space) : '').'
';
$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 = ''.lang('space','block_album_no_content').($space['self'] ? lang('space', 'block_album_no_content_publish', $space) : '').'
';
}
} else {
$html .= ''.lang('space','block_view_noperm').'';
}
$html = '';
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 ? ''.lang('space','block_feed_no_content').'
' : $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 .= "{$thread['subject']}";
}
}
}
$html = !$html ? ''.lang('space','block_thread_no_content').($space['self'] ? lang('space', 'block_thread_no_content_publish', $space) : '').'
' : '';
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 .= ''.avatar($value['fuid'],'small').''.$value['fusername'].'
';
}
$html = !$html ? ''.lang('space','block_friend_no_content').($space['self'] ? lang('space', 'block_friend_no_content_publish', $space) : '').'
' : '';
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 .= "";
if ($value['vusername'] == '') {
$html .= lang('space', 'visitor_anonymity');
} else {
$html .= lang('space', 'visitor_list', array(
'uid' => $value['vuid'],
'cuid' => $uid,
'username' => $value['vusername'],
'class' => ($_G['ols'][$value['vuid']]?'gol':''),
'self' => $value['vuid'] == $_G['uid'] ? 'god' : '',
'avatar' => avatar($value['vuid'],'small')));
}
$html .= "".dgmdate($value['dateline'],'u', '9999', 'Y-m-d')."";
$html .= "";
}
$html = !$html ? ''.lang('space','block_visitor_no_content').($space['self'] ? lang('space', 'block_visitor_no_content_publish', $space) : '').'
' : '';
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 .= ''.$value['title_template'].'('.dgmdate($value['dateline'], 'u').')';
if ($value['image']) {
$html .= '
';
}
$html .= '
'.$value['body_template'].'
';
if ($value['type'] == 'video') {
if(!empty($value['body_data']['imgurl'])) {
$html .= '
';
} else {
$html .= "
";
}
}elseif ($value['type'] == 'music') {
$html .= "
";
}elseif ($value['type'] == 'flash') {
$html .= "
";
}
if ($value['body_general']) {
$html .= '
";
}
$html .= '
';
}
$html = !$html ? ''.lang('space','block_share_no_content').'
' : '';
}
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 = ''.avatar($value['authorid'],'small').'';
$author = ''.$value['author'].'';
}else {
$author_avatar = '';
$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)) : ''.lang('space','block_wall_no_content').'
';
$html = '';
if(helper_access::check_module('wall')) {
$html = lang('space', 'wall_form', array('uid' => $uid, 'FORMHASH'=>FORMHASH)).'
'.$html;
}
$titlemore = ''.lang('space', 'all').'';
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 ? ''.lang('space','block_group_no_content').($space['self'] ? lang('space', ($_G['group']['allowbuildgroup'] ? 'block_group_no_content_publish' : 'block_group_no_content_join'), $space) : '').'
' : '';
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 = "";
} else {
$html = lang('space', 'music_no_content');
}
$html = ''.$html.'
';
break;
case 'myapp':
$html = '';
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 ? ''.$parameters['title'].'' : $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 ? ''.getblockdata($blockname).'' : 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;
}
function mkfeedhtml($value) {
global $_G;
$_GET['uid'] = intval($_GET['uid']);
$_GET['view'] = dhtmlspecialchars($_GET['view']);
$html = '';
$html .= "";
$html .= "";
$html .= "
$value[title_template]";
$html .= "\t
".dgmdate($value[dateline], 'n-j H:i')."";
$html .= "
";
if ($value['image_1']) {
$html .= "
";
}
if ($value['image_2']) {
$html .= "
";
}
if ($value['image_3']) {
$html .= "
";
}
if ($value['image_4']) {
$html .= "
";
}
if ($value['body_template']) {
$style = $value['image_3'] ? ' style="clear: both; zoom: 1;"' : '';
$html .= "
$value[body_template]
";
}
if (!empty($value['body_data']['flashvar'])) {
if(!empty($value['body_data']['imgurl'])) {
$html .= '
';
} else {
$html .= "
";
}
}elseif (!empty($value['body_data']['musicvar'])) {
$html .= "
";
}elseif (!empty($value['body_data']['flashaddr'])) {
$html .= "
";
}
if ($value['body_general']) {
$classname = $value['image_1'] ? ' z' : '';
$html .= "
";
}
$html .= "
";
$html .= "
";
$html .= "";
return $html;
}
function &getlayout($layout='') {
$layoutarr = array(
'1:2:1' => array('240', '480', '240'),
'1:1:2' => array('240', '240', '480'),
'2:1:1' => array('480', '240', '240'),
'2:2' => array('480', '480'),
'1:3' => array('240', '720'),
'3:1' => array('720', '240'),
'1:4' => array('190', '770'),
'4:1' => array('770', '190'),
'2:2:1' => array('385', '385', '190'),
'1:2:2' => array('190', '385', '385'),
'1:1:3' => array('190', '190', '570'),
'1:3:1' => array('190', '570', '190'),
'3:1:1' => array('570', '190', '190'),
'3:2' => array('575', '385'),
'2:3' => array('385', '575')
);
if (!empty($layout)) {
$rt = (isset($layoutarr[$layout])) ? $layoutarr[$layout] : false;
} else {
$rt = $layoutarr;
}
return $rt;
}
function getblockdata($blockname = '') {
$blockarr = lang('space', 'blockdata');
$r = empty($blockname) ? $blockarr : (isset($blockarr[$blockname]) ? $blockarr[$blockname] : false);
return $r;
}
function check_ban_block($blockname, $space) {
global $_G;
$return = true;
loadcache('usergroup_'.$space['groupid']);
if($blockname == 'group' && !helper_access::check_module('group')) {
$return = false;
} elseif($blockname == 'thread' && $_G['setting']['allowviewuserthread'] === -1) {
$return = false;
} elseif($blockname == 'myapp') {
loadcache('usergroup_'.$space['groupid']);
if(empty($_G['setting']['my_app_status']) || empty($_G['cache']['usergroup_'.$space['groupid']]['allowmyop'])) {
$return = false;
}
}
return $return;
}
?>