forked from m-o-p/labsystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
57 lines (52 loc) · 3.06 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
/**
* labsystem.m-o-p.de -
* the web based eLearning tool for practical exercises
* Copyright (C) 2010 Marc-Oliver Pahl
*
* 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 3 of the License, or
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* This script forwards to the startpage.
* Put the default configuration (the one that appears when no "config="
* is present in the URL) in the second line where it says else $config = 'demo';
*/
require( "include/classes/Url.inc" ); // Include url handling and rewriting stuff. => Object $url.
// needed to get parameters from the url ($url->get, ->available)
if (file_exists( 'include/config.inc' )){
require_once( 'include/config.inc' ); // contains DEFAULT_INSTANCE required below
} else {
$SYSINFO .= 'Falling back to "include/config-sample.inc". Use it to create your own "include/config.inc" to get rid of this notice.';
trigger_error( '"include/config.inc" missing! Falling back to "include/config-sample.inc". Use it to create your own "include/config.inc" to get rid of this warning.' , E_USER_WARNING );
require_once( 'include/config-sample.inc' ); // contains DEFAULT_INSTANCE required below
}
if ( $GLOBALS['url']->available('config') ) $config = $GLOBALS['url']->get('config'); // config provided
else $config = $DEFAULT_INSTANCE;
if ( $GLOBALS['url']->available('address') ) $address = $GLOBALS['url']->get('address'); // address provided
else $address = 'p3'; // use this (startpage is 3) as defaul value
if ($address == 'accessibleLabs' || $address == 'accessableLabs') header ('Location: pages/accessibleLabs.php?config='.$config.( $GLOBALS['url']->available('inside') ? '&inside=true' : '' ).( $GLOBALS['url']->available('nomenu') ? '&nomenu=true' : '' ) );
else if ($address == 'register') {
if (strpos($_SERVER['SERVER_NAME'],'ilab2') === 0){
header ('Location: pages/view.php?config=useradmin&address=p251'.( $GLOBALS['url']->available('nomenu') ? '&nomenu=true' : '' ) );
}else{
header ('Location: pages/view.php?config=useradmin&address=p252'.( $GLOBALS['url']->available('nomenu') ? '&nomenu=true' : '' ) );
}
}
else header ('Location: pages/view.php?address='.$address.'&config='.$config.( $GLOBALS['url']->available('inside') ? '&inside=true' : '' ).'&nomenu=true' );
/*
* You might create other forwaders to other pages:
* For example we use such forwarders to direct the members
* to the lab index page etc. lab.php -> pages/view.php?address=p3&config=demo
*/
?>