Exemple #1
0
 /**
  * Orders to the Router to redirect to the specified uri.
  *
  * @param string $uri
  * @param int    $time
  */
 protected function redirect($uri, $time = null)
 {
     Router::redirect($uri, $time);
 }
Exemple #2
0
 * along with CaPHPy.  If not, see <http://www.gnu.org/licenses/>.
 */
require 'app/etc/sys.conf.php';
require 'app/etc/db.conf.php';
require 'sys/core/Loader.class.php';
define('DB_INFO', serialize($dbInfo));
define('JS_DIR', ROOT_DIR . '/app/public/js/');
define('CSS_DIR', ROOT_DIR . '/app/public/css/');
define('IMG_DIR', ROOT_DIR . '/app/public/img/');
use sys\core\Loader;
use sys\core\Dispatcher;
use sys\core\Router;
use sys\core\ExceptionHandler;
use sys\error\MissingRessourceException;
use sys\error\DispatcherException;
use sys\error\RouterException;
Loader::register();
require 'app/etc/route.conf.php';
$router = new Router($routingTable);
try {
    $request = $router->getRequest($_GET, $_POST, $_FILES);
    try {
        Dispatcher::dispatch($request);
    } catch (DispatcherException $e) {
        ExceptionHandler::displayException($e);
    } catch (MissingRessourceException $e) {
        ExceptionHandler::displayException($e);
    }
} catch (RouterException $e) {
    ExceptionHandler::displayException($e);
}