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!\'});" /> '; $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 .= " <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; }
} else { include_once template('cp_friend'); exit; } } else { showmessage('waiting_for_the_other_test'); } } else { //对方加了我为好友,我审核通过 if (submitcheck('add2submit')) { //成为好友 $gid = intval($_POST['gid']); friend_update($space['uid'], $space['username'], $tospace['uid'], $tospace['username'], 'add', $gid); //事件发布 //加好友不发布事件 if (ckprivacy('friend', 1)) { $fs = array(); $fs['icon'] = 'friend'; $fs['title_template'] = cplang('feed_friend_title'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$tospace['uid']}\">" . $_SN[$tospace['uid']] . "</a>"); $fs['body_template'] = ''; $fs['body_data'] = array(); $fs['body_general'] = ''; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']); } //我的好友申请数进行变化 $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET addfriendnum=addfriendnum-1 WHERE uid='{$space['uid']}' AND addfriendnum>0"); //通知 notification_add($uid, 'friend', cplang('note_friend_add')); showmessage('friends_add', $_POST['refer'], 1, array($_SN[$tospace['uid']])); } else {
$flink = json_decode($fresult['flink'], true); } } //ᅯᄚ¥ $walllist = array(); if ($_SGLOBAL['mygroupid'] == 3 || ckprivacy('wall')) { $query_sql = "SELECT * FROM " . tname('comment') . " WHERE ((id={$space['uid']} AND secret='on' AND authorid={$_SGLOBAL['supe_uid']}) OR (id={$space['uid']} AND secret='on' AND id={$_SGLOBAL['supe_uid']}) OR (id={$space['uid']} AND secret!='on') AND idtype='uid') ORDER BY dateline DESC LIMIT 0,5"; $query = $_SGLOBAL['db']->query($query_sql); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['authorid'], $value['author']); $value['message'] = strlen($value['message']) > 500 ? getstr($value['message'], 500, 0, 0, 0, 0, -1) . ' ...' : $value['message']; $walllist[] = $value; } } $mywalllist = array(); if ($_SGLOBAL['mygroupid'] == 3 || ckprivacy('wall')) { $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('comment') . " WHERE authorid='{$space['uid']}' AND idtype='uid' ORDER BY dateline DESC LIMIT 0,12"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['authorid'], $value['author']); $value['message'] = strlen($value['message']) > 500 ? getstr($value['message'], 500, 0, 0, 0, 0, -1) . ' ...' : $value['message']; $mywalllist[] = $value; } } //ᅧᅦ워ᅳᅬ $query = $_SGLOBAL['db']->query('SELECT * FROM ' . tname('session') . " WHERE uid = '{$space['uid']}'"); $value = $_SGLOBAL['db']->fetch_array($query); $isonline = empty($value) || $value['magichidden'] ? 0 : sgmdate('H:i:s', $value['lastactivity'], 1); //ᄋᄌ $theme = empty($_GET['theme']) ? '' : preg_replace("/[^0-9a-z]/i", '', $_GET['theme']); if ($theme == 'uchomedefault') { $_SGLOBAL['space_theme'] = $_SGLOBAL['space_css'] = '';
$is_anonymous = empty($_G['cookie']['anonymous_visit_' . $_G['uid'] . '_' . $space['uid']]) ? 0 : 1; if (empty($visitor['dateline'])) { $setarr = array('uid' => $space['uid'], 'vuid' => $_G['uid'], 'vusername' => $is_anonymous ? '' : $_G['username'], 'dateline' => $_G['timestamp']); DB::insert('home_visitor', $setarr, 0, true); show_credit(); } else { if ($_G['timestamp'] - $visitor['dateline'] >= 300) { DB::update('home_visitor', array('dateline' => $_G['timestamp'], 'vusername' => $is_anonymous ? '' : $_G['username']), array('uid' => $space['uid'], 'vuid' => $_G['uid'])); } if ($_G['timestamp'] - $visitor['dateline'] >= 3600) { show_credit(); } } updatecreditbyaction('visit', 0, array(), $space['uid']); } if ($do != 'profile' && !ckprivacy($do, 'view')) { $_G['privacy'] = 1; require_once libfile('space/profile', 'include'); include template('home/space_privacy'); exit; } $widths = getlayout($userdiy['currentlayout']); $leftlist = formatdata($userdiy, 'left', $space); $centerlist = formatdata($userdiy, 'center', $space); $rightlist = formatdata($userdiy, 'right', $space); dsetcookie('home_diymode', 1); } $navtitle = !empty($space['spacename']) ? $space['spacename'] : lang('space', 'sb_space', array('who' => $space['username'])); $metakeywords = lang('space', 'sb_space', array('who' => $space['username'])); $metadescription = lang('space', 'sb_space', array('who' => $space['username'])); $space['medals'] = getuserprofile('medals');
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 .= " <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; }
} } $magvalues['type'] = $commentcable[$type]; } $arr['body_general'] = getstr($_POST['general'], 150, 1, 1, 1); $arr['body_general'] = censor($arr['body_general']); if (censormod($arr['body_general']) || $_G['group']['allowsharemod']) { $arr['status'] = 1; } else { $arr['status'] = 0; } $arr['type'] = $type; $arr['uid'] = $_G['uid']; $arr['username'] = $_G['username']; $arr['dateline'] = $_G['timestamp']; if ($arr['status'] == 0 && ckprivacy('share', 'feed')) { require_once libfile('function/feed'); feed_add('share', '{actor} ' . $arr['title_template'], array('hash_data' => $feed_hash_data), $arr['body_template'], $arr['body_data'], $arr['body_general'], array($arr['image']), array($arr['image_link'])); } $arr['body_data'] = serialize($arr['body_data']); $setarr = daddslashes($arr); $sid = DB::insert('home_share', $setarr, 1); switch ($type) { case 'space': DB::query("UPDATE " . DB::table('common_member_status') . " SET sharetimes=sharetimes+1 WHERE uid='{$id}'"); break; case 'blog': DB::query("UPDATE " . DB::table('home_blog') . " SET sharetimes=sharetimes+1 WHERE blogid='{$id}'"); break; case 'album': DB::query("UPDATE " . DB::table('home_album') . " SET sharetimes=sharetimes+1 WHERE albumid='{$id}'");
$fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$item['uid']}\">{$_SN[$item['uid']]}</a>", 'subject' => "<a href=\"space.php?uid={$item['uid']}&do=thread&id={$item['tid']}\">{$item['subject']}</a>", 'click' => $click['name']); $note_type = 'clickthread'; $q_note = cplang('note_click_thread', array("space.php?uid={$item['uid']}&do=thread&id={$item['tid']}", $item['subject'])); break; case 'picid': $fs['title_template'] = cplang('feed_click_pic'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$item['uid']}\">{$_SN[$item['uid']]}</a>", 'click' => $click['name']); $fs['images'] = array(pic_get($item['filepath'], $item['thumb'], $item['remote'])); $fs['image_links'] = array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}"); $fs['body_general'] = $item['title']; $note_type = 'clickpic'; $q_note = cplang('note_click_pic', array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}")); break; } //Event Publishing if (empty($item['friend']) && ckprivacy('click', 1)) { feed_add('click', $fs['title_template'], $fs['title_data'], '', array(), $fs['body_general'], $fs['images'], $fs['image_links']); } //Reward visitors getreward('click', 1, 0, $idtype . $id); //Statistics updatestat('click'); //Notice notification_add($item['uid'], $note_type, $q_note); showmessage('click_success', $_SGLOBAL['refer']); } elseif ($_GET['op'] == 'show') { foreach ($clicks as $key => $value) { $value['clicknum'] = $item["click_{$key}"]; $value['classid'] = mt_rand(1, 4); if ($value['clicknum'] > $maxclicknum) { $maxclicknum = $value['clicknum'];
$magvalues = array(); break; case 'sid': $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}&cid={$cid}"; $note_type = 'sharecomment'; $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'] = $_POST['id']; $note_values['from_idtype'] = $_POST['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 ($stattype) { include_once libfile('function/stat'); updatestat($stattype);
$newdoid = DB::insert('home_doing', $setarr, 1); $setarr = array('recentnote' => $message, 'spacenote' => $message); $credit = $experience = 0; $extrasql = array('doings' => 1); updatecreditbyaction('doing', 0, $extrasql); DB::update('common_member_field_home', $setarr, "uid='{$_G['uid']}'"); if ($_POST['to_signhtml'] && $_G['group']['maxsigsize']) { if ($_G['group']['maxsigsize'] < 200) { $signhtml = getstr($message, $_G['group']['maxsigsize'], 0, 0, 1); $signhtml = preg_replace("/\\<br.*?\\>/i", ' ', $signhtml); } else { $signhtml = $message; } DB::update('common_member_field_forum', array('sightml' => $signhtml), "uid='{$_G['uid']}'"); } if (ckprivacy('doing', 'feed') && $doing_status == '0') { $feedarr = array('appid' => '', 'icon' => 'doing', 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'title_template' => lang('feed', 'feed_doing_title'), 'title_data' => daddslashes(serialize(dstripslashes(array('message' => $message)))), 'body_template' => '', 'body_data' => '', 'id' => $newdoid, 'idtype' => 'doid'); DB::insert('home_feed', $feedarr); } if ($doing_status == '1') { updatemoderate('doid', $newdoid); manage_addnotify('verifydoing'); } require_once libfile('function/stat'); updatestat('doing'); DB::update('common_member_status', array('lastpost' => $_G['timestamp']), array('uid' => $_G['uid'])); if (!empty($_G['gp_fromcard'])) { showmessage($message . lang('spacecp', 'card_update_doing')); } else { showmessage('do_success', dreferer(), array('doid' => $newdoid), $_G['gp_spacenote'] ? array('showmsg' => false) : array('header' => true)); }
$note = cplang('note_share_at', array("space.php?uid=" . $_SGLOBAL['supe_uid'] . "&do=share&id=" . $sid)); notification_add($UserId, 'atyou', $note); } //更新用户统计 if (empty($space['sharenum'])) { $space['sharenum'] = getcount('share', array('uid' => $space['uid'])); $sharenumsql = "sharenum=" . $space['sharenum']; } else { $sharenumsql = 'sharenum=sharenum+1'; } //积分 $needle = $id ? $type . $id : ''; $reward = getreward('createshare', 0, 0, $needle); $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET {$sharenumsql}, lastpost='{$_SGLOBAL['timestamp']}', updatetime='{$_SGLOBAL['timestamp']}', credit=credit+{$reward['credit']}, experience=experience+{$reward['experience']} WHERE uid='{$_SGLOBAL['supe_uid']}'"); //动态 if (ckprivacy('share')) { include_once S_ROOT . './source/function_feed.php'; feed_publish($sid, 'sid', 1); } if ($_POST['topicid']) { topic_join($_POST['topicid'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); $url = 'space.php?do=topic&topicid=' . $_POST['topicid'] . '&view=share'; } else { $url = $_POST['refer']; } //martin 修改 start if ($inspace == '1') { $_SGLOBAL['inajax'] = 0; } if ($_GET['type'] == 'outernews') { showmessage('do_success');
// 活动 $n_url = "space.php?do=event&id={$id}&view=comment&cid={$cid}"; $note_type = 'eventcomment'; $note = cplang('note_event_comment', array($n_url)); $q_note = cplang('note_event_comment_reply', array($n_url)); $msg = 'do_success'; $magvalues = array(); $msgtype = 'event_comment'; $q_msgtype = 'event_comment_reply'; break; } if (empty($comment)) { //非引用评论 if ($tospace['uid'] != $_SGLOBAL['supe_uid']) { //事件发布 if (ckprivacy('comment', 1)) { 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']); } //发送通知 notification_add($tospace['uid'], $note_type, $note); //留言发送短消息 if ($_POST['idtype'] == 'uid' && $tospace['updatetime'] == $tospace['dateline']) { include_once S_ROOT . './uc_client/client.php'; uc_pm_send($_SGLOBAL['supe_uid'], $tospace['uid'], cplang('wall_pm_subject'), cplang('wall_pm_message', array(addslashes(getsiteurl() . $n_url))), 1, 0, 0); } //发送邮件通知 smail($tospace['uid'], '', cplang($msgtype, array($_SN[$space['uid']], shtmlspecialchars(getsiteurl() . $n_url))), '', $msgtype); } } elseif ($comment['authorid'] != $_SGLOBAL['supe_uid']) { //发送邮件通知 smail($comment['authorid'], '', cplang($q_msgtype, array($_SN[$space['uid']], shtmlspecialchars(getsiteurl() . $n_url))), '', $q_msgtype);
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); }
//相册 $albumlist = array(); if($space['albumnum'] && ckprivacy('album')) { $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('album')." WHERE uid='$space[uid]' ORDER BY updatetime DESC LIMIT 0,6"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if(ckfriend($value['uid'], $value['friend'], $value['target_ids'])) { $value['pic'] = pic_cover_get($value['pic'], $value['picflag']); $albumlist[] = $value; } } } //留言板 $walllist = array(); if(ckprivacy('wall')) { $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('comment')." WHERE id='$space[uid]' AND idtype='uid' ORDER BY dateline DESC LIMIT 0,5"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { realname_set($value['authorid'], $value['author']); $value['message'] = strlen($value['message'])>500?getstr($value['message'], 500, 0, 0, 0, 0, -1).' ...':$value['message']; $walllist[] = $value; } } //是否在线 $query = $_SGLOBAL['db']->query('SELECT * FROM '.tname('session')." WHERE uid = '$space[uid]'"); $value = $_SGLOBAL['db']->fetch_array($query); $isonline = (empty($value) || $value['magichidden']) ? 0 : sgmdate('H:i:s', $value['lastactivity'], 1); //风格 $theme = empty($_GET['theme'])?'':preg_replace("/[^0-9a-z]/i", '', $_GET['theme']);
function space_open($uid, $username, $gid = 0, $email = '') { global $_SGLOBAL, $_SCONFIG; if (empty($uid) || empty($username)) { return array(); } //验证 space 是否被管理员 delete $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spacelog') . " WHERE uid='{$uid}' AND flag='-1'"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { showmessage('the_space_has_been_closed'); } $space = array('uid' => $uid, 'username' => $username, 'dateline' => $_SGLOBAL['timestamp'], 'groupid' => $gid, 'regip' => getonlineip()); // Bonus Points $reward = getreward('register', 0, $uid); if ($reward['credit']) { $space['credit'] = $reward['credit']; } if ($reward['experience']) { $space['experience'] = $reward['experience']; } inserttable('space', $space, 0, true); inserttable('spacefield', array('uid' => $uid, 'email' => $email), 0, true); //发送PM if ($_SGLOBAL['supe_uid'] && $_SGLOBAL['supe_uid'] != $uid) { include_once S_ROOT . './uc_client/client.php'; uc_pm_send($_SGLOBAL['supe_uid'], $uid, cplang('space_open_subject'), cplang('space_open_message', array(getsiteurl())), 1, 0, 0); } //发送邮箱验证邮件 include_once S_ROOT . './source/function_cp.php'; emailcheck_send($uid, $email); //产生feed $_uid = $_SGLOBAL['supe_uid']; $_username = $_SGLOBAL['supe_username']; $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = addslashes($username); if (ckprivacy('spaceopen', 1)) { feed_add('profile', cplang('feed_space_open')); } // update 最新会员 if ($_SCONFIG['newspacenum'] > 0) { $newspacelist = array(); $wherearr = array('1'); if ($_SCONFIG['newspaceavatar']) { $wherearr[] = "avatar='1'"; } if ($_SCONFIG['newspacerealname']) { $wherearr[] = "namestatus='1'"; } if ($_SCONFIG['newspacevideophoto']) { $wherearr[] = "videostatus='1'"; } $query = $_SGLOBAL['db']->query("SELECT uid,username,name,namestatus,videostatus,dateline FROM " . tname('space') . " WHERE " . implode(' AND ', $wherearr) . " ORDER BY uid DESC LIMIT 0,{$_SCONFIG['newspacenum']}"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $newspacelist[] = $value; } data_set('newspacelist', $newspacelist); } //Statistics update include_once S_ROOT . './source/function_cp.php'; updatestat('register'); $_SGLOBAL['supe_uid'] = $_uid; $_SGLOBAL['supe_username'] = $_username; return $space; }
if ($note_uid && $note_uid != $_SGLOBAL['supe_uid']) { notification_add($note_uid, 'sharenotice', $note_message); } // update user Statistics if (empty($space['sharenum'])) { $space['sharenum'] = getcount('share', array('uid' => $space['uid'])); $sharenumsql = "sharenum=" . $space['sharenum']; } else { $sharenumsql = 'sharenum=sharenum+1'; } // points $needle = $id ? $type . $id : ''; $reward = getreward('createshare', 0, 0, $needle); $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET {$sharenumsql}, lastpost='{$_SGLOBAL['timestamp']}', updatetime='{$_SGLOBAL['timestamp']}', credit=credit+{$reward['credit']}, experience=experience+{$reward['experience']} WHERE uid='{$_SGLOBAL['supe_uid']}'"); //̬ if (ckprivacy('share', 1)) { include_once S_ROOT . './source/function_feed.php'; feed_publish($sid, 'sid', 1); } if ($_POST['topicid']) { topic_join($_POST['topicid'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); $url = 'space.php?do=topic&topicid=' . $_POST['topicid'] . '&view=share'; } else { $url = $_POST['refer']; } showmessage('do_success', $url, 0); } //ʾ $arr['body_data'] = serialize($arr['body_data']); // groups ת $arr = mkshare($arr);
function blog_post($POST, $olds = array()) { global $_SGLOBAL, $_SC; //操作者角色切换 if (!empty($olds['uid'])) { $__SGLOBAL = $_SGLOBAL; $_SGLOBAL['supe_uid'] = $olds['uid']; $_SGLOBAL['supe_username'] = addslashes($olds['username']); } //标题 $POST['subject'] = getstr(trim($POST['subject']), 80, 1, 1, 1); if (strlen($POST['subject']) < 1) { $POST['subject'] = sgmdate('Y-m-d'); } $POST['friend'] = intval($POST['friend']); //隐私 $POST['target_ids'] = ''; if ($POST['friend'] == 2) { //特定好友 $uids = array(); $names = empty($_POST['target_names']) ? array() : explode(' ', str_replace(cplang('tab_space'), ' ', $_POST['target_names'])); if ($names) { $query = $_SGLOBAL['db']->query("SELECT uid FROM " . tname('space') . " WHERE username IN (" . simplode($names) . ")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $uids[] = $value['uid']; } } if (empty($uids)) { $POST['friend'] = 3; //仅自己可见 } else { $POST['target_ids'] = implode(',', $uids); } } elseif ($POST['friend'] == 4) { //加密 $POST['password'] = trim($POST['password']); if ($POST['password'] == '') { $POST['friend'] = 0; } //公开 } if ($POST['friend'] !== 2) { $POST['target_ids'] = ''; } if ($POST['friend'] !== 4) { $POST['password'] == ''; } $POST['tag'] = shtmlspecialchars(trim($POST['tag'])); $POST['tag'] = getstr($POST['tag'], 500, 1, 1, 1); //语词屏蔽 //内容 $POST['message'] = checkhtml($POST['message']); $POST['message'] = getstr($POST['message'], 0, 1, 0, 1, 0, 1); $POST['message'] = preg_replace("/\\<div\\>\\<\\/div\\>/i", '', $POST['message']); $message = $POST['message']; //个人分类 if (empty($olds['classid']) || $POST['classid'] != $olds['classid']) { if (!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') { //分类名 $classname = shtmlspecialchars(trim(substr($POST['classid'], 4))); $classname = getstr($classname, 0, 1, 1, 1); if (empty($classname)) { $classid = 0; } else { $classid = getcount('class', array('classname' => $classname, 'uid' => $_SGLOBAL['supe_uid']), 'classid'); if (empty($classid)) { $setarr = array('classname' => $classname, 'uid' => $_SGLOBAL['supe_uid'], 'dateline' => $_SGLOBAL['timestamp']); $classid = inserttable('class', $setarr, 1); } } } else { $classid = intval($POST['classid']); } } else { $classid = $olds['classid']; } if ($classid && empty($classname)) { //是否是自己的 $classname = getcount('class', array('classid' => $classid, 'uid' => $_SGLOBAL['supe_uid']), 'classname'); if (empty($classname)) { $classid = 0; } } //主表 $blogarr = array('subject' => $POST['subject'], 'classid' => $classid, 'friend' => $POST['friend'], 'password' => $POST['password'], 'noreply' => empty($_POST['noreply']) ? 0 : 1); //标题图片 $titlepic = ''; //获取上传的图片 $uploads = array(); if (!empty($POST['picids'])) { $picids = array_keys($POST['picids']); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('pic') . " WHERE picid IN (" . simplode($picids) . ") AND uid='{$_SGLOBAL['supe_uid']}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (empty($titlepic) && $value['thumb']) { $titlepic = $value['filepath'] . '.thumb.jpg'; $blogarr['picflag'] = $value['remote'] ? 2 : 1; } $uploads[$POST['picids'][$value['picid']]] = $value; } if (empty($titlepic) && $value) { $titlepic = $value['filepath']; $blogarr['picflag'] = $value['remote'] ? 2 : 1; } } //插入文章 if ($uploads) { preg_match_all("/\\<img\\s.*?\\_uchome\\_localimg\\_([0-9]+).+?src\\=\"(.+?)\"/i", $message, $mathes); if (!empty($mathes[1])) { $searchs = $idsearchs = array(); $replaces = array(); foreach ($mathes[1] as $key => $value) { if (!empty($mathes[2][$key]) && !empty($uploads[$value])) { $searchs[] = $mathes[2][$key]; $idsearchs[] = "_uchome_localimg_{$value}"; $replaces[] = mkpicurl($uploads[$value], 0); unset($uploads[$value]); } } if ($searchs) { $message = str_replace($searchs, $replaces, $message); $message = str_replace($idsearchs, 'uchomelocalimg[]', $message); } } //未插入文章 foreach ($uploads as $value) { $picurl = mkpicurl($value, 0); $message .= "<div class=\"uchome-message-pic\"><img src=\"{$picurl}\"><p>{$value['title']}</p></div>"; } } //没有填写任何东西 $ckmessage = preg_replace("/(\\<div\\>|\\<\\/div\\>|\\s|\\ \\;|\\<br\\>|\\<p\\>|\\<\\/p\\>)+/is", '', $message); if (empty($ckmessage)) { return false; } //添加slashes $message = addslashes($message); //从内容中读取图片 if (empty($titlepic)) { $titlepic = getmessagepic($message); $blogarr['picflag'] = 0; } $blogarr['pic'] = $titlepic; if ($olds['blogid']) { //更新 $blogid = $olds['blogid']; updatetable('blog', $blogarr, array('blogid' => $blogid)); $fuids = array(); $blogarr['uid'] = $olds['uid']; $blogarr['username'] = $olds['username']; } else { $blogarr['uid'] = $_SGLOBAL['supe_uid']; $blogarr['username'] = $_SGLOBAL['supe_username']; $blogarr['dateline'] = empty($POST['dateline']) ? $_SGLOBAL['timestamp'] : $POST['dateline']; $blogid = inserttable('blog', $blogarr, 1); } $blogarr['blogid'] = $blogid; //附表 $fieldarr = array('message' => $message, 'postip' => getonlineip(), 'target_ids' => $POST['target_ids']); //TAG $oldtagstr = addslashes(empty($olds['tag']) ? '' : implode(' ', unserialize($olds['tag']))); $tagarr = array(); if ($POST['tag'] != $oldtagstr) { if (!empty($olds['tag'])) { //先把以前的给清理掉 $oldtags = array(); $query = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$blogid}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $oldtags[] = $value['tagid']; } if ($oldtags) { $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($oldtags) . ")"); $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$blogid}'"); } } $tagarr = tag_batch($blogid, $POST['tag']); //更新附表中的tag $fieldarr['tag'] = empty($tagarr) ? '' : addslashes(serialize($tagarr)); } if ($olds) { //更新 updatetable('blogfield', $fieldarr, array('blogid' => $blogid)); } else { $fieldarr['blogid'] = $blogid; $fieldarr['uid'] = $blogarr['uid']; inserttable('blogfield', $fieldarr); } //空间更新 if ($olds) { //空间更新 $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET updatetime='{$_SGLOBAL['timestamp']}' WHERE uid='{$_SGLOBAL['supe_uid']}'"); } else { //积分 updatespacestatus('get', 'blog'); } //feed if (empty($olds) && $blogarr['friend'] != 3) { //事件feed $fs = array(); $fs['icon'] = 'blog'; $fs['title_data'] = array(); $fs['images'] = $fs['image_links'] = array(); if ($blogarr['friend'] == 4) { //加密日志feed $fs['title_template'] = cplang('feed_blog_password'); $fs['title_data'] = array('subject' => "<a href=\"space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}\">{$blogarr['subject']}</a>"); $fs['body_template'] = ''; $fs['body_data'] = array(); } else { if ($blogarr['pic']) { $fs['images'] = array(mkpicurl($blogarr)); $fs['image_links'] = array("space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}"); } $fs['title_template'] = cplang('feed_blog'); $fs['body_template'] = '<b>{subject}</b><br>{summary}'; $fs['body_data'] = array('subject' => "<a href=\"space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}\">{$blogarr['subject']}</a>", 'summary' => getstr($message, 150, 1, 1, 0, 0, -1)); } $fs['body_general'] = ''; $fs['target_ids'] = $fieldarr['target_ids']; $fs['friend'] = $blogarr['friend']; if (ckprivacy('blog', 1)) { include_once S_ROOT . './source/function_cp.php'; 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']); } } //角色切换 if (!empty($__SGLOBAL)) { $_SGLOBAL = $__SGLOBAL; } return $blogarr; }
if (ckprivacy('join')) { realname_set($event['uid'], $event['username']); realname_get(); feed_add('event', cplang('event_join'), array('title' => $event['title'], "eventid" => $event['eventid'], "uid" => $event['uid'], "username" => $_SN[$event['uid']])); } } elseif ($_SGLOBAL['supe_userevent'] && $_SGLOBAL['supe_userevent'] < 2) { $arr = array("status" => 2); if ($_SGLOBAL['supe_userevent']['status'] == 1) { $numsql .= ",follownum = follownum - 1 "; } if ($event['limitnum'] > 0 && $event['membernum'] + $_SGLOBAL['supe_userevent']['fellow'] > $event['limitnum']) { $arr['fellow'] = 0; } updatetable("userevent", $arr, array("uid" => $_SGLOBAL['supe_uid'], "eventid" => $eventid)); $_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET {$numsql} WHERE eventid = '{$eventid}'"); if (ckprivacy('join')) { feed_add('event', cplang('event_join'), array('title' => $event['title'], "eventid" => $event['eventid'], "uid" => $event['uid'], "username" => $event['username'])); } } showmessage(cplang('event_accept_success', array("space.php?do=event&id={$event['eventid']}"))); } elseif ('delete' == $op) { // Delete/Cancel the Event if (!$eventid) { showmessage("event_does_not_exist"); // Event does not exist or has been deleted } if (!$allowmanage) { showmessage('no_privilege'); } if (submitcheck("deletesubmit")) { include_once S_ROOT . './source/function_delete.php';
&do=thread&view=me"><span>话题</span></a></li><?php } if (ckprivacy('wall')) { ?> <li<?php if ($do == 'wall') { ?> class="active"<?php } ?> ><a href="space.php?uid=<?php echo $space['uid']; ?> &do=wall&view=me"><span>留言</span></a></li><?php } if (ckprivacy('friend')) { ?> <li<?php if ($do == 'friend') { ?> class="active"<?php } ?> ><a href="space.php?uid=<?php echo $space['uid']; ?> &do=friend&view=me"><span>好友</span></a></li><?php } ?> </ul> </div>
} $_SGLOBAL['db']->query("UPDATE " . tname('poll') . " SET voternum=voternum+1, lastvote='{$_SGLOBAL['timestamp']}', credit=credit-{$poll['percredit']} {$sql} WHERE pid='{$pid}'"); // real name realname_get(); if ($poll['uid'] != $_SGLOBAL['supe_uid']) { //Reward points getreward('joinpoll', 1, 0, $pid); } // hot value if ($poll['uid'] != $_SGLOBAL['supe_uid']) { hot_update('pid', $poll['pid'], $poll['hotuser']); } //Statistics updatestat('pollvote'); // event feed if (!isset($_POST['anonymous']) && $_SGLOBAL['supe_uid'] != $poll['uid'] && ckprivacy('joinpoll', 1)) { $fs = array(); $fs['icon'] = 'poll'; $fs['images'] = $fs['image_links'] = array(); $fs['title_template'] = cplang('take_part_in_the_voting'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$poll['uid']}\">" . $_SN[$poll['uid']] . "</a>", 'url' => "space.php?uid={$poll['uid']}&do=poll&pid={$pid}", 'subject' => $poll['subject'], 'reward' => $poll['percredit'] ? cplang('reward') : ''); $fs['body_template'] = ''; $fs['body_data'] = array(); include_once S_ROOT . './source/function_cp.php'; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data']); } showmessage('do_success', 'space.php?uid=' . $poll['uid'] . '&do=poll&pid=' . $pid . ($poll['percredit'] ? '&reward=' . $poll['percredit'] : ''), 0); } } elseif ($op == 'endreward') { //Termination of reward if (submitcheck('endrewardsubmit')) {
$_SGLOBAL['db']->query("UPDATE " . tname("mtag") . " SET postnum=postnum+1 WHERE tagid='{$thread['tagid']}'"); //普通回复 if (empty($post) && $thread['uid'] != $_SGLOBAL['supe_uid']) { //积分 getreward('replythread', 1, 0, $thread['tid']); realname_set($thread['uid'], $thread['username']); realname_get(); if (empty($mtag['viewperm'])) { $fs = array(); $fs['icon'] = 'post'; $fs['body_template'] = ''; $fs['body_data'] = array(); $fs['body_general'] = ''; $fs['title_template'] = cplang('feed_thread_reply'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$thread['uid']}\">" . $_SN[$thread['uid']] . "</a>", 'thread' => "<a href=\"space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}\">{$thread['subject']}</a>"); if (ckprivacy('post', 1)) { feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']); } } //通知 $note = $anonymous ? '匿名用户 ' : ''; $note .= cplang('note_thread_reply') . " <a href=\"space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}&pid={$pid}\" target=\"_blank\">{$thread['subject']}</a>"; notification_add($thread['uid'], 'post', $note, 0, $anonymous); } elseif ($post) { $note = $anonymous ? '匿名用户 ' : ''; $note .= cplang('note_post_reply', array("space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}", $thread['subject'], "space.php?uid={$thread['uid']}&do=thread&id={$thread['tid']}&pid={$pid}")); notification_add($post['uid'], 'post', $note, 0, $anonymous); } //热点 if ($thread['uid'] != $_SGLOBAL['supe_uid']) { hot_update('tid', $thread['tid'], $thread['hotuser']);
$newdoid = C::t('home_doing')->insert($setarr, 1); $setarr = array('recentnote' => $message, 'spacenote' => $message); $credit = $experience = 0; $extrasql = array('doings' => 1); updatecreditbyaction('doing', 0, $extrasql); C::t('common_member_field_home')->update($_G['uid'], $setarr); if ($_POST['to_signhtml'] && $_G['group']['maxsigsize']) { if ($_G['group']['maxsigsize'] < 200) { $signhtml = getstr($_POST['message'], $_G['group']['maxsigsize'], 0, 0, 1); $signhtml = preg_replace("/\\<br.*?\\>/i", ' ', $signhtml); } else { $signhtml = $message; } C::t('common_member_field_forum')->update($_G['uid'], array('sightml' => $signhtml)); } if (helper_access::check_module('feed') && ckprivacy('doing', 'feed') && $doing_status == '0') { $feedarr = array('appid' => '', 'icon' => 'doing', 'uid' => $_G['uid'], 'username' => $_G['username'], 'dateline' => $_G['timestamp'], 'title_template' => lang('feed', 'feed_doing_title'), 'title_data' => serialize(array('message' => $message)), 'body_template' => '', 'body_data' => '', 'id' => $newdoid, 'idtype' => 'doid'); C::t('home_feed')->insert($feedarr); } if ($doing_status == '1') { updatemoderate('doid', $newdoid); manage_addnotify('verifydoing'); } require_once libfile('function/stat'); updatestat('doing'); C::t('common_member_status')->update($_G['uid'], array('lastpost' => TIMESTAMP), 'UNBUFFERED'); if (!empty($_GET['fromcard'])) { showmessage($message . lang('spacecp', 'card_update_doing')); } else { showmessage('do_success', dreferer(), array('doid' => $newdoid), $_GET['spacenote'] ? array('showmsg' => false) : array('header' => true)); }
$groups = friend_group_list(); space_merge($space, 'count'); space_merge($space, 'field_home'); $maxfriendnum = checkperm('maxfriendnum'); if ($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) { if ($_G['magic']['friendnum']) { showmessage('enough_of_the_number_of_friends_with_magic'); } else { showmessage('enough_of_the_number_of_friends'); } } if (friend_request_check($uid)) { if (submitcheck('add2submit')) { $_POST['gid'] = intval($_POST['gid']); friend_add($uid, $_POST['gid']); if (ckprivacy('friend', 'feed')) { require_once libfile('function/feed'); feed_add('friend', 'feed_friend_title', array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>")); } notification_add($uid, 'friend', 'friend_add'); showmessage('friends_add', dreferer(), array('username' => $tospace['username'], 'uid' => $uid, 'from' => $_G['gp_from']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true)); } $op = 'add2'; $groupselect = empty($space['privacy']['groupname']) ? array(1 => ' checked') : array(); $navtitle = lang('core', 'title_friend_add'); include template('home/spacecp_friend'); exit; } else { if (getcount('home_friend_request', array('uid' => $uid, 'fuid' => $_G['uid']))) { showmessage('waiting_for_the_other_test'); }
private function _userFriendSetting($res, $uid, $gid, $note) { global $_G; require_once libfile('function/friend'); require_once libfile('function/spacecp'); require_once libfile('function/home'); if (!checkperm('allowfriend')) { return $this->makeErrorInfo($res, 'no_privilege_addfriend'); } if ($uid == $_G['uid']) { return $this->makeErrorInfo($res, 'friend_self_error'); } if (friend_check($uid)) { return $this->makeErrorInfo($res, 'you_have_friends'); } $tospace = getuserbyuid($uid); if (empty($tospace)) { return $this->makeErrorInfo($res, 'space_does_not_exist'); } if (isblacklist($tospace['uid'])) { return $this->makeErrorInfo($res, 'is_blacklist'); } // $res['body']['gidInfo'] = $this->_getFriendGroupList(); space_merge($space, 'count'); space_merge($space, 'field_home'); $maxfriendnum = checkperm('maxfriendnum'); if ($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) { if ($_G['magic']['friendnum']) { return $this->makeErrorInfo($res, 'enough_of_the_number_of_friends_with_magic'); } else { return $this->makeErrorInfo($res, 'enough_of_the_number_of_friends'); } } if (friend_request_check($uid)) { // if(submitcheck('add2submit')) { $_POST['gid'] = intval($gid); friend_add($uid, $uid); if (ckprivacy('friend', 'feed')) { require_once libfile('function/feed'); feed_add('friend', 'feed_friend_title', array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>")); } notification_add($uid, 'friend', 'friend_add'); // showmessage('friends_add', dreferer(), array('username' => $tospace['username'], 'uid'=>$uid, 'from' => $_GET['from']), array('showdialog'=>1, 'showmsg' => true, 'closetime' => true)); return $this->makeErrorInfo($res, 'friends_add', array('{username}' => $tospace['username'])); // } // $op = 'add2'; // $groupselect = empty($space['privacy']['groupname']) ? array(1 => ' checked') : array(); // $navtitle = lang('core', 'title_friend_add'); // include template('home/spacecp_friend'); // exit(); } else { if (C::t('home_friend_request')->count_by_uid_fuid($uid, $_G['uid'])) { return $this->makeErrorInfo($res, 'waiting_for_the_other_test'); } $_POST['gid'] = $gid; $_POST['note'] = censor(htmlspecialchars(cutstr($note, strtolower(CHARSET) == 'utf-8' ? 30 : 20, ''))); friend_add($uid, $_POST['gid'], $_POST['note']); $note = array('uid' => $_G['uid'], 'url' => 'home.php?mod=spacecp&ac=friend&op=add&uid=' . $_G['uid'] . '&from=notice', 'from_id' => $_G['uid'], 'from_idtype' => 'friendrequest', 'note' => !empty($_POST['note']) ? lang('spacecp', 'friend_request_note', array('note' => $_POST['note'])) : ''); notification_add($uid, 'friend', 'friend_request', $note); require_once libfile('function/mail'); $values = array('username' => $tospace['username'], 'url' => getsiteurl() . 'home.php?mod=spacecp&ac=friend&op=request'); sendmail_touser($uid, lang('spacecp', 'friend_subject', $values), '', 'friend_add'); return $this->makeErrorInfo($res, 'request_has_been_sent'); } return $res; }
$dateline = $_SGLOBAL['timestamp'] - 600; $query = $_SGLOBAL['db']->query("SELECT pic.* FROM " . tname("eventpic") . " ep LEFT JOIN " . tname("pic") . " pic ON ep.picid=pic.picid WHERE ep.uid='{$_SGLOBAL['supe_uid']}' AND ep.eventid='{$eventid}' AND ep.dateline > {$dateline} ORDER BY ep.dateline DESC LIMIT 4"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $imgs[] = pic_get($value['filepath'], $value['thumb'], $value['remote']); $imglinks[] = "space.php?do=event&id={$eventid}&view=pic&picid=" . $value['picid']; } $picnum = 0; if ($imgs) { $picnum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname("eventpic") . " WHERE eventid='{$eventid}'"), 0); feed_add('event', cplang('event_feed_share_pic_title'), '', cplang('event_feed_share_pic_info'), array("eventid" => $eventid, "title" => $event['title'], "picnum" => $picnum), '', $imgs, $imglinks); } $_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET picnum='{$picnum}', updatetime='{$_SGLOBAL['timestamp']}' WHERE eventid='{$eventid}'"); showmessage('do_success', 'space.php?do=event&view=pic&id=' . $eventid, 0); } else { //相册feed if (ckprivacy('upload', 1)) { include_once S_ROOT . './source/function_feed.php'; feed_publish($_POST['opalbumid'], 'albumid'); } //单个图片feed if ($_POST['topicid']) { topic_join($_POST['topicid'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); $url = "space.php?do=topic&topicid={$_POST['topicid']}&view=pic"; } else { $url = "space.php?uid={$_SGLOBAL['supe_uid']}&do=album&id=" . (empty($_POST['opalbumid']) ? -1 : $_POST['opalbumid']); } capi_showmessage_by_data('upload_images_completed', $url, 0); } } else { if (!checkperm('allowupload')) { ckspacelog();
$note_text = getstr($_POST['message'], 200, 1, 1, 1, 0, -1); $note_message = strlen($message) > 200 ? $note_text : $message; $setarr = array('note' => $note_message); if (!empty($_POST['spacenote'])) { $setarr['spacenote'] = $note_text; } updatetable('spacefield', $setarr, array('uid' => $_SGLOBAL['supe_uid'])); //事件feed $fs = array(); $fs['icon'] = 'doing'; $fs['title_template'] = cplang('feed_doing_title'); $fs['title_data'] = array('message' => $message); $fs['body_template'] = ''; $fs['body_data'] = array('doid' => $newdoid); $fs['body_general'] = ''; if ($add_doing && ckprivacy('doing', 1)) { feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']); } showmessage('do_success', 'space.php?do=doing&view=me', 0); } elseif (submitcheck('commentsubmit')) { if (!checkperm('allowdoing')) { showmessage('no_privilege'); } //实名认证 ckrealname('doing'); //新用户见习 cknewuser(); //判断是否操作太快 $waittime = interval_check('post'); if ($waittime > 0) { showmessage('operating_too_fast', '', 1, array($waittime));
} elseif(submitcheck('showsubmit')) { $showcredit = intval($_POST['showcredit']); if($showcredit > $space['credit']) $showcredit = $space['credit']; if($showcredit < 1) { showmessage('showcredit_error'); } $_POST['note'] = getstr($_POST['note'], 100, 1, 1, 1); //增加 $count = getcount('show', array('uid'=>$_SGLOBAL['supe_uid'])); if($count) { $notesql = $_POST['note']?", note='$_POST[note]'":''; $_SGLOBAL['db']->query("UPDATE ".tname('show')." SET credit=credit+$showcredit $notesql WHERE uid='$_SGLOBAL[supe_uid]'"); } else { inserttable('show', array('uid'=>$_SGLOBAL['supe_uid'], 'username'=>$_SGLOBAL['supe_username'], 'credit'=>$showcredit, 'note'=>$_POST['note']), 0, true); } //减少自己的积分 $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$showcredit WHERE uid='$space[uid]'"); //feed if(ckprivacy('show', 1)) { feed_add('show', cplang('feed_showcredit_self'), array('credit'=>$showcredit), '', array(), $_POST['note']); } showmessage('showcredit_do_success', "space.php?do=top"); } ?>
function mtag_join($type, $key, $fieldid=0) { global $_SGLOBAL, $space; //判断用户是否已经加入 $havejoin = 0; $key = addslashes($key); if($type == 'tagid') { $wheresql = "main.tagid='$key'"; } else { if(strlen($key) < 2) { showmessage('mtag_tagname_error'); } $wheresql = "main.tagname='$key' AND main.fieldid='$fieldid'"; } $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('mtag')." main WHERE $wheresql LIMIT 1"); if($mtag = $_SGLOBAL['db']->fetch_array($query)) { //判断是否加入 $fieldid = $mtag['fieldid']; $havejoin = getcount('tagspace', array('tagid'=>$mtag['tagid'], 'uid'=>$_SGLOBAL['supe_uid'])); } elseif($type == 'tagid') { return array(); } if($havejoin) { return $mtag; } $field = $_SGLOBAL['profield'][$fieldid]; if(!$mtag) { //创建 $mtag = array( 'tagname' => $key, 'fieldid' => $fieldid ); $tagid = inserttable('mtag', $mtag, 1); $mtag['tagid'] = $tagid; } else { $tagid = $mtag['tagid']; } //检查个数 $mtag['title'] = $field['title']; //自己在当前栏目下面的群组 $maxinputnum = 0; if($field['formtype'] == 'text' || $field['formtype'] == 'multi') { $maxinputnum = intval($field['inputnum']); } elseif($field['formtype'] == 'select') { $maxinputnum = 1; } if($maxinputnum) { $var = "myinputnum_$fieldid"; $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('tagspace')." ts, ".tname('mtag')." mtag WHERE ts.tagid=mtag.tagid AND ts.uid='$_SGLOBAL[supe_uid]' AND mtag.fieldid='$fieldid'"); $_SGLOBAL[$var] = $_SGLOBAL['db']->result($query, 0); if($_SGLOBAL[$var] >= $maxinputnum) { showmessage('mtag_join_field_error', '', 1, array($field['title'], $maxinputnum)); } } //加入 $setarr = array( 'tagid' => $tagid, 'uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'] ); if($mtag['joinperm'] == 2) { return array(); } elseif($mtag['joinperm'] == 1) { $mtag['grade'] = $setarr['grade'] = -2;//需要审核 } else { //检测是否有群主 $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('tagspace')." WHERE tagid='$tagid' AND grade>=8"); $modcount = $_SGLOBAL['db']->result($query, 0); if($modcount) { $mtag['grade'] = $setarr['grade'] = 0;//已经有群主 } else { $mtag['grade'] = $setarr['grade'] = $field['manualmoderator']?0:9;//自动为群主 } //事件通知 if(ckprivacy('mtag', 1)) { $fs = array(); $fs['icon'] = 'mtag'; $fs['title_template'] = cplang('feed_mtag_join'); $fs['title_data'] = array( 'mtag' => "<a href=\"space.php?do=mtag&tagid=$tagid\">$mtag[tagname]</a>", 'field' => "<a href=\"space.php?do=mtag&id=$mtag[fieldid]\">$mtag[title]</a>" ); feed_add($fs['icon'], $fs['title_template'], $fs['title_data']); } } if($setarr) { $_SGLOBAL['db']->query("UPDATE ".tname('mtag')." SET membernum=membernum+1 WHERE tagid='$tagid'"); inserttable('tagspace', $setarr, 0, true); $mtag['membernum'] = $mtag['membernum'] + 1; } return $mtag; }
$inserts = array(); foreach ($_POST['info'] as $key => $value) { $value = getstr($value, 500, 1, 1); $friend = intval($_POST['info_friend'][$key]); $inserts[] = "('{$space['uid']}','info','{$key}','{$value}','{$friend}')"; } if ($inserts) { $_SGLOBAL['db']->query("DELETE FROM " . tname('spaceinfo') . " WHERE uid='{$space['uid']}' AND type='info'"); $_SGLOBAL['db']->query("INSERT INTO " . tname('spaceinfo') . "\r\n\t\t\t\t(uid,type,subtype,title,friend)\r\n\t\t\t\tVALUES " . implode(',', $inserts)); } //变更记录 if ($_SCONFIG['my_status']) { inserttable('userlog', array('uid' => $_SGLOBAL['supe_uid'], 'action' => 'update', 'dateline' => $_SGLOBAL['timestamp'], 'type' => 2), 0, true); } //产生feed if (ckprivacy('profile', 1)) { feed_add('profile', cplang('feed_profile_update_info')); } $url = 'cp.php?ac=profile&op=info'; showmessage('update_on_successful_individuals', $url); } //隐私 $list = $friends = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceinfo') . " WHERE uid='{$space['uid']}' AND type='info'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $list[$value['subtype']] = $value; $friends[$value['subtype']][$value['friend']] = ' selected'; } } $cat_actives = array($_GET['op'] => ' class="active"'); if ($_GET['op'] == 'edu' || $_GET['op'] == 'work') {
function invite_update($inviteid, $uid, $username, $m_uid, $m_username, $appid=0) { global $_SGLOBAL, $_SN; if($uid && $uid != $m_uid) { $friendstatus = getfriendstatus($uid, $m_uid); if($friendstatus < 1) { friend_update($uid, $username, $m_uid, $m_username, 'invite'); //查找邀请记录 $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('invite')." WHERE uid='$m_uid' AND fuid='$uid'"); if($oldinvite = $_SGLOBAL['db']->fetch_array($query)) { //已经邀请过 return false; } //奖励积分 getreward('invitefriend', 1, $m_uid, '', 0); //feed $_SGLOBAL['supe_uid'] = $m_uid; $_SGLOBAL['supe_username'] = $m_username; //实名 realname_set($uid, $username); realname_get(); if(ckprivacy('invite', 1)) { $title_template = cplang('feed_invite'); $tite_data = array('username'=>'<a href="space.php?uid='.$uid.'">'.stripslashes($_SN[$uid]).'</a>'); feed_add('friend', $title_template, $tite_data); } //通知 $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = $username; notification_add($m_uid, 'friend', cplang('note_invite')); //更新邀请 $setarr = array('fuid'=>$uid, 'fusername'=>$username, 'appid'=>$appid); if($inviteid) { updatetable('invite', $setarr, array('id'=>$inviteid)); } else { $setarr['uid'] = $m_uid; inserttable('invite', $setarr, 0, true);//插入邀请记录 } } } }
require_once libfile('function/feed'); feed_add('show', 'feed_showcredit', array('fusername' => "<a href=\"home.php?mod=space&uid={$fuid}\">{$friend[fusername]}</a>", 'credit' => $showcredit)); } showmessage('showcredit_friend_do_success', "misc.php?mod=ranklist&type=member"); } elseif (submitcheck('showsubmit')) { $showcredit = intval($_POST['showcredit']); $unitprice = intval($_POST['unitprice']); if ($showcredit > $space[$key]) { $showcredit = $space[$key]; } if ($showcredit < 1 || $unitprice < 1) { showmessage('showcredit_error', '', array(), array('return' => 1)); } $_POST['note'] = getstr($_POST['note'], 100); $_POST['note'] = censor($_POST['note']); $showarr = C::t('home_show')->fetch($_G['uid']); if ($showarr) { $notesql = $_POST['note'] ? $_POST['note'] : false; $unitprice = $unitprice > $showarr['credit'] + $showcredit ? $showarr['credit'] + $showcredit : $unitprice; C::t('home_show')->update_credit_by_uid($_G['uid'], $showcredit, false, $unitprice, $notesql); } else { $unitprice = $unitprice > $showcredit ? $showcredit : $unitprice; C::t('home_show')->insert(array('uid' => $_G['uid'], 'username' => $_G['username'], 'unitprice' => $unitprice, 'credit' => $showcredit, 'note' => $_POST['note']), false, true); } updatemembercount($space['uid'], array($_G['setting']['creditstransextra'][6] => 0 - $showcredit), true, 'RKC', $space['uid']); if (ckprivacy('show', 'feed')) { require_once libfile('function/feed'); feed_add('show', 'feed_showcredit_self', array('credit' => $showcredit), '', array(), $_POST['note']); } showmessage('showcredit_do_success', dreferer()); }