From c50a323c25a0787ba2051b19721983776a229615 Mon Sep 17 00:00:00 2001 From: Camil Staps Date: Thu, 5 Feb 2015 00:40:47 +0100 Subject: Initial commit --- index.php | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 index.php (limited to 'index.php') diff --git a/index.php b/index.php new file mode 100644 index 0000000..238b72e --- /dev/null +++ b/index.php @@ -0,0 +1,66 @@ +. + */ + +/** + * Load the basic configuration (sessions, database, class autoloading, etc.) + */ +require_once('./conf.php'); + +// Fetch information from the REQUEST_URI. +$_request = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); +$_request = str_replace(constants::url_internal, '', $_request); + +// This is the REQUEST_URI switch +// The default shows a 404 page +$pages = array( + '' => './include/home.php', + '/clients' => './include/clients.php', + '/clients/new' => './include/clients-new.php', + '/clients/edit' => './include/clients-edit.php', + '/contacts' => './include/contacts.php', + '/contacts/new' => './include/contacts-new.php', + '/contacts/edit' => './include/contacts-edit.php', + '/offers' => './include/offers.php', + '/offers/new' => './include/offers-new.php', + '/offers/edit' => './include/offers-edit.php', + '/assignments' => './include/assignments.php', + '/assignments/new' => './include/assignments-new.php', + '/assignments/edit' => './include/assignments-edit.php', + '/about' => './include/about.php' +); +$_page = null; +foreach ($pages as $uri => $path) { + if ($_request == $uri && file_exists($path)) { + $_page = $uri; + require($path); + break; + } +} +if ($_page === null) { + $_page = '/404'; + http_response_code(404); + require('./include/404.php'); +} \ No newline at end of file -- cgit v1.2.3