private function _updateUser($res, $gender, $avatar) { global $_G; include_once libfile('function/profile'); $setarr['gender'] = intval($gender); if ($setarr) { C::t('common_member_profile')->update($_G['uid'], $setarr); } manyoulog('user', $uid, 'update'); $operation = 'gender'; include_once libfile('function/feed'); feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile')); countprofileprogress(); // ob_start(); // $this->getController()->forward('user/uploadavatar', false); // $result = ob_get_clean(); // $picInfo = WebUtils::jsonDecode($result, true); // $avatar = $picInfo['pic_path']; // $avatar = !empty($_GET['avatar']) ? $_GET['avatar'] : ''; if (!empty($avatar)) { $_GET = array_merge($_GET, array('avatar' => $avatar)); ob_start(); $this->getController()->forward('user/saveavatar', false); $result = ob_get_clean(); $result = WebUtils::jsonDecode($result); if (WebUtils::checkError($result)) { return $this->makeErrorInfo($res, 'user_info_avatar_error'); } } return $this->makeErrorInfo($res, lang('message', 'profile_succeed'), array('noError' => 1)); }
function space_open($uid, $username, $gid = 0, $email = '') { global $_SGLOBAL, $_SCONFIG; if (empty($uid) || empty($username)) { return array(); } //验证空间是否被管理员删除 $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spacelog') . " WHERE uid='{$uid}' AND flag='-1'"); if ($value = $_SGLOBAL['db']->fetch_array($query)) { showmessage('the_space_has_been_closed'); } $space = array('uid' => $uid, 'username' => $username, 'dateline' => $_SGLOBAL['timestamp'], 'groupid' => $gid); inserttable('space', $space, 0, true); inserttable('spacefield', array('uid' => $uid, 'email' => $email), 0, true); //发送PM if ($_SGLOBAL['supe_uid'] && $_SGLOBAL['supe_uid'] != $uid) { include_once S_ROOT . './uc_client/client.php'; uc_pm_send($_SGLOBAL['supe_uid'], $uid, cplang('space_open_subject'), cplang('space_open_message', array(getsiteurl())), 1, 0, 0); } //产生feed include_once S_ROOT . './source/function_cp.php'; $_uid = $_SGLOBAL['supe_uid']; $_username = $_SGLOBAL['supe_username']; $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = addslashes($username); feed_add('profile', cplang('feed_space_open')); $_SGLOBAL['supe_uid'] = $_uid; $_SGLOBAL['supe_username'] = $_username; return $space; }
function publishTemplatizedAction($uId, $appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral = '', $image1 = '', $image1Link = '', $image2 = '', $image2Link = '', $image3 = '', $image3Link = '', $image4 = '', $image4Link = '', $targetIds = '', $privacy = '', $hashTemplate = '', $hashData = '') { $friend = ($privacy == 'public') ? 0 : ($privacy == 'friends' ? 1 : 2); $images = array($image1, $image2, $image3, $image4); $image_links = array($image1Link, $image2Link, $image3Link, $image4Link); $result = feed_add($appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral, $images, $image_links, $targetIds, $friend, 0, 1); return new APIResponse($result); }
function publishTemplatizedAction($uId, $appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral = '', $image1 = '', $image1Link = '', $image2 = '', $image2Link = '', $image3 = '', $image3Link = '', $image4 = '', $image4Link = '', $targetIds = '', $privacy = '', $hashTemplate = '', $hashData = '', $specialAppid = 0) { global $_SGLOBAL; $friend = $privacy == 'public' ? 0 : ($privacy == 'friends' ? 1 : 2); $images = array($image1, $image2, $image3, $image4); $image_links = array($image1Link, $image2Link, $image3Link, $image4Link); include_once S_ROOT . './source/function_cp.php'; $result = feed_add($appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral, $images, $image_links, $targetIds, $friend, $specialAppid, 1); return new APIResponse($result); }
public function onFeedPublishTemplatizedAction($uId, $appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral = '', $image1 = '', $image1Link = '', $image2 = '', $image2Link = '', $image3 = '', $image3Link = '', $image4 = '', $image4Link = '', $targetIds = '', $privacy = '', $hashTemplate = '', $hashData = '', $specialAppid = 0) { $res = $this->getUserSpace($uId); if (!$res) { return new Cloud_Service_Server_ErrorResponse('1', "User({$uId}) Not Exists"); } $friend = $privacy == 'public' ? 0 : ($privacy == 'friends' ? 1 : 2); $images = array($image1, $image2, $image3, $image4); $image_links = array($image1Link, $image2Link, $image3Link, $image4Link); require_once libfile('function/feed'); $result = feed_add($appId, $titleTemplate, $titleData, $bodyTemplate, $bodyData, $bodyGeneral, $images, $image_links, $targetIds, $friend, $specialAppid, 1); return $result; }
function usesubmit() { global $_G; $uid = $_G['uid']; $_G['uid'] = 0; $avatar = avatar($uid, 'middle', true); include_once libfile('function/feed'); feed_add('thunder', 'magicuse_thunder_announce_title', array('uid' => $uid, 'username' => "<a href=\"home.php?mod=space&uid={$uid}\">{$_G['username']}</a>"), 'magicuse_thunder_announce_body', array('uid' => $uid, 'magic_thunder' => 1), '', array($avatar), array("home.php?mod=space&uid={$uid}")); $_G['uid'] = $uid; usemagic($this->magic['magicid'], $this->magic['num']); updatemagiclog($this->magic['magicid'], '2', '1', '0', '0', 'uid', $_G['uid']); showmessage('magics_thunder_message', '', array('magicname' => $_G['setting']['magics']['thunder']), array('showdialog' => 1)); }
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; }
} } else { $setarr = array(); } $feednew['dateline'] = trim($feednew['dateline']); if ($feednew['dateline']) { require_once libfile('function/home'); $newtimestamp = strtotime($feednew['dateline']); if ($newtimestamp > $_G['timestamp']) { $_G['timestamp'] = $newtimestamp; } } if (empty($feedid)) { $_G['uid'] = 0; require_once libfile('function/feed'); $feedid = feed_add('sitefeed', trim($feednew['title_template']), array(), trim($feednew['body_template']), array(), trim($feednew['body_general']), array(trim($feednew['image_1']), trim($feednew['image_2']), trim($feednew['image_3']), trim($feednew['image_4'])), array(trim($feednew['image_1_link']), trim($feednew['image_2_link']), trim($feednew['image_3_link']), trim($feednew['image_4_link'])), '', '', '', 1); } else { if (empty($feednew['feeduid'])) { $setarr['body_general'] = trim($feednew['body_general']); } $setarr['image_1'] = trim($feednew['image_1']); $setarr['image_1_link'] = trim($feednew['image_1_link']); $setarr['image_2'] = trim($feednew['image_2']); $setarr['image_2_link'] = trim($feednew['image_2_link']); $setarr['image_3'] = trim($feednew['image_3']); $setarr['image_3_link'] = trim($feednew['image_3_link']); $setarr['image_4'] = trim($feednew['image_4']); $setarr['image_4_link'] = trim($feednew['image_4_link']); $setarr['dateline'] = $newtimestamp; $setarr['hot'] = intval($feednew['hot']); C::t('home_feed')->update('', $setarr, '', '', $feedid);
$note_type = 'clickthread'; $q_note = cplang('note_click_thread', array("space.php?uid={$item['uid']}&do=thread&id={$item['tid']}", $item['subject'])); break; case 'picid': $fs['title_template'] = cplang('feed_click_pic'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$item['uid']}\">{$_SN[$item['uid']]}</a>", 'click' => $click['name']); $fs['images'] = array(pic_get($item['filepath'], $item['thumb'], $item['remote'])); $fs['image_links'] = array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}"); $fs['body_general'] = $item['title']; $note_type = 'clickpic'; $q_note = cplang('note_click_pic', array("space.php?uid={$item['uid']}&do=album&picid={$item['picid']}")); break; } //Event Publishing if (empty($item['friend']) && ckprivacy('click', 1)) { feed_add('click', $fs['title_template'], $fs['title_data'], '', array(), $fs['body_general'], $fs['images'], $fs['image_links']); } //Reward visitors getreward('click', 1, 0, $idtype . $id); //Statistics updatestat('click'); //Notice notification_add($item['uid'], $note_type, $q_note); showmessage('click_success', $_SGLOBAL['refer']); } elseif ($_GET['op'] == 'show') { foreach ($clicks as $key => $value) { $value['clicknum'] = $item["click_{$key}"]; $value['classid'] = mt_rand(1, 4); if ($value['clicknum'] > $maxclicknum) { $maxclicknum = $value['clicknum']; }
<?php if (!defined('iBUAA')) { exit('Access Denied'); } //À×ÃùÖ®Éù if (submitcheck("usesubmit")) { magic_use($mid, array(), true); //·¢È«Õ¾feed $uid = $_SGLOBAL['supe_uid']; realname_set($_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); realname_get(); $_SGLOBAL['supe_uid'] = 0; include_once S_ROOT . './source/function_cp.php'; $avatar = ckavatar($uid) ? avatar($uid, 'middle', true) : UC_API . '/images/noavatar_middle.gif'; feed_add('thunder', cplang('magicuse_thunder_announce_title'), array('uid' => $uid, 'username' => "<a href=\"space.php?uid={$uid}\">{$_SN[$uid]}</a>"), cplang('magicuse_thunder_announce_body'), array('uid' => $uid, 'magic_thunder' => 1), '', array($avatar), array("space.php?uid={$uid}")); showmessage('magicuse_success', $_POST['refer'], 0); }
$magvalues['type'] = $commentcable[$type]; } $arr['body_general'] = getstr($_POST['general'], 150, 1, 1, 1); $arr['body_general'] = censor($arr['body_general']); if (censormod($arr['body_general']) || $_G['group']['allowsharemod']) { $arr['status'] = 1; } else { $arr['status'] = 0; } $arr['type'] = $type; $arr['uid'] = $_G['uid']; $arr['username'] = $_G['username']; $arr['dateline'] = $_G['timestamp']; if ($arr['status'] == 0 && ckprivacy('share', 'feed')) { require_once libfile('function/feed'); feed_add('share', '{actor} ' . $arr['title_template'], array('hash_data' => $feed_hash_data), $arr['body_template'], $arr['body_data'], $arr['body_general'], array($arr['image']), array($arr['image_link'])); } $arr['body_data'] = serialize($arr['body_data']); $setarr = daddslashes($arr); $sid = DB::insert('home_share', $setarr, 1); switch ($type) { case 'space': DB::query("UPDATE " . DB::table('common_member_status') . " SET sharetimes=sharetimes+1 WHERE uid='{$id}'"); break; case 'blog': DB::query("UPDATE " . DB::table('home_blog') . " SET sharetimes=sharetimes+1 WHERE blogid='{$id}'"); break; case 'album': DB::query("UPDATE " . DB::table('home_album') . " SET sharetimes=sharetimes+1 WHERE albumid='{$id}'"); break; case 'pic':
function addfeed($get, $post) { global $_SGLOBAL; if (!API_ADDFEED) { return API_RETURN_FORBIDDEN; } $_SGLOBAL['supe_uid'] = intval($post['uid']); $_SGLOBAL['supe_username'] = trim($post['username']); $images = array($post['image_1'], $post['image_2'], $post['image_3'], $post['image_4']); $image_links = array($post['image_1_link'], $post['image_2_link'], $post['image_3_link'], $post['image_4_link']); include_once S_ROOT . './source/function_cp.php'; return feed_add($post['icon'], $post['title_template'], $post['title_data'], $post['body_template'], $post['body_data'], $post['body_general'], $images, $image_links, $post['target_ids'], '', $post['appid']); }
$n_url = "home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}&cid={$cid}"; $note_type = 'sharecomment'; $note = 'share_comment'; $note_values = array('url' => $n_url); $q_note = 'share_comment_reply'; $q_values = array('url' => $n_url); $msg = 'do_success'; $magvalues = array(); break; } if (empty($comment)) { if ($tospace['uid'] != $_G['uid']) { if (ckprivacy('comment', 'feed')) { require_once libfile('function/feed'); $fs['title_data']['hash_data'] = "{$idtype}{$id}"; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'], $fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']); } $note_values['from_id'] = $_POST['id']; $note_values['from_idtype'] = $_POST['idtype']; $note_values['url'] .= "&goto=new#comment_{$cid}_li"; notification_add($tospace['uid'], $note_type, $note, $note_values); } } elseif ($comment['authorid'] != $_G['uid']) { notification_add($comment['authorid'], $note_type, $q_note, $q_values); } if ($stattype) { include_once libfile('function/stat'); updatestat($stattype); } if ($tospace['uid'] != $_G['uid']) { $needle = $id;
} elseif(submitcheck('showsubmit')) { $showcredit = intval($_POST['showcredit']); if($showcredit > $space['credit']) $showcredit = $space['credit']; if($showcredit < 1) { showmessage('showcredit_error'); } $_POST['note'] = getstr($_POST['note'], 100, 1, 1, 1); //增加 $count = getcount('show', array('uid'=>$_SGLOBAL['supe_uid'])); if($count) { $notesql = $_POST['note']?", note='$_POST[note]'":''; $_SGLOBAL['db']->query("UPDATE ".tname('show')." SET credit=credit+$showcredit $notesql WHERE uid='$_SGLOBAL[supe_uid]'"); } else { inserttable('show', array('uid'=>$_SGLOBAL['supe_uid'], 'username'=>$_SGLOBAL['supe_username'], 'credit'=>$showcredit, 'note'=>$_POST['note']), 0, true); } //减少自己的积分 $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$showcredit WHERE uid='$space[uid]'"); //feed if(ckprivacy('show', 1)) { feed_add('show', cplang('feed_showcredit_self'), array('credit'=>$showcredit), '', array(), $_POST['note']); } showmessage('showcredit_do_success', "space.php?do=top"); } ?>
foreach ($_POST['info'] as $key => $value) { $value = getstr($value, 500, 1, 1); $friend = intval($_POST['info_friend'][$key]); $inserts[] = "('{$space['uid']}','info','{$key}','{$value}','{$friend}')"; } if ($inserts) { $_SGLOBAL['db']->query("DELETE FROM " . tname('spaceinfo') . " WHERE uid='{$space['uid']}' AND type='info'"); $_SGLOBAL['db']->query("INSERT INTO " . tname('spaceinfo') . "\r\n\t\t\t\t(uid,type,subtype,title,friend)\r\n\t\t\t\tVALUES " . implode(',', $inserts)); } //变更记录 if ($_SCONFIG['my_status']) { inserttable('userlog', array('uid' => $_SGLOBAL['supe_uid'], 'action' => 'update', 'dateline' => $_SGLOBAL['timestamp'], 'type' => 2), 0, true); } //产生feed if (ckprivacy('profile', 1)) { feed_add('profile', cplang('feed_profile_update_info')); } $url = 'cp.php?ac=profile&op=info'; showmessage('update_on_successful_individuals', $url); } //隐私 $list = $friends = array(); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('spaceinfo') . " WHERE uid='{$space['uid']}' AND type='info'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $list[$value['subtype']] = $value; $friends[$value['subtype']][$value['friend']] = ' selected'; } } $cat_actives = array($_GET['op'] => ' class="active"'); if ($_GET['op'] == 'edu' || $_GET['op'] == 'work') { $yearhtml = '';
space_merge($space, 'field_home'); $maxfriendnum = checkperm('maxfriendnum'); if ($maxfriendnum && $space['friends'] >= $maxfriendnum + $space['addfriend']) { if ($_G['magic']['friendnum']) { showmessage('enough_of_the_number_of_friends_with_magic'); } else { showmessage('enough_of_the_number_of_friends'); } } if (friend_request_check($uid)) { if (submitcheck('add2submit')) { $_POST['gid'] = intval($_POST['gid']); friend_add($uid, $_POST['gid']); if (ckprivacy('friend', 'feed')) { require_once libfile('function/feed'); feed_add('friend', 'feed_friend_title', array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>")); } notification_add($uid, 'friend', 'friend_add'); showmessage('friends_add', dreferer(), array('username' => $tospace['username'], 'uid' => $uid, 'from' => $_G['gp_from']), array('showdialog' => 1, 'showmsg' => true, 'closetime' => true)); } $op = 'add2'; $groupselect = empty($space['privacy']['groupname']) ? array(1 => ' checked') : array(); $navtitle = lang('core', 'title_friend_add'); include template('home/spacecp_friend'); exit; } else { if (getcount('home_friend_request', array('uid' => $uid, 'fuid' => $_G['uid']))) { showmessage('waiting_for_the_other_test'); } if ($tospace['videophotostatus']) { ckvideophoto('friend', $tospace);
} elseif (capi_submitcheck('viewAlbumid')) { //上传完成发送feed if ($eventid) { //跳到活动页面 $imgs = array(); $imglinks = array(); $dateline = $_SGLOBAL['timestamp'] - 600; $query = $_SGLOBAL['db']->query("SELECT pic.* FROM " . tname("eventpic") . " ep LEFT JOIN " . tname("pic") . " pic ON ep.picid=pic.picid WHERE ep.uid='{$_SGLOBAL['supe_uid']}' AND ep.eventid='{$eventid}' AND ep.dateline > {$dateline} ORDER BY ep.dateline DESC LIMIT 4"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $imgs[] = pic_get($value['filepath'], $value['thumb'], $value['remote']); $imglinks[] = "space.php?do=event&id={$eventid}&view=pic&picid=" . $value['picid']; } $picnum = 0; if ($imgs) { $picnum = $_SGLOBAL['db']->result($_SGLOBAL['db']->query("SELECT COUNT(*) FROM " . tname("eventpic") . " WHERE eventid='{$eventid}'"), 0); feed_add('event', cplang('event_feed_share_pic_title'), '', cplang('event_feed_share_pic_info'), array("eventid" => $eventid, "title" => $event['title'], "picnum" => $picnum), '', $imgs, $imglinks); } $_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET picnum='{$picnum}', updatetime='{$_SGLOBAL['timestamp']}' WHERE eventid='{$eventid}'"); showmessage('do_success', 'space.php?do=event&view=pic&id=' . $eventid, 0); } else { //相册feed if (ckprivacy('upload', 1)) { include_once S_ROOT . './source/function_feed.php'; feed_publish($_POST['opalbumid'], 'albumid'); } //单个图片feed if ($_POST['topicid']) { topic_join($_POST['topicid'], $_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); $url = "space.php?do=topic&topicid={$_POST['topicid']}&view=pic"; } else { $url = "space.php?uid={$_SGLOBAL['supe_uid']}&do=album&id=" . (empty($_POST['opalbumid']) ? -1 : $_POST['opalbumid']);
showmessage("信息填写有误"); } if ($_POST['tel']) { if (!ismobile($_POST['tel'])) { showmessage("手机号有误!"); } } $arr = array("uid" => $_SGLOBAL[supe_uid], "username" => $_SGLOBAL[supe_username], "lpid" => $lpid, "giftname" => $thevalue[name], "time" => time(), "address" => strip_tags($_POST['address']), "tel" => ismobile(strip_tags($_POST['tel'])), "name" => strip_tags($_POST['realname'])); $id = inserttable('jifen_dhlog', $arr, 1); //插入数据 $_SGLOBAL['db']->query('UPDATE ' . tname('jifen_lp') . ' SET total=total-1,nums=nums+1 WHERE id=' . $lpid); //更新礼品信息 $_SGLOBAL['db']->query('UPDATE ' . tname('space') . ' SET credit=credit-' . $thevalue['price'] . ' WHERE uid=' . $_SGLOBAL[supe_uid]); //更新积分信息 //发全站feed $uid = $_SGLOBAL['supe_uid']; realname_set($_SGLOBAL['supe_uid'], $_SGLOBAL['supe_username']); realname_get(); include_once S_ROOT . './source/function_cp.php'; $avatar = ckavatar($uid) ? avatar($uid, 'middle', true) : UC_API . '/images/noavatar_middle.gif'; $summay = getstr($thevalue['des'], 150, 1, 1, 0, 0, -1); if ($thevalue['pic']) { $thevalue['pic'] = "jifen/uploads/image/" . $thevalue['id'] . ".jpg"; } else { $thevalue['pic'] = "jifen/images/default.jpg"; } feed_add('share', '{actor} 兑换了 [{gift}]', array('actor' => "<a href=\"space.php?uid={$uid}\">{$_SN[$uid]}</a>", 'gift' => "<a href=\"jifen.php?ac=show&id={$lpid}\">{$thevalue[name]}</a>"), '{summay}', array('summay' => $summay), '', array($thevalue['pic']), array('jifen.php?ac=show&id=' . $lpid)); showmessage("兑换成功", "index.php", 2); } else { include_once S_ROOT . "jifen/source/jifen_info.php"; }
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 blog_post($POST, $olds = array()) { global $_SGLOBAL, $_SC; //操作者角色切换 if (!empty($olds['uid'])) { $__SGLOBAL = $_SGLOBAL; $_SGLOBAL['supe_uid'] = $olds['uid']; $_SGLOBAL['supe_username'] = addslashes($olds['username']); } //标题 $POST['subject'] = getstr(trim($POST['subject']), 80, 1, 1, 1); if (strlen($POST['subject']) < 1) { $POST['subject'] = sgmdate('Y-m-d'); } $POST['friend'] = intval($POST['friend']); //隐私 $POST['target_ids'] = ''; if ($POST['friend'] == 2) { //特定好友 $uids = array(); $names = empty($_POST['target_names']) ? array() : explode(' ', str_replace(cplang('tab_space'), ' ', $_POST['target_names'])); if ($names) { $query = $_SGLOBAL['db']->query("SELECT uid FROM " . tname('space') . " WHERE username IN (" . simplode($names) . ")"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $uids[] = $value['uid']; } } if (empty($uids)) { $POST['friend'] = 3; //仅自己可见 } else { $POST['target_ids'] = implode(',', $uids); } } elseif ($POST['friend'] == 4) { //加密 $POST['password'] = trim($POST['password']); if ($POST['password'] == '') { $POST['friend'] = 0; } //公开 } if ($POST['friend'] !== 2) { $POST['target_ids'] = ''; } if ($POST['friend'] !== 4) { $POST['password'] == ''; } $POST['tag'] = shtmlspecialchars(trim($POST['tag'])); $POST['tag'] = getstr($POST['tag'], 500, 1, 1, 1); //语词屏蔽 //内容 $POST['message'] = checkhtml($POST['message']); $POST['message'] = getstr($POST['message'], 0, 1, 0, 1, 0, 1); $POST['message'] = preg_replace("/\\<div\\>\\<\\/div\\>/i", '', $POST['message']); $message = $POST['message']; //个人分类 if (empty($olds['classid']) || $POST['classid'] != $olds['classid']) { if (!empty($POST['classid']) && substr($POST['classid'], 0, 4) == 'new:') { //分类名 $classname = shtmlspecialchars(trim(substr($POST['classid'], 4))); $classname = getstr($classname, 0, 1, 1, 1); if (empty($classname)) { $classid = 0; } else { $classid = getcount('class', array('classname' => $classname, 'uid' => $_SGLOBAL['supe_uid']), 'classid'); if (empty($classid)) { $setarr = array('classname' => $classname, 'uid' => $_SGLOBAL['supe_uid'], 'dateline' => $_SGLOBAL['timestamp']); $classid = inserttable('class', $setarr, 1); } } } else { $classid = intval($POST['classid']); } } else { $classid = $olds['classid']; } if ($classid && empty($classname)) { //是否是自己的 $classname = getcount('class', array('classid' => $classid, 'uid' => $_SGLOBAL['supe_uid']), 'classname'); if (empty($classname)) { $classid = 0; } } //主表 $blogarr = array('subject' => $POST['subject'], 'classid' => $classid, 'friend' => $POST['friend'], 'password' => $POST['password'], 'noreply' => empty($_POST['noreply']) ? 0 : 1); //标题图片 $titlepic = ''; //获取上传的图片 $uploads = array(); if (!empty($POST['picids'])) { $picids = array_keys($POST['picids']); $query = $_SGLOBAL['db']->query("SELECT * FROM " . tname('pic') . " WHERE picid IN (" . simplode($picids) . ") AND uid='{$_SGLOBAL['supe_uid']}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { if (empty($titlepic) && $value['thumb']) { $titlepic = $value['filepath'] . '.thumb.jpg'; $blogarr['picflag'] = $value['remote'] ? 2 : 1; } $uploads[$POST['picids'][$value['picid']]] = $value; } if (empty($titlepic) && $value) { $titlepic = $value['filepath']; $blogarr['picflag'] = $value['remote'] ? 2 : 1; } } //插入文章 if ($uploads) { preg_match_all("/\\<img\\s.*?\\_uchome\\_localimg\\_([0-9]+).+?src\\=\"(.+?)\"/i", $message, $mathes); if (!empty($mathes[1])) { $searchs = $idsearchs = array(); $replaces = array(); foreach ($mathes[1] as $key => $value) { if (!empty($mathes[2][$key]) && !empty($uploads[$value])) { $searchs[] = $mathes[2][$key]; $idsearchs[] = "_uchome_localimg_{$value}"; $replaces[] = mkpicurl($uploads[$value], 0); unset($uploads[$value]); } } if ($searchs) { $message = str_replace($searchs, $replaces, $message); $message = str_replace($idsearchs, 'uchomelocalimg[]', $message); } } //未插入文章 foreach ($uploads as $value) { $picurl = mkpicurl($value, 0); $message .= "<div class=\"uchome-message-pic\"><img src=\"{$picurl}\"><p>{$value['title']}</p></div>"; } } //没有填写任何东西 $ckmessage = preg_replace("/(\\<div\\>|\\<\\/div\\>|\\s|\\ \\;|\\<br\\>|\\<p\\>|\\<\\/p\\>)+/is", '', $message); if (empty($ckmessage)) { return false; } //添加slashes $message = addslashes($message); //从内容中读取图片 if (empty($titlepic)) { $titlepic = getmessagepic($message); $blogarr['picflag'] = 0; } $blogarr['pic'] = $titlepic; if ($olds['blogid']) { //更新 $blogid = $olds['blogid']; updatetable('blog', $blogarr, array('blogid' => $blogid)); $fuids = array(); $blogarr['uid'] = $olds['uid']; $blogarr['username'] = $olds['username']; } else { $blogarr['uid'] = $_SGLOBAL['supe_uid']; $blogarr['username'] = $_SGLOBAL['supe_username']; $blogarr['dateline'] = empty($POST['dateline']) ? $_SGLOBAL['timestamp'] : $POST['dateline']; $blogid = inserttable('blog', $blogarr, 1); } $blogarr['blogid'] = $blogid; //附表 $fieldarr = array('message' => $message, 'postip' => getonlineip(), 'target_ids' => $POST['target_ids']); //TAG $oldtagstr = addslashes(empty($olds['tag']) ? '' : implode(' ', unserialize($olds['tag']))); $tagarr = array(); if ($POST['tag'] != $oldtagstr) { if (!empty($olds['tag'])) { //先把以前的给清理掉 $oldtags = array(); $query = $_SGLOBAL['db']->query("SELECT tagid, blogid FROM " . tname('tagblog') . " WHERE blogid='{$blogid}'"); while ($value = $_SGLOBAL['db']->fetch_array($query)) { $oldtags[] = $value['tagid']; } if ($oldtags) { $_SGLOBAL['db']->query("UPDATE " . tname('tag') . " SET blognum=blognum-1 WHERE tagid IN (" . simplode($oldtags) . ")"); $_SGLOBAL['db']->query("DELETE FROM " . tname('tagblog') . " WHERE blogid='{$blogid}'"); } } $tagarr = tag_batch($blogid, $POST['tag']); //更新附表中的tag $fieldarr['tag'] = empty($tagarr) ? '' : addslashes(serialize($tagarr)); } if ($olds) { //更新 updatetable('blogfield', $fieldarr, array('blogid' => $blogid)); } else { $fieldarr['blogid'] = $blogid; $fieldarr['uid'] = $blogarr['uid']; inserttable('blogfield', $fieldarr); } //空间更新 if ($olds) { //空间更新 $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET updatetime='{$_SGLOBAL['timestamp']}' WHERE uid='{$_SGLOBAL['supe_uid']}'"); } else { //积分 updatespacestatus('get', 'blog'); } //feed if (empty($olds) && $blogarr['friend'] != 3) { //事件feed $fs = array(); $fs['icon'] = 'blog'; $fs['title_data'] = array(); $fs['images'] = $fs['image_links'] = array(); if ($blogarr['friend'] == 4) { //加密日志feed $fs['title_template'] = cplang('feed_blog_password'); $fs['title_data'] = array('subject' => "<a href=\"space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}\">{$blogarr['subject']}</a>"); $fs['body_template'] = ''; $fs['body_data'] = array(); } else { if ($blogarr['pic']) { $fs['images'] = array(mkpicurl($blogarr)); $fs['image_links'] = array("space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}"); } $fs['title_template'] = cplang('feed_blog'); $fs['body_template'] = '<b>{subject}</b><br>{summary}'; $fs['body_data'] = array('subject' => "<a href=\"space.php?uid={$_SGLOBAL['supe_uid']}&do=blog&id={$blogid}\">{$blogarr['subject']}</a>", 'summary' => getstr($message, 150, 1, 1, 0, 0, -1)); } $fs['body_general'] = ''; $fs['target_ids'] = $fieldarr['target_ids']; $fs['friend'] = $blogarr['friend']; if (ckprivacy('blog', 1)) { include_once S_ROOT . './source/function_cp.php'; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'], $fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']); } } //角色切换 if (!empty($__SGLOBAL)) { $_SGLOBAL = $__SGLOBAL; } return $blogarr; }
function postfeed($feed) { global $_G; if ($feed) { require_once libfile('function/feed'); feed_add($feed['icon'], $feed['title_template'], $feed['title_data'], $feed['body_template'], $feed['body_data'], '', $feed['images'], $feed['image_links'], '', '', '', 0, $feed['id'], $feed['idtype']); } }
$feed_hash_data = 'albumid' . $share['itemid']; $share['title_template'] = lang('spacecp', 'share_album'); break; case 'pic': $feed_hash_data = 'picid' . $share['itemid']; $share['title_template'] = lang('spacecp', 'share_image'); break; case 'article': $feed_hash_data = 'articleid' . $share['itemid']; $share['title_template'] = lang('spacecp', 'share_article'); break; case 'link': $feed_hash_data = ''; break; } feed_add('share', '{actor} ' . $share['title_template'], array('hash_data' => $feed_hash_data), $share['body_template'], dunserialize($share['body_data']), $share['body_general'], array($share['image']), array($share['image_link']), '', '', '', 0, 0, '', $share['uid'], $share['username']); } updatemoderate('sid', $moderation['validate'], 2); } if (!empty($moderation['delete'])) { require libfile('function/delete'); $shares = deleteshares($moderation['delete']); $deletes = count($shares); updatemoderate('sid', $moderation['delete'], 2); } if ($ignore_sids = dimplode($moderation['ignore'])) { $ignores = C::t('home_share')->update($moderation['ignore'], array('status' => 2)); updatemoderate('sid', $moderation['ignore'], 1); } if ($_GET['fast']) { echo callback_js($_GET['sid']);
//对方加了我为好友,我审核通过 if (submitcheck('add2submit')) { //成为好友 $gid = intval($_POST['gid']); friend_update($space['uid'], $space['username'], $tospace['uid'], $tospace['username'], 'add', $gid); //事件发布 //加好友不发布事件 if (ckprivacy('friend', 1)) { $fs = array(); $fs['icon'] = 'friend'; $fs['title_template'] = cplang('feed_friend_title'); $fs['title_data'] = array('touser' => "<a href=\"space.php?uid={$tospace['uid']}\">" . $_SN[$tospace['uid']] . "</a>"); $fs['body_template'] = ''; $fs['body_data'] = array(); $fs['body_general'] = ''; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general']); } //我的好友申请数进行变化 $_SGLOBAL['db']->query("UPDATE " . tname('space') . " SET addfriendnum=addfriendnum-1 WHERE uid='{$space['uid']}' AND addfriendnum>0"); //通知 notification_add($uid, 'friend', cplang('note_friend_add')); showmessage('friends_add', $_POST['refer'], 1, array($_SN[$tospace['uid']])); } else { $op = 'add2'; include_once template('cp_friend'); exit; } } } } elseif ($op == 'ignore') { //检测用户
function invite_update($inviteid, $uid, $username, $m_uid, $m_username, $appid=0) { global $_SGLOBAL, $_SN; if($uid && $uid != $m_uid) { $friendstatus = getfriendstatus($uid, $m_uid); if($friendstatus < 1) { friend_update($uid, $username, $m_uid, $m_username, 'invite'); //查找邀请记录 $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('invite')." WHERE uid='$m_uid' AND fuid='$uid'"); if($oldinvite = $_SGLOBAL['db']->fetch_array($query)) { //已经邀请过 return false; } //奖励积分 getreward('invitefriend', 1, $m_uid, '', 0); //feed $_SGLOBAL['supe_uid'] = $m_uid; $_SGLOBAL['supe_username'] = $m_username; //实名 realname_set($uid, $username); realname_get(); if(ckprivacy('invite', 1)) { $title_template = cplang('feed_invite'); $tite_data = array('username'=>'<a href="space.php?uid='.$uid.'">'.stripslashes($_SN[$uid]).'</a>'); feed_add('friend', $title_template, $tite_data); } //通知 $_SGLOBAL['supe_uid'] = $uid; $_SGLOBAL['supe_username'] = $username; notification_add($m_uid, 'friend', cplang('note_invite')); //更新邀请 $setarr = array('fuid'=>$uid, 'fusername'=>$username, 'appid'=>$appid); if($inviteid) { updatetable('invite', $setarr, array('id'=>$inviteid)); } else { $setarr['uid'] = $m_uid; inserttable('invite', $setarr, 0, true);//插入邀请记录 } } } }
function mtag_join($type, $key, $fieldid=0) { global $_SGLOBAL, $space; //判断用户是否已经加入 $havejoin = 0; $key = addslashes($key); if($type == 'tagid') { $wheresql = "main.tagid='$key'"; } else { if(strlen($key) < 2) { showmessage('mtag_tagname_error'); } $wheresql = "main.tagname='$key' AND main.fieldid='$fieldid'"; } $query = $_SGLOBAL['db']->query("SELECT * FROM ".tname('mtag')." main WHERE $wheresql LIMIT 1"); if($mtag = $_SGLOBAL['db']->fetch_array($query)) { //判断是否加入 $fieldid = $mtag['fieldid']; $havejoin = getcount('tagspace', array('tagid'=>$mtag['tagid'], 'uid'=>$_SGLOBAL['supe_uid'])); } elseif($type == 'tagid') { return array(); } if($havejoin) { return $mtag; } $field = $_SGLOBAL['profield'][$fieldid]; if(!$mtag) { //创建 $mtag = array( 'tagname' => $key, 'fieldid' => $fieldid ); $tagid = inserttable('mtag', $mtag, 1); $mtag['tagid'] = $tagid; } else { $tagid = $mtag['tagid']; } //检查个数 $mtag['title'] = $field['title']; //自己在当前栏目下面的群组 $maxinputnum = 0; if($field['formtype'] == 'text' || $field['formtype'] == 'multi') { $maxinputnum = intval($field['inputnum']); } elseif($field['formtype'] == 'select') { $maxinputnum = 1; } if($maxinputnum) { $var = "myinputnum_$fieldid"; $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('tagspace')." ts, ".tname('mtag')." mtag WHERE ts.tagid=mtag.tagid AND ts.uid='$_SGLOBAL[supe_uid]' AND mtag.fieldid='$fieldid'"); $_SGLOBAL[$var] = $_SGLOBAL['db']->result($query, 0); if($_SGLOBAL[$var] >= $maxinputnum) { showmessage('mtag_join_field_error', '', 1, array($field['title'], $maxinputnum)); } } //加入 $setarr = array( 'tagid' => $tagid, 'uid' => $_SGLOBAL['supe_uid'], 'username' => $_SGLOBAL['supe_username'] ); if($mtag['joinperm'] == 2) { return array(); } elseif($mtag['joinperm'] == 1) { $mtag['grade'] = $setarr['grade'] = -2;//需要审核 } else { //检测是否有群主 $query = $_SGLOBAL['db']->query("SELECT COUNT(*) FROM ".tname('tagspace')." WHERE tagid='$tagid' AND grade>=8"); $modcount = $_SGLOBAL['db']->result($query, 0); if($modcount) { $mtag['grade'] = $setarr['grade'] = 0;//已经有群主 } else { $mtag['grade'] = $setarr['grade'] = $field['manualmoderator']?0:9;//自动为群主 } //事件通知 if(ckprivacy('mtag', 1)) { $fs = array(); $fs['icon'] = 'mtag'; $fs['title_template'] = cplang('feed_mtag_join'); $fs['title_data'] = array( 'mtag' => "<a href=\"space.php?do=mtag&tagid=$tagid\">$mtag[tagname]</a>", 'field' => "<a href=\"space.php?do=mtag&id=$mtag[fieldid]\">$mtag[title]</a>" ); feed_add($fs['icon'], $fs['title_template'], $fs['title_data']); } } if($setarr) { $_SGLOBAL['db']->query("UPDATE ".tname('mtag')." SET membernum=membernum+1 WHERE tagid='$tagid'"); inserttable('tagspace', $setarr, 0, true); $mtag['membernum'] = $mtag['membernum'] + 1; } return $mtag; }
function add_comment($message, $id, $idtype, $cid = 0) { global $_G, $bbcode; $allowcomment = false; switch ($idtype) { case 'uid': $allowcomment = helper_access::check_module('wall'); break; case 'picid': $allowcomment = helper_access::check_module('album'); break; case 'blogid': $allowcomment = helper_access::check_module('blog'); break; case 'sid': $allowcomment = helper_access::check_module('share'); break; } if (!$allowcomment) { showmessage('quickclear_noperm'); } $summay = getstr($message, 150, 0, 0, 0, -1); $comment = array(); if ($cid) { $comment = C::t('home_comment')->fetch_by_id_idtype($id, $idtype, $cid); if ($comment && $comment['authorid'] != $_G['uid']) { $comment['message'] = preg_replace("/\\<div class=\"quote\"\\>\\<blockquote\\>.*?\\<\\/blockquote\\>\\<\\/div\\>/is", '', $comment['message']); $comment['message'] = $bbcode->html2bbcode($comment['message']); $message = "<div class=\"quote\"><blockquote><b>" . $comment['author'] . "</b>: " . getstr($comment['message'], 150, 0, 0, 2, 1) . '</blockquote></div>' . $message; if ($comment['idtype'] == 'uid') { $id = $comment['authorid']; } } else { $comment = array(); } } $hotarr = array(); $stattype = ''; $tospace = $pic = $blog = $album = $share = $poll = array(); switch ($idtype) { case 'uid': $tospace = getuserbyuid($id); $stattype = 'wall'; break; case 'picid': $pic = C::t('home_pic')->fetch($id); if (empty($pic)) { showmessage('view_images_do_not_exist'); } $picfield = C::t('home_picfield')->fetch($id); $pic['hotuser'] = $picfield['hotuser']; $tospace = getuserbyuid($pic['uid']); $album = array(); if ($pic['albumid']) { $query = C::t('home_album')->fetch($pic['albumid']); if (!$query['albumid']) { C::t('home_pic')->update_for_albumid($albumid, array('albumid' => 0)); } } if (!ckfriend($album['uid'], $album['friend'], $album['target_ids'])) { showmessage('no_privilege_ckfriend_pic'); } elseif (!$tospace['self'] && $album['friend'] == 4) { $cookiename = "view_pwd_album_{$album['albumid']}"; $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename]; if ($cookievalue != md5(md5($album['password']))) { showmessage('no_privilege_ckpassword_pic'); } } $hotarr = array('picid', $pic['picid'], $pic['hotuser']); $stattype = 'piccomment'; break; case 'blogid': $blog = array_merge(C::t('home_blog')->fetch($id), C::t('home_blogfield')->fetch_targetids_by_blogid($id)); if (empty($blog)) { showmessage('view_to_info_did_not_exist'); } $tospace = getuserbyuid($blog['uid']); if (!ckfriend($blog['uid'], $blog['friend'], $blog['target_ids'])) { showmessage('no_privilege_ckfriend_blog'); } elseif (!$tospace['self'] && $blog['friend'] == 4) { $cookiename = "view_pwd_blog_{$blog['blogid']}"; $cookievalue = empty($_G['cookie'][$cookiename]) ? '' : $_G['cookie'][$cookiename]; if ($cookievalue != md5(md5($blog['password']))) { showmessage('no_privilege_ckpassword_blog'); } } if (!empty($blog['noreply'])) { showmessage('do_not_accept_comments'); } if ($blog['target_ids']) { $blog['target_ids'] .= ",{$blog['uid']}"; } $hotarr = array('blogid', $blog['blogid'], $blog['hotuser']); $stattype = 'blogcomment'; break; case 'sid': $share = C::t('home_share')->fetch($id); if (empty($share)) { showmessage('sharing_does_not_exist'); } $tospace = getuserbyuid($share['uid']); $hotarr = array('sid', $share['sid'], $share['hotuser']); $stattype = 'sharecomment'; break; default: showmessage('non_normal_operation'); break; } if (empty($tospace)) { showmessage('space_does_not_exist', '', array(), array('return' => true)); } if (isblacklist($tospace['uid'])) { showmessage('is_blacklist'); } if ($hotarr && $tospace['uid'] != $_G['uid']) { hot_update($hotarr[0], $hotarr[1], $hotarr[2]); } $fs = array(); $fs['icon'] = 'comment'; $fs['target_ids'] = ''; $fs['friend'] = ''; $fs['body_template'] = ''; $fs['body_data'] = array(); $fs['body_general'] = ''; $fs['images'] = array(); $fs['image_links'] = array(); switch ($idtype) { case 'uid': $fs['icon'] = 'wall'; $fs['title_template'] = 'feed_comment_space'; $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">{$tospace['username']}</a>"); break; case 'picid': $fs['title_template'] = 'feed_comment_image'; $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>"); $fs['body_template'] = '{pic_title}'; $fs['body_data'] = array('pic_title' => $pic['title']); $fs['body_general'] = $summay; $fs['images'] = array(pic_get($pic['filepath'], 'album', $pic['thumb'], $pic['remote'])); $fs['image_links'] = array("home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$pic['picid']}"); $fs['target_ids'] = $album['target_ids']; $fs['friend'] = $album['friend']; break; case 'blogid': C::t('home_blog')->increase($id, 0, array('replynum' => 1)); $fs['title_template'] = 'feed_comment_blog'; $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'blog' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}\">{$blog['subject']}</a>"); $fs['target_ids'] = $blog['target_ids']; $fs['friend'] = $blog['friend']; break; case 'sid': $fs['title_template'] = 'feed_comment_share'; $fs['title_data'] = array('touser' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}\">" . $tospace['username'] . "</a>", 'share' => "<a href=\"home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}\">" . str_replace(lang('spacecp', 'share_action'), '', $share['title_template']) . "</a>"); break; } $message = censor($message); if (censormod($message)) { $comment_status = 1; } else { $comment_status = 0; } $setarr = array('uid' => $tospace['uid'], 'id' => $id, 'idtype' => $idtype, 'authorid' => $_G['uid'], 'author' => $_G['username'], 'dateline' => $_G['timestamp'], 'message' => $message, 'ip' => $_G['clientip'], 'port' => $_G['remoteport'], 'status' => $comment_status); $cid = C::t('home_comment')->insert($setarr, true); $action = 'comment'; $becomment = 'getcomment'; $note = $q_note = ''; $note_values = $q_values = array(); switch ($idtype) { case 'uid': $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=wall&cid={$cid}"; $note_type = 'wall'; $note = 'wall'; $note_values = array('url' => $n_url); $q_note = 'wall_reply'; $q_values = array('url' => $n_url); if ($comment) { $msg = 'note_wall_reply_success'; $magvalues = array('username' => $tospace['username']); $becomment = ''; } else { $msg = 'do_success'; $magvalues = array(); $becomment = 'getguestbook'; } $action = 'guestbook'; break; case 'picid': $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=album&picid={$id}&cid={$cid}"; $note_type = 'comment'; $note = 'pic_comment'; $note_values = array('url' => $n_url); $q_note = 'pic_comment_reply'; $q_values = array('url' => $n_url); $msg = 'do_success'; $magvalues = array(); break; case 'blogid': $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=blog&id={$id}&cid={$cid}"; $note_type = 'comment'; $note = 'blog_comment'; $note_values = array('url' => $n_url, 'subject' => $blog['subject']); $q_note = 'blog_comment_reply'; $q_values = array('url' => $n_url); $msg = 'do_success'; $magvalues = array(); break; case 'sid': $n_url = "home.php?mod=space&uid={$tospace['uid']}&do=share&id={$id}&cid={$cid}"; $note_type = 'comment'; $note = 'share_comment'; $note_values = array('url' => $n_url); $q_note = 'share_comment_reply'; $q_values = array('url' => $n_url); $msg = 'do_success'; $magvalues = array(); break; } if (empty($comment)) { if ($tospace['uid'] != $_G['uid']) { if (ckprivacy('comment', 'feed')) { require_once libfile('function/feed'); $fs['title_data']['hash_data'] = "{$idtype}{$id}"; feed_add($fs['icon'], $fs['title_template'], $fs['title_data'], $fs['body_template'], $fs['body_data'], $fs['body_general'], $fs['images'], $fs['image_links'], $fs['target_ids'], $fs['friend']); } $note_values['from_id'] = $id; $note_values['from_idtype'] = $idtype; $note_values['url'] .= "&goto=new#comment_{$cid}_li"; notification_add($tospace['uid'], $note_type, $note, $note_values); } } elseif ($comment['authorid'] != $_G['uid']) { notification_add($comment['authorid'], $note_type, $q_note, $q_values); } if ($comment_status == 1) { updatemoderate($idtype . '_cid', $cid); manage_addnotify('verifycommontes'); } if ($stattype) { include_once libfile('function/stat'); updatestat($stattype); } if ($tospace['uid'] != $_G['uid']) { $needle = $id; if ($idtype != 'uid') { $needle = $idtype . $id; } else { $needle = $tospace['uid']; } updatecreditbyaction($action, 0, array(), $needle); if ($becomment) { if ($idtype == 'uid') { $needle = $_G['uid']; } updatecreditbyaction($becomment, $tospace['uid'], array(), $needle); } } C::t('common_member_status')->update($_G['uid'], array('lastpost' => $_G['timestamp']), 'UNBUFFERED'); $magvalues['cid'] = $cid; return array('cid' => $cid, 'msg' => $msg, 'magvalues' => $magvalues); }
} 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); } elseif ($welcomemsg == 2) { sendmail_cron($email, $welcomtitle, $welcomemsgtxt); } }
realname_set($event['uid'], $event['username']); realname_get(); feed_add('event', cplang('event_join'), array('title' => $event['title'], "eventid" => $event['eventid'], "uid" => $event['uid'], "username" => $_SN[$event['uid']])); } } elseif ($_SGLOBAL['supe_userevent'] && $_SGLOBAL['supe_userevent'] < 2) { $arr = array("status" => 2); if ($_SGLOBAL['supe_userevent']['status'] == 1) { $numsql .= ",follownum = follownum - 1 "; } if ($event['limitnum'] > 0 && $event['membernum'] + $_SGLOBAL['supe_userevent']['fellow'] > $event['limitnum']) { $arr['fellow'] = 0; } updatetable("userevent", $arr, array("uid" => $_SGLOBAL['supe_uid'], "eventid" => $eventid)); $_SGLOBAL['db']->query("UPDATE " . tname("event") . " SET {$numsql} WHERE eventid = '{$eventid}'"); if (ckprivacy('join')) { feed_add('event', cplang('event_join'), array('title' => $event['title'], "eventid" => $event['eventid'], "uid" => $event['uid'], "username" => $event['username'])); } } showmessage(cplang('event_accept_success', array("space.php?do=event&id={$event['eventid']}"))); } elseif ('delete' == $op) { // Delete/Cancel the Event if (!$eventid) { showmessage("event_does_not_exist"); // Event does not exist or has been deleted } if (!$allowmanage) { showmessage('no_privilege'); } if (submitcheck("deletesubmit")) { include_once S_ROOT . './source/function_delete.php'; deleteevents(array($eventid));
} if ($_G['setting']['verify'][$vid]['available']) { manage_addnotify('verify_' . $vid, 0, array('langkey' => 'manage_verify_field', 'verifyname' => $_G['setting']['verify'][$vid]['title'], 'doid' => $vid)); } } if (isset($_POST['privacy'])) { foreach ($_POST['privacy'] as $key => $value) { if (isset($_G['cache']['profilesetting'][$key])) { $space['privacy']['profile'][$key] = intval($value); } } DB::update('common_member_field_home', array('privacy' => addslashes(serialize($space['privacy']))), array('uid' => $space['uid'])); } manyoulog('user', $_G['uid'], 'update'); include_once libfile('function/feed'); feed_add('profile', 'feed_profile_update_' . $operation, array('hash_data' => 'profile')); countprofileprogress(); $message = $vid ? lang('spacecp', 'profile_verify_verifying', array('verify' => $verifyconfig['title'])) : ''; profile_showsuccess($message); } elseif (submitcheck('passwordsubmit', 0, $seccodecheck, $secqaacheck)) { $membersql = $memberfieldsql = $authstradd1 = $authstradd2 = $newpasswdadd = ''; $setarr = array(); $emailnew = dhtmlspecialchars($_G['gp_emailnew']); $ignorepassword = 0; if ($_G['setting']['connect']['allow'] && DB::result_first("SELECT conisregister FROM " . DB::table('common_member_connect') . " WHERE uid='{$_G['uid']}'")) { $_G['gp_oldpassword'] = ''; $ignorepassword = 1; if (empty($_G['gp_newpassword'])) { showmessage('profile_passwd_empty'); } }
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); } }