Skip to content

Instantly share code, notes, and snippets.

@luniki
Created June 25, 2013 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save luniki/5856853 to your computer and use it in GitHub Desktop.
Save luniki/5856853 to your computer and use it in GitHub Desktop.
StudipDispatcher
<?php
# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
/*
* index.php - <short-description>
*
* Copyright (C) 2006 - Marcus Lunzenauer <mlunzena@uos.de>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*/
require '../lib/bootstrap.php';
require_once 'lib/functions.php';
require_once 'vendor/trails/trails.php';
require_once 'lib/classes/StudipDispatcher.php';
URLHelper::setBaseUrl($ABSOLUTE_URI_STUDIP);
$request_uri = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';
$dispatcher = new StudipDispatcher();
$dispatcher->dispatch($request_uri);
<?php
/**
* StudipDispatcher.php - create the default Trails dispatcher
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* @author <mlunzena@uos.de>
* @copyright 2013 Stud.IP Core-Group
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL version 2
* @category Stud.IP
*/
require_once 'vendor/trails/trails.php';
/**
* Use this subclass to easily get an Stud.IP specific
* Trails_Dispatcher.
*
* Example of use:
* @code
* // deep in the Stud.IP jungle
* $dispatcher = new StudipDispatcher();
* $dispatcher->dispatch($requested_uri);
* @endcode
*/
class StudipDispatcher extends Trails_Dispatcher {
/**
* Create a new Trails_Dispatcher with Stud.IP specific parameters
* for: trails_root is "$STUDIP_BASE_PATH/app", trails_uri is
* "dispatch.php" and default_controller is "default" (which does
* not map to anything).
*/
public function __construct()
{
global $STUDIP_BASE_PATH, $ABSOLUTE_URI_STUDIP;
$trails_root = $STUDIP_BASE_PATH . DIRECTORY_SEPARATOR . 'app';
$trails_uri = rtrim($ABSOLUTE_URI_STUDIP, '/') . '/dispatch.php';
$default_controller = 'default';
parent::__construct($trails_root, $trails_uri, $default_controller);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment