} session_start(); $router = array(); if (file_exists(APP_PATH . 'router.php')) { $router = (include APP_PATH . 'router.php'); } $_uri = router($router); define('MODULE', $_uri['module']); define('ACTION', $_uri['action']); require CORE_PATH . '/db.php'; $db = new db(); if (isset($config['DB_DRIVER'])) { $db->set_driver($config['DB_DRIVER']); } if (isset($config['DB_PREFIX'])) { $db->prefix($config['DB_PREFIX']); } $db_host = $config['DB_HOST'] . (isset($config['DB_PORT']) ? ':' . $config['DB_PORT'] : ''); $db->setting($db_host, $config['DB_USER'], $config['DB_PSWD'], $config['DB_NAME']); $script = APP_PATH . 'action/' . MODULE . 'Action.php'; if (!file_exists($script)) { error_404('Can not find the action ' . MODULE . 'Action.php'); } else { require $script; $class = MODULE . 'Action'; $method = ACTION; if ($method != $class) { $run = new $class(); if (is_callable(array($run, $method))) { $run->{$method}(); } else {
public function testPrefix() { db::connect(array('database' => self::$database, 'type' => 'sqlite', 'prefix' => 'myprefix_')); $this->assertEquals('myprefix_', db::prefix()); db::connect(array('database' => self::$database, 'type' => 'sqlite')); }