panacea-php/src/index.php

32 lines
1019 B
PHP

<?php
/**
* Landing page for all requests to the Panacea application
*
* @package Panacea
* @author Tommy Montgomery
* @since 2008-10-12
*/
/** Bootstraps the Panacea framework */
require_once 'bootstrap.php';
$uriRegex = str_replace(str_replace('/', DIRECTORY_SEPARATOR, $_SERVER['DOCUMENT_ROOT']), '', dirname(__FILE__));
$uriRegex = str_replace('\\', '/', $uriRegex);
$uriRegex = '^' . $uriRegex . '/([^/]*)(?:/([^\?]*)(?:\?(.*))?)?';
/*
* $uriRegex: ^/webroot/([^/]*)(?:/(.*)(?:\?(.*))?)?
*
* ^/webroot/ - matches the webroot
* ([^/]*) - matches the section (this can be empty, hence the *)
* (?:/([^\?]*) - matches the page, if there is one
* (?:\?(.*)) - matches the query string, if there is one
*/
Dispatcher::getInstance()->setUriRegex($uriRegex)
->setThrowExceptions(true)
->setControllerFactory(PanaceaControllerFactory::getInstance())
->dispatch($_SERVER['REQUEST_URI']);
?>