public static function run() { $route_found = false; foreach (self::$routes as $route) { if (app\config::get('basepath')) { $route['expression'] = rtrim(app\config::get('basepath') . DIRECTORY_SEPARATOR . $route['expression'], '/'); } //Add 'find string start' automatically $route['expression'] = '^' . $route['expression']; //Add 'find string end' automatically $route['expression'] = $route['expression'] . '$'; //check match if (preg_match('#' . $route['expression'] . '#', self::$path, $matches)) { array_shift($matches); //Always remove first element. This contains the whole string call_user_func_array($route['function'], $matches); $route_found = true; } //echo $route['expression'].'<br />'; } if (!$route_found) { foreach (self::$routes404 as $route404) { call_user_func_array($route404, array(self::$path)); } } }
public function getCells($table) { $query = 'SELECT COLUMN_NAME '; $query .= 'FROM INFORMATION_SCHEMA.COLUMNS '; $query .= 'WHERE TABLE_SCHEMA=\'' . app\config::get('dbname') . '\' '; $query .= 'AND TABLE_NAME=\'' . $table . '\';'; return $this->sql_getVals($query); }
function loadClass($classname) { $classname = str_replace('\\', DIRECTORY_SEPARATOR, $classname); if (file_exists(__DIR__ . config::get('classroot') . $classname . '.php')) { include __DIR__ . config::get('classroot') . $classname . '.php'; } else { echo __DIR__ . config::get('classroot') . $classname . '.php'; throw new Exception('Can\'t find file to include. /index.php/loadClass(\'' . $classname . '\')'); } }
public static function start_session() { $secure = config::get('environment') === 'deveop' ? FALSE : TRUE; $httponly = config::get('environment') === 'deveop' ? FALSE : TRUE; if (ini_set('session.use_only_cookies', 1) === FALSE) { header("Location: ../login?message=cookies"); exit; } $cookieParams = session_get_cookie_params(); session_set_cookie_params($cookieParams["lifetime"], $cookieParams["path"], $cookieParams["domain"], $secure, $httponly); session_name(config::get('session_name')); session_start(); // Startet die PHP-Sitzung session_regenerate_id(); }
/** * (non-PHPdoc) * @see classes.authorization::logoff() */ public function logout() { config::stop_session(); header(config::get('page_base')); }