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));
 }
예제 #2
0
 public function insert($uid, $username, $password, $email, $ip, $groupid, $extdata, $adminid = 0)
 {
     if ($uid = dintval($uid)) {
         $credits = isset($extdata['credits']) ? $extdata['credits'] : array();
         $profile = isset($extdata['profile']) ? $extdata['profile'] : array();
         $profile['uid'] = $uid;
         $base = array('uid' => $uid, 'username' => (string) $username, 'password' => (string) $password, 'email' => (string) $email, 'adminid' => intval($adminid), 'groupid' => intval($groupid), 'regdate' => TIMESTAMP, 'emailstatus' => intval($extdata['emailstatus']), 'credits' => dintval($credits[0]), 'timeoffset' => 9999);
         $status = array('uid' => $uid, 'regip' => (string) $ip, 'lastip' => (string) $ip, 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP, 'lastpost' => 0, 'lastsendmail' => 0);
         $count = array('uid' => $uid, 'extcredits1' => dintval($credits[1]), 'extcredits2' => dintval($credits[2]), 'extcredits3' => dintval($credits[3]), 'extcredits4' => dintval($credits[4]), 'extcredits5' => dintval($credits[5]), 'extcredits6' => dintval($credits[6]), 'extcredits7' => dintval($credits[7]), 'extcredits8' => dintval($credits[8]));
         $ext = array('uid' => $uid);
         parent::insert($base, false, true);
         C::t('common_member_status')->insert($status, false, true);
         C::t('common_member_count')->insert($count, false, true);
         C::t('common_member_profile')->insert($profile, false, true);
         C::t('common_member_field_forum')->insert($ext, false, true);
         C::t('common_member_field_home')->insert($ext, false, true);
         manyoulog('user', $uid, 'add');
     }
 }
예제 #3
0
			$db->query("REPLACE INTO {$tablepre}memberfields (uid) VALUES ('$discuz_uid')");
		}

		if($memberfieldsql) {
			$db->query("UPDATE {$tablepre}memberfields SET $memberfieldsql WHERE uid='$discuz_uid'");
		}

		if($prompts['newbietask'] && $newbietaskid && $newbietasks[$newbietaskid]['scriptname'] == 'modifyprofile') {
			require_once DISCUZ_ROOT.'./include/task.func.php';
			task_newbie_complete();
			$msgforward = unserialize($_DCACHE['settings']['msgforward']);
			$msgforward['refreshtime'] = 9999999999;
			$_DCACHE['settings']['msgforward'] = serialize($msgforward);
		}

		manyoulog('user', $discuz_uid, 'update');

		if($type == 1 && !empty($authstradd1) && !empty($authstradd2)) {
			showmessage('profile_email_verify');
		} else {
			showmessage('profile_succeed', 'memcp.php?action=profile&typeid='.$typeid);
		}
	}

} elseif($action == 'credits') {

	$taxpercent = sprintf('%1.2f', $creditstax * 100).'%';

	if($creditspolicy['promotion_visit'] || $creditspolicy['promotion_register']) {
		$promotion_visit = $promotion_register = $space = '';
		foreach(array('promotion_visit', 'promotion_register') as $val) {
예제 #4
0
 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(':', '&#58;', $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(':', '&#58;', $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&amp;uid={$_G[uid]}&amp;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);
     }
 }
예제 #5
0
function deletespace($uid)
{
    global $_G;
    $allowmanage = checkperm('managedelspace');
    if ($allowmanage) {
        DB::query("UPDATE " . DB::table('common_member') . " SET status='1' WHERE uid='{$uid}'");
        manyoulog('user', $uid, 'delete');
        return true;
    } else {
        return false;
    }
}
 /**
  * 将用户帐号导入(主要应对用了UC的多论坛)
  * 本函数主要供_setPushbackSiteAccount方法使用
  * @param array $userInfo uc_get_user返回的数据
  */
 function _importUserFromUC($userInfo)
 {
     $uid = (int) $userInfo[0];
     $db = XWB_plugin::getDB();
     $exist_uid = intval($db->result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$userInfo[0]}' LIMIT 0,1 "));
     if ($exist_uid > 0) {
         return true;
     }
     $username = mysql_real_escape_string($userInfo[1]);
     $email = mysql_real_escape_string($userInfo[2]);
     $password = md5(rand(1, 10000));
     $db->query("INSERT IGNORE INTO " . DB::table('common_member') . " (uid, username, password, adminid, groupid, email)\n\t\t\tVALUES ('{$uid}', '{$username}', '{$password}', '0', '10', '{$email}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_status') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_profile') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_field_forum') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_field_home') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     $db->query("INSERT IGNORE INTO " . DB::table('common_member_count') . " (uid)\n\t\t\tVALUES ('{$uid}')");
     manyoulog('user', $this->uid, 'add');
     return true;
 }
 private function _adminUserInfo($act)
 {
     global $_G;
     $defaultop = '';
     $profilegroup = C::t('common_setting')->fetch('profilegroup', true);
     foreach ($profilegroup as $key => $value) {
         if ($value['available']) {
             $defaultop = $key;
             break;
         }
     }
     $errorMsg = '';
     $operation = $act;
     require_once libfile('function/editor');
     include_once libfile('function/profile');
     $space = getuserbyuid($_G['uid']);
     space_merge($space, 'profile');
     space_merge($space, 'field_home');
     space_merge($space, 'field_forum');
     $space['sightml'] = html2bbcode($space['sightml']);
     $vid = $_GET['vid'] ? intval($_GET['vid']) : 0;
     $privacy = $space['privacy']['profile'] ? $space['privacy']['profile'] : array();
     $_G['setting']['privacy'] = $_G['setting']['privacy'] ? $_G['setting']['privacy'] : array();
     $_G['setting']['privacy'] = is_array($_G['setting']['privacy']) ? $_G['setting']['privacy'] : dunserialize($_G['setting']['privacy']);
     $_G['setting']['privacy']['profile'] = !empty($_G['setting']['privacy']['profile']) ? $_G['setting']['privacy']['profile'] : array();
     $privacy = array_merge($_G['setting']['privacy']['profile'], $privacy);
     $actives = array('profile' => ' class="a"');
     $opactives = array($operation => ' class="a"');
     $allowitems = array();
     $allowitems = $profilegroup[$operation]['field'];
     $showbtn = $vid && $verify['verify' . $vid] != 1 || empty($vid);
     if (!empty($verify) && is_array($verify)) {
         foreach ($verify as $key => $flag) {
             if (in_array($key, array('verify1', 'verify2', 'verify3', 'verify4', 'verify5', 'verify6', 'verify7')) && $flag == 1) {
                 $verifyid = intval(substr($key, -1, 1));
                 if ($_G['setting']['verify'][$verifyid]['available']) {
                     foreach ($_G['setting']['verify'][$verifyid]['field'] as $field) {
                         $_G['cache']['profilesetting'][$field]['unchangeable'] = 1;
                     }
                 }
             }
         }
     }
     if ($vid) {
         if ($value = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid)) {
             $field = dunserialize($value['field']);
             foreach ($field as $key => $fvalue) {
                 $space[$key] = $fvalue;
             }
         }
     }
     $htmls = $settings = array();
     foreach ($allowitems as $fieldid) {
         if (!in_array($fieldid, array('sightml', 'customstatus', 'timeoffset'))) {
             $html = profile_setting($fieldid, $space, $vid ? false : true);
             if ($html) {
                 $settings[$fieldid] = $_G['cache']['profilesetting'][$fieldid];
                 $htmls[$fieldid] = $html;
             }
         }
     }
     if (!empty($_POST)) {
         require_once libfile('function/discuzcode');
         $forum = $setarr = $verifyarr = $errorarr = array();
         $forumfield = array('customstatus', 'sightml');
         $censor = discuz_censor::instance();
         if ($_GET['vid']) {
             $vid = intval($_GET['vid']);
             $verifyconfig = $_G['setting']['verify'][$vid];
             if ($verifyconfig['available'] && (empty($verifyconfig['groupid']) || in_array($_G['groupid'], $verifyconfig['groupid']))) {
                 $verifyinfo = C::t('common_member_verify_info')->fetch_by_uid_verifytype($_G['uid'], $vid);
                 if (!empty($verifyinfo)) {
                     $verifyinfo['field'] = dunserialize($verifyinfo['field']);
                 }
                 foreach ($verifyconfig['field'] as $key => $field) {
                     if (!isset($verifyinfo['field'][$key])) {
                         $verifyinfo['field'][$key] = $key;
                     }
                 }
             } else {
                 $_GET['vid'] = $vid = 0;
                 $verifyconfig = array();
             }
         }
         if (isset($_POST['birthprovince'])) {
             $initcity = array('birthprovince', 'birthcity', 'birthdist', 'birthcommunity');
             foreach ($initcity as $key) {
                 $_GET['' . $key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : '';
             }
         }
         if (isset($_POST['resideprovince'])) {
             $initcity = array('resideprovince', 'residecity', 'residedist', 'residecommunity');
             foreach ($initcity as $key) {
                 $_GET['' . $key] = $_POST[$key] = !empty($_POST[$key]) ? $_POST[$key] : '';
             }
         }
         foreach ($_POST as $key => $value) {
             $field = $_G['cache']['profilesetting'][$key];
             if (in_array($field['formtype'], array('text', 'textarea')) || in_array($key, $forumfield)) {
                 $censor->check($value);
                 if ($censor->modbanned() || $censor->modmoderated()) {
                     $list = $this->makeErrorInfo($res, 'profile_censor');
                     $this->_exitWithHtmlAlert($list['errcode']);
                     // profile_showerror($key, lang('spacecp', 'profile_censor'));
                 }
             }
             if (in_array($key, $forumfield)) {
                 if ($key == 'sightml') {
                     loadcache(array('smilies', 'smileytypes'));
                     $value = cutstr($value, $_G['group']['maxsigsize'], '');
                     foreach ($_G['cache']['smilies']['replacearray'] as $skey => $smiley) {
                         $_G['cache']['smilies']['replacearray'][$skey] = '[img]' . $_G['siteurl'] . 'static/image/smiley/' . $_G['cache']['smileytypes'][$_G['cache']['smilies']['typearray'][$skey]]['directory'] . '/' . $smiley . '[/img]';
                     }
                     $value = preg_replace($_G['cache']['smilies']['searcharray'], $_G['cache']['smilies']['replacearray'], trim($value));
                     $forum[$key] = discuzcode($value, 1, 0, 0, 0, $_G['group']['allowsigbbcode'], $_G['group']['allowsigimgcode'], 0, 0, 1);
                 } elseif ($key == 'customstatus' && $allowcstatus) {
                     $forum[$key] = dhtmlspecialchars(trim($value));
                 }
                 continue;
             } elseif ($field && !$field['available']) {
                 continue;
             } elseif ($key == 'timeoffset') {
                 if ($value >= -12 && $value <= 12 || $value == 9999) {
                     C::t('common_member')->update($_G['uid'], array('timeoffset' => intval($value)));
                 }
             } elseif ($key == 'site') {
                 if (!in_array(strtolower(substr($value, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\\//', $value) && !preg_match('/^data\\//', $value)) {
                     $value = 'http://' . $value;
                 }
             }
             if ($field['formtype'] == 'file') {
                 if (!empty($_FILES[$key]) && $_FILES[$key]['error'] == 0 || !empty($space[$key]) && empty($_GET['deletefile'][$key])) {
                     $value = '1';
                 } else {
                     $value = '';
                 }
             }
             if (empty($field)) {
                 continue;
             } elseif (profile_check($key, $value, $space)) {
                 $setarr[$key] = dhtmlspecialchars(trim($value));
             } else {
                 if ($key == 'birthprovince') {
                     $key = 'birthcity';
                 } elseif ($key == 'resideprovince' || $key == 'residecommunity' || $key == 'residedist') {
                     $key = 'residecity';
                 } elseif ($key == 'birthyear' || $key == 'birthmonth') {
                     $key = 'birthday';
                 }
                 // profile_showerror($key);
                 $list = $this->makeErrorInfo($res, 'check_date_item');
                 $errcode = $list['errcode'] . $settings[$key]['title'];
                 $this->_exitWithHtmlAlert($errcode);
             }
             if ($field['formtype'] == 'file') {
                 unset($setarr[$key]);
             }
             if ($vid && $verifyconfig['available'] && isset($verifyconfig['field'][$key])) {
                 if (isset($verifyinfo['field'][$key]) && $setarr[$key] !== $space[$key]) {
                     $verifyarr[$key] = $setarr[$key];
                 }
                 unset($setarr[$key]);
             }
             if (isset($setarr[$key]) && $_G['cache']['profilesetting'][$key]['needverify']) {
                 if ($setarr[$key] !== $space[$key]) {
                     $verifyarr[$key] = $setarr[$key];
                 }
                 unset($setarr[$key]);
             }
         }
         if ($vid && !empty($verifyinfo['field']) && is_array($verifyinfo['field'])) {
             foreach ($verifyinfo['field'] as $key => $fvalue) {
                 if (!isset($verifyconfig['field'][$key])) {
                     unset($verifyinfo['field'][$key]);
                     continue;
                 }
                 if (empty($verifyarr[$key]) && !isset($verifyarr[$key]) && isset($verifyinfo['field'][$key])) {
                     $verifyarr[$key] = !empty($fvalue) && $key != $fvalue ? $fvalue : $space[$key];
                 }
             }
         }
         if ($forum) {
             if (!$_G['group']['maxsigsize']) {
                 $forum['sightml'] = '';
             }
             C::t('common_member_field_forum')->update($_G['uid'], $forum);
         }
         if (isset($_POST['birthmonth']) && ($space['birthmonth'] != $_POST['birthmonth'] || $space['birthday'] != $_POST['birthday'])) {
             $setarr['constellation'] = get_constellation($_POST['birthmonth'], $_POST['birthday']);
         }
         if (isset($_POST['birthyear']) && $space['birthyear'] != $_POST['birthyear']) {
             $setarr['zodiac'] = get_zodiac($_POST['birthyear']);
         }
         if ($setarr) {
             C::t('common_member_profile')->update($_G['uid'], $setarr);
         }
         if ($verifyarr) {
             C::t('common_member_verify_info')->delete_by_uid($_G['uid'], $vid);
             $setverify = array('uid' => $_G['uid'], 'username' => $_G['username'], 'verifytype' => $vid, 'field' => serialize($verifyarr), 'dateline' => $_G['timestamp']);
             C::t('common_member_verify_info')->insert($setverify);
             if (!C::t('common_member_verify')->count_by_uid($_G['uid'])) {
                 C::t('common_member_verify')->insert(array('uid' => $_G['uid']));
             }
             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);
                 }
             }
             C::t('common_member_field_home')->update($space['uid'], array('privacy' => serialize($space['privacy'])));
         }
         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'])) : '';
         $list = $this->makeErrorInfo($res, 'update_date_success');
         $this->_exitWithHtmlAlert($list['errcode']);
     }
     $this->getController()->renderPartial('userInfoAdmin', array('formUrl' => WebUtils::createUrl_oldVersion('user/userinfoadminview', array('act' => $act)), 'errorMsg' => $errorMsg, 'action' => $act, '_G' => $_G, 'htmls' => $htmls, 'settings' => $settings));
 }
예제 #8
0
 DB::insert('common_member', $userdata);
 $status_data = array('uid' => $uid, 'regip' => $_G['clientip'], 'lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP, 'lastpost' => 0, 'lastsendmail' => 0);
 DB::insert('common_member_status', $status_data);
 $profile['uid'] = $uid;
 DB::insert('common_member_profile', $profile);
 DB::insert('common_member_field_forum', array('uid' => $uid));
 DB::insert('common_member_field_home', array('uid' => $uid));
 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' => $username);
 save_syscache('userstats', $userstats);
 if ($_G['setting']['regctrl'] || $_G['setting']['regfloodctrl']) {
     DB::query("DELETE FROM " . DB::table('common_regip') . " WHERE dateline<='{$_G['timestamp']}'-" . ($_G['setting']['regctrl'] > 72 ? $_G['setting']['regctrl'] : 72) . "*3600", 'UNBUFFERED');
     if ($_G['setting']['regctrl']) {
         DB::query("INSERT INTO " . DB::table('common_regip') . " (ip, count, dateline)\r\n\t\t\t\tVALUES ('{$_G['clientip']}', '-1', '{$_G['timestamp']}')");
     }
 }
 $regmessage = dhtmlspecialchars($_G['gp_regmessage']);
 if ($_G['setting']['regverify'] == 2) {
     DB::query("REPLACE INTO " . DB::table('common_member_validate') . " (uid, submitdate, moddate, admin, submittimes, status, message, remark)\r\n\t\t\tVALUES ('{$uid}', '{$_G['timestamp']}', '0', '', '1', '0', '{$regmessage}', '')");
 }
 $_G['uid'] = $uid;
 $_G['username'] = $username;
예제 #9
0
					if(isset($buddyarray[$buddyid[0]])) {
						showmessage('buddy_add_invalid');
					}
					if(uc_friend_add($discuz_uid, $buddyid[0], cutstr(dhtmlspecialchars($newdescription), 255))) {
						if($my_status) {
							$manyoufriend = FALSE;
							$buddyarray = uc_friend_ls($discuz_uid, 1, $buddynum, $buddynum, 3);
							foreach($buddyarray as $buddy) {
								if($buddyid[0] == $buddy['friendid']) {
									$manyoufriend = TRUE;
									break;
								}
							}
							if($manyoufriend) {
								manyoulog('friend', $discuz_uid, 'add', $buddyid[0]);
								manyoulog('friend', $buddyid[0], 'add', $discuz_uid);
							}
						}
						if($ucappopen['UCHOME']) {
							sendnotice($buddyid[0], 'buddy_new_uch', 'friend');
						} else {
							sendnotice($buddyid[0], 'buddy_new', 'friend');
						}
						if($prompts['newbietask'] && $newbietaskid && $newbietasks[$newbietaskid]['scriptname'] == 'addbuddy') {
							require_once DISCUZ_ROOT.'./include/task.func.php';
							task_newbie_complete();
						}
					} else {
						showmessage('buddy_add_ignore');
					}
				} else {
예제 #10
0
 private function _updateAvatarStatus()
 {
     global $_G;
     loaducenter();
     $uc_avatarflash = uc_avatar($_G['uid'], 'virtual', 0);
     if (empty($space['avatarstatus']) && uc_check_avatar($_G['uid'], 'middle')) {
         C::t('common_member')->update($_G['uid'], array('avatarstatus' => '1'));
         updatecreditbyaction('setavatar');
         manyoulog('user', $_G['uid'], 'update');
     }
 }
 /**
  * 在UC和DZX进行用户初始化注册
  * @access protected
  * @return boolen
  */
 function _regToUCDZX()
 {
     global $_G;
     $this->uid = (int) uc_user_register($this->username, $this->password, $this->email, $this->questionid, $this->answer);
     if ($this->uid > 0) {
         //在有UC的情况下,附属论坛的members表password列并不存储真实密码,只是用于cookies登陆状态校样。
         $init_arr = explode(',', $_G['setting']['initcredits']);
         $userdata = array('uid' => $this->uid, 'username' => $this->username, 'password' => md5(rand(100000, 999999)), 'email' => $this->email, 'adminid' => 0, 'groupid' => $this->groupid, 'regdate' => $this->timestamp, 'credits' => $init_arr[0], 'timeoffset' => 9999);
         DB::insert('common_member', $userdata);
         $status_data = array('uid' => $this->uid, 'regip' => $this->ip, 'lastip' => $this->ip, 'lastvisit' => $this->timestamp, 'lastactivity' => $this->timestamp, 'lastpost' => 0, 'lastsendmail' => 0);
         DB::insert('common_member_status', $status_data);
         $profile['uid'] = $this->uid;
         DB::insert('common_member_profile', $profile);
         DB::insert('common_member_field_forum', array('uid' => $this->uid));
         DB::insert('common_member_field_home', array('uid' => $this->uid));
         //初始化积分
         $count_data = array('uid' => $this->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' => $this->username), false, true);
         manyoulog('user', $this->uid, 'add');
         return true;
     } else {
         return false;
     }
 }
예제 #12
0
		if($task = $db->fetch_first("SELECT * FROM {$tablepre}tasks WHERE taskid='$newbietaskids[0]' AND available='2'")) {
			require_once DISCUZ_ROOT.'./include/task.func.php';
			$task['newbie'] = 1;
			task_apply($task);
			$db->query("UPDATE {$tablepre}members SET prompt=prompt|8, newbietaskid='$newbietaskids[0]' WHERE uid='$discuz_uid'", 'UNBUFFERED');
		}
	}

	require_once DISCUZ_ROOT.'./include/cache.func.php';
	$_DCACHE['settings']['totalmembers']++;
	updatesettings();

	dsetcookie('loginuser', '');
	dsetcookie('activationauth', '', -86400 * 365);

	manyoulog('user', $discuz_uid, 'add');

	if(!empty($inajax)) {
		$msgforward = unserialize($msgforward);
		$mrefreshtime = intval($msgforward['refreshtime']) * 1000;
		$message = 1;
		if($regverify != 1) {
			include template('register');
		}
	}

	switch($regverify) {
		case 1:
			sendmail("$username <$email>", 'email_verify_subject', 'email_verify_message');
			if(!empty($inajax)) {
				include template('register');
 public function delById($id)
 {
     parent::update($id, array('deleted' => 1));
     manyoulog('wirror_slider_pics', $id, 'delete');
 }
예제 #14
0
function friend_cache($touid)
{
    global $_G;
    $tospace = array('uid' => $touid);
    space_merge($tospace, 'field_home');
    $filtergids = empty($tospace['privacy']['filter_gid']) ? array() : $tospace['privacy']['filter_gid'];
    $uids = array();
    $count = 0;
    $fcount = 0;
    $query = DB::query("SELECT * FROM " . DB::table('home_friend') . " WHERE uid='{$touid}' ORDER BY num DESC, dateline DESC");
    while ($value = DB::fetch($query)) {
        if ($value['fuid'] == $touid) {
            continue;
        }
        if ($fcount < 200 && (empty($filtergids) || !in_array($value['gid'], $filtergids))) {
            $uids[] = $value['fuid'];
            $fcount++;
        }
        $count++;
    }
    DB::update('common_member_field_home', array('feedfriend' => implode(',', $uids)), array('uid' => $touid));
    DB::update('common_member_count', array('friends' => $count), array('uid' => $touid));
    if ($_G['setting']['my_app_status']) {
        manyoulog('user', $touid, 'update');
    }
}
예제 #15
0
$sitekey = $db->result_first("SELECT value FROM {$tablepre}settings WHERE variable='siteuniqueid'");
if($_GET['c'] != substr(md5($sitekey.'|'.$_GET['u'].(empty($_GET['app']) ? '' : '|'.$_GET['app'])), 8, 16)) {
	showmessage('manyou:invite_error');
}

$friendname = $db->result_first("SELECT username FROM {$tablepre}members WHERE uid='$_GET[u]'");
if(!$friendname) {
	showmessage('manyou:invite_error');
}

if(!$discuz_uid) {
	$regname .= (strpos($regname, '?') ? '&' : '?').'referer='.rawurlencode($boardurl.'manyou/invite.php?'.$_SERVER['QUERY_STRING']);
	showmessage('manyou:invite_message', $regname);
}

if($_GET['u'] == $discuz_uid) {
	showmessage('manyou:invite_noself');
}

require_once './uc_client/client.php';

uc_friend_add($_GET['u'], $discuz_uid);
uc_friend_add($discuz_uid, $_GET['u']);
manyoulog('friend', $discuz_uid, 'add', $_GET['u']);
manyoulog('friend', $_GET['u'], 'add', $discuz_uid);


showmessage('manyou:invite_friend', 'userapp.php?script=user&id='.$_GET['app'].'&my_extra=invitedby_bi_'.$_GET['u'].'_'.$_GET['c'].'&my_suffix=Lw%3D%3D');

?>
예제 #16
0
function deletespace($uid)
{
    global $_G;
    $allowmanage = checkperm('managedelspace');
    if ($allowmanage) {
        C::t('common_member')->update($uid, array('status' => 1));
        manyoulog('user', $uid, 'delete');
        return true;
    } else {
        return false;
    }
}
예제 #17
0
                updatecache('connect_blacklist');
            }
            if ($member['conisbind'] && !$member['conisregister'] && !empty($_GET['connectunbind'])) {
                connectunbind($member);
            }
        }
        $memberupdate = array_merge($memberupdate, array('regdate' => $regdatenew, 'emailstatus' => $emailstatusnew, 'status' => $status, 'timeoffset' => $_GET['timeoffsetnew']));
        C::t('common_member' . $tableext)->update($uid, $memberupdate);
        C::t('common_member_field_home' . $tableext)->update($uid, array('addsize' => $addsize, 'addfriend' => $addfriend));
        C::t('common_member_count' . $tableext)->update($uid, array('posts' => $_GET['postsnew'], 'digestposts' => $_GET['digestpostsnew']));
        C::t('common_member_status' . $tableext)->update($uid, array('regip' => $_GET['regipnew'], 'lastvisit' => $lastvisitnew, 'lastip' => $_GET['lastipnew'], 'invisible' => $_GET['invisiblenew']));
        C::t('common_member_field_forum' . $tableext)->update($uid, array('customstatus' => $_GET['cstatusnew'], 'sightml' => $sightmlnew));
        if (!empty($fieldarr)) {
            C::t('common_member_profile' . $tableext)->update($uid, $fieldarr);
        }
        manyoulog('user', $uid, 'update');
        cpmsg('members_edit_succeed', 'action=members&operation=edit&uid=' . $uid, 'succeed');
    }
} elseif ($operation == 'ipban') {
    if (!$_GET['ipact']) {
        if (!submitcheck('ipbansubmit')) {
            require_once libfile('function/misc');
            $iptoban = explode('.', getgpc('ip'));
            $ipbanned = '';
            foreach (C::t('common_banned')->fetch_all_order_dateline() as $banned) {
                for ($i = 1; $i <= 4; $i++) {
                    if ($banned["ip{$i}"] == -1) {
                        $banned["ip{$i}"] = '*';
                    }
                }
                $disabled = $_G['adminid'] != 1 && $banned['admin'] != $_G['member']['username'] ? 'disabled' : '';
예제 #18
0
function pick_reg($info)
{
    $member = $info;
    extract($info);
    global $_G;
    loaducenter();
    require_once libfile('function/misc');
    require_once libfile('function/profile');
    include_once libfile('class/member');
    $activation = array();
    if (!$activation) {
        $usernamelen = dstrlen($username);
        if ($usernamelen < 3) {
            return milu_lang('too_short');
        } elseif ($usernamelen > 15) {
            return milu_lang('too_long');
        }
        $username = addslashes(trim(dstripslashes($username)));
        $email = trim($email);
    }
    if (!$activation) {
        $uid = uc_user_register($username, $password, $email, $questionid, $answer, $_G['clientip']);
        if ($uid <= 0) {
            if ($uid == -1) {
                return milu_lang('bad_word');
            } elseif ($uid == -2) {
                return milu_lang('system_bad_word');
            } elseif ($uid == -3) {
                return milu_lang('reged');
            } elseif ($uid == -4) {
                return milu_lang('wrong_email');
            } elseif ($uid == -5) {
                return milu_lang('bad_email');
            } elseif ($uid == -6) {
                return milu_lang('email_reged');
            } else {
                return milu_lang('unknow_error');
            }
        }
    } else {
        list($uid, $username, $email) = $activation;
    }
    if (DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE uid='{$uid}'")) {
        if (!$activation) {
            uc_user_delete($uid);
        }
        return milu_lang('uid_reged');
    }
    $init_arr = explode(',', $_G['setting']['initcredits']);
    $groupinfo['groupid'] = $_G['setting']['newusergroupid'];
    $password = md5(random(10));
    $secques = $questionid > 0 ? random(8) : '';
    //用户资料
    $profile['constellation'] = get_constellation($birthmonth, $birthday);
    $profile['zodiac'] = get_zodiac($birthyear);
    $profile['gender'] = $gender == milu_lang('baomi') ? 0 : ($gender == milu_lang('man') ? 1 : 0);
    $profile_field_arr = array('birthyear', 'birthmonth', 'birthday', 'birthprovince', 'birthcity', 'birthdist', 'birthcommunity', 'resideprovince', 'residecity', 'residedist', 'residecommunity', 'residesuite', 'site', 'bio', 'interest', 'idcardtype', 'idcard', 'bloodtype', 'height', 'weight', 'qq', 'msn', 'taobao', 'yahoo', 'icq', 'alipay', 'lookingfor', 'position', 'occupation', 'education', 'company', 'graduateschool', 'revenue', 'telephone', 'mobile', 'constellation', 'realname', 'zodiac', 'affectivestatus');
    foreach ($profile_field_arr as $k => $v) {
        $profile[$v] = ${$v};
    }
    $lastactivity = rand($regdate, $regdate + 3600 * 24 * 2);
    if ($regipsql) {
        DB::query($regipsql);
    }
    $credits = 0;
    if (!empty($_G['setting']['creditsformula'])) {
        eval("\$credits = round(" . $_G['setting']['creditsformula'] . ");");
    }
    $userdata = array('uid' => $uid, 'username' => $username, 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => $groupinfo['groupid'], 'regdate' => $regdate, 'credits' => $credits, 'timeoffset' => 9999);
    $status_data = array('uid' => $uid, 'regip' => $regip, 'lastip' => $lastip, 'lastvisit' => $lastvisit, 'lastactivity' => $lastactivity, 'lastpost' => $lastpost, 'lastsendmail' => 0);
    $profile['uid'] = $uid;
    $field_forum['uid'] = $uid;
    $field_forum['sightml'] = $sightmlm;
    $field_home['uid'] = $uid;
    DB::insert('common_member', paddslashes($userdata));
    DB::insert('common_member_status', paddslashes($status_data));
    DB::insert('common_member_profile', paddslashes($profile));
    DB::insert('common_member_field_forum', paddslashes($field_forum));
    DB::insert('common_member_field_home', paddslashes($field_home));
    if ($verifyarr) {
        $setverify = array('uid' => $uid, 'username' => $username, 'verifytype' => '0', 'field' => daddslashes(serialize($verifyarr)), 'dateline' => $lastactivity);
        DB::insert('common_member_verify_info', $setverify);
        DB::insert('common_member_verify', array('uid' => $uid));
    }
    $count_data = array('uid' => $uid, 'oltime' => $oltime ? $oltime : 0, 'extcredits1' => $extcredits1 ? $extcredits1 : $init_arr[1], 'extcredits2' => $extcredits2 ? $extcredits2 : $init_arr[2], 'extcredits3' => $extcredits3 ? $extcredits3 : $init_arr[3], 'extcredits4' => $extcredits4 ? $extcredits4 : $init_arr[4], 'extcredits5' => $extcredits5 ? $extcredits5 : $init_arr[5], 'extcredits6' => $extcredits6 ? $extcredits6 : $init_arr[6], 'extcredits7' => $extcredits7 ? $extcredits7 : $init_arr[7], 'extcredits8' => $extcredits8 ? $extcredits8 : $init_arr[8]);
    DB::insert('common_member_count', paddslashes($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' => $username);
    checkusergroup($uid);
    //更新用户所在的用户组
    save_syscache('userstats', $userstats);
    $re_arr['uid'] = $uid;
    return $re_arr;
}
예제 #19
0
        if (!$count) {
            DB::insert('common_member_verify', array('uid' => $_G['uid']));
        }
        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');
 /**
  * 在UC和DZX进行用户初始化注册
  * @access protected
  * @return boolen
  */
 function _regToUCDZX()
 {
     global $_G;
     $this->uid = (int) uc_user_register($this->username, $this->password, $this->email, $this->questionid, $this->answer);
     //----------------add by zh--------------------------
     $passp = new passport();
     $pass = $passp->useradd($this->uid, $this->username, $this->password, $this->email, $this->ip, $this->groupid, $this->nickname);
     //add
     if (is_array($pass)) {
         $psptuser = $passp->passport_setsession($pass, 2592000, $this->ip);
         //add
     } else {
         if ($pass == "userisexist") {
             uc_user_delete($this->uid);
             $this->uid = -3;
         } else {
             if ($pass == "nicknameexist") {
                 uc_user_delete($this->uid);
                 $this->uid = -7;
             } else {
                 uc_user_delete($this->uid);
                 $this->uid = -8;
             }
         }
     }
     //-------------add end-------------------------------
     if ($this->uid > 0) {
         //在有UC的情况下,附属论坛的members表password列并不存储真实密码,只是用于cookies登陆状态校样。
         $init_arr = explode(',', $_G['setting']['initcredits']);
         $userdata = array('uid' => $this->uid, 'username' => $this->username, 'password' => md5(rand(100000, 999999)), 'email' => $this->email, 'adminid' => 0, 'groupid' => $this->groupid, 'regdate' => $this->timestamp, 'credits' => $init_arr[0], 'timeoffset' => 9999);
         DB::insert('common_member', $userdata);
         $status_data = array('uid' => $this->uid, 'regip' => $this->ip, 'lastip' => $this->ip, 'lastvisit' => $this->timestamp, 'lastactivity' => $this->timestamp, 'lastpost' => 0, 'lastsendmail' => 0);
         DB::insert('common_member_status', $status_data);
         $profile['uid'] = $this->uid;
         $profile['field1'] = $this->nickname;
         //add by zh
         DB::insert('common_member_profile', $profile);
         DB::insert('common_member_field_forum', array('uid' => $this->uid));
         DB::insert('common_member_field_home', array('uid' => $this->uid));
         //初始化积分
         $count_data = array('uid' => $this->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' => $this->username), false, true);
         manyoulog('user', $this->uid, 'add');
         return true;
     } else {
         return false;
     }
 }