/** * @brief ext中的CAS外部文件映射初始化接口 * * @return success-true failed-false * @retval boolean * @see php/phplib/ext/cas/中的phpCAS相关实现文件 * @note 将php/ext/cas目录下的文件进行路径映射,并读取ral/services/uuap.conf配置文件的信息 * @author chenyijie * @date 2012/09/28 22:25:52 **/ private static function getCasInit() { if (!self::$isInit) { Bd_Autoloader::addClassMap(self::$casClassMap); self::$isInit = true; } // 加载配置 if (empty(self::$arrConf)) { self::$arrConf = Bd_Conf::getConf('ral/services/uuap/CamelConfig/ServiceConfig/Local/Service'); if (empty(self::$arrConf)) { Bd_Log::warning('Get configure from ral/services/uuap.conf failed'); self::$arrConf = null; return false; } //裁剪掉关于UIC服务的配置 foreach (self::$arrConf as $index) { if ($index['Name'] === 'uuapSSO') { self::$arrConf = $index; } } } if (self::$arrConf['ReverseProxy'] === 'On') { $str = $_SERVER['SERVER_NAME']; if (self::$arrConf['ProxyPort']) { $str .= ":" . self::$arrConf['ProxyPort']; } define("UUAP_SERVICE_URL", $str); } return true; }
public static function getInstance($param = null) { // 初始化Smarty自动加载 if (!self::$isInit) { Bd_Autoloader::addClassMap(self::$smartyClassMap); self::$isInit = true; } // 从配置中读取参数 if (!is_array($param)) { // 加载配置 if (empty(self::$arrConf)) { self::$arrConf = Bd_Conf::getConf('/smarty/'); if (empty(self::$arrConf)) { self::$arrConf = null; return null; } } // 取指定的配置组 if ($param != null) { $param = self::$arrConf[$param]; // 不存在则出错 if (!$param) { return null; } } else { $param = current(self::$arrConf); } } // new一个smarty $smarty = new Smarty(); // 根据参数初始化该smarty对象 $smarty->setTemplateDir(self::__absPath($param['template_dir'])); $smarty->setCompileDir(self::__absPath($param['compile_dir'])); $smarty->setCompileCheck($param['compile_check'] != '0'); $smarty->setConfigDir(self::__absPath($param['config_dir'])); if (!empty($param['config_load'])) { $smarty->configLoad($param['config_load']); } $smarty->addPluginsDir(self::__absPath($param['plugins_dir'])); $smarty->left_delimiter = $param['left_delimiter']; $smarty->right_delimiter = $param['right_delimiter']; if (isset($_COOKIE['FIS_DEBUG']) && $_COOKIE['FIS_DEBUG'] === 'YlwtSmt' && self::isInternalIp(Bd_Ip::getClientIp())) { return new Bd_TplFactory($smarty); } return $smarty; }