From b646a7fddf78970c12e703913e9f1492c9b966b6 Mon Sep 17 00:00:00 2001 From: Richard Whitehouse Date: Thu, 3 Feb 2011 04:31:08 +0000 Subject: [PATCH] Inital ticketing system --- .htaccess | 11 +++++ index.php | 104 ++++++++++++++++++++++++++++++++++++++++++++ pages/index.php | 6 +++ templates/index.php | 6 +++ 4 files changed, 127 insertions(+) create mode 100644 .htaccess create mode 100644 index.php create mode 100644 pages/index.php create mode 100644 templates/index.php diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..4a19a4d --- /dev/null +++ b/.htaccess @@ -0,0 +1,11 @@ +RewriteEngine On +RewriteCond %{HTTPS} off +RewriteRule (.*) http://www.homertonball.com [L] + +RewriteRule index.php - [QSA,L] +RewriteRule (.*) https://www.srcf.ucam.org/hmb/secure/index.php?page=$1 [QSA,L] + +AuthType Ucam-WebAuth +Require valid-user +Require rjw201 + diff --git a/index.php b/index.php new file mode 100644 index 0000000..e8b091d --- /dev/null +++ b/index.php @@ -0,0 +1,104 @@ +config)){ + $this->config = Config::Load(); + } + return $config; + } + + private $type; + + public function type(){ + if(!isset($this->type)){ + $type = isset($_GET['page']) ? $_GET['page'] : null; + if(isset($type) && file_exists('pages/' . $type . '.php') && file_exists('templates/' . $type . '.php')){ + $this->type = $type; + } elseif(file_exists('pages/index.php') && file_exists('templates/index.php')) { + $this->type = 'index'; + } else { + throw new Exception('Invalid type'); + } + } + return $this->type; + } + + private $page; + + public function page(){ + if(!isset($this->page)){ + require_once('pages/' . $this->type() . '.php'); + $class = 'Page_' . $this->type(); + $this->page = new $class(); + if(!isset($this->page) || !($this->page instanceof Page)){ + throw new Exception('Invalid Page Object - ' . $this->type()); + } + } + return $this->page; + } + + private $template; + + public function template(){ + if(!isset($this->template)){ + require_once('templates/' . $this->type() . '.php'); + $class = 'Template_' . $this->type(); + $this->template = new $class(); + if(!isset($this->template) || !($this->template instanceof Template)){ + throw new Exception('Invalid Template Object - ' . $this->type()); + } + } + return $this->template; + } + + public function run(){ + try { + + $this->page()->logic($this->template()); + $this->template()->display(); + + } catch(Exception $e){ + header('Content-type: text/plain'); print_r($e); exit; + } + } + +} + +Ticketing::Get()->run(); + diff --git a/pages/index.php b/pages/index.php new file mode 100644 index 0000000..ef6a52c --- /dev/null +++ b/pages/index.php @@ -0,0 +1,6 @@ +