Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: d9b36a000a
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (34 sloc) 1.223 kb
<?php
/**
* @copyright 2012 City of Bloomington, Indiana
* @license http://www.gnu.org/licenses/agpl.txt GNU/AGPL, see LICENSE.txt
* @author Cliff Ingham <inghamn@bloomington.in.gov>
*/
include '../configuration.inc';
// Check for routes
if (preg_match('|'.BASE_URI.'(/([a-zA-Z0-9]+))?(/([a-zA-Z0-9]+))?|',$_SERVER['REQUEST_URI'],$matches)) {
$resource = isset($matches[2]) ? $matches[2] : 'index';
$action = isset($matches[4]) ? $matches[4] : 'index';
}
// Create the default Template
$template = !empty($_REQUEST['format'])
? new Template('default',$_REQUEST['format'])
: new Template('default');
// Execute the Controller::action()
if (isset($resource) && isset($action) && $ZEND_ACL->has($resource)) {
$USER_ROLE = isset($_SESSION['USER']) ? $_SESSION['USER']->getRole() : 'Anonymous';
if ($ZEND_ACL->isAllowed($USER_ROLE, $resource, $action)) {
$controller = ucfirst($resource).'Controller';
$c = new $controller($template);
$c->$action();
}
else {
header('HTTP/1.1 403 Forbidden', true, 403);
$_SESSION['errorMessages'][] = new Exception('noAccessAllowed');
}
}
else {
header('HTTP/1.1 404 Not Found', true, 404);
$template->blocks[] = new Block('404.inc');
}
echo $template->render();
Jump to Line
Something went wrong with that request. Please try again.