<?php
/*
* ARBS - Advanced Resource Booking System
* Copyright (C) 2005-2007 ITMC der TU Dortmund
* Based on MRBS by Daniel Gardner <http://mrbs.sourceforge.net/>
*
* 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.
*
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
/*
* This file is included by every invoked php file
*/
session_start();
session_register('instance');
session_register('session_selected_language');
if(isset($_GET['pview']))
$pview=1;
else
unset($pview);
if(isset($_GET['instance'])){
//check for invalid or malcious instance values
if(strrpos($_GET['instance'],".")!=0 || strrpos($_GET['instance'],"/")!=0){
echo(_("Invalid instance-name"));
exit;
}
$instance=$_GET['instance'];
$_SESSION['instance']=$instance;
//reset session later
$session_must_be_reset=true;
}
if(!isset($_SESSION['instance'])){
$_SESSION['instance']="default";
}
$instance=$_SESSION['instance'];
include_once("./language.inc.php");
if (file_exists($instance."/config.inc.php")){
include $instance."/config.inc.php";
}
else{
die("<html><body><pre><b>"._("Error")."</b><br>".sprintf(_("Instance %s not found!"), $instance)."</pre></body></html>");
}
#lang.inc is included in config.inc.php
#also, all changeing code for language selection is at config.inc.php
#sometimes, script include other stand-alone scripts -> include_once
include_once "functions.inc.php";
include_once "$dbsys.inc.php";
include_once "mrbs_auth.inc.php";
include_once "mrbs_sql.inc.php";
if($mod_history_enable)//config value
include_once "mod_history.inc.php";
if($session_must_be_reset)
reset_session();
?>