public function __construct() { $this->aParams = array_merge($_GET, $_POST); $this->aFile = $_FILES; $this->aURL = parse_url($_SERVER["REQUEST_URI"]); // Strip slashes from path. $this->aURL["path"] = trim($this->aURL["path"], "/"); // Use default path if not specified. if (empty($this->aURL["path"])) { $this->aURL["path"] = DKY_Config::get("default_path"); } // Get item from request path. $this->item = DKY_Item::getItemByPath($this->aURL["path"]); // TODO: Handle no item..? // Get component from POST/GET. $this->componentName = $this->get("component"); $this->actionName = $this->get("action"); // Use item component/action if not specified in request. if (empty($this->componentName)) { $this->componentName = $this->item["component"]; } if (empty($this->actionName)) { $this->actionName = $this->item["action"]; } }
public static function process() { $request = DKY_RequestHandler::getRequest(); $component = DKY_ComponentHandler::getComponent($request->componentName); if (!empty($component)) { $component->run($request->actionName, $request); } else { header("HTTP/1.0 404 Not Found"); DKY_HTTP::redirect("/" . DKY_Config::get("404_path")); } }
public static function run() { // TODO: Filters.. exceptions..? if ($_SERVER["REQUEST_URI"] == "/favicon.ico") { DKY_HTTP::redirect("/www/favicon.ico"); } DKY_Config::initialize(); DKY_DB::initialize(array("host" => DKY_Config::get("db_host"), "database" => DKY_Config::get("db_database"), "username" => DKY_Config::get("db_username"), "password" => DKY_Config::get("db_password"))); DKY_Log::initialize(array("path" => DKY_Config::get("log_path"))); DKY_Log::i("REQUEST: " . $_SERVER["REQUEST_URI"]); DKY_SessionHandler::startSession(); DKY_SessionHandler::cachePermissions(); //$strLogTail = "<div style='font:10px sans-serif;height:100px;overflow:auto;'>" . implode("<br />", DKY_Log::tail(20)) . "</div>"; //DKY_Output::raiseMessage($strLogTail, DKY_MSG_INFO); DKY_RequestHandler::process(); }
public static function initialize() { DKY_Config::$_aConfig = array(); require_once DKY_PATH_VAR . "/Config.php"; }
<?php DKY_Config::set("log_enabled", "1"); DKY_Config::set("log_path", DKY_PATH_VAR . "/log.txt"); DKY_Config::set("default_path", "login"); DKY_Config::set("404_path", "404"); DKY_Config::set("db_host", "localhost"); DKY_Config::set("db_database", "framework"); DKY_Config::set("db_username", "root"); DKY_Config::set("db_password", "");