/** * Setup object needed to process a request * @param object $config site configuration * @return object */ public function __construct($config) { /* get the site config defined in the hm3.rc file */ $this->site_config = $config; /* setup a session handler, but don't actually start a session yet */ $this->session = setup_session($this->site_config); /* instantiate the module runner */ $this->module_exec = new Hm_Module_Exec($this->site_config); /* process request input using the white-lists defined in modules */ $this->request = new Hm_Request($this->module_exec->filters); /* do it */ $this->process_request(); }
/** * @preserveGlobalState disabled * @runInSeparateProcess */ public function test_setup_session() { $this->assertEquals('Hm_PHP_Session', get_class(setup_session($this->config))); $this->config->set('session_type', 'DB'); $this->config->set('auth_type', 'DB'); $this->assertEquals('Hm_DB_Session', get_class(setup_session($this->config))); }
<?php require_once "libs/smarty/libs/Smarty.class.php"; function setup_smarty() { $smarty = new Smarty(); $smarty->setTemplateDir('templates/'); $smarty->setCompileDir('libs/smarty/templates_c/'); $smarty->setConfigDir('libs/smarty/configs/'); $smarty->setCacheDir('libs/smarty/cache/'); return $smarty; } function setup_session() { session_start(); if (!isset($_SESSION["loggedIn"])) { $_SESSION["loggedIn"] = False; } } //Create variables accesible to scripts that require setup.php $smarty = setup_smarty(); setup_session();