Documentation is available at include_others.inc
- <?php
- /**
- * Master include file for the whole project.
- *
- * Master include file for CIB components, parses
- * the URI to determine which other include files
- * are needed by the current script. This file starts
- * the session. One of the sub-included files normally
- * will create the appropriate database connections.
- *
- * This file is part of CompInaBox.
- * @package CompInaBox
- * @author Eric D. Nielsen <nielsene@alum.mit.edu>
- * @copyright CompInaBox Copyright 2002-2005, Eric D. Nielsen. All Rights Reserved.
- * @license http://opensource.org/licenses/gpl-license.php GNU Public License
- * @filesource
- */
- /**
- * Include basic path information
- */
- require("paths.inc");
- $PHP_SELF=$_SERVER["REQUEST_URI"];
- // redirect to a secure page, if ssl should be used for all transactions and
- // currently on an insecure page.
- if (strpos($_SERVER["SERVER_PROTOCOL"],"HTTPS") ||
- (isset($_SERVER["HTTPS"]) && $_SERVER["HTTPS"]=="on"))
- $usesSSL=TRUE;
- else
- $usesSSL=FALSE;
- if ($CIB_USES_SSL=="ALWAYS" && $usesSSL==FALSE)
- {
- header("Location: https://$CIB_HOSTNAME"."$CIB_DOMAIN{$PHP_SELF}");
- exit;
- }
- // redirect to a insecure page, if ssl should not be used at all and
- // currently on a secure page.
- if ($CIB_USES_SSL=="NEVER" && $usesSSL==TRUE)
- {
- header("Location: http://$CIB_HOSTNAME"."$CIB_DOMAIN{$PHP_SELF}");
- exit;
- }
- // if we only use ssl sometimes is the responsibilities of ssl requiring
- // pages to handle the redirect if reached insecurely
- // Now we need to grab the toolname and the compname: these will be the first
- // and second directory components of the URL.
- $CIB_LAST_SLASH = strrpos($CIB_WEB_INSTALL_DIR,'/');
- $CIB_REQUEST_PATH = substr($PHP_SELF,$CIB_LAST_SLASH+2);
- $CIB_PATH_COMPONENTS = explode('/',$CIB_REQUEST_PATH);
- $CIB_NUM_PATH_COMPONENTS = count($CIB_PATH_COMPONENTS);
- if ($CIB_NUM_PATH_COMPONENTS==1 || $CIB_PATH_COMPONENTS[0]=="SCRIPTS" ||
- $CIB_PATH_COMPONENTS[0]=="accounts")
- {
- $CIB_TOOL_ROLE="core";
- }
- else
- {
- $CIB_TOOL_ROLE = $CIB_PATH_COMPONENTS[0];
- }
- if ($CIB_TOOL_ROLE=="") $CIB_TOOL_ROLE="core";
- $CIB_TOOL_NAME = $CIB_ROLE_TO_NAME_LUT[$CIB_TOOL_ROLE];
- if ($CIB_NUM_PATH_COMPONENTS>2 && in_array($CIB_TOOL_ROLE,array("register")))
- {
- $CIB_COMP_UNIXNAME = $CIB_PATH_COMPONENTS[1];
- if ($CIB_COMP_UNIXNAME=="SCRIPTS")
- $CIB_COMP_UNIXNAME = "";
- }
- else
- {
- $CIB_COMP_UNIXNAME="";
- }
- if (in_array($CIB_TOOL_NAME,array("SlidingDoors","PrepStep")))
- include_once("$CIB_CONFIG_PATH/tools/{$CIB_TOOL_NAME}_config.inc");
- if (""!=$CIB_COMP_UNIXNAME)
- {
- include("$CIB_CONFIG_PATH/comps/{$CIB_COMP_UNIXNAME}_config.inc");
- }
- session_start();
- include("$CIB_INCLUDE_PATH/tools/{$CIB_TOOL_NAME}_header.inc");
- if (isset($authorizationLevels))
- $authenticationRequired=TRUE;
- else if (!isset($authenticationRequired)) $authenticationRequired=FALSE;
- if ($authenticationRequired)
- {
- if (!isset($user)) $user="";
- include_once("$CIB_INCLUDE_PATH/session_user_setup.inc");
- newTimestamp("Found user permissions");
- $gate = new Gate();
- $guard = new Guard();
- if ($authenticationRequired)
- $gate->lowerPortcullis();
- if (isset($authorizationLevels))
- $gate->lockGate($authorizationLevels);
- newTimestamp("Locked gate");
- if (isset($user) && $user!="" &&
- $guard->recognizesUser($user->getUsername()))
- {
- $guard->unlockGateWithKeys($gate,$user->getKeys(),
- "{$CIB_BASE_URL}access-denied.php");
- newTimestamp("Successful unlocked gate");
- }
- else
- {
- $guard->referToScribe($PHP_SELF);
- exit;
- }
- }
- ?>
Documentation generated on Tue, 25 Apr 2006 13:02:57 -0400 by phpDocumentor 1.3.0RC3