예제 #1
0
 function csc($task = array())
 {
     global $_G;
     $taskvars = array('num' => 0);
     $num = 0;
     $query = DB::query("SELECT variable, value FROM " . DB::table('common_taskvar') . " WHERE taskid='{$task['taskid']}'");
     while ($taskvar = DB::fetch($query)) {
         if ($taskvar['value']) {
             $taskvars[$taskvar['variable']] = $taskvar['value'];
         }
     }
     $taskvars['time'] = floatval($taskvars['time']);
     if ($taskvars['act'] == 'buddy') {
         loaducenter();
         $num = uc_friend_totalnum($_G['uid'], 1) + uc_friend_totalnum($_G['uid'], 3) - DB::result_first("SELECT value FROM " . DB::table('forum_spacecache') . " WHERE uid='{$_G['uid']}' AND variable='buddy{$task['taskid']}'");
     } elseif ($taskvars['act'] == 'magic') {
         $num = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_magiclog') . " WHERE action='2' AND uid='{$_G['uid']}'" . ($taskvars['time'] ? " AND dateline BETWEEN {$task['applytime']} AND {$task['applytime']}+3600*{$taskvars['time']}" : " AND dateline>{$task['applytime']}"));
     }
     if ($num && $num >= $taskvars['num']) {
         if (in_array($taskvars['act'], array('buddy', 'favorite'))) {
             DB::query("DELETE FROM " . DB::table('forum_spacecache') . " WHERE uid='{$_G['uid']}' AND variable='{$taskvars['act']}{$task['taskid']}'");
         }
         return TRUE;
     } elseif ($taskvars['time'] && TIMESTAMP >= $task['applytime'] + 3600 * $taskvars['time'] && (!$num || $num < $taskvars['num'])) {
         return FALSE;
     } else {
         return array('csc' => $num > 0 && $taskvars['num'] ? sprintf("%01.2f", $num / $taskvars['num'] * 100) : 0, 'remaintime' => $taskvars['time'] ? $task['applytime'] + $taskvars['time'] * 3600 - TIMESTAMP : 0);
     }
 }
예제 #2
0
 public function onNotificationsGet($uId)
 {
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     $i = 0;
     foreach (C::t('home_notification')->fetch_all_by_uid($uId, 1) as $value) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     loaducenter();
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     $fIds = array();
     foreach (C::t('home_friend_request')->fetch_all_by_uid($uId) as $value) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return $result;
 }
 /**
  * 资源初始化
  * @access public
  * @return xwbSiteUserRegister
  */
 function xwbSiteUserRegister()
 {
     global $_G;
     loaducenter();
     $this->ip = (string) $_G['clientip'];
     $this->timestamp = TIMESTAMP;
 }
 private function _updatePass($res, $oldpassword, $newpassword)
 {
     global $_G;
     $oldpassword = $oldpassword ? urldecode($oldpassword) : '';
     $newpassword = $newpassword ? urldecode($newpassword) : '';
     if (!empty($newpassword) && $newpassword != addslashes($newpassword)) {
         // 抱歉,密码空或包含非法字符:新密码
         return $this->makeErrorInfo($res, lang('message', 'profile_passwd_illegal'));
     }
     loaducenter();
     $ucresult = uc_user_edit(addslashes($_G['username']), $oldpassword, $newpassword);
     if ($ucresult == -1) {
         // 原密码不正确,您不能修改密码或 Email 或安全提问
         return $this->makeErrorInfo($res, lang('message', 'profile_passwd_wrong'));
     }
     $setarr['password'] = md5(random(10));
     C::t('common_member')->update($_G['uid'], $setarr);
     $secretStr = AppbymeUserAccess::getSecretStr($_G['uid'], $newpassword);
     $newAccessSecret = $secretStr['accessSecret'];
     $data = array('user_access_secret' => $newAccessSecret);
     $result = AppbymeUserAccess::updateUserAccess($data, $_G['uid']);
     // if (!$result) {
     //     return $this->makeErrorInfo($res, 'user_info_edit_error');
     // }
     $res['token'] = $secretStr['accessToken'];
     $res['secret'] = $newAccessSecret;
     return $res;
 }
예제 #5
0
파일: fzc.class.php 프로젝트: v998/dsu
 function register_header()
 {
     global $_G;
     $inputemail = 'gp_' . $this->regemail['email'];
     $_G['gp_email'] = $_G[$inputemail];
     if ($_POST) {
         $_G['gp_activationauth'] = strip_tags(str_replace(" ", "+", $_G['gp_activationauth']));
         $activationinfo = authcode($_G['gp_activationauth'], $operation = 'DECODE');
         $activationinfoname = preg_replace("/\\s.+/i", "", $activationinfo);
         if ($activationinfoname) {
             loaducenter();
             if ($data = uc_get_user($activationinfoname)) {
                 list($uid, $username, $email) = $data;
             }
             $_G['gp_email'] = getEmail(strip_tags($email));
         } else {
             $_G['gp_email'] = getEmail(strip_tags($_G['gp_email']));
         }
         $_G['gp_rid'] = strip_tags($_G['gp_rid']);
         if (!$_G['gp_rid']) {
             showmessage('dsu_amufzc:1', '');
         }
         if (!$_G['gp_email']) {
             showmessage('dsu_amufzc:5', '');
         }
         $amutb = DB::table("plugin_dsuamfzc");
         $query = DB::fetch_first("SELECT * FROM {$amutb} WHERE rid = '" . $_G['gp_rid'] . "'");
         if (!$query || $query['yes'] == '1') {
             showmessage('dsu_amufzc:2', '');
         }
         if ($_G['gp_email'] != $query['email']) {
             showmessage('dsu_amufzc:11', '');
         }
     }
 }
예제 #6
0
 private function _getPMMsgList($uid, $fromUid, $startTime = 0, $stopTime = 0, $cacheCount = 0, $pmLimit = 10, $isFilter = false)
 {
     $msgList = array();
     $hasPrev = false;
     $plid = 0;
     loaducenter();
     $tempMsgList = array();
     if ($stopTime == 0) {
         // 获取新的消息
         if ($startTime == 0) {
             // 获取新的消息
             $count = (int) uc_pm_view_num($uid, $fromUid, 0);
             $tempMsgList = (array) uc_pm_view($uid, 0, $fromUid, 5, 1, $pmLimit, 0, 0);
             $count > count($tempMsgList) && ($hasPrev = true);
         } else {
             $tempMsgList = (array) uc_pm_view($uid, 0, $fromUid, 5, 1, 50, 0, 0);
             $lastIndex = count($tempMsgList) - 1;
             if ($lastIndex >= 0) {
                 $offset = 0;
                 for ($i = $lastIndex; $i >= 0; $i--) {
                     if ($tempMsgList[$i]['dateline'] <= $startTime) {
                         $offset = $i;
                         $offset++;
                         break;
                     }
                 }
                 $tempMsgList = array_slice($tempMsgList, $offset);
             }
         }
     } else {
         if ($stopTime) {
             // 获取历史的消息
             $count = (int) uc_pm_view_num($uid, $fromUid, 0);
             $lastPage = (int) (($count - 1) / $pmLimit) + 1;
             $page = (int) floor($cacheCount / $pmLimit) + 1;
             $tempList = (array) uc_pm_view($uid, 0, $fromUid, 5, $page, $pmLimit);
             foreach ($tempList as $pm) {
                 if ($pm['dateline'] < $stopTime) {
                     $tempMsgList[] = $pm;
                 }
             }
             $page < $lastPage && ($hasPrev = true);
         }
     }
     foreach ($tempMsgList as $msg) {
         $msgInfo = array();
         $plid = $msg['plid'];
         if (!$isFilter || $msg['authorid'] != $uid) {
             $tempMsg = $this->_transMessage($msg['message']);
             $msgInfo['sender'] = (int) $msg['authorid'];
             $msgInfo['mid'] = (int) $msg['pmid'];
             $msgInfo['content'] = (string) $tempMsg['content'];
             $msgInfo['type'] = $tempMsg['type'];
             $msgInfo['time'] = $msg['dateline'] . '000';
             $msgList[] = $msgInfo;
         }
     }
     return array('list' => $msgList, 'hasPrev' => $hasPrev, 'plid' => $plid);
 }
예제 #7
0
function userlogin($username, $password, $questionid, $answer, $loginfield = 'username')
{
    $return = array();
    if ($loginfield == 'uid') {
        $isuid = 1;
    } elseif ($loginfield == 'email') {
        $isuid = 2;
    } elseif ($loginfield == 'auto') {
        $isuid = 3;
    } else {
        $isuid = 0;
    }
    if (!function_exists('uc_user_login')) {
        loaducenter();
    }
    if ($isuid == 3) {
        if (preg_match('/^[1-9]\\d*$/', $username)) {
            $return['ucresult'] = uc_user_login($username, $password, 1, 1, $questionid, $answer);
        } elseif (isemail($username)) {
            $return['ucresult'] = uc_user_login($username, $password, 2, 1, $questionid, $answer);
        }
        if ($return['ucresult'][0] <= 0) {
            $return['ucresult'] = uc_user_login($username, $password, 0, 1, $questionid, $answer);
        }
    } else {
        $return['ucresult'] = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
    }
    $tmp = array();
    $duplicate = '';
    list($tmp['uid'], $tmp['username'], $tmp['password'], $tmp['email'], $duplicate) = daddslashes($return['ucresult'], 1);
    $return['ucresult'] = $tmp;
    if ($duplicate && $return['ucresult']['uid'] > 0) {
        if ($olduid = DB::result_first("SELECT uid FROM " . DB::table('common_member') . " WHERE username='******'ucresult']['username']) . "'")) {
            require_once libfile('function/membermerge');
            if ($olduid != $return['ucresult']['uid']) {
                membermerge($olduid, $return['ucresult']['uid']);
            }
            uc_user_merge_remove($return['ucresult']['username']);
        } else {
            $return['status'] = 0;
            return $return;
        }
    }
    if ($return['ucresult']['uid'] <= 0) {
        $return['status'] = 0;
        return $return;
    }
    $member = DB::fetch_first("SELECT * FROM " . DB::table('common_member') . " WHERE uid='" . $return['ucresult']['uid'] . "'");
    if (!$member) {
        $return['status'] = -1;
        return $return;
    }
    $return['member'] = $member;
    $return['status'] = 1;
    if (addslashes($member['email']) != $return['ucresult']['email']) {
        DB::query("UPDATE " . DB::table('common_member') . " SET email='" . $return['ucresult']['email'] . "' WHERE uid='" . $return['ucresult']['uid'] . "'");
    }
    return $return;
}
 /**
  * 同步头像到指定的DZX uid,成功则执行一些更新后的操作
  *
  * @param integer $uid DZ uid
  * @return integer 同步结果
  */
 function sync4DX($uid)
 {
     loaducenter();
     $result = $this->syncToUC($uid);
     if ($result >= 0) {
         $db = XWB_plugin::getDB();
         $sql = "UPDATE " . DB::table('common_member') . " SET avatarstatus = '1' WHERE uid='{$uid}'";
         $db->query($sql, 'UNBUFFERED');
     }
     $this->_logFaceSyncResult($result);
 }
예제 #9
0
function my_userapp_update($uId, $appId, $privacy = null, $allowProfileLink = null)
{
    global $my_register_url, $_G;
    $mySiteId = $_G['setting']['my_siteid'];
    $mySiteKey = $_G['setting']['my_sitekey'];
    if (!$_G['setting']['my_app_status']) {
        $res = array('errCode' => 121, 'errMessage' => 'Manyou Service Disabled', 'result' => '');
        return $res;
    }
    $data = array();
    if ($privacy !== null) {
        switch ($privacy) {
            case 1:
                $data['privacy'] = 'friends';
                break;
            case 3:
                $data['privacy'] = 'me';
                break;
            case 5:
                $data['privacy'] = 'none';
                break;
            case 0:
            default:
                $data['privacy'] = 'public';
        }
    }
    if ($allowProfileLink !== null) {
        $data['allowProfileLink'] = $allowProfileLink ? true : false;
    }
    if (!$data) {
        return array('errCode' => 5, 'errMessage' => 'Post Data Cann\'t Be Empty!');
    }
    $data = serialize($data);
    $key = "{$mySiteId}|{$mySiteKey}|{$uId}|{$appId}|{$data}";
    $key = md5($key);
    $data = urlencode($data);
    $postString = sprintf('action=%s&key=%s&mySiteId=%d&uId=%d&appId=%d&data=%s', 'userappUpdate', $key, $mySiteId, $uId, $appId, $data);
    loaducenter();
    $url = 'http://api.manyou.com/uchome.php';
    $response = uc_fopen2($url, 0, $postString, '', false, $_G['setting']['my_ip']);
    $res = unserialize($response);
    if (!$response) {
        $res['errCode'] = 111;
        $res['errMessage'] = 'Empty Response';
        $res['result'] = $response;
    } elseif (!$res) {
        $res['errCode'] = 110;
        $res['errMessage'] = 'Error Response';
        $res['result'] = $response;
    }
    return $res;
}
예제 #10
0
 public static function sendpm($toid, $subject, $message, $fromid = '', $replypmid = 0, $isusername = 0, $type = 0)
 {
     global $_G;
     if ($fromid === '') {
         $fromid = $_G['uid'];
     }
     $author = '';
     if ($fromid) {
         if ($fromid == $_G['uid']) {
             $sendpmmaxnum = $_G['group']['allowsendpmmaxnum'];
             $author = $_G['username'];
         } else {
             $user = getuserbyuid($fromid);
             $author = $user['username'];
             loadcache('usergroup_' . $user['groupid']);
             $sendpmmaxnum = $_G['cache']['usergroup_' . $user['groupid']]['allowsendpmmaxnum'];
         }
         $currentnum = C::t('common_member_action_log')->count_day_hours(getuseraction('pmid'), $fromid);
         if ($sendpmmaxnum && $currentnum >= $sendpmmaxnum) {
             return -16;
         }
     }
     loaducenter();
     $return = uc_pm_send($fromid, $toid, addslashes($subject), addslashes($message), 1, $replypmid, $isusername, $type);
     if ($return > 0 && $fromid) {
         if ($_G['setting']['cloud_status']) {
             $msgService = Cloud::loadClass('Cloud_Service_Client_Message');
             if (is_numeric($toid)) {
                 $tospace = getuserbyuid($toid);
                 if ($tospace['conisbind']) {
                     $msgService->add($toid, $fromid, $author, $_G['timestamp']);
                 }
             } else {
                 $senduids = array();
                 foreach (C::t('common_member')->fetch_all_by_username(explode(',', $toid)) as $touser) {
                     if ($touser['conisbind']) {
                         $senduids[$touser['uid']] = $touser['uid'];
                     }
                 }
                 if ($senduids) {
                     $msgService->add($senduids, $fromid, $author, $_G['timestamp']);
                 }
             }
         }
         foreach (explode(',', $fromid) as $v) {
             useractionlog($fromid, 'pmid');
         }
     }
     return $return;
 }
예제 #11
0
 private function _getPmInfos($uid)
 {
     $pmInfos = array();
     loaducenter();
     $pmList = uc_pm_list($uid, 1, 10000, 'inbox', 'newpm', 200);
     $pmList = (array) $pmList['data'];
     foreach ($pmList as $pm) {
         // 目前只要两人对话的列表
         if ($pm['members'] > 2 || $pm['pmtype'] != 1) {
             continue;
         }
         $pmInfos[] = array('fromUid' => (int) $pm['touid'], 'plid' => (int) $pm['plid'], 'pmid' => (int) $pm['pmid'], 'time' => $pm['lastdateline'] . '000');
     }
     return $pmInfos;
 }
 private function _uploadAvatarByUcenter($uid, $fileName, $fileData)
 {
     $image = '';
     loaducenter();
     $uc_avatarflash = uc_avatar($uid, 'virtual', 0);
     if (!empty($uc_avatarflash[7])) {
         $parse = parse_url($uc_avatarflash[7]);
         if (!empty($parse['query'])) {
             $url = sprintf('%s/index.php?m=user&a=uploadavatar&%s', UC_API, $parse['query']);
             $res = WebUtils::httpRequestByDiscuzApi($url, array('Filedata' => $fileData), '', array('Filedata' => $fileName));
             strpos($res, 'http') !== false && ($image = $res);
         }
     }
     return $image;
 }
예제 #13
0
 private function _getPMList($page, $pageSize)
 {
     $pmList = array('list' => array(), 'count' => 0);
     global $_G;
     // 在DISCUZ_ROOT/source/include/space/space_pm.php基础上二次开发
     loaducenter();
     $filter = 'privatepm';
     $perpage = $pageSize;
     $count = 0;
     $list = array();
     if ($filter == 'privatepm' || $filter == 'newpm') {
         $result = uc_pm_list($_G['uid'], $page, $perpage, 'inbox', $filter, 200);
         $count = $result['count'];
         $list = $result['data'];
     }
     if ($_G['member']['newpm']) {
         if ($newpm && $_G['setting']['cloud_status']) {
             $msgService = Cloud::loadClass('Cloud_Service_Client_Message');
             $msgService->setMsgFlag($_G['uid'], $_G['timestamp']);
         }
         C::t('common_member')->update($_G['uid'], array('newpm' => 0));
         uc_pm_ignore($_G['uid']);
     }
     $tempPMList = array();
     foreach ($list as $pm) {
         // 目前只要两人对话的列表
         if ($pm['members'] > 2 || $pm['pmtype'] != 1) {
             $count--;
             continue;
         }
         $tempPm = array();
         $tempPm['plid'] = (int) $pm['plid'];
         $tempPm['pmid'] = (int) $pm['pmid'];
         $tempPm['lastUserId'] = (int) $pm['lastauthorid'];
         $tempPm['lastUserName'] = (string) $pm['lastauthor'];
         $tempPm['lastSummary'] = (string) $pm['lastsummary'];
         $tempPm['lastDateline'] = $pm['lastdateline'] . '000';
         $tempPm['toUserId'] = (int) $pm['touid'];
         $tempPm['toUserAvatar'] = UserUtils::getUserAvatar($pm['touid']);
         $tempPm['toUserName'] = (string) $pm['tousername'];
         $tempPm['toUserIsBlack'] = UserUtils::isBlacklist($_G['uid'], $pm['touid']) ? 1 : 0;
         $tempPm['isNew'] = $pm['new'] ? 1 : 0;
         $tempPMList[] = $tempPm;
     }
     $pmList['list'] = $tempPMList;
     $pmList['count'] = $count;
     return $pmList;
 }
예제 #14
0
function autoactivationuser($uid)
{
    global $_G;
    $member = null;
    if (!function_exists('uc_get_user')) {
        loaducenter();
    }
    list($uid, $username, $email) = uc_get_user($uid, 1);
    $uid = intval($uid);
    if ($uid > 0) {
        $password = md5(time() . rand(100000, 999999));
        $userdata = array('uid' => $uid, 'username' => addslashes($username), 'password' => $password, 'email' => $email, 'adminid' => 0, 'groupid' => 0, 'regdate' => TIMESTAMP, 'credits' => 0);
        DB::insert('common_member', $userdata);
        $status_data = array('uid' => $uid, 'regip' => $_G['clientip'], 'lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP);
        DB::insert('common_member_status', $status_data);
        $member = $userdata;
    }
    return $member;
}
 /**
  * 进行身份验证
  * 请保证传参所用字符集和论坛字符集一致,否则请先自行转换再传参
  * @param string $username
  * @param string $password
  * @param int $questionid
  * @param string $answer
  * @param boolen $isuid 使用UID验证么?
  * @return array
  *    第一个数组下标($return[0])若大于0,则表示验证成功的登录uid。否则为错误信息:
  *   	 -1:UC用户不存在,或者被删除
  *    	 -2:密码错
  *   	 -3:安全提问错
  *   	 -4:用户没有在dz注册
  *    第二个数组下标($return[1])若大于等于0,则表示验证成功的adminid;
  *   	 否则为-1,表示验证失败
  */
 function verify($username, $password, $questionid = '', $answer = '', $isuid = 0)
 {
     $return = array(0 => -1, 1 => -1);
     loaducenter();
     $ucresult = uc_user_login($username, $password, $isuid, 1, $questionid, $answer);
     if ($ucresult[0] < 1) {
         $return[0] = $ucresult[0];
     } else {
         $uid = (int) $ucresult[0];
         $member = $this->db->fetch_first("SELECT uid, username, adminid\n\t\t\t\t\t\t\t\t\t\t\t\tFROM " . DB::table('common_member') . " \n\t\t\t\t\t\t\t\t\t\t\t\tWHERE uid='{$uid}'");
         if (!$member) {
             $return[0] = -4;
         } else {
             $return[0] = (int) $member['uid'];
             $return[1] = (int) $member['adminid'];
         }
     }
     return $return;
 }
예제 #16
0
 private function _pmAdmin($res, $data)
 {
     require_once libfile('function/spacecp');
     // require_once libfile('function/magic');
     loaducenter();
     // 在DISCUZ_ROOT/source/include/spacecp/spacecp_pm.php基础上二次开发
     switch ($data['action']) {
         case self::ACTION_SEND:
             $res = $this->_pmSend($res, $data);
             break;
         case self::ACTION_DELPLID:
             $res = $this->_pmDel($res, $data, 1);
             break;
         case self::ACTION_DELPMID:
             $res = $this->_pmDel($res, $data);
             break;
         default:
             $res = $this->makeErrorInfo($res, 'mobcent_error_params');
             break;
     }
     return $res;
 }
예제 #17
0
function checkemail($email)
{
    global $_G;
    $email = strtolower(trim($email));
    if (strlen($email) > 32) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    }
    if ($_G['setting']['regmaildomain']) {
        $maildomainexp = '/(' . str_replace("\r\n", '|', preg_quote(trim($_G['setting']['maildomainlist']), '/')) . ')$/i';
        if ($_G['setting']['regmaildomain'] == 1 && !preg_match($maildomainexp, $email)) {
            showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
        } elseif ($_G['setting']['regmaildomain'] == 2 && preg_match($maildomainexp, $email)) {
            showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
        }
    }
    loaducenter();
    $ucresult = uc_user_checkemail($email);
    if ($ucresult == -4) {
        showmessage('profile_email_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -5) {
        showmessage('profile_email_domain_illegal', '', array(), array('handle' => false));
    } elseif ($ucresult == -6) {
        showmessage('profile_email_duplicate', '', array(), array('handle' => false));
    }
}
예제 #18
0
function sendpm($toid, $subject, $message, $fromid = '')
{
    global $_G;
    if ($fromid === '') {
        $fromid = $_G['uid'];
    }
    loaducenter();
    uc_pm_send($fromid, $toid, $subject, $message);
}
 /**
  * 设置评论回推用户
  * @param string $username 用户名,请传参前自行转码到论坛用户的编码
  * @return int 用户uid
  */
 function _setPushbackSiteAccount($username)
 {
     loaducenter();
     $userInfo = uc_get_user($username);
     if (is_array($userInfo) && $userInfo[0] > 0) {
         $this->_importUserFromUC($userInfo);
         return $userInfo[0];
     }
     $email = 'xweibo_user' . rand(1, 99999) . '@sina.com';
     $siteRegister = XWB_plugin::O('xwbSiteUserRegister');
     $uid = $siteRegister->reg($username, $email);
     return $uid > 0 ? $uid : 0;
 }
예제 #20
0
파일: my.php 프로젝트: Kingson4Wu/php_demo
 function onNotificationsGet($uId)
 {
     $notify = $result = array();
     $result = array('message' => array('unread' => 0, 'mostRecent' => 0), 'notification' => array('unread' => 0, 'mostRecent' => 0), 'friendRequest' => array('uIds' => array()));
     $query = DB::query("SELECT * FROM " . DB::table('home_notification') . "  WHERE uid='{$uId}' AND new='1' ORDER BY id DESC");
     $i = 0;
     while ($value = DB::fetch($query)) {
         $i++;
         if (!$result['notification']['mostRecent']) {
             $result['notification']['mostRecent'] = $value['dateline'];
         }
     }
     $result['notification']['unread'] = $i;
     loaducenter();
     $pmarr = uc_pm_list($uId, 1, 1, 'newbox', 'newpm');
     if ($pmarr['count']) {
         $result['message']['unread'] = $pmarr['count'];
         $result['message']['mostRecent'] = $pmarr['data'][0]['dateline'];
     }
     $query = DB::query("SELECT * FROM " . DB::table('home_friend_request') . "  WHERE uid='{$uId}' ORDER BY dateline DESC");
     $fIds = array();
     while ($value = DB::fetch($query)) {
         if (!$result['friendRequest']['mostRecent']) {
             $result['friendRequest']['mostRecent'] = $value['dateline'];
         }
         $fIds[] = $value['uid'];
     }
     $result['friendRequest']['uIds'] = $fIds;
     return $result;
 }
 function register_ctl()
 {
     global $_G;
     if ($_G['setting']['bbclosed']) {
         if ($_GET['action'] != 'activation' && !$_GET['activationauth'] || !$_G['setting']['closedallowactivation']) {
             showmessage('register_disable', NULL, array(), array('login' => 1));
         }
     }
     loadcache(array('modreasons', 'stamptypeid', 'fields_required', 'fields_optional', 'fields_register', 'ipctrl'));
     require_once libfile('function/misc');
     require_once libfile('function/profile');
     if (!function_exists('sendmail')) {
         include libfile('function/mail');
     }
     loaducenter();
 }
 function _getHuwbUsers($limit, $friendIds = array())
 {
     $huwbUserRs = array();
     if (XWB_S_UID <= 0) {
         return $huwbUserRs;
     }
     // 处理活跃用户微博数据
     $huwbCacheFile = XWB_P_ROOT . '/cache/owbset/huwbCache.data.php';
     //定义活跃用户微博数据缓存文件路径
     // 缓存文件存在
     if (is_file($huwbCacheFile) && intval(XWB_plugin::pCfg('wbx_huwb_update_time')) * 60 * 60 > time() - filemtime($huwbCacheFile)) {
         require_once $huwbCacheFile;
         //调用活跃用户数据缓存文件
         $huwbUserRs = array_slice($huwbUserRs, 0, $limit);
     } else {
         //$xwbDBHandler = XWB_plugin::getDB(); //定义数据库管理器
         // 查询已绑定新浪微博的好友
         $sql = "SELECT main.fuid AS uid,main.fusername AS username,bind.sina_uid FROM " . DB::table('home_friend') . " main," . DB::table('xwb_bind_info') . " bind WHERE main.uid='" . XWB_S_UID . "' AND main.fuid = bind.uid ORDER BY main.num DESC, main.dateline DESC LIMIT 0," . $limit;
         $result = $this->_dbToArray(DB::query($sql));
         //执行查询,结果返回数据源
         // 好友数小于上限
         if ($limit > count($result)) {
             // 查询在一星期内发帖数最多的已绑定新浪微博的用户(查询论坛活跃用户)
             $dateline = strtotime(date('Y-n-') . (date('j') - 7));
             $sql = "SELECT m.uid,m.username,n.sina_uid FROM " . DB::table('common_member') . " m," . DB::table('common_member_count') . " mc," . DB::table('common_member_status') . " ms," . DB::table('xwb_bind_info') . " n WHERE mc.uid=m.uid AND ms.uid=m.uid AND n.uid=m.uid AND n.uid!='" . XWB_S_UID . "' AND ms.lastpost>'" . $dateline . "' ORDER BY mc.posts DESC LIMIT 0," . $limit;
             //定义查询字符串
             $memberRs = $this->_dbToArray(DB::query($sql));
             //执行查询,结果返回数据源
             $result = array_merge($result, $memberRs);
             // 合并数据集
         }
         // 处理查询数据
         loaducenter();
         //载入UCenter配置
         foreach ($result as $row) {
             if (in_array($row['sina_uid'], $friendIds) || in_array($row['uid'], $huwbUserRs)) {
                 continue;
             }
             //若会员已存在则忽略
             $huwbUserRs[$row['uid']] = $row;
             //数据集赋值
         }
         // 写入缓存文件
         $fileContent = "<?php\r\n\$huwbUserRs = " . var_export($huwbUserRs, TRUE) . "\r\n?>";
         if (!file_put_contents($huwbCacheFile, $fileContent)) {
             $this->_showBindError('file');
         }
     }
     // 判断是否关注
     foreach ($huwbUserRs as $key => $row) {
         $huwbUserRs[$key]['avatar'] = avatar($row['uid'], 'small');
         //定义用户论坛头像
         $huwbUserRs[$key]['friends'] = in_array($row['sina_uid'], $friendIds);
     }
     return $huwbUserRs;
 }
예제 #23
0
 function check_admin_login()
 {
     global $_G;
     if ((empty($_POST['admin_questionid']) || empty($_POST['admin_answer'])) && $_G['config']['admincp']['forcesecques']) {
         $this->do_user_login();
     }
     loaducenter();
     $ucresult = uc_user_login($this->adminuser['uid'], $_POST['admin_password'], 1, 1, $_POST['admin_questionid'], $_POST['admin_answer']);
     if ($ucresult[0] > 0) {
         DB::update('common_admincp_session', array('dateline' => TIMESTAMP, 'ip' => $this->core->var['clientip'], 'errorcount' => -1), "uid={$this->adminuser['uid']} AND panel={$this->panel}");
         dheader('Location: ' . ADMINSCRIPT . '?' . cpurl('url', array('sid')));
     } else {
         $errorcount = $this->adminsession['errorcount'] + 1;
         DB::update('common_admincp_session', array('dateline' => TIMESTAMP, 'ip' => $this->core->var['clientip'], 'errorcount' => $errorcount), "uid={$this->adminuser['uid']} AND panel={$this->panel}");
     }
 }
예제 #24
0
function redirectregister($username)
{
    global $_G;
    $defaultusername = substr($username, 0, 15);
    loaducenter();
    $user = uc_get_user($defaultusername);
    if (!empty($user)) {
        $defaultusername = cutstr($defaultusername, 7, '') . '_' . random(5);
    }
    $auth = urlencode(base64_encode(authcode($_GET['openid'] . "\t" . $_GET['openidsign'] . "\t" . $_GET['referer'], 'ENCODE')));
    $referer = urlencode($_G['siteurl'] . 'plugin.php?id=wechat:login&ac=regcallback&auth=' . $auth);
    dheader('location: ' . $_G['siteurl'] . 'member.php?mod=' . $_G['setting']['regname'] . '&referer=' . $referer . '&defaultusername=' . urlencode($defaultusername));
}
예제 #25
0
 public static function getnewname($openid)
 {
     global $_G;
     if (!$_G['wechat']['setting']) {
         $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
     }
     $wechat_client = new WeChatClient($_G['wechat']['setting']['wechat_appId'], $_G['wechat']['setting']['wechat_appsecret']);
     $userinfo = $wechat_client->getUserInfoById($openid);
     if ($userinfo) {
         $defaultusername = substr(WeChatEmoji::clear($userinfo['nickname']), 0, 15);
         loaducenter();
         $user = uc_get_user($defaultusername);
         if (!empty($user)) {
             $defaultusername = cutstr($defaultusername, 7, '') . '_' . random(5);
         }
     } else {
         $defaultusername = '******' . random(5);
     }
     return $defaultusername;
 }
예제 #26
0
 public function register()
 {
     global $_G;
     $validate_error = array();
     //数据验证
     $validate_error_rules = $this->rules();
     if ($validate_error_rules !== true) {
         return $validate_error_rules;
     }
     $input_email = $_POST['email'];
     $input_password = $_POST['password'];
     $rand = rand(100, 999);
     $newusername = '******' . $_G['timestamp'] . $rand;
     //*注册数据提交
     loaducenter();
     $uid = uc_user_register(addslashes($newusername), $input_password, $input_email);
     if ($uid <= 0) {
         if ($uid == -4) {
             $validate_error['email'] = 'Email 地址无效';
             return $validate_error;
         } elseif ($uid == -5) {
             $validate_error['email'] = 'Email 包含不可使用的邮箱域名';
             return $validate_error;
         } elseif ($uid == -6) {
             $validate_error['email'] = '该 Email 地址已经被注册';
             return $validate_error;
         } elseif ($uid == -1) {
             $rand = rand(100, 999);
             $newusername = '******' . $_G['timestamp'] . $rand;
             $uid = uc_user_register(addslashes($newusername), $input_password, $input_email);
             do {
                 $rand = rand(100, 999);
                 $newusername = '******' . $_G['timestamp'] . $rand;
                 $uid = uc_user_register(addslashes($newusername), $input_password, $input_email);
             } while ($uid == -1);
         } else {
             $validate_error['email'] = '未知错误';
             return $validate_error;
         }
     }
     loadcache('fields_register');
     $init_arr = explode(',', $_G['setting']['initcredits']);
     $password = md5(random(10));
     C::t('common_member')->insert($uid, $newusername, $password, $input_email, $_G['clientip'], 10, $init_arr, 0);
     //直接登录
     require_once libfile('function/member');
     $result = userlogin($input_email, $input_password, 0, 0, 'email', $_G['clientip']);
     setloginstatus($result['member'], 0);
     //是否记住密码,自动登录
     C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'port' => $_G['remoteport'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
     $ucsynlogin = $this->setting['allowsynlogin'] ? uc_user_synlogin($_G['uid']) : '';
     //是否Ucenter同步登录
     return true;
 }
예제 #27
0
function register()
{
    /*{{{*/
    require_once dirname(dirname(dirname(__FILE__))) . '/bigappjson.class.php';
    require_once libfile('function/misc');
    require_once libfile('function/member');
    require_once libfile('class/member');
    $userName = isset($_REQUEST["username"]) ? $_REQUEST["username"] : "";
    $password = isset($_REQUEST["password"]) ? $_REQUEST["password"] : "";
    $email = isset($_REQUEST["email"]) ? strtolower($_REQUEST["email"]) : "";
    global $_G;
    if (function_exists('iconv')) {
        $userName = iconv('UTF-8', CHARSET . '//ignore', $userName);
    } else {
        $userName = mb_convert_encoding($userName, CHARSET, 'UTF-8');
    }
    if (empty($userName) || empty($password) || empty($email)) {
        echo BIGAPPJSON::encode(array('error_code' => 2, 'error_msg' => lang('plugin/bigapp', 'empty_params'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'empty_params'))));
        die(0);
    }
    $userNamelen = dstrlen($userName);
    if ($userNamelen < 3) {
        echo BIGAPPJSON::encode(array('error_code' => 3, 'error_msg' => lang('plugin/bigapp', 'username_short'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_short'))));
        die(0);
    }
    if ($userNamelen > 15) {
        echo BIGAPPJSON::encode(array('error_code' => 4, 'error_msg' => lang('plugin/bigapp', 'username_long'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_long'))));
        die(0);
    }
    $ctlObj = new register_ctl();
    $ctlObj->setting = $_G['setting'];
    if (isset($ctlObj->setting['pwlength']) && $ctlObj->setting['pwlength']) {
        if (strlen($password) < $ctlObj->setting['pwlength']) {
            echo BIGAPPJSON::encode(array('error_code' => 5, 'error_msg' => lang('plugin/bigapp', 'password_length') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_not_equal') . ' [ >= ' . $ctlObj->setting['pwlength'] . ' ]')));
            die(0);
        }
    }
    if (isset($ctlObj->setting['strongpw']) && $ctlObj->setting['strongpw']) {
        $strongpw_str = array();
        if (in_array(1, $ctlObj->setting['strongpw']) && !preg_match("/\\d+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_number');
        }
        if (in_array(2, $ctlObj->setting['strongpw']) && !preg_match("/[a-z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_lowercase_char');
        }
        if (in_array(3, $ctlObj->setting['strongpw']) && !preg_match("/[A-Z]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_uppercase_char');
        }
        if (in_array(4, $ctlObj->setting['strongpw']) && !preg_match("/[^a-zA-Z0-9]+/", $password)) {
            $strongpw_str[] = lang('plugin/bigapp', 'password_charset');
        }
        if ($strongpw_str) {
            echo BIGAPPJSON::encode(array('error_code' => 6, 'error_msg' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]', 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid') . ' [ ' . implode(', ', $strongpw_str) . ' ]')));
            die(0);
        }
    }
    /*
    	if(!isset($_G['setting']['mobile']['mobileregister']) || !$_G['setting']['mobile']['mobileregister']){
    		echo BIGAPPJSON::encode(array('error_code' => 7, 'error_msg' => lang('plugin/bigapp', 'forbid_mobreg'), 
    				'Variables' => array('auth' => null),
                    'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_mobreg'))));
    		die(0);
    	}
    */
    loaducenter();
    if (!$ctlObj->setting['regclosed'] && (!$ctlObj->setting['regstatus'] || !$ctlObj->setting['ucactivation'])) {
        if (!$ctlObj->setting['regstatus']) {
            echo BIGAPPJSON::encode(array('error_code' => 8, 'error_msg' => lang('plugin/bigapp', 'forbid_registration'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_registration'))));
            die(0);
        }
    }
    if ($ctlObj->setting['regverify']) {
        if ($ctlObj->setting['areaverifywhite']) {
            $location = $whitearea = '';
            $location = trim(convertip($_G['clientip'], "./"));
            if ($location) {
                $whitearea = preg_quote(trim($ctlObj->setting['areaverifywhite']), '/');
                $whitearea = str_replace(array("\\*"), array('.*'), $whitearea);
                $whitearea = '.*' . $whitearea . '.*';
                $whitearea = '/^(' . str_replace(array("\r\n", ' '), array('.*|.*', ''), $whitearea) . ')$/i';
                if (@preg_match($whitearea, $location)) {
                    $ctlObj->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'])) {
                    $ctlObj->setting['regverify'] = 0;
                    break;
                }
            }
        }
    }
    if ($ctlObj->setting['regverify']) {
        $groupinfo['groupid'] = 8;
    } else {
        $groupinfo['groupid'] = $ctlObj->setting['newusergroupid'];
    }
    if (!$password || $password != addslashes($password)) {
        echo BIGAPPJSON::encode(array('error_code' => 9, 'error_msg' => lang('plugin/bigapp', 'password_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'password_invalid_char'))));
        die(0);
    }
    $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($ctlObj->setting['censoruser'] = trim($ctlObj->setting['censoruser']), '/')) . ')$/i';
    if ($ctlObj->setting['censoruser'] && @preg_match($censorexp, $userName)) {
        echo BIGAPPJSON::encode(array('error_code' => 10, 'error_msg' => lang('plugin/bigapp', 'forbid_username'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_username'))));
        die(0);
    }
    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 . '%';
                $ctlObj->setting['regctrl'] = $ctlObj->setting['ipregctrltime'];
                break;
            } else {
                $ctrlip = $_G['clientip'];
            }
        }
    } else {
        $ctrlip = $_G['clientip'];
    }
    if ($ctlObj->setting['regctrl']) {
        if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $ctlObj->setting['regctrl'] * 3600)) {
            echo BIGAPPJSON::encode(array('error_code' => 11, 'error_msg' => lang('plugin/bigapp', 'forbid_ip'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip'))));
            die(0);
        }
    }
    $setregip = null;
    if ($ctlObj->setting['regfloodctrl']) {
        $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
        if ($regip) {
            if ($regip['count'] >= $ctlObj->setting['regfloodctrl']) {
                echo BIGAPPJSON::encode(array('error_code' => 12, 'error_msg' => lang('plugin/bigapp', 'forbid_ip_today'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'forbid_ip_today'))));
                die(0);
            } else {
                $setregip = 1;
            }
        } else {
            $setregip = 2;
        }
    }
    $uid = uc_user_register($userName, $password, $email, '', '', $_G['clientip']);
    if ($uid <= 0) {
        if ($uid == -1) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char'))));
        } elseif ($uid == -2) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_invalid_char'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_invalid_char'))));
        } elseif ($uid == -3) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'username_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'username_used'))));
        } elseif ($uid == -4) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email'))));
        } elseif ($uid == -5) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'invalid_email'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'invalid_email'))));
        } elseif ($uid == -6) {
            echo BIGAPPJSON::encode(array('error_code' => 13, 'error_msg' => lang('plugin/bigapp', 'email_used'), 'Variables' => array('auth' => null), 'Message' => array('messageval' => 'for comaptible', 'messagestr' => lang('plugin/bigapp', 'email_used'))));
        }
        die(0);
    }
    $_G['username'] = $userName;
    $password = md5(random(10));
    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']));
        }
    }
    $profile = $verifyarr = array();
    $emailstatus = 0;
    $init_arr = array('credits' => explode(',', $ctlObj->setting['initcredits']), 'profile' => $profile, 'emailstatus' => $emailstatus);
    C::t('common_member')->insert($uid, $userName, $password, $email, $_G['clientip'], $groupinfo['groupid'], $init_arr);
    if ($ctlObj->setting['regctrl'] || $ctlObj->setting['regfloodctrl']) {
        C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($ctlObj->setting['regctrl'] > 72 ? $ctlObj->setting['regctrl'] : 72) * 3600);
        if ($ctlObj->setting['regctrl']) {
            C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
        }
    }
    if ($ctlObj->setting['regverify'] == 1) {
        $idstring = random(6);
        $authstr = $ctlObj->setting['regverify'] == 1 ? "{$_G['timestamp']}\t2\t{$idstring}" : '';
        C::t('common_member_field_forum')->update($uid, array('authstr' => $authstr));
        $verifyurl = "{$_G[siteurl]}member.php?mod=activate&amp;uid={$uid}&amp;id={$idstring}";
        $email_verify_message = lang('email', 'email_verify_message', array('username' => $username, 'bbname' => $ctlObj->setting['bbname'], 'siteurl' => $_G['siteurl'], 'url' => $verifyurl));
        if (!sendmail("{$username} <{$email}>", lang('email', 'email_verify_subject'), $email_verify_message)) {
            runlog('sendmail', "{$email} sendmail failed.");
        }
    }
    require_once libfile('cache/userstats', 'function');
    build_cache_userstats();
    $_GET['regmessage'] = 'from bigapp client';
    $regmessage = dhtmlspecialchars($_GET['regmessage']);
    if ($ctlObj->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');
    checkfollowfeed();
    C::t('common_member_status')->update($_G['uid'], array('lastip' => $_G['clientip'], 'lastvisit' => TIMESTAMP, 'lastactivity' => TIMESTAMP));
    ////////////////////////////////////////////////
    // 注册成功,绑定第三方openid
    $plat = $_GET["platform"];
    if ($plat == "qq") {
        include_once CUR_PATH . "/../qqconnect/bind.php";
    } else {
        if ($plat == "wechat") {
            include_once CUR_PATH . "/../wechatconnect/bind.php";
        }
    }
    ////////////////////////////////////////////////
    echo BIGAPPJSON::encode(array('error_code' => 0, 'error_msg' => lang('plugin/bigapp', 'regist_succ'), 'Message' => array('messageval' => 'register_succeed', 'messagestr' => lang('plugin/bigapp', 'regist_succ')), 'Variables' => array('auth' => 'in order to be comapatible')));
    die(0);
}
예제 #28
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;
}
예제 #29
0
     if (empty($_G['gp_newpassword'])) {
         showmessage('profile_passwd_empty');
     }
 }
 if ($_G['gp_questionidnew'] === '') {
     $_G['gp_questionidnew'] = $_G['gp_answernew'] = '';
 } else {
     $secquesnew = $_G['gp_questionidnew'] > 0 ? random(8) : '';
 }
 if (!empty($_G['gp_newpassword']) && $_G['gp_newpassword'] != addslashes($_G['gp_newpassword'])) {
     showmessage('profile_passwd_illegal', '', array(), array('return' => true));
 }
 if (!empty($_G['gp_newpassword']) && $_G['gp_newpassword'] != $_G['gp_newpassword2']) {
     showmessage('profile_passwd_notmatch', '', array(), array('return' => true));
 }
 loaducenter();
 $ucresult = uc_user_edit($_G['username'], $_G['gp_oldpassword'], $_G['gp_newpassword'], $emailnew != $_G['member']['email'] ? $emailnew : '', $ignorepassword, $_G['gp_questionidnew'], $_G['gp_answernew']);
 if ($ucresult == -1) {
     showmessage('profile_passwd_wrong', '', array(), array('return' => true));
 } elseif ($ucresult == -4) {
     showmessage('profile_email_illegal', '', array(), array('return' => true));
 } elseif ($ucresult == -5) {
     showmessage('profile_email_domain_illegal', '', array(), array('return' => true));
 } elseif ($ucresult == -6) {
     showmessage('profile_email_duplicate', '', array(), array('return' => true));
 }
 if (!empty($_G['gp_newpassword']) || $secquesnew) {
     $setarr['password'] = md5(random(10));
 }
 if ($_G['setting']['connect']['allow']) {
     DB::update('common_member_connect', array('conisregister' => 0), array('uid' => $_G['uid']));
예제 #30
0
파일: r.inc.php 프로젝트: deepziyu/JX3PVE
function register($username, $return = 0, $groupid = 0)
{
    global $_G;
    if (!$username) {
        return;
    }
    if (!$_G['wechat']['setting']) {
        $_G['wechat']['setting'] = unserialize($_G['setting']['mobilewechat']);
    }
    loaducenter();
    $groupid = !$groupid ? $_G['wechat']['setting']['wechat_newusergroupid'] ? $_G['wechat']['setting']['wechat_newusergroupid'] : $_G['setting']['newusergroupid'] : $groupid;
    $pwd = random(7);
    $password = md5($pwd);
    $email = 'wechat_' . strtolower(random(10)) . '@null.null';
    $usernamelen = dstrlen($username);
    if ($usernamelen < 3) {
        $username = $username . '_' . random(5);
    }
    if ($usernamelen > 15) {
        if (!$return) {
            showmessage('profile_username_toolong');
        } else {
            return;
        }
    }
    $censorexp = '/^(' . str_replace(array('\\*', "\r\n", ' '), array('.*', '|', ''), preg_quote($_G['setting']['censoruser'] = trim($_G['setting']['censoruser']), '/')) . ')$/i';
    if ($_G['setting']['censoruser'] && @preg_match($censorexp, $username)) {
        if (!$return) {
            showmessage('profile_username_protect');
        } else {
            return;
        }
    }
    if (!$_G['wechat']['setting']['wechat_disableregrule']) {
        loadcache('ipctrl');
        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 . '%';
                    $_G['setting']['regctrl'] = $_G['setting']['ipregctrltime'];
                    break;
                } else {
                    $ctrlip = $_G['clientip'];
                }
            }
        } else {
            $ctrlip = $_G['clientip'];
        }
        if ($_G['setting']['regctrl']) {
            if (C::t('common_regip')->count_by_ip_dateline($ctrlip, $_G['timestamp'] - $_G['setting']['regctrl'] * 3600)) {
                if (!$return) {
                    showmessage('register_ctrl', NULL, array('regctrl' => $_G['setting']['regctrl']));
                } else {
                    return;
                }
            }
        }
        $setregip = null;
        if ($_G['setting']['regfloodctrl']) {
            $regip = C::t('common_regip')->fetch_by_ip_dateline($_G['clientip'], $_G['timestamp'] - 86400);
            if ($regip) {
                if ($regip['count'] >= $_G['setting']['regfloodctrl']) {
                    if (!$return) {
                        showmessage('register_flood_ctrl', NULL, array('regfloodctrl' => $_G['setting']['regfloodctrl']));
                    } else {
                        return;
                    }
                } else {
                    $setregip = 1;
                }
            } else {
                $setregip = 2;
            }
        }
        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']));
            }
        }
    }
    $uid = uc_user_register(addslashes($username), $password, $email, '', '', $_G['clientip']);
    if ($uid <= 0) {
        if (!$return) {
            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 {
            return;
        }
    }
    $init_arr = array('credits' => explode(',', $_G['setting']['initcredits']));
    C::t('common_member')->insert($uid, $username, $password, $email, $_G['clientip'], $groupid, $init_arr);
    if ($_G['setting']['regctrl'] || $_G['setting']['regfloodctrl']) {
        C::t('common_regip')->delete_by_dateline($_G['timestamp'] - ($_G['setting']['regctrl'] > 72 ? $_G['setting']['regctrl'] : 72) * 3600);
        if ($_G['setting']['regctrl']) {
            C::t('common_regip')->insert(array('ip' => $_G['clientip'], 'count' => -1, 'dateline' => $_G['timestamp']));
        }
    }
    if ($_G['setting']['regverify'] == 2) {
        C::t('common_member_validate')->insert(array('uid' => $uid, 'submitdate' => $_G['timestamp'], 'moddate' => 0, 'admin' => '', 'submittimes' => 1, 'status' => 0, 'message' => '', 'remark' => ''), false, true);
        manage_addnotify('verifyuser');
    }
    setloginstatus(array('uid' => $uid, 'username' => $username, 'password' => $password, 'groupid' => $groupid), 0);
    //统计
    include_once libfile('function/stat');
    updatestat('register');
    return array('uid' => $uid, 'username' => $username, 'password' => $pwd, 'groupid' => $groupid);
}