[Openfirst-cvscommit] base/config globals.php,1.14,1.15
Brought to you by:
xtimg
From: Astronouth7303 <ast...@us...> - 2005-05-25 22:40:42
|
Update of /cvsroot/openfirst/base/config In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27601/config Added Files: globals.php Log Message: Globals.php got lost in shuffle --- NEW FILE: globals.php --- <?php /* * openFIRST.base - config/globals.php * * Copyright (C) 2003, * openFIRST Project * Original Author: Tim Ginn <tim...@po...> * * 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. * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ // Purpose: Initialize the openFIRST system. $configdir = dirname(__FILE__); if( !file_exists( "$configdir/sitesettings.php" ) ) { $path = "#"; if(file_exists("../config/first.php")) { $path = "../config/first.php"; } elseif(file_exists("config/first.php")) { $path = "config/first.php"; } elseif(file_exists("../../config/first.php")) { $path = "../../config/first.php"; } $path = htmlentities($path); die( "You'll have to <a href=\"$path\">set openFIRST up</a> first!" ); } if (substr(PHP_OS, 0, 3) == 'WIN') { $ostype = 'windows'; } else { $ostype = 'unix'; } if ($ostype == 'windows') { set_include_path( get_include_path().";$configdir/;."); } else { set_include_path( get_include_path().":$configdir/:."); } unset($configdir); require_once('dbase.php'); require_once('auth.php'); require_once('sitesettings.php'); if(function_exists("ofirst_dbconnect") == false) { die("Your version of PHP has not been compiled with SQL support, therefore the openFIRST web portal system cannot run on this system. Please contact your system administrator to request SQL support for your version of PHP."); } // We use glob enough, that we should either write a substitute, or just refuse to work if(!function_exists('glob')) { die('You really should upgrade PHP, seeing as you don't even have <a href="http://us2.php.net/manual/en/function.glob.php"><code>glob()</code></a>.'); } InitUser(); // Determine what module the user is viewing $currentmodule = str_replace($basepath, '', $_SERVER['SCRIPT_NAME']); $currentmodule = substr($currentmodule, 1, strpos($currentmodule, '/', 2) - 1); session_start(); // Include the functions using glob(); foreach (glob("$fbasepath/config/functions/*.php") as $filename) { include_once($filename); } $headers = ''; $incl = ofirst_dbquery('SELECT * FROM ofirst_config'); $Modules = array(); function AddModule($code, $name, $version, $includes, $adminnav, $modulenav, $active, $show) { global $Modules; $Modules[$code] = array( 'name' => $name, 'ver' => $version, 'inc' => $includes, 'admin' => $adminnav, 'nav' => $modulenav, 'active' => (bool)$active, 'show' => (bool)$show ); } // If there is no error then run the module add feature if(ofirst_dberrno() == 0) { // Begin to loop through modules from the databaes while($module = ofirst_dbfetch_object($incl)) { AddModule($module->modulename, $module->label, $module->version, explode(',', $module->includes), $module->adminnavigation, $module->modulenavigation, $module->active, $module->showonmenu ); // Check if the value is try, if it is then run an include if($module->active == true) { // Check if there are includes that need to be included if(!( $module->includes == '')){ // If the list is not empty then explode the value and put it into inclist $inclist = explode(',',$module->includes); // This is to remove an error that you have if you don't check if there are more then 2 if(count($inclist) >= 2){ // Loop through the inclist and add them according to their paths foreach($inclist As $inc){ include_once("$fbasepath/$module->modulename/$inc"); } } else { // If there is only 1 include available then use this line to include it instead include_once("$fbasepath/$module->modulename/$module->includes"); } } // If the module has requested to be shown on the menu then add it if( (bool) $module->showonmenu == true) { // If it is the current module then color the item if ($currentmodule == $module->modulename){ $headers .= " » <a class='menu selected' href='$basepath/$module->modulename'>".ucwords($module->modulename)."</a> | "; // Declare important variables so that headers can pick them up and preview them $adminnav = str_replace("\$basepath", $basepath, $module->adminnavigation) . " <a href='http://bugzilla.openfirst.org'>Report Bug</a>"; $subnav = str_replace("\$basepath", $basepath, $module->modulenavigation); } else { $headers .= " » <a class='menu' href='$basepath/$module->modulename'>".ucwords($module->modulename)."</a> | "; } } } } } if (!preg_match('/\A[a-zA-Z0-9]+\z/',session_id())) { session_regenerate_id(); } session_write_close(); ?> |