/** * Ethna_Sessionクラスのコンストラクタ * * @access public * @param string $appid アプリケーションID(セッション名として使用) * @param string $save_dir セッションデータを保存するディレクトリ */ public function __construct($ctl, $appid) { $this->ctl = $ctl; $this->logger = $this->ctl->getLogger(); $config = $this->ctl->getConfig()->get('session'); if ($config) { $this->config = array_merge($this->config, $config); } $this->session_save_dir = $this->config['path']; if (($dir = $this->ctl->getDirectory($this->config['path'])) !== null) { $this->session_save_dir = $dir; } $this->session_name = $appid . $this->config['suffix']; // set session handler ini_set('session.save_handler', $this->config['handler']); session_save_path($this->session_save_dir); session_name($this->session_name); session_cache_limiter($this->config['cache_limiter']); session_cache_expire($this->config['cache_expire']); $this->session_start = false; if (isset($_SERVER['REQUEST_METHOD']) == false) { return; } if (strcasecmp($_SERVER['REQUEST_METHOD'], 'post') == 0) { $http_vars = $_POST; } else { $http_vars = $_GET; } if (array_key_exists($this->session_name, $http_vars) && $http_vars[$this->session_name] != null) { $_COOKIE[$this->session_name] = $http_vars[$this->session_name]; } }
/** * プラグインのインスタンスをレジストリから消す * * @access private * @param string $type プラグインの種類 * @param string $name プラグインの名前 */ public function _loadPluginDirList() { $this->_dirlist[] = $this->controller->getDirectory('plugin'); // include_path から検索 $include_path_list = explode(PATH_SEPARATOR, get_include_path()); // Communiy based libraries $extlib_dir = implode(DIRECTORY_SEPARATOR, array('Ethna', 'extlib', 'Plugin')); // Ethna bandle $class_dir = implode(DIRECTORY_SEPARATOR, array('Ethna', 'class', 'Plugin')); foreach ($include_path_list as $include_path) { if (is_dir($include_path . DIRECTORY_SEPARATOR . $extlib_dir)) { $this->_dirlist[] = $include_path . DIRECTORY_SEPARATOR . $extlib_dir; } if (is_dir($include_path . DIRECTORY_SEPARATOR . $class_dir)) { $this->_dirlist[] = $include_path . DIRECTORY_SEPARATOR . $class_dir; } } }
/** * オブジェクト生成メソッド(i18n) * * @access protected * @param string $class_name クラス名 * @return object 生成されたオブジェクト(エラーならnull) */ function _getObject_I18n($class_name) { $_ret_object = new $class_name($this->ctl->getDirectory('locale'), $this->ctl->getAppId()); return $_ret_object; }
/** * アプリケーションのテンポラリディレクトリを取得する * * @access public * @return string テンポラリディレクトリのパス名 */ public function getTmpdir() { return $this->controller->getDirectory('tmp'); }
/** * 設定ファイル名を取得する * * @access private * @return string 設定ファイルへのフルパス名 */ function _getConfigFile() { return $this->controller->getDirectory('etc') . '/' . strtolower($this->controller->getAppId()) . '-ini.php'; }