/** * @brief 保存用户信息到passport * * @author cuichao02 * @date 2011/02/21 **/ public static function saveModDatat() { $arrSavePassport = Saf_SmartMain::getSavePassport(); if (is_array($arrSavePassport) && count($arrSavePassport) > 0) { $safConf = Bd_Conf::getAppConf('/saf'); if (empty($safConf)) { $safConf = Bd_Conf::getConf('/saf'); } $intPassportSaveLen = intval($safConf['passport_save_len']); if ($intPassportSaveLen == 0) { $intPassportSaveLen = 32; } Bd_Passport::initDataBuf($arrCachePass, $intPassportSaveLen); foreach ($arrSavePassport as $bit => $v) { Bd_Passport::modDataBufByBit($arrCachePass, intval($bit), intval($v)); } $arrOutput = Bd_Passport::modData($_COOKIE['BDUSS'], '', '', $arrCachePass['data'], $arrCachePass['mask']); if ($arrOutput['status'] != 0 || $arrOutput == false) { Saf_SmartMain::setSafLog("保存到passport服务器出错(" . var_export($arrOutput, true) . ")", 2); Saf_Base_Hook::warningAction('save_passport', 'system busy'); return false; } } return true; }
public function actionStartUp() { if (!isset($_COOKIE['BDUSS']) || $_COOKIE['BDUSS'] === '') { $ssid = $this->_getSSID(); if ($ssid !== false) { $bduss = Bd_Passport::getBDUSSBySSID($ssid); if ($bduss !== false) { $_COOKIE['BDUSS'] = $bduss; } else { return false; } } else { return false; } } $arrUserInfo = Saf_Base_Session::checkLogin(); if ($arrUserInfo === false) { return false; } $re = self::setUserInfo($arrUserInfo); return true; }
private function _getUidByBduss($strBduss) { $mixRet = $ret = Bd_Passport::checkUserLogin($strBduss, 1); if (false === $mixRet) { return Navilib_Const::DEFAULT_UID; } else { return $mixRet['uid']; } }
/** * @brief 从URL中解密PSPTOKEN * @param string $psptoken 加密过的psptoken,根据配置文件中配置的tpl和key进行解密 * @return string psptoken * @return bool false On failure * @author fanmengzhe */ public static function decryptPSPToken($psptoken) { $tpl = Bd_Passport_Conf::getConfEx('tpl', false); if (!$tpl) { self::$_errno = -1; self::$_errmsg = 'TPL not found in passport.conf/Inc.php'; Bd_Passport_Log::warning(self::$_errmsg, self::$_errno); return false; } $key = Bd_Passport_Conf::getConfEx('psptoken_key_crypt', false); if (!$key) { self::$_errno = -1; self::$_errmsg = 'psptoken_key_crypt not found in passport.conf/Inc.php'; Bd_Passport_Log::warning(self::$_errmsg, self::$_errno); return false; } return Bd_Passport_Util_URLCrypt::url_decrypt($tpl, $key, $psptoken); }