protected function setOptions() { if (isset($this->_vars[0])) { switch (is_numeric($this->_vars[0])) { case true: $this->setOption('id', $this->_vars[0]); break; case false: $this->setOption('name', $this->_vars[0]); break; } } switch ($this->_action) { case 'open': $start = isset($this->_vars[1]) && is_numeric($this->_vars[1]) ? $this->_vars[1] : TFRouter::getParam('start'); $limit = isset($this->_vars[2]) && is_numeric($this->_vars[2]) ? $this->_vars[2] : TFRouter::getParam('limit'); $this->setOption('start', $start); $this->setOption('limit', $limit); break; case 'close': $this->setOption('close', true); $this->setOption('action', 'restrict'); break; } parent::setOptions(); }
protected function executeAfter() { if (TFRouter::getEnv() == 'xhtml') { $this->_view->assign('js', $this->_js); $this->_output .= $this->_view->fetch('footer' . DIRECTORY_SEPARATOR . 'xhtml' . DIRECTORY_SEPARATOR . 'main.tpl.php'); } foreach ($this->_headers as $header) { header($header); } }
public function setOptions() { switch ($this->_action) { case 'create': $this->setOption('new-permissions', array(TFRouter::getParam('new-permission'))); break; case 'open': if (isset($this->_vars[0])) { switch (is_numeric($this->_vars[0])) { case true: $this->setOption('id', $this->_vars[0]); break; case false: $this->setOption('name', $this->_vars[0]); break; } } break; } parent::setOptions(); }
<?php ob_start(); define("_SEP_", DIRECTORY_SEPARATOR); define("_DEBUG_", true); require_once 'autoloader.php'; require_once 'errorHandler.php'; require_once ".." . _SEP_ . "classes" . _SEP_ . "library" . _SEP_ . 'firePHP' . _SEP_ . "fb.php"; NewDao::connect('mysql', ".." . _SEP_ . "configs" . _SEP_ . "db.ini"); NewDao::setLogger(array('FB', 'log')); TreeForumAutoload('TFUserM'); session_start(); session_regenerate_id(); $conf = new IniObject(".." . _SEP_ . "configs" . _SEP_ . "view.ini"); TFRouter::route($conf->base_path, '', $conf); ob_flush();
public static function setEnv($env) { self::$_env = $env; }
/** * sets the view * @access protected */ protected function setView() { if ($this->_model) { $this->_view->assign('model', $this->_model); } $this->_view->assign('options', $this->_options); if (in_array(TFRouter::getEnv(), $this->_envs)) { $folder = TFRouter::getEnv(); } else { $folder = $this->_def_env; } if (strlen($this->_action) > 0) { if (in_array($this->_action, $this->_tpl_folders)) { $location = $this->_template_dir . _SEP_ . $this->_action . _SEP_ . $folder . _SEP_; } elseif (array_key_exists($this->_action, $this->_tpl_folders)) { $location = $this->_template_dir . _SEP_ . $this->_tpl_folders[$this->_action] . _SEP_ . $folder . _SEP_; } } else { $location = $this->_template_dir . _SEP_ . $this->_default_tpl_folder . _SEP_ . $folder . _SEP_; } $file = is_null($this->_model) == false && $this->_model->isError() ? 'errors.tpl.php' : 'main.tpl.php'; $this->_output .= $this->_view->fetch($location . $file); }