Exemplo n.º 1
0
 /**
  * 数组转成UserCenter对象
  * @param unknown $userArray
  */
 public static function array2UserCenter($userArray)
 {
     if ($userArray != null) {
         $user = new UserCenter();
         $user->setId($userArray['id']);
         $user->setUsername($userArray['username']);
         $user->setPassword($userArray['password']);
         $user->setNickname($userArray['nickname']);
         return $user;
     }
 }
Exemplo n.º 2
0
<?php

defined('IN_KEKE') or exit('Access Denied');
$strPageTitle = $_lang['login'] . '- ' . $_K['html_title'];
$strPageTitle = 'oauth登录-' . $_K['html_title'];
$strPageKeyword = 'oauth登录,' . $_K['html_title'];
$strPageDescription = $kekezu->_sys_config['index_seo_desc'];
$type = strval(trim($type));
$arrOauthType = UserCenter::getOauthType();
if (!$_SESSION[$type . '_oauthInfo']) {
    if (in_array($type, array_keys($arrOauthType))) {
        UserCenter::oauthRoute($type);
    }
    kekezu::show_msg('缺少参数', 'index.php?do=login', 3, NULL, 'warning');
}
$arrOauthInfo = $_SESSION[$type . '_oauthInfo'];
if (strtoupper(CHARSET) == 'GBK') {
    $arrOauthInfo = kekezu::utftogbk($arrOauthInfo);
}
$objLogin = new keke_user_login_class();
$arrBindInfo = keke_register_class::is_oauth_bind($type, $arrOauthInfo['account']);
if ($_SESSION[$type . '_oauthInfo'] && $arrBindInfo && !$is_binding) {
    $_SESSION[$type . '_oauthInfo'] = null;
    $arrUserInfo = kekezu::get_user_info($arrBindInfo['uid']);
    $loginUserInfo = $objLogin->oauth_user_login($arrUserInfo['username'], $arrUserInfo['password'], null, 1);
    $objLogin->save_user_info($loginUserInfo, 1);
}
$inter = $kekezu->_sys_config['user_intergration'];
$intLoginTimes = intval($_SESSION['login_times']);
if (kekezu::submitcheck(isset($formhash)) || isset($login_type) == 3) {
    if ($code) {
Exemplo n.º 3
0
                $saveInfo = array('account' => $oauthInfo['id'], 'nickname' => $oauthInfo['name'], 'gender' => strtoupper($oauthInfo['basicInformation']['sex']) == 'MALE' ? '男' : '女', 'type' => $_REQUEST['state']);
                break;
            case 'douban':
                $oauthInfo = $oauth_obj->getAccountInfo();
                unset($oauth_obj, $_SESSION['oauth_token']);
                $saveInfo = array('account' => $oauthInfo['id'], 'nickname' => $oauthInfo['name'], 'gender' => '', 'type' => $_REQUEST['state']);
                break;
            case 'taobao':
                $saveInfo = array('account' => $token['taobao_user_id'], 'nickname' => urldecode($token['taobao_user_nick']), 'gender' => $token['taobao_user_gender'], 'type' => $_REQUEST['state']);
                break;
            case 'baidu':
                $oauthInfo = $oauth_obj->getAccountInfo($token);
                unset($oauth_obj, $_SESSION['oauth_token']);
                $saveInfo = array('account' => $oauthInfo['userid'], 'nickname' => $oauthInfo['username'], 'gender' => $oauthInfo['sex'] ? '男' : '女', 'type' => $_REQUEST['state']);
                break;
            default:
                break;
        }
        if ($gUid) {
            UserCenter::bindingAccount($gUid, $gUserInfo['username'], $saveInfo);
            header('Location:' . $basic_config['website_url'] . '/index.php?do=user&view=account&op=binding');
        } else {
            $_SESSION[$saveInfo['type'] . '_oauthInfo'] = $saveInfo;
            header('Location:' . $basic_config['website_url'] . '/index.php?do=oauthregister&type=' . $saveInfo['type']);
        }
    } else {
        exit('授权失败');
    }
} else {
    exit('参数错误');
}
Exemplo n.º 4
0
}
$objLogin = new keke_user_login_class();
$arrBindInfo = keke_register_class::is_oauth_bind($type, $arrOauthInfo['account']);
if ($_SESSION[$type . '_oauthInfo'] && $arrBindInfo) {
    $_SESSION[$type . '_oauthInfo'] = null;
    $arrUserInfo = kekezu::get_user_info($arrBindInfo['uid']);
    $loginUserInfo = $objLogin->oauth_user_login($arrUserInfo['username'], $arrUserInfo['password'], null, 1);
    $objLogin->save_user_info($loginUserInfo, 1);
}
$inter = $kekezu->_sys_config['user_intergration'];
$intLoginTimes = intval($_SESSION['login_times']);
if (kekezu::submitcheck(isset($formhash)) || isset($login_type) == 3) {
    if ($code) {
        $strCodeCheck = kekezu::check_secode($code);
        if ($strCodeCheck != 1) {
            $tips['errors']['code'] = $strCodeCheck;
            kekezu::show_msg($tips, NULL, NULL, NULL, 'error');
        }
    }
    $strCode = isset($code) ? $code : "";
    $intLoginType = isset($login_type) ? $login_type : "";
    $ckb_cookie = isset($ckb_cookie) ? $ckb_cookie : "";
    if (strtoupper(CHARSET) == 'GBK') {
        $account = kekezu::utftogbk($account);
    }
    $arrUserInfo = $objLogin->user_login($account, $password, $strCode, $intLoginType);
    UserCenter::bindingAccount($arrUserInfo['uid'], $arrUserInfo['username'], $arrOauthInfo);
    $_SESSION[$type . '_oauthInfo'] = null;
    $objLogin->save_user_info($arrUserInfo, $account, $ckb_cookie, $intLoginType, 0, true);
    die;
}