本文整理汇总了PHP中space_merge函数的典型用法代码示例。如果您正苦于以下问题:PHP space_merge函数的具体用法?PHP space_merge怎么用?PHP space_merge使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了space_merge函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkfield
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;
}
}
示例2: manyou_getuserapp
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;
}
}
}
}
}
}
示例3: mobcent_cknewuser
/**
* 修改原cknewuser方法
*
* @author 谢建平 <jianping_xie@aliyun.com>
* @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;
}
示例4: mobcent_formulaperm
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'];
//.........这里部分代码省略.........
示例5: if
<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;?>>
示例6: getblockhtml
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>';
}
//.........这里部分代码省略.........
示例7: on_register
//.........这里部分代码省略.........
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);
}
}
示例8: sendmail_touser
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;
}
示例9: check_formula_forum_isforbidden
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;
//.........这里部分代码省略.........
示例10: _userFriendSetting
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;
}
示例11: _getPersonalDataInfo
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;
}
示例12: trim
if (submitcheck('blacklistsubmit')) {
$_POST['username'] = trim($_POST['username']);
$query = DB::query("SELECT * FROM " . DB::table('common_member') . " WHERE username='{$_POST['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();
示例13: interval_check
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;
}
示例14: sendmail_touser
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;
}
示例15: getuserapp
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;
}
}
}
}
}