public static function getEngine($strEngine = 'Ral') { if (defined('IS_ODP') && true === IS_ODP) { $strClassName = "Bd_Passport_Interact_Ral"; } else { $engine = Bd_Passport_Conf::getConfEx('engine', 'Ral'); $strEngine = ucfirst(strtolower($engine)); $strClassName = "Bd_Passport_Interact_{$strEngine}"; $filename = dirname(__FILE__) . "/interact/" . $strEngine . ".php"; if (file_exists($filename)) { require_once $filename; } else { Bd_Passport_Log::warning("{$filename} doesn't exist!", E_USER_ERROR); } } if (class_exists($strClassName)) { $instance = new $strClassName(); if (!$instance instanceof Bd_Passport_Interact_IEngine) { Bd_Passport_Log::warning("{$strClassName} isn't instanceof Bd_Passport_Interact_IEngine", E_USER_WARNING); } return $instance; } else { Bd_Passport_Log::warning("{$strClassName} Not Found!", E_USER_WARNING); } }
/** * @brief 从passport.conf读取配置文件 * @param string $strField 'tpl', 'psptoken_key_crypt', 'psptoken_key_csrf' * @return string * @author fanmengzhe */ public static function getConf($strField) { if (!in_array($strField, array('tpl', 'psptoken_key_crypt', 'psptoken_key_csrf'))) { return false; } return Bd_Passport_Conf::getConfEx($strField, false); }
protected function __construct() { self::$_appUser = Bd_Passport_Conf::getConf('app_user'); self::$_appPasswd = Bd_Passport_Conf::getConf('app_passwd'); self::$_encoding = Bd_Passport_Conf::getConfEx('internal_encoding', 'utf8'); if (!in_array(self::$_encoding, array('gbk', 'gb18030', 'utf8'))) { self::$_encoding = 'utf8'; } if (is_null(self::$_appUser) || is_null(self::$_appPasswd)) { Bd_Passport_Log::warning("Invalid app_user or app_passwd.", E_USER_ERROR); } if (!defined('LOG_ID')) { define('LOG_ID', Bd_Passport_Util::getLogId()); } if (!defined('CLIENT_IP')) { define('CLIENT_IP', Bd_Passport_Util::getClientIp()); } }
protected function __construct() { self::$_apid = Bd_Passport_Conf::getConf('apid'); self::$_tpl = Bd_Passport_Conf::getConf('tpl'); self::$_pass = Bd_Passport_Conf::getConf('pass'); self::$_is_orp = intval(Bd_Passport_Conf::getConfEx('is_orp', 0)) === 1 ? true : false; if (is_null(self::$_apid)) { Bd_Passport_Log::warning("Apid for session Not Found!", -1); } if (!defined('LOG_ID')) { define('LOG_ID', Bd_Passport_Util::getLogId()); } if (!defined('CLIENT_IP')) { define('CLIENT_IP', Bd_Passport_Util::getClientIp()); } }