Ejemplo n.º 1
0
<?php

# Lifter002: TODO
# Lifter007: TODO
# Lifter003: TODO
# Lifter010: TODO
/*
 * index.php - <short-description>
 *
 * Copyright (C) 2006 - Marcus Lunzenauer <*****@*****.**>
 *
 * 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';
// prepare environment
URLHelper::setBaseUrl($GLOBALS['ABSOLUTE_URI_STUDIP']);
$request_uri = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : '/';
$dispatcher = new StudipDispatcher();
$dispatcher->dispatch($request_uri);
Ejemplo n.º 2
0
/**
 * extracts route
 *
 * @param string $route           route (optional, uses REQUEST_URI otherwise)
 *
 * @return  string  route
 */
function get_route($route = '')
{
    $route = substr(parse_url($route ?: $_SERVER['REQUEST_URI'], PHP_URL_PATH), strlen($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP']));
    if (strpos($route, 'plugins.php/') !== false) {
        $trails = explode('plugins.php/', $route);
        $pieces = explode('/', $trails[1]);
        $route = 'plugins.php/' . $pieces[0] . ($pieces[1] ? '/' . $pieces[1] : '') . ($pieces[2] ? '/' . $pieces[2] : '');
    } elseif (strpos($route, 'dispatch.php/') !== false) {
        $trails = explode('dispatch.php/', $route);
        $dispatcher = new StudipDispatcher();
        $pieces = explode('/', $trails[1]);
        foreach ($pieces as $index => $piece) {
            $trail .= ($trail ? '/' : '') . $piece;
            if ($dispatcher->file_exists($trail . '.php')) {
                $route = 'dispatch.php/' . $trail . ($pieces[$index + 1] ? '/' . $pieces[$index + 1] : '');
            }
        }
    }
    while (substr($route, strlen($route) - 6, 6) == '/index') {
        $route = substr($route, 0, strlen($route) - 6);
    }
    return $route;
}