function checkfield() { global $_G; $fields = array('realname', 'gender', 'birthyear', 'birthmonth', 'birthday', 'bloodtype', 'affectivestatus', 'birthprovince', 'birthcity', 'resideprovince', 'residecity'); loadcache('profilesetting'); $fieldsnew = array(); foreach ($fields as $v) { if (isset($_G['cache']['profilesetting'][$v])) { $fieldsnew[$v] = $_G['cache']['profilesetting'][$v]['title']; } } if ($fieldsnew) { space_merge($_G['member'], 'profile'); $none = array(); foreach ($_G['member'] as $k => $v) { if (in_array($k, $fields, true) && !trim($v)) { $none[] = $fieldsnew[$k]; } } $all = count($fields); $csc = intval(($all - count($none)) / $all * 100); return array($none, $csc); } else { return true; } }
function manyou_getuserapp($panel = 0) { global $_G; $panelapp = $_G['my_menu'] = $userapplist = $_G['my_panelapp'] = array(); $showcount = $_G['my_menu_more'] = 0; if ($_G['uid'] && $_G['setting']['my_app_status']) { space_merge($_G['member'], 'field_home'); if ($_G['member']['menunum'] < 3) { $_G['member']['menunum'] = 10; } $query = DB::query("SELECT ua.*, my.iconstatus, my.userpanelarea FROM " . DB::table('home_userapp') . " ua LEFT JOIN " . DB::table('common_myapp') . " my USING(appid) WHERE ua.uid='{$_G['uid']}' ORDER BY ua.menuorder DESC"); while ($value = DB::fetch($query)) { $value['icon'] = getmyappiconpath($value['appid'], $value['iconstatus']); if ($value['iconstatus'] == '0' && empty($_G['myapp_icon_downloaded'])) { $_G['myapp_icon_downloaded'] = '1'; downloadmyappicon($value['appid']); } if ($value['allowsidenav'] && !empty($value['appname'])) { $_G['my_userapp'][$value['appid']] = $value; if ($panel) { $userapplist[$value['appid']] = $value; if ($value['userpanelarea'] && $value['userpanelarea'] < 3) { $panelapp[$value['appid']] = $value; $_G['my_panelapp'][$value['userpanelarea']][$value['appid']] = $value; } } else { if (!isset($_G['cache']['userapp'][$value['appid']])) { if ($_G['member']['menunum'] > 100 || $showcount < $_G['member']['menunum']) { $_G['my_menu'][] = $value; $showcount++; } else { $_G['my_menu_more'] = 1; } } } } } if (!empty($userapplist)) { foreach ($panelapp as $appid => $value) { if (isset($_G['cache']['userapp'][$value['appid']])) { unset($_G['cache']['userapp'][$appid]); } } foreach ($userapplist as $appid => $value) { if (!isset($_G['cache']['userapp'][$value['appid']]) && !isset($panelapp[$value['appid']])) { if ($_G['member']['menunum'] > 100 || $showcount < $_G['member']['menunum']) { $_G['my_menu'][] = $value; $showcount++; } else { $_G['my_menu_more'] = 1; break; } } } } } }
/** * 修改原cknewuser方法 * * @author 谢建平 <*****@*****.**> * @param int $return 1为返回bool, 0为返回错误message * @return bool|string */ function mobcent_cknewuser($return = 0) { global $_G; $result = true; if (!$_G['uid']) { return true; } if (checkperm('disablepostctrl')) { return empty($return) ? '' : $result; } $ckuser = $_G['member']; if ($_G['setting']['newbiespan'] && $_G['timestamp'] - $ckuser['regdate'] < $_G['setting']['newbiespan'] * 60) { if (empty($return)) { // showmessage('no_privilege_newbiespan', '', array('newbiespan' => $_G['setting']['newbiespan']), array()); return lang('message', 'no_privilege_newbiespan', array('newbiespan' => $_G['setting']['newbiespan'])); } $result = false; } if ($_G['setting']['need_avatar'] && empty($ckuser['avatarstatus'])) { if (empty($return)) { // showmessage('no_privilege_avatar', '', array(), array()); return lang('message', 'no_privilege_avatar'); } $result = false; } if ($_G['setting']['need_email'] && empty($ckuser['emailstatus'])) { if (empty($return)) { // showmessage('no_privilege_email', '', array(), array()); return lang('message', 'no_privilege_email'); } $result = false; } if ($_G['setting']['need_friendnum']) { space_merge($ckuser, 'count'); if ($ckuser['friends'] < $_G['setting']['need_friendnum']) { if (empty($return)) { // showmessage('no_privilege_friendnum', '', array('friendnum' => $_G['setting']['need_friendnum']), array()); return lang('message', 'no_privilege_friendnum', array('friendnum' => $_G['setting']['need_friendnum'])); } $result = false; } } return empty($return) ? '' : $result; }
function mobcent_formulaperm($formula) { $msg = array('message' => '', 'params' => array()); global $_G; if ($_G['forum']['ismoderator']) { // return TRUE; return $msg; } $formula = dunserialize($formula); $medalperm = $formula['medal']; $permusers = $formula['users']; $permmessage = $formula['message']; if ($_G['setting']['medalstatus'] && $medalperm) { $exists = 1; $_G['forum_formulamessage'] = ''; $medalpermc = $medalperm; if ($_G['uid']) { $memberfieldforum = C::t('common_member_field_forum')->fetch($_G['uid']); $medals = explode("\t", $memberfieldforum['medals']); unset($memberfieldforum); foreach ($medalperm as $k => $medal) { foreach ($medals as $r) { list($medalid) = explode("|", $r); if ($medalid == $medal) { $exists = 0; unset($medalpermc[$k]); } } } } else { $exists = 0; } if ($medalpermc) { loadcache('medals'); foreach ($medalpermc as $medal) { if ($_G['cache']['medals'][$medal]) { $_G['forum_formulamessage'] .= '<img src="' . STATICURL . 'image/common/' . $_G['cache']['medals'][$medal]['image'] . '" style="vertical-align:middle;" /> ' . $_G['cache']['medals'][$medal]['name'] . ' '; } } // showmessage('forum_permforum_nomedal', NULL, array('forum_permforum_nomedal' => $_G['forum_formulamessage']), array('login' => 1)); return array('message' => 'forum_permforum_nomedal', 'params' => array('{forum_permforum_nomedal}' => $_G['forum_formulamessage'])); } } $formulatext = $formula[0]; $formula = $formula[1]; if ($_G['adminid'] == 1 || $_G['forum']['ismoderator'] || in_array($_G['groupid'], explode("\t", $_G['forum']['spviewperm']))) { // return FALSE; return $msg; } if ($permusers) { $permusers = str_replace(array("\r\n", "\r"), array("\n", "\n"), $permusers); $permusers = explode("\n", trim($permusers)); if (!in_array($_G['member']['username'], $permusers)) { // showmessage('forum_permforum_disallow', NULL, array(), array('login' => 1)); return array('message' => 'forum_permforum_disallow', 'params' => array()); } } if (!$formula) { // return FALSE; return $msg; } if (strexists($formula, '$memberformula[')) { preg_match_all("/\\\$memberformula\\['(\\w+?)'\\]/", $formula, $a); $profilefields = array(); foreach ($a[1] as $field) { switch ($field) { case 'regdate': $formula = preg_replace("/\\{(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})\\}/e", "'\\'\\1-'.sprintf('%02d', '\\2').'-'.sprintf('%02d', '\\3').'\\''", $formula); case 'regday': break; case 'regip': case 'lastip': $formula = preg_replace("/\\{([\\d\\.]+?)\\}/", "'\\1'", $formula); $formula = preg_replace('/(\\$memberformula\\[\'(regip|lastip)\'\\])\\s*=+\\s*\'([\\d\\.]+?)\'/', "strpos(\\1, '\\3')===0", $formula); case 'buyercredit': case 'sellercredit': space_merge($_G['member'], 'status'); break; case substr($field, 0, 5) == 'field': space_merge($_G['member'], 'profile'); $profilefields[] = $field; break; } } $memberformula = array(); if ($_G['uid']) { $memberformula = $_G['member']; if (in_array('regday', $a[1])) { $memberformula['regday'] = intval((TIMESTAMP - $memberformula['regdate']) / 86400); } if (in_array('regdate', $a[1])) { $memberformula['regdate'] = date('Y-m-d', $memberformula['regdate']); } $memberformula['lastip'] = $memberformula['lastip'] ? $memberformula['lastip'] : $_G['clientip']; } else { if (isset($memberformula['regip'])) { $memberformula['regip'] = $_G['clientip']; } if (isset($memberformula['lastip'])) { $memberformula['lastip'] = $_G['clientip']; } } } @eval("\$formulaperm = ({$formula}) ? TRUE : FALSE;"); if (!$formulaperm) { if (!$permmessage) { $language = lang('forum/misc'); $search = array('regdate', 'regday', 'regip', 'lastip', 'buyercredit', 'sellercredit', 'digestposts', 'posts', 'threads', 'oltime'); $replace = array($language['formulaperm_regdate'], $language['formulaperm_regday'], $language['formulaperm_regip'], $language['formulaperm_lastip'], $language['formulaperm_buyercredit'], $language['formulaperm_sellercredit'], $language['formulaperm_digestposts'], $language['formulaperm_posts'], $language['formulaperm_threads'], $language['formulaperm_oltime']); for ($i = 1; $i <= 8; $i++) { $search[] = 'extcredits' . $i; $replace[] = $_G['setting']['extcredits'][$i]['title'] ? $_G['setting']['extcredits'][$i]['title'] : $language['formulaperm_extcredits'] . $i; } if ($profilefields) { loadcache(array('fields_required', 'fields_optional')); foreach ($profilefields as $profilefield) { $search[] = $profilefield; $replace[] = !empty($_G['cache']['fields_optional']['field_' . $profilefield]) ? $_G['cache']['fields_optional']['field_' . $profilefield]['title'] : $_G['cache']['fields_required']['field_' . $profilefield]['title']; } } $i = 0; $_G['forum_usermsg'] = ''; foreach ($search as $s) { if (in_array($s, array('digestposts', 'posts', 'threads', 'oltime', 'extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8'))) { $_G['forum_usermsg'] .= strexists($formulatext, $s) ? '<br /> ' . $replace[$i] . ': ' . @eval('return intval(getuserprofile(\'' . $s . '\'));') : ''; } elseif (in_array($s, array('regdate', 'regip', 'regday'))) { $_G['forum_usermsg'] .= strexists($formulatext, $s) ? '<br /> ' . $replace[$i] . ': ' . @eval('return $memberformula[\'' . $s . '\'];') : ''; } $i++; } $search = array_merge($search, array('and', 'or', '>=', '<=', '==')); $replace = array_merge($replace, array(' <b>' . $language['formulaperm_and'] . '</b> ', ' <b>' . $language['formulaperm_or'] . '</b> ', '≥', '≤', '=')); $_G['forum_formulamessage'] = str_replace($search, $replace, $formulatext); } else { $_G['forum_formulamessage'] = $permmessage; } if (!$permmessage) { // showmessage('forum_permforum_nopermission', NULL, array('formulamessage' => $_G['forum_formulamessage'], 'usermsg' => $_G['forum_usermsg']), array('login' => 1)); return array('message' => 'forum_permforum_nopermission', 'params' => array('{formulamessage}' => $_G['forum_formulamessage'], '{usermsg}' => $_G['forum_usermsg'])); } else { // showmessage('forum_permforum_nopermission_custommsg', NULL, array('formulamessage' => $_G['forum_formulamessage']), array('login' => 1)); return array('message' => 'forum_permforum_nopermission_custommsg', 'params' => array('{formulamessage}' => $_G['forum_formulamessage'])); } } // return TRUE; return $msg; }
<div class="y"> <a href="member.php?mod=<?php echo $_G['setting']['regname'];?>"><?php echo $_G['setting']['reglinkname'];?></a> <a href="member.php?mod=logging&action=login" onclick="showWindow('login', this.href)">登录</a> </div> <?php } ?> <div class="z"> <a href="./" title="<?php echo $_G['setting']['bbname'];?>" class="xw1"><?php echo $_G['setting']['bbname'];?></a> <a href="home.php?mod=space&do=home" id="navs" class="showmenu" onmouseover="showMenu(this.id);">返回首页</a> </div> </div> <?php if($space['status'] == -1 && $_G['adminid'] == 1 ) { ?> <p class="ptw xw1 xi1 hm"><img src="<?php echo IMGDIR;?>/locked.gif" alt="Locked" class="vm" /> 提示: 作者被禁止或删除 内容自动屏蔽,只有管理员可见</p> <?php } ?> <div id="hd" class="wp cl"> <h2 id="spaceinfoshow"><?php space_merge($space, 'field_home'); $space[domainurl] = space_domain($space);getuserdiydata($space);$personalnv = isset($_G['blockposition']['nv']) ? $_G['blockposition']['nv'] : '';?><strong id="spacename" class="mbn"> <?php if($space['spacename']) { ?><?php echo $space['spacename'];?><?php } else { ?><?php echo $space['username'];?>的个人空间<?php } ?> </strong> <span class="xs0 xw0"> <a id="domainurl" href="<?php echo $space['domainurl'];?>" onclick="setCopy('<?php echo $space['domainurl'];?>', '空间地址复制成功');return false;"><?php echo $space['domainurl'];?></a> <a href="javascript:;" onclick="addFavorite(location.href, document.title)">[收藏]</a> <a id="domainurl" href="<?php echo $space['domainurl'];?>" onclick="setCopy('<?php echo $space['domainurl'];?>', '空间地址复制成功');return false;">[复制]</a> <?php if(!$space['self']) { if(helper_access::check_module('share')) { ?> <a id="share_space" href="home.php?mod=spacecp&ac=share&type=space&id=<?php echo $space['uid'];?>" onclick="showWindow(this.id, this.href, 'get', 0);">[分享]</a> <?php } ?> <a href="home.php?mod=rss&uid=<?php echo $space['uid'];?>">[RSS]</a> <?php } ?> </span> <span id="spacedescription" class="xs1 xw0 mtn"><?php echo $space['spacedescription'];?></span> </h2><?php if($_G['adminid'] == 1 && empty($space['self'])) { $personalnv['items'] = array(); $personalnv['banitems'] = array(); $personalnv['nvhidden'] = 0;?><?php } $nvclass = !empty($personalnv['nvhidden']) ? ' class="mininv"' : '';?><div id="nv"> <ul<?php echo $nvclass;?>>
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; }
function on_register() { global $_G; $_GET['username'] = $_GET['' . $this->setting['reginput']['username']]; $_GET['password'] = $_GET['' . $this->setting['reginput']['password']]; $_GET['password2'] = $_GET['' . $this->setting['reginput']['password2']]; $_GET['email'] = $_GET['' . $this->setting['reginput']['email']]; if ($_G['uid']) { $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : ''; $url_forward = dreferer(); if (strpos($url_forward, $this->setting['regname']) !== false) { $url_forward = 'forum.php'; } showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array('extrajs' => $ucsynlogin)); } elseif (!$this->setting['regclosed'] && (!$this->setting['regstatus'] || !$this->setting['ucactivation'])) { if ($_GET['action'] == 'activation' || $_GET['activationauth']) { if (!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) { showmessage('register_disable_activation'); } } elseif (!$this->setting['regstatus']) { if ($this->setting['regconnect']) { dheader('location:connect.php?mod=login&op=init&referer=forum.php&statfrom=login_simple'); } showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage'])); } } $bbrules =& $this->setting['bbrules']; $bbrulesforce =& $this->setting['bbrulesforce']; $bbrulestxt =& $this->setting['bbrulestxt']; $welcomemsg =& $this->setting['welcomemsg']; $welcomemsgtitle =& $this->setting['welcomemsgtitle']; $welcomemsgtxt =& $this->setting['welcomemsgtxt']; $regname = $this->setting['regname']; if ($this->setting['regverify']) { if ($this->setting['areaverifywhite']) { $location = $whitearea = ''; $location = trim(convertip($_G['clientip'], "./")); if ($location) { $whitearea = preg_quote(trim($this->setting['areaverifywhite']), '/'); $whitearea = str_replace(array("\\*"), array('.*'), $whitearea); $whitearea = '.*' . $whitearea . '.*'; $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i'; if (@preg_match($whitearea, $location)) { $this->setting['regverify'] = 0; } } } if ($_G['cache']['ipctrl']['ipverifywhite']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $this->setting['regverify'] = 0; break; } } } } $invitestatus = false; if ($this->setting['regstatus'] == 2) { if ($this->setting['inviteconfig']['inviteareawhite']) { $location = $whitearea = ''; $location = trim(convertip($_G['clientip'], "./")); if ($location) { $whitearea = preg_quote(trim($this->setting['inviteconfig']['inviteareawhite']), '/'); $whitearea = str_replace(array("\\*"), array('.*'), $whitearea); $whitearea = '.*' . $whitearea . '.*'; $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i'; if (@preg_match($whitearea, $location)) { $invitestatus = true; } } } if ($this->setting['inviteconfig']['inviteipwhite']) { foreach (explode("\n", $this->setting['inviteconfig']['inviteipwhite']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $invitestatus = true; break; } } } } $groupinfo = array(); if ($this->setting['regverify']) { $groupinfo['groupid'] = 8; } else { $groupinfo['groupid'] = $this->setting['newusergroupid']; } $seccodecheck = $this->setting['seccodestatus'] & 1; $secqaacheck = $this->setting['secqaa']['status'] & 1; $fromuid = !empty($_G['cookie']['promotion']) && $this->setting['creditspolicy']['promotion_register'] ? intval($_G['cookie']['promotion']) : 0; $username = isset($_GET['username']) ? $_GET['username'] : ''; $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : ''; $auth = $_GET['auth']; if (!$invitestatus) { $invite = getinvite(); } $sendurl = $this->setting['sendregisterurl'] ? true : false; if ($sendurl) { if (!empty($_GET['hash'])) { $_GET['hash'] = preg_replace("/[^\\[A-Za-z0-9_\\]%]/", '', $_GET['hash']); $hash = explode("\t", authcode($_GET['hash'], 'DECODE', $_G['config']['security']['authkey'])); if (is_array($hash) && isemail($hash[0]) && TIMESTAMP - $hash[1] < 259200) { $sendurl = false; } } } if (!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) { if ($_GET['action'] == 'activation') { $auth = explode("\t", authcode($auth, 'DECODE')); if (FORMHASH != $auth[1]) { showmessage('register_activation_invalid', 'member.php?mod=logging&action=login'); } $username = $auth[0]; $activationauth = authcode("{$auth['0']}\t" . FORMHASH, 'ENCODE'); $sendurl = false; } if (!$sendurl) { if ($fromuid) { $member = getuserbyuid($fromuid); if (!empty($member)) { $fromuser = dhtmlspecialchars($member['username']); } else { dsetcookie('promotion'); } } if ($_GET['action'] == 'activation') { $auth = dhtmlspecialchars($auth); } if ($seccodecheck) { $seccode = random(6, 1); } $username = dhtmlspecialchars($username); $htmls = $settings = array(); foreach ($_G['cache']['fields_register'] as $field) { $fieldid = $field['fieldid']; $html = profile_setting($fieldid, array(), false, false, true); if ($html) { $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid]; $htmls[$fieldid] = $html; } } $navtitle = $this->setting['reglinkname']; if ($this->extrafile && file_exists($this->extrafile)) { require_once $this->extrafile; } } $bbrulestxt = nl2br("\n{$bbrulestxt}\n\n"); $dreferer = dreferer(); include template($this->template); } else { $activationauth = array(); if (isset($_GET['activationauth']) && $_GET['activationauth']) { $activationauth = explode("\t", authcode($_GET['activationauth'], 'DECODE')); if ($activationauth[1] != FORMHASH) { showmessage('register_activation_invalid', 'member.php?mod=logging&action=login'); } $sendurl = false; } if (!$activationauth && ($sendurl || !$_G['setting']['forgeemail'])) { checkemail($_GET['email']); } if ($sendurl) { $hashstr = urlencode(authcode("{$_GET['email']}\t{$_G['timestamp']}", 'ENCODE', $_G['config']['security']['authkey'])); $registerurl = "{$_G[siteurl]}member.php?mod=" . $this->setting['regname'] . "&hash={$hashstr}&email={$_GET[email]}"; $email_register_message = lang('email', 'email_register_message', array('bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $registerurl)); if (!sendmail("{$_GET['email']} <{$_GET['email']}>", lang('email', 'email_register_subject'), $email_register_message)) { runlog('sendmail', "{$_GET['email']} sendmail failed."); } showmessage('register_email_send_succeed', dreferer(), array('bbname' => $this->setting['bbname']), array('showdialog' => false, 'msgtype' => 3, 'closetime' => 10)); } $emailstatus = 0; if ($this->setting['sendregisterurl'] && !$sendurl) { $_GET['email'] = strtolower($hash[0]); $this->setting['regverify'] = $this->setting['regverify'] == 1 ? 0 : $this->setting['regverify']; if (!$this->setting['regverify']) { $groupinfo['groupid'] = $this->setting['newusergroupid']; } $emailstatus = 1; } if ($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) { showmessage('not_open_registration_invite'); } if ($bbrules && $bbrulehash != $_POST['agreebbrule']) { showmessage('register_rules_agree'); } $activation = array(); if (isset($_GET['activationauth']) && $activationauth && is_array($activationauth)) { if ($activationauth[1] == FORMHASH && !($activation = uc_get_user($activationauth[0]))) { showmessage('register_activation_invalid', 'member.php?mod=logging&action=login'); } } if (!$activation) { $usernamelen = dstrlen($username); if ($usernamelen < 3) { showmessage('profile_username_tooshort'); } elseif ($usernamelen > 15) { showmessage('profile_username_toolong'); } if (uc_get_user(addslashes($username)) && !C::t('common_member')->fetch_uid_by_username($username) && !C::t('common_member_archive')->fetch_uid_by_username($username)) { if ($_G['inajax']) { showmessage('profile_username_duplicate'); } else { showmessage('register_activation_message', 'member.php?mod=logging&action=login', array('username' => $username)); } } if ($this->setting['pwlength']) { if (strlen($_GET['password']) < $this->setting['pwlength']) { showmessage('profile_password_tooshort', '', array('pwlength' => $this->setting['pwlength'])); } } if ($this->setting['strongpw']) { $strongpw_str = array(); if (in_array(1, $this->setting['strongpw']) && !preg_match("/\\d+/", $_GET['password'])) { $strongpw_str[] = lang('member/template', 'strongpw_1'); } if (in_array(2, $this->setting['strongpw']) && !preg_match("/[a-z]+/", $_GET['password'])) { $strongpw_str[] = lang('member/template', 'strongpw_2'); } if (in_array(3, $this->setting['strongpw']) && !preg_match("/[A-Z]+/", $_GET['password'])) { $strongpw_str[] = lang('member/template', 'strongpw_3'); } if (in_array(4, $this->setting['strongpw']) && !preg_match("/[^a-zA-z0-9]+/", $_GET['password'])) { $strongpw_str[] = lang('member/template', 'strongpw_4'); } if ($strongpw_str) { showmessage(lang('member/template', 'password_weak') . implode(',', $strongpw_str)); } } $email = strtolower(trim($_GET['email'])); if (empty($email) && $_G['setting']['forgeemail']) { $_GET['email'] = $email = strtolower(random(6)) . '@' . $_SERVER['HTTP_HOST']; } if (empty($this->setting['ignorepassword'])) { if ($_GET['password'] !== $_GET['password2']) { showmessage('profile_passwd_notmatch'); } if (!$_GET['password'] || $_GET['password'] != addslashes($_GET['password'])) { showmessage('profile_passwd_illegal'); } $password = $_GET['password']; } else { $password = md5(random(10)); } } $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($this->setting['censoruser'] = trim($this->setting['censoruser']), '/')) . ')$/i'; if ($this->setting['censoruser'] && @preg_match($censorexp, $username)) { showmessage('profile_username_protect'); } if ($this->setting['regverify'] == 2 && !trim($_GET['regmessage'])) { showmessage('profile_required_info_invalid'); } if ($_G['cache']['ipctrl']['ipregctrl']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $ctrlip = $ctrlip . '%'; $this->setting['regctrl'] = $this->setting['ipregctrltime']; break; } else { $ctrlip = $_G['clientip']; } } } else { $ctrlip = $_G['clientip']; } if ($this->setting['regctrl']) { if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $this->setting['regctrl'] * 3600)) { showmessage('register_ctrl', NULL, array('regctrl' => $this->setting['regctrl'])); } } $setregip = null; if ($this->setting['regfloodctrl']) { $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400); if ($regip) { if ($regip['count'] >= $this->setting['regfloodctrl']) { showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $this->setting['regfloodctrl'])); } else { $setregip = 1; } } else { $setregip = 2; } } $profile = $verifyarr = array(); foreach ($_G['cache']['fields_register'] as $field) { if (defined('IN_MOBILE')) { break; } $field_key = $field['fieldid']; $field_val = $_GET['' . $field_key]; if ($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) { $field_val = true; } if (!profile_check($field_key, $field_val)) { $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday'; showmessage($field['title'] . lang('message', 'profile_illegal'), '', array(), array('showid' => 'chk_' . $showid, 'extrajs' => $field['title'] . lang('message', 'profile_illegal') . ($field['formtype'] == 'text' ? '<script type="text/javascript">' . '$(\'registerform\').' . $field['fieldid'] . '.className = \'px er\';' . '$(\'registerform\').' . $field['fieldid'] . '.onblur = function () { if(this.value != \'\') {this.className = \'px\';$(\'chk_' . $showid . '\').innerHTML = \'\';}}' . '</script>' : ''))); } if ($field['needverify']) { $verifyarr[$field_key] = $field_val; } else { $profile[$field_key] = $field_val; } } if (!$activation) { $uid = uc_user_register(addslashes($username), $password, $email, $questionid, $answer, $_G['clientip']); if ($uid <= 0) { if ($uid == -1) { showmessage('profile_username_illegal'); } elseif ($uid == -2) { showmessage('profile_username_protect'); } elseif ($uid == -3) { showmessage('profile_username_duplicate'); } elseif ($uid == -4) { showmessage('profile_email_illegal'); } elseif ($uid == -5) { showmessage('profile_email_domain_illegal'); } elseif ($uid == -6) { showmessage('profile_email_duplicate'); } else { showmessage('undefined_action'); } } } else { list($uid, $username, $email) = $activation; } $_G['username'] = $username; if (getuserbyuid($uid, 1)) { if (!$activation) { uc_user_delete($uid); } showmessage('profile_uid_duplicate', '', array('uid' => $uid)); } $password = md5(random(10)); $secques = $questionid > 0 ? random(8) : ''; if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) { $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']); } if (isset($_POST['birthyear'])) { $profile['zodiac'] = get_zodiac($_POST['birthyear']); } if ($_FILES) { $upload = new discuz_upload(); foreach ($_FILES as $key => $file) { $field_key = 'field_' . $key; if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') { $upload->init($file, 'profile'); $attach = $upload->attach; if (!$upload->error()) { $upload->save(); if (!$upload->get_image_info($attach['target'])) { @unlink($attach['target']); continue; } $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment'])); if ($_G['cache']['fields_register'][$field_key]['needverify']) { $verifyarr[$key] = $attach['attachment']; } else { $profile[$key] = $attach['attachment']; } } } } } if ($setregip !== null) { if ($setregip == 1) { C::t('common_regip')->update_count_by_ip($_G['clientip']); } else { C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => 1, 'dateline' => $_G['timestamp'])); } } if ($invite && $this->setting['inviteconfig']['invitegroupid']) { $groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid']; } $init_arr = array('credits' => explode(',', $this->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus); C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr); if ($emailstatus) { updatecreditbyaction('realemail', $uid); } if ($verifyarr) { $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => serialize($verifyarr), 'dateline' => TIMESTAMP); C::t('common_member_verify_info')->insert($setverify); C::t('common_member_verify')->insert(array('uid' => $uid)); } require_once libfile('cache/userstats', 'function'); build_cache_userstats(); if ($this->extrafile && file_exists($this->extrafile)) { require_once $this->extrafile; } if ($this->setting['regctrl'] || $this->setting['regfloodctrl']) { C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($this->setting['regctrl'] > 72 ? $this->setting['regctrl'] : 72) * 3600); if ($this->setting['regctrl']) { C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp'])); } } $regmessage = dhtmlspecialchars($_GET['regmessage']); if ($this->setting['regverify'] == 2) { C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => $regmessage, 'remark' => ''), false, true); manage_addnotify('verifyuser'); } setloginstatus(array('uid' => $uid, 'username' => $_G['username'], 'password' => $password, 'groupid' => $groupinfo['groupid']), 0); include_once libfile('function/stat'); updatestat('register'); if ($invite['id']) { $result = C::t('common_invite')->count_by_uid_fuid($invite['uid'], $uid); if (!$result) { C::t('common_invite')->update($invite['id'], array('fuid' => $uid, 'fusername' => $_G['username'], 'regdateline' => $_G['timestamp'], 'status' => 2)); updatestat('invite'); } else { $invite = array(); } } if ($invite['uid']) { if ($this->setting['inviteconfig']['inviteaddcredit']) { updatemembercount($uid, array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['inviteaddcredit'])); } if ($this->setting['inviteconfig']['invitedaddcredit']) { updatemembercount($invite['uid'], array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['invitedaddcredit'])); } require_once libfile('function/friend'); friend_make($invite['uid'], $invite['username'], false); notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1); space_merge($invite, 'field_home'); if (!empty($invite['privacy']['feed']['invite'])) { require_once libfile('function/feed'); $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>'); feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']); } if ($invite['appid']) { updatestat('appinvite'); } } if ($welcomemsg && !empty($welcomemsgtxt)) { $welcomemsgtitle = replacesitevar($welcomemsgtitle); $welcomemsgtxt = replacesitevar($welcomemsgtxt); if ($welcomemsg == 1) { $welcomemsgtxt = nl2br(str_replace(':', ':', $welcomemsgtxt)); notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1); } elseif ($welcomemsg == 2) { sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt); } elseif ($welcomemsg == 3) { sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt); $welcomemsgtxt = nl2br(str_replace(':', ':', $welcomemsgtxt)); notification_add($uid, 'system', $welcomemsgtxt, array('from_id' => 0, 'from_idtype' => 'welcomemsg'), 1); } } if ($fromuid) { updatecreditbyaction('promotion_register', $fromuid); dsetcookie('promotion', ''); } dsetcookie('loginuser', ''); dsetcookie('activationauth', ''); dsetcookie('invite_auth', ''); $url_forward = dreferer(); $refreshtime = 3000; switch ($this->setting['regverify']) { case 1: $idstring = random(6); $authstr = $this->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : ''; C::t('common_member_field_forum')->update($_G['uid'], array('authstr' => $authstr)); $verifyurl = "{$_G[siteurl]}member.php?mod=activate&uid={$_G[uid]}&id={$idstring}"; $email_verify_message = lang('email', 'email_verify_message', array('username' => $_G['member']['username'], 'bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl)); if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) { runlog('sendmail', "{$email} sendmail failed."); } $message = 'register_email_verify'; $locationmessage = 'register_email_verify_location'; $refreshtime = 10000; break; case 2: $message = 'register_manual_verify'; $locationmessage = 'register_manual_verify_location'; break; default: $message = 'register_succeed'; $locationmessage = 'register_succeed_location'; break; } $param = array('bbname' => $this->setting['bbname'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']); if (strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) { $url_forward = 'forum.php'; } $href = str_replace("'", "\\'", $url_forward); $extra = array('showid' => 'succeedmessage', 'extrajs' => '<script type="text/javascript">' . 'setTimeout("window.location.href =\'' . $href . '\';", ' . $refreshtime . ');' . '$(\'succeedmessage_href\').href = \'' . $href . '\';' . '$(\'main_message\').style.display = \'none\';' . '$(\'main_succeed\').style.display = \'\';' . '$(\'succeedlocation\').innerHTML = \'' . lang('message', $locationmessage) . '\';' . '</script>', 'striptags' => false); showmessage($message, $url_forward, $param, $extra); } }
function sendmail_touser($touid, $subject, $message, $mailtype = '') { global $_G; if (empty($_G['setting']['sendmailday'])) { return false; } require_once libfile('function/home'); $tospace = getuserbyuid($touid); if (empty($tospace['email'])) { return false; } space_merge($tospace, 'field_home'); space_merge($tospace, 'status'); $acceptemail = $tospace['acceptemail']; if (!empty($acceptemail[$mailtype]) && $_G['timestamp'] - $tospace['lastvisit'] > $_G['setting']['sendmailday'] * 86400) { if (empty($tospace['lastsendmail'])) { $tospace['lastsendmail'] = $_G['timestamp']; } $sendtime = $tospace['lastsendmail'] + $acceptemail['frequency']; $value = C::t('common_mailcron')->fetch_all_by_touid($touid, 0, 1); $value = $value[0]; if ($value) { $cid = $value['cid']; if ($value['sendtime'] < $sendtime) { $sendtime = $value['sendtime']; } C::t('common_mailcron')->update($cid, array('email' => $tospace['email'], 'sendtime' => $sendtime)); } else { $cid = C::t('common_mailcron')->insert(array('touid' => $touid, 'email' => $tospace['email'], 'sendtime' => $sendtime), true); } $message = preg_replace("/href\\=\"(?!(http|https)\\:\\/\\/)(.+?)\"/i", 'href="' . $_G['siteurl'] . '\\1"', $message); $setarr = array('cid' => $cid, 'subject' => $subject, 'message' => $message, 'dateline' => $_G['timestamp']); C::t('common_mailqueue')->insert($setarr); return true; } return false; }
function check_formula_forum_isforbidden($formula) { global $_G; $formula = dunserialize($formula); $medalperm = $formula['medal']; $permusers = $formula['users']; $permmessage = $formula['message']; $formulatext = $formula[0]; $formula = $formula[1]; if ($_G['adminid'] == 1 || $_G['forum']['ismoderator'] || in_array($_G['groupid'], explode("\t", $_G['forum']['spviewperm']))) { return FALSE; } if ($permusers) { $permusers = str_replace(array("\r\n", "\r"), array("\n", "\n"), $permusers); $permusers = explode("\n", trim($permusers)); if (!in_array($_G['member']['username'], $permusers)) { return TRUE; } } if (!$formula) { return FALSE; } if (strexists($formula, '$memberformula[')) { preg_match_all("/\\\$memberformula\\['(\\w+?)'\\]/", $formula, $a); $profilefields = array(); foreach ($a[1] as $field) { switch ($field) { case 'regdate': $formula = preg_replace_callback("/\\{(\\d{4})\\-(\\d{1,2})\\-(\\d{1,2})\\}/", function ($matches) { return '\'' . $matches[1] . '-' . sprintf('%02d', $matches[2]) . '-' . sprintf('%02d', $matches[3]) . '\''; }, $formula); case 'regday': break; case 'regip': case 'lastip': $formula = preg_replace("/\\{([\\d\\.]+?)\\}/", "'\\1'", $formula); $formula = preg_replace('/(\\$memberformula\\[\'(regip|lastip)\'\\])\\s*=+\\s*\'([\\d\\.]+?)\'/', "strpos(\\1, '\\3')===0", $formula); case 'buyercredit': case 'sellercredit': space_merge($_G['member'], 'status'); break; case substr($field, 0, 5) == 'field': space_merge($_G['member'], 'profile'); $profilefields[] = $field; break; } } $memberformula = array(); if ($_G['uid']) { $memberformula = $_G['member']; if (in_array('regday', $a[1])) { $memberformula['regday'] = intval((TIMESTAMP - $memberformula['regdate']) / 86400); } if (in_array('regdate', $a[1])) { $memberformula['regdate'] = date('Y-m-d', $memberformula['regdate']); } $memberformula['lastip'] = $memberformula['lastip'] ? $memberformula['lastip'] : $_G['clientip']; } else { if (isset($memberformula['regip'])) { $memberformula['regip'] = $_G['clientip']; } if (isset($memberformula['lastip'])) { $memberformula['lastip'] = $_G['clientip']; } } } @eval("\$formulaperm = ({$formula}) ? TRUE : FALSE;"); if (!$formulaperm) { if (!$permmessage) { $language = lang('forum/misc'); $search = array('regdate', 'regday', 'regip', 'lastip', 'buyercredit', 'sellercredit', 'digestposts', 'posts', 'threads', 'oltime'); $replace = array($language['formulaperm_regdate'], $language['formulaperm_regday'], $language['formulaperm_regip'], $language['formulaperm_lastip'], $language['formulaperm_buyercredit'], $language['formulaperm_sellercredit'], $language['formulaperm_digestposts'], $language['formulaperm_posts'], $language['formulaperm_threads'], $language['formulaperm_oltime']); for ($i = 1; $i <= 8; $i++) { $search[] = 'extcredits' . $i; $replace[] = $_G['setting']['extcredits'][$i]['title'] ? $_G['setting']['extcredits'][$i]['title'] : $language['formulaperm_extcredits'] . $i; } if ($profilefields) { loadcache(array('fields_required', 'fields_optional')); foreach ($profilefields as $profilefield) { $search[] = $profilefield; $replace[] = !empty($_G['cache']['fields_optional']['field_' . $profilefield]) ? $_G['cache']['fields_optional']['field_' . $profilefield]['title'] : $_G['cache']['fields_required']['field_' . $profilefield]['title']; } } $i = 0; $_G['forum_usermsg'] = ''; foreach ($search as $s) { if (in_array($s, array('digestposts', 'posts', 'threads', 'oltime', 'extcredits1', 'extcredits2', 'extcredits3', 'extcredits4', 'extcredits5', 'extcredits6', 'extcredits7', 'extcredits8'))) { $_G['forum_usermsg'] .= strexists($formulatext, $s) ? '<br /> ' . $replace[$i] . ': ' . @eval('return intval(getuserprofile(\'' . $s . '\'));') : ''; } elseif (in_array($s, array('regdate', 'regip', 'regday'))) { $_G['forum_usermsg'] .= strexists($formulatext, $s) ? '<br /> ' . $replace[$i] . ': ' . @eval('return $memberformula[\'' . $s . '\'];') : ''; } $i++; } $search = array_merge($search, array('and', 'or', '>=', '<=', '==')); $replace = array_merge($replace, array(' <b>' . $language['formulaperm_and'] . '</b> ', ' <b>' . $language['formulaperm_or'] . '</b> ', '≥', '≤', '=')); $_G['forum_formulamessage'] = str_replace($search, $replace, $formulatext); } else { $_G['forum_formulamessage'] = $permmessage; } return TRUE; } return FALSE; }
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; }
private function _getPersonalDataInfo($puid, $space) { global $_G; $res['body']['PersonalData'] = array(); require_once libfile('function/spacecp'); space_merge($space, 'count'); space_merge($space, 'field_home'); space_merge($space, 'field_forum'); space_merge($space, 'profile'); space_merge($space, 'status'); $space['buyerrank'] = 0; if ($space['buyercredit']) { foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) { if ($space['buyercredit'] <= $credit) { $space['buyerrank'] = $level; break; } } } $space['sellerrank'] = 0; if ($space['sellercredit']) { foreach ($_G['setting']['ec_credit']['rank'] as $level => $credit) { if ($space['sellercredit'] <= $credit) { $space['sellerrank'] = $level; break; } } } require_once libfile('function/friend'); $isfriend = friend_check($space['uid'], 1); loadcache('profilesetting'); include_once libfile('function/profile'); $profiles = array(); $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array(); if ($_G['setting']['verify']['enabled']) { space_merge($space, 'verify'); } if ($_G['uid'] == $space['uid'] || $_G['group']['allowviewip']) { foreach ($_G['cache']['profilesetting'] as $fieldid => $field) { if (!$field['available'] || $field['invisible'] || in_array($fieldid, array('birthmonth', 'birthyear'))) { continue; } $val = profile_show($fieldid, $space); $profiles[] = array('type' => $fieldid, 'title' => $field['title'], 'data' => WebUtils::emptyHtml($val)); } } else { foreach ($_G['cache']['profilesetting'] as $fieldid => $field) { if (!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) { continue; } if ($field['available'] && (strlen($space[$fieldid]) > 0 || ($fieldid == 'birthcity' && strlen($space['birthprovince']) || $fieldid == 'residecity' && strlen($space['resideprovince']))) && ($space['self'] || empty($privacy[$fieldid]) || $isfriend && $privacy[$fieldid] == 1) && (!$_G['inajax'] && !$field['invisible'] || $_G['inajax'] && $field['showincard'])) { $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: 500px;" /></a></span>'; } $profiles[] = array('type' => $fieldid, 'title' => $field['title'], 'data' => WebUtils::emptyHtml($val)); } } } } return $profiles; }
if (submitcheck('blacklistsubmit')) { $_POST['username'] = trim($_POST['username']); $query = DB::query("SELECT * FROM " . DB::table('common_member') . " WHERE username='******'username']}'"); if (!($tospace = DB::fetch($query))) { showmessage('space_does_not_exist'); } if ($tospace['uid'] == $space['uid']) { showmessage('unable_to_manage_self'); } friend_delete($tospace['uid']); DB::insert('home_blacklist', array('uid' => $space['uid'], 'buid' => $tospace['uid'], 'dateline' => $_G['timestamp']), 0, true); showmessage('do_success', "home.php?mod=space&uid={$_G['uid']}&do=friend&view=blacklist&quickforward=1&start={$_GET['start']}"); } } elseif ($op == 'rand') { $userlist = $randuids = array(); space_merge($space, 'count'); if ($space['friends'] < 5) { $query = DB::query("SELECT uid FROM " . DB::table('common_session') . " LIMIT 0,100"); } else { $query = DB::query("SELECT fuid as uid FROM " . DB::table('home_friend') . " WHERE uid='{$_G['uid']}'"); } while ($value = DB::fetch($query)) { if ($value['uid'] != $space['uid']) { $userlist[] = $value['uid']; } } $randuids = sarray_rand($userlist, 1); showmessage('do_success', "home.php?mod=space&quickforward=1&uid=" . array_pop($randuids)); } elseif ($op == 'getcfriend') { $fuid = empty($_GET['fuid']) ? 0 : intval($_GET['fuid']); $list = array();
function interval_check($type) { global $_G; $waittime = 0; if (checkperm('disablepostctrl')) { return $waittime; } if ($_G['setting']['floodctrl']) { space_merge($_G['member'], 'status'); getuserprofile('lastpost'); $waittime = $_G['setting']['floodctrl'] - ($_G['timestamp'] - $_G['member']['lastpost']); } return $waittime; }
function sendmail_touser($touid, $subject, $message, $mailtype = '') { global $_G; if (empty($_G['setting']['sendmailday'])) { return false; } require_once libfile('function/home'); $tospace = getspace($touid); if (empty($tospace['email'])) { return false; } space_merge($tospace, 'field_home'); space_merge($tospace, 'status'); $acceptemail = $tospace['acceptemail']; if (!empty($acceptemail[$mailtype]) && $_G['timestamp'] - $tospace['lastvisit'] > $_G['setting']['sendmailday'] * 86400) { if (empty($tospace['lastsendmail'])) { $tospace['lastsendmail'] = $_G['timestamp']; } $sendtime = $tospace['lastsendmail'] + $acceptemail['frequency']; $query = DB::query("SELECT * FROM " . DB::table('common_mailcron') . " WHERE touid='{$touid}' LIMIT 1"); if ($value = DB::fetch($query)) { $cid = $value['cid']; if ($value['sendtime'] < $sendtime) { $sendtime = $value['sendtime']; } DB::update('common_mailcron', array('email' => addslashes($tospace['email']), 'sendtime' => $sendtime), array('cid' => $cid)); } else { $cid = DB::insert('common_mailcron', array('touid' => $touid, 'email' => addslashes($tospace['email']), 'sendtime' => $sendtime), 1); } $message = preg_replace("/href\\=\"(?!http\\:\\/\\/)(.+?)\"/i", 'href="' . $_G['siteurl'] . '\\1"', $message); $setarr = array('cid' => $cid, 'subject' => addslashes($subject), 'message' => addslashes($message), 'dateline' => $_G['timestamp']); DB::insert('common_mailqueue', $setarr); return true; } return false; }
function getuserapp() { global $_G; $_G['my_userapp'] = $_G['my_menu'] = array(); $_G['my_menu_more'] = 0; if ($_G['uid'] && $_G['setting']['my_app_status']) { space_merge($_G['member'], 'field_home'); $showcount = 0; $query = DB::query("SELECT * FROM " . DB::table('home_userapp') . " WHERE uid='{$_G['uid']}' ORDER BY menuorder DESC", 'SILENT'); while ($value = DB::fetch($query)) { $_G['my_userapp'][$value['appid']] = $value; if ($value['allowsidenav'] && !isset($_G['cache']['userapp'][$value['appid']])) { if ($_G['member']['menunum'] < 5) { $_G['member']['menunum'] = 10; } if ($_G['member']['menunum'] > 100 || $showcount < $_G['member']['menunum']) { $_G['my_menu'][] = $value; $showcount++; } else { $_G['my_menu_more'] = 1; } } } } }
$rule['cyclenum'] = $rule['rewardnum'] ? $rule['rewardnum'] - $creditlog['cyclenum'] : 0; } dsetcookie('reward_log', ''); } } elseif ($op == 'district') { $container = $_GET['container']; $showlevel = intval($_GET['level']); $showlevel = $showlevel >= 1 && $showlevel <= 4 ? $showlevel : 4; $values = array(intval($_GET['pid']), intval($_GET['cid']), intval($_GET['did']), intval($_GET['coid'])); $containertype = in_array($_GET['containertype'], array('birth', 'reside'), true) ? $_GET['containertype'] : 'birth'; $level = 1; if ($values[0]) { $level++; } else { if ($_G['uid'] && !empty($_GET['showdefault'])) { space_merge($_G['member'], 'profile'); $district = array(); if ($containertype == 'birth') { if (!empty($_G['member']['birthprovince'])) { $district[] = $_G['member']['birthprovince']; if (!empty($_G['member']['birthcity'])) { $district[] = $_G['member']['birthcity']; } if (!empty($_G['member']['birthdist'])) { $district[] = $_G['member']['birthdist']; } if (!empty($_G['member']['birthcommunity'])) { $district[] = $_G['member']['birthcommunity']; } } } else {
public static function notification_add($username, $touid, $type, $note, $uid, $notevars = array(), $system = 0) { global $_G; if (!($tospace = getuserbyuid($touid))) { return false; } space_merge($tospace, 'field_home'); $filter = empty($tospace['privacy']['filter_note']) ? array() : array_keys($tospace['privacy']['filter_note']); if ($filter && (in_array($type . '|0', $filter) || in_array($type . '|' . $_G['uid'], $filter))) { return false; } $notevars['actor'] = "<a href=\"home.php?mod=space&uid={$_G['uid']}\">" . $username . "</a>"; if (!is_numeric($type)) { $vars = explode(':', $note); if (count($vars) == 2) { $notestring = lang('plugin/' . $vars[0], $vars[1], $notevars); } else { $notestring = lang('notification', $note, $notevars); } $frommyapp = false; } else { $frommyapp = true; $notestring = $note; } $oldnote = array(); if ($notevars['from_id'] && $notevars['from_idtype']) { $oldnote = C::t('home_notification')->fetch_by_fromid_uid($notevars['from_id'], $notevars['from_idtype'], $touid); } if (empty($oldnote['from_num'])) { $oldnote['from_num'] = 0; } $notevars['from_num'] = $notevars['from_num'] ? $notevars['from_num'] : 1; $setarr = array('uid' => $touid, 'type' => $type, 'new' => 1, 'authorid' => $uid, 'author' => $username, 'note' => $notestring, 'dateline' => $_G['timestamp'], 'from_id' => $notevars['from_id'], 'from_idtype' => $notevars['from_idtype'], 'from_num' => $oldnote['from_num'] + $notevars['from_num']); if ($system) { $setarr['authorid'] = 0; $setarr['author'] = ''; } $pkId = 0; if ($oldnote['id']) { C::t('home_notification')->update($oldnote['id'], $setarr); $pkId = $oldnote['id']; } else { $oldnote['new'] = 0; $pkId = C::t('home_notification')->insert($setarr, true); } $banType = array('task'); if ($_G['setting']['cloud_status'] && !in_array($type, $banType)) { $noticeService = Cloud::loadClass('Service_Client_Notification'); if ($oldnote['id']) { $noticeService->update($touid, $pkId, $setarr['from_num'], $setarr['dateline']); } else { $extra = $type == 'post' ? array('pId' => $notevars['pid']) : array(); $noticeService->add($touid, $pkId, $type, $setarr['authorid'], $setarr['author'], $setarr['from_id'], $setarr['from_idtype'], $setarr['note'], $setarr['from_num'], $setarr['dateline'], $extra); } } if (empty($oldnote['new'])) { C::t('common_member')->increase($touid, array('newprompt' => 1)); require_once libfile('function/mail'); $mail_subject = lang('notification', 'mail_to_user'); sendmail_touser($touid, $mail_subject, $notestring, $frommyapp ? 'myapp' : $type); } if (!$system && $_G['uid'] && $touid != $_G['uid']) { C::t('home_friend')->update_num_by_uid_fuid(1, $_G['uid'], $touid); } }
} space_merge($space, 'field_home'); if (!empty($space['privacy']['feed']['invite'])) { require_once libfile('function/feed'); $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>'); feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $space['uid'], $space['username']); } if ($_G['setting']['inviteconfig']['inviteaddcredit']) { updatemembercount($_G['uid'], array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['inviteaddcredit'])); } if ($_G['setting']['inviteconfig']['invitedaddcredit']) { updatemembercount($uid, array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['invitedaddcredit'])); } include_once libfile('function/stat'); updatestat($appid ? 'appinvite' : 'invite'); showmessage('invite_friend_ok', $jumpurl); } else { dsetcookie('invite_auth', $cookievar, 604800); } space_merge($space, 'count'); space_merge($space, 'field_home'); space_merge($space, 'profile'); $flist = array(); $query = C::t('home_friend')->fetch_all_by_uid($uid, 0, 12, true); foreach ($query as $value) { $value['uid'] = $value['fuid']; $value['username'] = $value['fusername']; $flist[] = $value; } $jumpurl = urlencode($jumpurl); include_once template('home/invite');
} } } $space['attachsize'] = formatsize($space['attachsize']); $space['timeoffset'] = empty($space['timeoffset']) ? '9999' : $space['timeoffset']; if (strtotime($space['regdate']) + $space['oltime'] * 3600 > TIMESTAMP) { $space['oltime'] = 0; } require_once libfile('function/friend'); $isfriend = friend_check($space['uid'], 1); loadcache('profilesetting'); include_once libfile('function/profile'); $profiles = array(); $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array(); if ($_G['setting']['verify']['enabled']) { space_merge($space, 'verify'); } foreach ($_G['cache']['profilesetting'] as $fieldid => $field) { if (!$field['available'] || in_array($fieldid, array('birthprovince', 'birthdist', 'birthcommunity', 'resideprovince', 'residedist', 'residecommunity'))) { continue; } if ($field['available'] && strlen($space[$fieldid]) > 0 && ($field['showinthread'] || $field['showincard'] || ($space['self'] || empty($privacy[$fieldid]) || $isfriend && $privacy[$fieldid] == 1)) && (!$_G['inajax'] && $field['invisible'] != '1' || $_G['inajax'] && $field['showincard'])) { $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: 500px;" /></a></span>'; }
ckstart($start, $perpage); $fuids = $list = array(); $count = DB::result(DB::query("SELECT COUNT(*) FROM " . DB::table('home_poke') . " WHERE uid='{$space['uid']}'"), 0); if ($count) { $query = DB::query("SELECT * FROM " . DB::table('home_poke') . " WHERE uid='{$space['uid']}' ORDER BY dateline DESC LIMIT {$start},{$perpage}"); while ($value = DB::fetch($query)) { $value['uid'] = $value['fromuid']; $value['username'] = $value['fromusername']; $fuids[$value['uid']] = $value['uid']; $list[$value['uid']] = $value; } if ($fuids) { require_once libfile('function/friend'); friend_check($fuids); $value = array(); foreach ($fuids as $key => $fuid) { $value['isfriend'] = $fuid == $space['uid'] || $_G["home_friend_" . $space['uid'] . '_' . $fuid] ? 1 : 0; $list[$fuid] = array_merge($list[$fuid], $value); } } } $multi = multi($count, $perpage, $page, "home.php?mod=spacecp&ac=poke"); $pokenum = getcount('home_poke', array('uid' => $space['uid'])); space_merge($space, 'status'); if ($pokenum != $space['pokes']) { $changenum = $pokenum - $space['pokes']; member_status_update($space['uid'], array('pokes' => $changenum)); } } $actives = array($op == 'send' ? 'send' : 'poke' => ' class="a"'); include_once template('home/spacecp_poke');
function friend_cache($touid) { global $_G; $tospace = array('uid' => $touid); space_merge($tospace, 'field_home'); $filtergids = empty($tospace['privacy']['filter_gid']) ? array() : $tospace['privacy']['filter_gid']; $uids = array(); $count = 0; $fcount = 0; $query = DB::query("SELECT * FROM " . DB::table('home_friend') . " WHERE uid='{$touid}' ORDER BY num DESC, dateline DESC"); while ($value = DB::fetch($query)) { if ($value['fuid'] == $touid) { continue; } if ($fcount > 200) { $count = DB::num_rows($query); DB::free_result($query); break; } elseif (empty($filtergids) || !in_array($value['gid'], $filtergids)) { $uids[] = $value['fuid']; $fcount++; } $count++; } DB::update('common_member_field_home', array('feedfriend' => implode(',', $uids)), array('uid' => $touid)); DB::update('common_member_count', array('friends' => $count), array('uid' => $touid)); }
dsetcookie('auth', authcode("{$_G['member']['password']}\t{$_G['uid']}", 'ENCODE'), 2592000, 1, true); if ($invite['id']) { DB::update("common_invite", array('fuid' => $uid, 'fusername' => $username, 'regdateline' => $_G['timestamp'], 'status' => 2), array('id' => $invite['id'])); updatestat('invite'); } if ($invite['uid']) { if ($_G['setting']['inviteconfig']['inviteaddcredit']) { updatemembercount($uid, array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['inviteaddcredit'])); } if ($_G['setting']['inviteconfig']['invitedaddcredit']) { updatemembercount($invite['uid'], array($_G['setting']['inviteconfig']['inviterewardcredit'] => $_G['setting']['inviteconfig']['invitedaddcredit'])); } require_once libfile('function/friend'); friend_make($invite['uid'], $invite['username'], false); notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1); space_merge($invite, 'field_home'); if (!empty($invite['privacy']['feed']['invite'])) { require_once libfile('function/feed'); $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>'); feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']); } if ($invite['appid']) { updatestat('appinvite'); } } if ($welcomemsg && !empty($welcomemsgtxt)) { $welcomtitle = !empty($_G['setting']['welcomemsgtitle']) ? $_G['setting']['welcomemsgtitle'] : "Welcome to " . $_G['setting']['bbname'] . "!"; $welcomtitle = addslashes(replacesitevar($welcomtitle)); $welcomemsgtxt = addslashes(replacesitevar($welcomemsgtxt)); if ($welcomemsg == 1) { sendpm($uid, $welcomtitle, $welcomemsgtxt, 0);
function getblockhtml($blockname, $parameters = array()) { global $_G, $space; $parameters = empty($parameters) ? array() : $parameters; $list = array(); $sql = $title = $html = $wheresql = $ordersql = $titlemore = $do = $view = $contentclassname = ''; $contenttagname = 'div'; $shownum = 6; $uid = intval($space['uid']); $shownum = empty($parameters['shownum']) ? $shownum : intval($parameters['shownum']); switch ($blockname) { case 'profile': $do = $blockname; $managehtml = ''; $avatar = empty($parameters['banavatar']) ? 'middle' : $parameters['banavatar']; $html .= "<div class=\"hm\"><p><a href=\"home.php?mod=space&uid={$uid}\" target=\"__blank\">" . avatar($uid, $avatar) . '</a></p>'; $html .= "<h2><a href=\"home.php?mod=space&uid={$uid}\" target=\"__blank\">" . $space['username'] . "</a></h2>"; $html .= '</div><ul class="xl xl2 cl ul_list">'; $magicinfo = $showmagicgift = false; if ($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) { $showmagicgift = true; $magicinfo = !empty($space['magicgift']) ? unserialize($space['magicgift']) : array(); } if ($space['self']) { $html .= '<li class="ul_diy"><a href="home.php?mod=space&diy=yes">' . lang('space', 'block_profile_diy') . '</a></li>'; $html .= '<li class="ul_msg"><a href="home.php?mod=space&uid=' . $uid . '&do=wall">' . lang('space', 'block_profile_wall') . '</a></li>'; $html .= '<li class="ul_avt"><a href="home.php?mod=spacecp&ac=avatar">' . lang('space', 'block_profile_avatar') . '</a></li>'; $html .= '<li class="ul_profile"><a href="home.php?mod=spacecp&ac=profile">' . lang('space', 'block_profile_update') . '</a></li>'; if ($showmagicgift) { $html .= '<li class="ul_magicgift"><div style="' . 'background: url(' . STATICURL . 'image/magic/gift.small.gif) no-repeat 0 50%;' . '">'; if ($magicinfo) { $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=retiregift">' . lang('magic/gift', 'gift_gc') . '</a>'; } else { $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=magic&mid=gift">' . lang('magic/gift', 'gift_use') . '</a>'; } $html .= '</div></li>'; } } else { require_once libfile('function/friend'); $isfriend = friend_check($uid); if (!$isfriend) { $html .= "<li class='ul_add'><a href=\"home.php?mod=spacecp&ac=friend&op=add&uid={$space['uid']}&handlekey=addfriendhk_{$space[uid]}\" id=\"a_friend_li_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_friend_add') . "</a></li>"; } else { $html .= "<li class='ul_ignore'><a href=\"home.php?mod=spacecp&ac=friend&op=ignore&uid={$space['uid']}&handlekey=ignorefriendhk_{$space[uid]}\" id=\"a_ignore_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_friend_ignore') . "</a></li>"; } $html .= "<li class='ul_msg'><a href=\"home.php?mod=space&uid={$space['uid']}&do=wall\">" . lang('space', 'block_profile_wall_to_me') . "</a></li>"; $html .= "<li class='ul_poke'><a href=\"home.php?mod=spacecp&ac=poke&op=send&uid={$space['uid']}&handlekey=propokehk_{$space[uid]}\" id=\"a_poke_{$space[uid]}\" onclick=\"showWindow(this.id, this.href, 'get', 0);\">" . lang('space', 'block_profile_poke') . "</a></li>"; $html .= "<li class='ul_pm'><a href=\"home.php?mod=spacecp&ac=pm&op=showmsg&handlekey=showmsg_{$space['uid']}&touid={$space['uid']}&pmid=0&daterange=2\" id=\"a_sendpm_{$space['uid']}\" onclick=\"showWindow('showMsgBox', this.href, 'get', 0)\">" . lang('space', 'block_profile_sendmessage') . "</a></li>"; } $html .= '</ul>'; $encodeusername = rawurlencode($space['username']); if (checkperm('allowbanuser')) { $managehtml .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username={$encodeusername}&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid={$space['uid']}") . '" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">' . lang('home/template', 'member_manage') . '</a></li>'; } elseif (checkperm('allowedituser')) { $managehtml .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username={$encodeusername}&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid={$space['uid']}") . '" id="usermanageli" onmouseover="showMenu(this.id)" class="showmenu" target="_blank">' . lang('home/template', 'member_manage') . '</a></li>'; } if ($_G['adminid'] == 1) { $managehtml .= "<li><a href=\"forum.php?mod=modcp&action=thread&op=post&do=search&searchsubmit=1&users={$encodeusername}\" id=\"umanageli\" onmouseover=\"showMenu(this.id)\" class=\"showmenu\">" . lang('home/template', 'content_manage') . "</a></li>"; } if (!empty($managehtml)) { $html .= '<hr class="da mtn m0" /><ul class="ptn xl xl2 cl">' . $managehtml . '</ul><ul id="usermanageli_menu" class="p_pop" style="width: 80px; display:none;">'; if (checkperm('allowbanuser')) { $html .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=ban&username={$encodeusername}&frames=yes" : "forum.php?mod=modcp&action=member&op=ban&uid={$space['uid']}") . '" target="_blank">' . lang('home/template', 'user_ban') . '</a></li>'; } if (checkperm('allowedituser')) { $html .= '<li><a href="' . ($_G['adminid'] == 1 ? "admin.php?action=members&operation=search&username={$encodeusername}&submit=yes&frames=yes" : "forum.php?mod=modcp&action=member&op=edit&uid={$space['uid']}") . '" target="_blank">' . lang('home/template', 'user_edit') . '</a></li>'; } $html .= '</ul>'; if ($_G['adminid'] == 1) { $html .= '<ul id="umanageli_menu" class="p_pop" style="width: 80px; display:none;">'; $html .= '<li><a href="admin.php?action=threads&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_post') . '</a></li>'; $html .= '<li><a href="admin.php?action=doing&searchsubmit=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_doing') . '</a></li>'; $html .= '<li><a href="admin.php?action=blog&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_blog') . '</a></li>'; $html .= '<li><a href="admin.php?action=feed&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_feed') . '</a></li>'; $html .= '<li><a href="admin.php?action=album&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_album') . '</a></li>'; $html .= '<li><a href="admin.php?action=pic&searchsubmit=1&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_pic') . '</a></li>'; $html .= '<li><a href="admin.php?action=comment&searchsubmit=1&authorid=' . $uid . '" target="_blank">' . lang('space', 'manage_comment') . '</a></li>'; $html .= '<li><a href="admin.php?action=share&searchsubmit=1&uid=' . $uid . '" target="_blank">' . lang('space', 'manage_share') . '</a></li>'; $html .= '<li><a href="admin.php?action=threads&operation=group&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_group_threads') . '</a></li>'; $html .= '<li><a href="admin.php?action=prune&searchsubmit=1&operation=group&users=' . $encodeusername . '" target="_blank">' . lang('space', 'manage_group_prune') . '</a></li>'; $html .= '</ul>'; } } if ($_G['setting']['magicstatus'] && $_G['setting']['magics']['gift']) { $info = !empty($space['magicgift']) ? unserialize($space['magicgift']) : array(); if ($space['self']) { } elseif ($info) { if ($info['left'] && !in_array($_G['uid'], (array) $info['receiver'])) { $percredit = min($info['percredit'], $info['left']); if ($info['credittype'] == 'credits') { $credittype = lang('core', 'title_credit'); } else { $extcredits = str_replace('extcredits', '', $info['credittype']); $credittype = $_G['setting']['extcredits'][$extcredits]['title']; } $html .= '<div id="magicreceivegift">'; $html .= '<a onclick="showWindow(\'magicgift\', this.href, \'get\', 0)" href="home.php?mod=spacecp&ac=magic&op=receivegift&uid=' . $uid . '" title="' . lang('magic/gift', 'gift_receive_gift', array('percredit' => $percredit, 'credittype' => $credittype)) . '">'; $html .= '<img src="' . STATICURL . 'image/magic/gift.gif" alt="gift" />'; $html .= '</a>'; $html .= '</div>'; } } } $html = '<div id="pcd">' . $html . '</div>'; break; case 'statistic': space_merge($space, 'count'); $html .= '<p class="mbm xw1">'; if (empty($parameters['banviews'])) { $html .= lang('space', 'space_views', array('views' => $space['views'] ? $space['views'] : '--')); } $html .= '</p><ul class="xl xl2 cl">'; if (empty($parameters['bancredits'])) { $html .= "<li>" . lang('space', 'credits') . ': <a href="home.php?mod=spacecp&ac=credit">' . ($space['credits'] ? $space['credits'] : '--') . "</a></li>"; foreach ($_G['setting']['extcredits'] as $extcreditid => $extcredit) { $html .= "<li>" . $extcredit['img'] . $extcredit['title'] . ': <a href="home.php?mod=spacecp&ac=credit">' . ($space['extcredits' . $extcreditid] ? $space['extcredits' . $extcreditid] : '--') . '</a>'; } } if (empty($parameters['banfriends'])) { $html .= "<li>" . lang('space', 'friends') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=friend&view=me&from=space">' . ($space['friends'] ? $space['friends'] : '--') . "</a></li>"; } if (empty($parameters['banthreads']) && $_G['setting']['allowviewuserthread'] !== false || $_G['adminid'] == 1) { $html .= "<li>" . lang('space', 'threads') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=thread&view=me&from=space">' . ($space['threads'] ? $space['threads'] : '--') . "</a></li>"; } if (empty($parameters['banblogs'])) { $html .= "<li>" . lang('space', 'blogs') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=blog&view=me&from=space">' . ($space['blogs'] ? $space['blogs'] : '--') . "</a></li>"; } if (empty($parameters['banalbums'])) { $html .= "<li>" . lang('space', 'albums') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=album&view=me&from=space">' . ($space['albums'] ? $space['albums'] : '--') . "</a></li>"; } if (empty($parameters['bansharings'])) { $html .= "<li>" . lang('space', 'sharings') . ': <a href="home.php?mod=space&uid=' . $uid . '&do=share&view=me&from=space">' . ($space['sharings'] ? $space['sharings'] : '--') . "</a></li>"; } $html .= '</ul>'; $html = '<div id="pcd">' . $html . '</div>'; break; case 'doing': $do = $blockname; if (ckprivacy('doing', 'view')) { $dolist = array(); $sql = "SELECT * FROM " . DB::table('home_doing') . " WHERE uid='{$uid}' ORDER BY dateline DESC LIMIT 0,{$shownum}"; $query = DB::query($sql); while ($value = DB::fetch($query)) { if ($value['status'] == 0 || $value['uid'] == $_G['uid']) { $dolist[] = $value; } } if ($dolist) { foreach ($dolist as $dv) { $doid = $dv['doid']; $_G[gp_key] = $key = random(8); $html .= "<li class=\"pbn bbda\">"; $html .= $dv['message']; $html .= " <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; }
$wheresql .= " AND t.replies>='{$minhot}'"; $orderactives = array('hot' => ' class="a"'); } else { $orderactives = array('dateline' => ' class="a"'); } } elseif ($_GET['view'] == 'me') { $filter = in_array($_G['gp_filter'], array('publish', 'join')) ? $_G['gp_filter'] : 'publish'; if ($filter == 'join') { $wheresql = "p.uid = '{$space['uid']}' AND p.tid = t.tid"; $apply_sql = ', ' . DB::table('forum_pollvoter') . ' p '; } else { $wheresql = "t.authorid = '{$space['uid']}'"; } $filteractives = array($filter => ' class="a"'); } else { space_merge($space, 'field_home'); if ($space['feedfriend']) { $fuid_actives = array(); require_once libfile('function/friend'); $fuid = intval($_GET['fuid']); if ($fuid && friend_check($fuid, $space['uid'])) { $wheresql = "t.authorid='{$fuid}'"; $fuid_actives = array($fuid => ' selected'); } else { $wheresql = "t.authorid IN ({$space['feedfriend']})"; $theurl = "home.php?mod=space&uid={$space['uid']}&do={$do}&view=we"; } $query = DB::query("SELECT * FROM " . DB::table('home_friend') . " WHERE uid='{$space['uid']}' ORDER BY num DESC LIMIT 0,100"); while ($value = DB::fetch($query)) { $userlist[] = $value; }
function ckvideophoto($type, $tospace = array(), $return = 0) { global $_G; if (empty($_G['setting']['videophoto']) || $_G['member']['videophotostatus']) { return true; } space_merge($tospace, 'field_home'); $result = true; if (empty($tospace) || empty($tospace['privacy']['view']['video' . $type])) { if (!checkperm('videophotoignore') && empty($_G['setting']['video_allow' . $type])) { if ($type != 'viewphoto' || $type == 'viewphoto' && !checkperm('allowviewvideophoto')) { $result = false; } } } elseif ($tospace['privacy']['view']['video' . $type] == 2) { $result = false; } if ($return) { return $result; } elseif (!$result) { showmessage('no_privilege_videophoto'); } }
function on_register() { global $_G; $_G['gp_username'] = $_G['gp_' . $this->setting['reginput']['username']]; $_G['gp_password'] = $_G['gp_' . $this->setting['reginput']['password']]; $_G['gp_password2'] = $_G['gp_' . $this->setting['reginput']['password2']]; $_G['gp_email'] = $_G['gp_' . $this->setting['reginput']['email']]; if ($_G['uid']) { $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : ''; $url_forward = dreferer(); if (strpos($url_forward, $this->setting['regname']) !== false) { $url_forward = 'forum.php'; } showmessage('login_succeed', $url_forward ? $url_forward : './', array('username' => $_G['member']['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']), array('extrajs' => $ucsynlogin)); } elseif (!$this->setting['regclosed'] && (!$this->setting['regstatus'] || !$this->setting['ucactivation'])) { if ($_G['gp_action'] == 'activation' || $this->setting['gp_activationauth']) { if (!$this->setting['ucactivation'] && !$this->setting['closedallowactivation']) { showmessage('register_disable_activation'); } } elseif (!$this->setting['regstatus']) { showmessage(!$this->setting['regclosemessage'] ? 'register_disable' : str_replace(array("\r", "\n"), '', $this->setting['regclosemessage'])); } } $bbrules =& $this->setting['bbrules']; $bbrulesforce =& $this->setting['bbrulesforce']; $bbrulestxt =& $this->setting['bbrulestxt']; $welcomemsg =& $this->setting['welcomemsg']; $welcomemsgtitle =& $this->setting['welcomemsgtitle']; $welcomemsgtxt =& $this->setting['welcomemsgtxt']; $regname = $this->setting['regname']; if ($this->setting['regverify']) { if ($this->setting['areaverifywhite']) { $location = $whitearea = ''; $location = trim(convertip($_G['clientip'], "./")); if ($location) { $whitearea = preg_quote(trim($this->setting['areaverifywhite']), '/'); $whitearea = str_replace(array("\\*"), array('.*'), $whitearea); $whitearea = '.*' . $whitearea . '.*'; $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i'; if (@preg_match($whitearea, $location)) { $this->setting['regverify'] = 0; } } } if ($_G['cache']['ipctrl']['ipverifywhite']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipverifywhite']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $this->setting['regverify'] = 0; break; } } } } $invitestatus = false; if ($this->setting['regstatus'] == 2) { if ($this->setting['inviteconfig']['inviteareawhite']) { $location = $whitearea = ''; $location = trim(convertip($_G['clientip'], "./")); if ($location) { $whitearea = preg_quote(trim($this->setting['inviteconfig']['inviteareawhite']), '/'); $whitearea = str_replace(array("\\*"), array('.*'), $whitearea); $whitearea = '.*' . $whitearea . '.*'; $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i'; if (@preg_match($whitearea, $location)) { $invitestatus = true; } } } if ($this->setting['inviteconfig']['inviteipwhite']) { foreach (explode("\n", $this->setting['inviteconfig']['inviteipwhite']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $invitestatus = true; break; } } } } $groupinfo = array(); if ($this->setting['regverify']) { $groupinfo['groupid'] = 8; } else { $groupinfo['groupid'] = $this->setting['newusergroupid']; } $seccodecheck = $this->setting['seccodestatus'] & 1; $secqaacheck = $this->setting['secqaa']['status'] & 1; $fromuid = !empty($_G['cookie']['promotion']) && $this->setting['creditspolicy']['promotion_register'] ? intval($_G['cookie']['promotion']) : 0; $username = isset($_G['gp_username']) ? $_G['gp_username'] : ''; $bbrulehash = $bbrules ? substr(md5(FORMHASH), 0, 8) : ''; $auth = $_G['gp_auth']; if (!$invitestatus) { $invite = getinvite(); } if (!submitcheck('regsubmit', 0, $seccodecheck, $secqaacheck)) { if ($_G['gp_action'] == 'activation') { $auth = explode("\t", authcode($auth, 'DECODE')); if (FORMHASH != $auth[1]) { showmessage('register_activation_invalid', 'member.php?mod=logging&action=login'); } $username = $auth[0]; $activationauth = authcode("{$auth['0']}\t" . FORMHASH, 'ENCODE'); } if ($fromuid) { $query = DB::query("SELECT username FROM " . DB::table('common_member') . " WHERE uid='{$fromuid}'"); if (DB::num_rows($query)) { $fromuser = dhtmlspecialchars(DB::result($query, 0)); } else { dsetcookie('promotion'); } } $bbrulestxt = nl2br("\n{$bbrulestxt}\n\n"); if ($_G['gp_action'] == 'activation') { $auth = dhtmlspecialchars($auth); } if ($seccodecheck) { $seccode = random(6, 1); } $username = dhtmlspecialchars($username); $htmls = $settings = array(); foreach ($_G['cache']['fields_register'] as $field) { $fieldid = $field['fieldid']; $html = profile_setting($fieldid, array(), false, false, true); if ($html) { $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid]; $htmls[$fieldid] = $html; } } $navtitle = $this->setting['reglinkname']; if ($this->extrafile && file_exists(libfile('member/' . $this->extrafile, 'module'))) { require_once libfile('member/' . $this->extrafile, 'module'); } $dreferer = dreferer(); include template($this->template); } else { if ($this->setting['regstatus'] == 2 && empty($invite) && !$invitestatus) { showmessage('not_open_registration_invite'); } if ($bbrules && $bbrulehash != $_POST['agreebbrule']) { showmessage('register_rules_agree'); } $activation = array(); if (isset($_G['gp_activationauth'])) { $activationauth = explode("\t", authcode($_G['gp_activationauth'], 'DECODE')); if ($activationauth[1] == FORMHASH && !($activation = daddslashes(uc_get_user($activationauth[0]), 1))) { showmessage('register_activation_invalid', 'member.php?mod=logging&action=login'); } } if (!$activation) { $usernamelen = dstrlen($username); if ($usernamelen < 3) { showmessage('profile_username_tooshort'); } elseif ($usernamelen > 15) { showmessage('profile_username_toolong'); } $username = addslashes(trim(dstripslashes($username))); if (uc_get_user($username) && !DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='******'")) { if ($_G['inajax']) { showmessage('profile_username_duplicate'); } else { showmessage('register_activation_message', 'member.php?mod=logging&action=login', array('username' => stripslashes($username))); } } $email = trim($_G['gp_email']); if (empty($this->setting['ignorepassword'])) { if ($_G['gp_password'] !== $_G['gp_password2']) { showmessage('profile_passwd_notmatch'); } if (!$_G['gp_password'] || $_G['gp_password'] != addslashes($_G['gp_password'])) { showmessage('profile_passwd_illegal'); } $password = $_G['gp_password']; } else { $password = md5(random(10)); } } $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($this->setting['censoruser'] = trim($this->setting['censoruser']), '/')) . ')$/i'; if ($this->setting['censoruser'] && @preg_match($censorexp, $username)) { showmessage('profile_username_protect'); } if ($this->setting['regverify'] == 2 && !trim($_G['gp_regmessage'])) { showmessage('profile_required_info_invalid'); } if ($_G['cache']['ipctrl']['ipregctrl']) { foreach (explode("\n", $_G['cache']['ipctrl']['ipregctrl']) as $ctrlip) { if (preg_match("/^(" . preg_quote($ctrlip = trim($ctrlip), '/') . ")/", $_G['clientip'])) { $ctrlip = $ctrlip . '%'; $this->setting['regctrl'] = $this->setting['ipregctrltime']; break; } else { $ctrlip = $_G['clientip']; } } } else { $ctrlip = $_G['clientip']; } if ($this->setting['regctrl']) { $query = DB::query("SELECT ip FROM " . DB::table('common_regip') . " WHERE ip LIKE '{$ctrlip}' AND count='-1' AND dateline>{$_G['timestamp']}-'" . $this->setting['regctrl'] . "'*3600 LIMIT 1"); if (DB::num_rows($query)) { showmessage('register_ctrl', NULL, array('regctrl' => $this->setting['regctrl'])); } } $regipsql = ''; if ($this->setting['regfloodctrl']) { if ($regattempts = DB::result_first("SELECT count FROM " . DB::table('common_regip') . " WHERE ip='{$_G['clientip']}' AND count>'0' AND dateline>'{$_G['timestamp']}'-86400")) { if ($regattempts >= $this->setting['regfloodctrl']) { showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $this->setting['regfloodctrl'])); } else { $regipsql = "UPDATE " . DB::table('common_regip') . " SET count=count+1 WHERE ip='{$_G['clientip']}' AND count>'0'"; } } else { $regipsql = "INSERT INTO " . DB::table('common_regip') . " (ip, count, dateline)\r\n\t\t\t\t\t\tVALUES ('{$_G['clientip']}', '1', '{$_G['timestamp']}')"; } } $profile = $verifyarr = array(); foreach ($_G['cache']['fields_register'] as $field) { if (defined('IN_MOBILE')) { break; } $field_key = $field['fieldid']; $field_val = $_G['gp_' . $field_key]; if ($field['formtype'] == 'file' && !empty($_FILES[$field_key]) && $_FILES[$field_key]['error'] == 0) { $field_val = true; } if (!profile_check($field_key, $field_val)) { $showid = !in_array($field['fieldid'], array('birthyear', 'birthmonth')) ? $field['fieldid'] : 'birthday'; showmessage($field['title'] . lang('message', 'profile_illegal'), '', array(), array('showid' => 'chk_' . $showid, 'extrajs' => $field['title'] . lang('message', 'profile_illegal') . ($field['formtype'] == 'text' ? '<script type="text/javascript">' . '$(\'registerform\').' . $field['fieldid'] . '.className = \'px er\';' . '$(\'registerform\').' . $field['fieldid'] . '.onblur = function () { if(this.value != \'\') {this.className = \'px\';$(\'chk_' . $showid . '\').innerHTML = \'\';}}' . '</script>' : ''))); } if ($field['needverify']) { $verifyarr[$field_key] = $field_val; } else { $profile[$field_key] = $field_val; } } if (!$activation) { $uid = uc_user_register($username, $password, $email, $questionid, $answer, $_G['clientip']); if ($uid <= 0) { if ($uid == -1) { showmessage('profile_username_illegal'); } elseif ($uid == -2) { showmessage('profile_username_protect'); } elseif ($uid == -3) { showmessage('profile_username_duplicate'); } elseif ($uid == -4) { showmessage('profile_email_illegal'); } elseif ($uid == -5) { showmessage('profile_email_domain_illegal'); } elseif ($uid == -6) { showmessage('profile_email_duplicate'); } else { showmessage('undefined_action'); } } } else { list($uid, $username, $email) = $activation; } $_G['username'] = $username; if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$uid}'")) { if (!$activation) { uc_user_delete($uid); } showmessage('profile_uid_duplicate', '', array('uid' => $uid)); } $password = md5(random(10)); $secques = $questionid > 0 ? random(8) : ''; if (isset($_POST['birthmonth']) && isset($_POST['birthday'])) { $profile['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']); } if (isset($_POST['birthyear'])) { $profile['zodiac'] = get_zodiac($_POST['birthyear']); } if ($_FILES) { require_once libfile('class/upload'); $upload = new discuz_upload(); foreach ($_FILES as $key => $file) { $field_key = 'field_' . $key; if (!empty($_G['cache']['fields_register'][$field_key]) && $_G['cache']['fields_register'][$field_key]['formtype'] == 'file') { $upload->init($file, 'profile'); $attach = $upload->attach; if (!$upload->error()) { $upload->save(); if (!$upload->get_image_info($attach['target'])) { @unlink($attach['target']); continue; } $attach['attachment'] = dhtmlspecialchars(trim($attach['attachment'])); if ($_G['cache']['fields_register'][$field_key]['needverify']) { $verifyarr[$key] = $attach['attachment']; } else { $profile[$key] = $attach['attachment']; } } } } } if ($regipsql) { DB::query($regipsql); } if ($invite && $this->setting['inviteconfig']['invitegroupid']) { $groupinfo['groupid'] = $this->setting['inviteconfig']['invitegroupid']; } $init_arr = explode(',', $this->setting['initcredits']); $userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => $groupinfo['groupid'], 'regdate' => TIMESTAMP, 'credits' => $init_arr[0], 'timeoffset' => 9999); $status_data = array('uid' => $uid, 'regip' => $_G['clientip'], 'lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP, 'lastpost' => 0, 'lastsendmail' => 0); $profile['uid'] = $uid; $field_forum['uid'] = $uid; $field_home['uid'] = $uid; if ($this->extrafile && file_exists(libfile('member/' . $this->extrafile, 'module'))) { require_once libfile('member/' . $this->extrafile, 'module'); } DB::insert('common_member', $userdata); DB::insert('common_member_status', $status_data); DB::insert('common_member_profile', $profile); DB::insert('common_member_field_forum', $field_forum); DB::insert('common_member_field_home', $field_home); if ($verifyarr) { $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => daddslashes(serialize($verifyarr)), 'dateline' => TIMESTAMP); DB::insert('common_member_verify_info', $setverify); DB::insert('common_member_verify', array('uid' => $uid)); } $count_data = array('uid' => $uid, 'extcredits1' => $init_arr[1], 'extcredits2' => $init_arr[2], 'extcredits3' => $init_arr[3], 'extcredits4' => $init_arr[4], 'extcredits5' => $init_arr[5], 'extcredits6' => $init_arr[6], 'extcredits7' => $init_arr[7], 'extcredits8' => $init_arr[8]); DB::insert('common_member_count', $count_data); DB::insert('common_setting', array('skey' => 'lastmember', 'svalue' => $username), false, true); manyoulog('user', $uid, 'add'); $totalmembers = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_member')); $userstats = array('totalmembers' => $totalmembers, 'newsetuser' => stripslashes($username)); save_syscache('userstats', $userstats); if ($this->setting['regctrl'] || $this->setting['regfloodctrl']) { DB::query("DELETE FROM " . DB::table('common_regip') . " WHERE dateline<='{$_G['timestamp']}'-" . ($this->setting['regctrl'] > 72 ? $this->setting['regctrl'] : 72) . "*3600", 'UNBUFFERED'); if ($this->setting['regctrl']) { DB::query("INSERT INTO " . DB::table('common_regip') . " (ip, count, dateline)\r\n\t\t\t\t\t\tVALUES ('{$_G['clientip']}', '-1', '{$_G['timestamp']}')"); } } $regmessage = dhtmlspecialchars($_G['gp_regmessage']); if ($this->setting['regverify'] == 2) { DB::query("REPLACE INTO " . DB::table('common_member_validate') . " (uid, submitdate, moddate, admin, submittimes, status, message, remark)\r\n\t\t\t\t\tVALUES ('{$uid}', '{$_G['timestamp']}', '0', '', '1', '0', '{$regmessage}', '')"); manage_addnotify('verifyuser'); } setloginstatus(array('uid' => $uid, 'username' => dstripslashes($_G['username']), 'password' => $password, 'groupid' => $groupinfo['groupid']), 0); include_once libfile('function/stat'); updatestat('register'); if ($invite['id']) { $result = DB::result_first("SELECT COUNT(*) FROM " . DB::table('common_invite') . " WHERE uid='{$invite['uid']}' AND fuid='{$uid}'"); if (!$result) { DB::update("common_invite", array('fuid' => $uid, 'fusername' => $_G['username'], 'regdateline' => $_G['timestamp'], 'status' => 2), array('id' => $invite['id'])); updatestat('invite'); } else { $invite = array(); } } if ($invite['uid']) { if ($this->setting['inviteconfig']['inviteaddcredit']) { updatemembercount($uid, array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['inviteaddcredit'])); } if ($this->setting['inviteconfig']['invitedaddcredit']) { updatemembercount($invite['uid'], array($this->setting['inviteconfig']['inviterewardcredit'] => $this->setting['inviteconfig']['invitedaddcredit'])); } require_once libfile('function/friend'); friend_make($invite['uid'], $invite['username'], false); notification_add($invite['uid'], 'friend', 'invite_friend', array('actor' => '<a href="home.php?mod=space&uid=' . $invite['uid'] . '" target="_blank">' . $invite['username'] . '</a>'), 1); space_merge($invite, 'field_home'); if (!empty($invite['privacy']['feed']['invite'])) { require_once libfile('function/feed'); $tite_data = array('username' => '<a href="home.php?mod=space&uid=' . $_G['uid'] . '">' . $_G['username'] . '</a>'); feed_add('friend', 'feed_invite', $tite_data, '', array(), '', array(), array(), '', '', '', 0, 0, '', $invite['uid'], $invite['username']); } if ($invite['appid']) { updatestat('appinvite'); } } if ($welcomemsg && !empty($welcomemsgtxt)) { $welcomemsgtitle = addslashes(replacesitevar($welcomemsgtitle)); $welcomemsgtxt = addslashes(replacesitevar($welcomemsgtxt)); if ($welcomemsg == 1) { $welcomemsgtxt = nl2br(str_replace(':', ':', $welcomemsgtxt)); notification_add($uid, 'system', $welcomemsgtxt, array(), 1); } elseif ($welcomemsg == 2) { sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt); } elseif ($welcomemsg == 3) { sendmail_cron($email, $welcomemsgtitle, $welcomemsgtxt); $welcomemsgtxt = nl2br(str_replace(':', ':', $welcomemsgtxt)); notification_add($uid, 'system', $welcomemsgtxt, array(), 1); } } if ($fromuid) { updatecreditbyaction('promotion_register', $fromuid); dsetcookie('promotion', ''); } dsetcookie('loginuser', ''); dsetcookie('activationauth', ''); dsetcookie('invite_auth', ''); loadcache('setting', true); $_G['setting']['lastmember'] = stripslashes($username); $settingnew = $_G['setting']; $settingnew['pluginhooks'] = array(); save_syscache('setting', $settingnew); switch ($this->setting['regverify']) { case 1: $idstring = random(6); $authstr = $this->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : ''; DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET authstr='{$authstr}' WHERE uid='{$_G['uid']}'"); $verifyurl = "{$_G[siteurl]}member.php?mod=activate&uid={$_G[uid]}&id={$idstring}"; $email_verify_message = lang('email', 'email_verify_message', array('username' => $_G['member']['username'], 'bbname' => $this->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl)); sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message); $message = 'register_email_verify'; $locationmessage = 'register_email_verify_location'; $url_forward = dreferer(); break; case 2: $message = 'register_manual_verify'; $locationmessage = 'register_manual_verify_location'; $url_forward = $_G['setting']['homestatus'] ? 'home.php?mod=space&do=home' : 'home.php?mod=spacecp'; break; default: $message = 'register_succeed'; $locationmessage = 'register_succeed_location'; $url_forward = dreferer(); break; } $param = array('bbname' => $this->setting['bbname'], 'username' => $_G['username'], 'usergroup' => $_G['group']['grouptitle'], 'uid' => $_G['uid']); if (strpos($url_forward, $this->setting['regname']) !== false || strpos($url_forward, 'buyinvitecode') !== false) { $url_forward = 'forum.php'; } $href = str_replace("'", "\\'", $url_forward); $extra = array('showid' => 'succeedmessage', 'extrajs' => '<script type="text/javascript">' . 'setTimeout("window.location.href =\'' . $href . '\';", 3000);' . '$(\'succeedmessage_href\').href = \'' . $href . '\';' . '$(\'main_message\').style.display = \'none\';' . '$(\'main_succeed\').style.display = \'\';' . '$(\'succeedlocation\').innerHTML = \'' . lang('message', $locationmessage) . '\';' . '</script>', 'striptags' => false); showmessage($message, $url_forward, $param, $extra); } }
if ($_G['gp_resend'] && $resend) { $toemail = $space['newemail'] ? $space['newemail'] : $space['email']; emailcheck_send($space['uid'], $toemail); dsetcookie('resendemail', TIMESTAMP); showmessage('send_activate_mail_succeed', "home.php?mod=spacecp&ac=profile&op=password"); } elseif ($_G['gp_resend']) { showmessage('send_activate_mail_error', "home.php?mod=spacecp&ac=profile&op=password"); } if (!empty($space['newemail'])) { $acitvemessage = lang('spacecp', 'email_acitve_message', array('newemail' => $space['newemail'], 'imgdir' => $_G['style']['imgdir'])); } $actives = array('password' => ' class="a"'); $navtitle = lang('core', 'title_password_security'); } else { space_merge($space, 'field_home'); space_merge($space, 'field_forum'); require_once libfile('function/editor'); $space['sightml'] = html2bbcode($space['sightml']); $vid = $_G['gp_vid'] ? intval($_G['gp_vid']) : 0; $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array(); $_G['setting']['privacy'] = $_G['setting']['privacy'] ? $_G['setting']['privacy'] : array(); $_G['setting']['privacy'] = is_array($_G['setting']['privacy']) ? $_G['setting']['privacy'] : unserialize($_G['setting']['privacy']); $_G['setting']['privacy']['profile'] = !empty($_G['setting']['privacy']['profile']) ? $_G['setting']['privacy']['profile'] : array(); $privacy = array_merge($_G['setting']['privacy']['profile'], $privacy); $actives = array('profile' => ' class="a"'); $opactives = array($operation => ' class="a"'); $allowitems = array(); if (in_array($operation, array('base', 'contact', 'edu', 'work', 'info'))) { $allowitems = $profilegroup[$operation]['field']; } elseif ($operation == 'verify') { if ($vid == 0) {
function ckfriend_album($album) { global $_G, $space; if ($_G['adminid'] != 1) { if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) { if (empty($_G['uid'])) { showmessage('to_login', null, array(), array('showmsg' => true, 'login' => 1)); } require_once libfile('function/friend'); $isfriend = friend_check($album['uid']); space_merge($space, 'count'); space_merge($space, 'profile'); $_G['privacy'] = 1; require_once libfile('space/profile', 'include'); include template('home/space_privacy'); exit; } elseif (!$space['self'] && $album['friend'] == 4) { $cookiename = "view_pwd_album_{$album['albumid']}"; $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename]; if ($cookievalue != md5(md5($album['password']))) { $invalue = $album; include template('home/misc_inputpwd'); exit; } } } }
function ckicon_uid($feed) { global $_G, $space; space_merge($space, 'field_home'); $filter_icon = empty($space['privacy']['filter_icon']) ? array() : array_keys($space['privacy']['filter_icon']); if ($filter_icon && (in_array($feed['icon'] . '|0', $filter_icon) || in_array($feed['icon'] . '|' . $feed['uid'], $filter_icon))) { return false; } return true; }
private function _applyActivityTopic($res, $tid, $uid, $data) { // from forum_misc.php require_once libfile('function/post'); $activity = DzForumActivity::getActivityByTid($tid); if ($activity['expiration'] && $activity['expiration'] < TIMESTAMP) { return $this->_makeErrorInfo($res, 'activity_stop'); } $applyinfo = DzForumActivityApply::getApplyByTidUid($tid, $uid); if ($applyinfo && $applyinfo['verified'] < DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { return $this->_makeErrorInfo($res, 'activity_repeat_apply'); } global $_G; $_GET = $data; $thread = ForumUtils::getTopicInfo($tid); $payvalue = intval($_GET['payvalue']); $payment = $_GET['payment'] ? $payvalue : -1; $message = cutstr(dhtmlspecialchars($_GET['message']), 200); $verified = $thread['authorid'] == $uid ? 1 : 0; $ufielddata = ''; if ($activity['ufield']) { $ufielddata = array(); $version = MobcentDiscuz::getMobcentDiscuzVersion(); $activity['ufield'] = $version != MobcentDiscuz::VERSION_X20 ? dunserialize($activity['ufield']) : unserialize($activity['ufield']); if (!empty($activity['ufield']['userfield'])) { if ($version == MobcentDiscuz::VERSION_X20) { if (!class_exists('discuz_censor')) { include libfile('class/censor'); } } $censor = discuz_censor::instance(); loadcache('profilesetting'); foreach ($data as $key => $value) { if (empty($_G['cache']['profilesetting'][$key])) { continue; } if (is_array($value)) { $value = implode(',', $value); } $value = cutstr(dhtmlspecialchars(trim($value)), 100, '.'); // if ($_G['cache']['profilesetting'][$key]['formtype'] == 'file' && !preg_match("/^https?:\/\/(.*)?\.(jpg|png|gif|jpeg|bmp)$/i", $value)) { // showmessage('activity_imgurl_error'); // } if (empty($value) && $key != 'residedist' && $key != 'residecommunity') { return $this->_makeErrorInfo($res, 'activity_exile_field'); } $ufielddata['userfield'][$key] = $value; } } if (!empty($activity['ufield']['extfield'])) { foreach ($activity['ufield']['extfield'] as $fieldid) { $value = cutstr(dhtmlspecialchars(trim($_GET['' . $fieldid])), 50, '.'); $ufielddata['extfield'][$fieldid] = $value; } } $ufielddata = !empty($ufielddata) ? serialize($ufielddata) : ''; } if ($_G['setting']['activitycredit'] && $activity['credit'] && empty($applyinfo['verified'])) { checklowerlimit(array('extcredits' . $_G['setting']['activitycredit'] => '-' . $activity['credit'])); updatemembercount($uid, array($_G['setting']['activitycredit'] => '-' . $activity['credit']), true, 'ACC', $tid); } $data = array('tid' => $tid, 'username' => $_G['username'], 'uid' => $uid, 'message' => $message, 'verified' => $verified, 'dateline' => $_G['timestamp'], 'payment' => $payment, 'ufielddata' => $ufielddata); if ($applyinfo && $applyinfo['verified'] == DzForumActivityApply::STATUS_VERIFIED_IMPROVE) { DzForumActivityApply::updateApplyById($data, $applyinfo['applyid']); } else { DzForumActivityApply::insertApply($data); } DzForumActivity::updateApplyNumberByTid($tid); if ($thread['authorid'] != $uid) { notification_add($thread['authorid'], 'activity', 'activity_notice', array('tid' => $tid, 'subject' => $thread['subject'])); $space = array(); space_merge($space, 'field_home'); if (!empty($space['privacy']['feed']['newreply'])) { $feed['icon'] = 'activity'; $feed['title_template'] = 'feed_reply_activity_title'; $feed['title_data'] = array('subject' => "<a href=\"forum.php?mod=viewthread&tid={$tid}\">{$thread['subject']}</a>", 'hash_data' => "tid{$tid}"); $feed['id'] = $tid; $feed['idtype'] = 'tid'; postfeed($feed); } } $res = $this->_makeErrorInfo($res, 'activity_completion'); $res['rs'] = 1; return $res; }