[Openfirst-cvscommit] base/includes globals.php,1.17,1.18
Brought to you by:
xtimg
From: Jamie <ast...@us...> - 2005-11-15 20:51:53
|
Update of /cvsroot/openfirst/base/includes In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27246/includes Modified Files: globals.php Log Message: Bug #264. Basic testing done and confirmed to compress (by headers). Index: globals.php =================================================================== RCS file: /cvsroot/openfirst/base/includes/globals.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** globals.php 19 Oct 2005 04:12:21 -0000 1.17 --- globals.php 15 Nov 2005 20:51:43 -0000 1.18 *************** *** 1,200 **** ! <?php ! /* ! * openFIRST.base - includes/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( !defined('OPENFIRST_INSTALLATION_SCRIPT') && !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 (defined('OPENFIRST_NO_INSTALLATION')) { ! if(is_readable("style/headers.php")) { ! $Header = "style/headers.php"; ! } else { ! $Header = "../style/headers.php"; ! } ! } ! ! define('osUNIX', 'unix'); ! define('osWINDOWS', 'windows'); ! #Add more operating systems here ! ! if (substr(PHP_OS, 0, 3) == 'WIN') { ! $osType = osWINDOWS; ! } else { ! $osType = osUNIX; ! } ! ! #Because of the differences between versions, this may be needed. ! $usingPHP5 = version_compare(PHP_VERSION, '5.0.0', '>='); ! ! require_once('compatibility.php'); ! ! /** URL of the server. It will be automaticly build including https mode */ ! $ogServer = ''; ! ! if( isset( $_SERVER['SERVER_NAME'] ) ) { ! $ogServerName = $_SERVER['SERVER_NAME']; ! } elseif( isset( $_SERVER['HOSTNAME'] ) ) { ! $ogServerName = $_SERVER['HOSTNAME']; ! } elseif( isset( $_SERVER['HTTP_HOST'] ) ) { ! $ogServerName = $_SERVER['HTTP_HOST']; ! } elseif( isset( $_SERVER['SERVER_ADDR'] ) ) { ! $ogServerName = $_SERVER['SERVER_ADDR']; ! } else { ! $ogServerName = 'localhost'; ! } ! ! # check if server use https: ! $ogProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; ! ! $ogServer = $ogProto.'://' . $ogServerName; ! # If the port is a non-standard one, add it to the URL ! if( isset( $_SERVER['SERVER_PORT'] ) ! && ( ( $ogProto == 'http' && $_SERVER['SERVER_PORT'] != 80 ) ! || ( $ogProto == 'https' && $_SERVER['SERVER_PORT'] != 443 ) ) ) { ! ! $ogServer .= ":" . $_SERVER['SERVER_PORT']; ! } ! ! $ogCookiePath = '/'; ! $ogCookieDomain = ''; ! ! set_include_path( get_include_path().PATH_SEPARATOR."$configdir/".PATH_SEPARATOR."."); ! unset($configdir); ! ! require_once('functions.php'); ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! require_once('dbase.php'); ! require_once('auth.php'); ! require_once('User.php'); ! } ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! require_once('Module.php'); ! require_once('slug.php'); ! require_once('edit.php'); ! require_once('settings.php'); ! } ! require_once('skin.php'); ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $ogSQLTablePrefix = 'ofirst_'; ! $ogDataBaseType = dbMYSQL; ! $ogSQLServer = $ogSQLUser = $ogSQLPassword = false; ! $ogSQLDatabase = 'openfirst'; ! $ogPasswordSaveEnabled = true; ! $ogEncryptionType = eCRYPT; ! require_once('sitesettings.php'); ! } ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $ogDB = ofCreateDataBase($ogDataBaseType, $ogSQLServer, $ogSQLUser, $ogSQLPassword); ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! $ogDB->selectDB($ogSQLDatabase, $ogSQLTablePrefix); ! } ! } ! ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! User::SetupSession(); ! /* ofDebugVar($_SESSION); ! ofDebugVar($_COOKIE);*/ ! if (User::canLogIn()) { ! $ogUser = User::logIn(); ! } else { ! $ogUser = User::loadFromSession(); ! } ! } ! ! // Determine what module the user is viewing ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $curmodule = str_replace($BasePath, '', $_SERVER['SCRIPT_NAME']); ! $curmodule = substr($curmodule, 1, strpos($curmodule, '/', 2) - 1); ! } ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! // Include the functions using glob(); ! foreach (glob("$fBasePath/includes/functions/*.php") as $filename) { ! include_once($filename); ! } ! } ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! $ogCurrentModule = new BaseModule; ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! /* This is not going into a function becuase: ! 1. the files should be included in the global scope ! 2. I'd rather iterate through the array once ! */ ! $ogModuleManager = new ModuleManager; ! $res = $ogDB->query('SELECT '.$ogDB->quoteField('dir'). ! ' FROM '.$ogDB->quoteTable('config')); ! if($ogDB->errorNumber() != 0) { ! trigger_error('Error while listing modules!', E_USER_ERROR); ! } ! while($mod =& $ogDB->fetchObject($res)) { ! $dir = $mod->dir; ! $module =& $ogModuleManager->addModuleFromDir($dir); ! if ($dir == $curmodule) $ogCurrentModule =& $module; ! if ($module->getActive()) { ! $dir = $module->getDir(); ! $includes = $module->getIncludes(); ! if (is_array($includes) && count($includes) > 0) { ! foreach ($includes as $include) { ! if ($include != '') { ! include_once($include); ! } ! } ! } ! } ! } ! $ogDB->freeResult($res); ! } ! ! ! /* if (!preg_match('/\A[a-zA-Z0-9]+\z/',session_id())) { ! session_regenerate_id(); ! }*/ ! ! $ogUser->saveData(); ! /* ofDebugVar($_SESSION); ! ofDebugVar($_COOKIE);*/ ! session_write_close(); ! } ?> \ No newline at end of file --- 1,208 ---- ! <?php ! /* ! * openFIRST.base - includes/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( !defined('OPENFIRST_INSTALLATION_SCRIPT') && !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 (defined('OPENFIRST_NO_INSTALLATION')) { ! if(is_readable("style/headers.php")) { ! $Header = "style/headers.php"; ! } else { ! $Header = "../style/headers.php"; ! } ! } ! ! define('osUNIX', 'unix'); ! define('osWINDOWS', 'windows'); ! #Add more operating systems here ! ! if (substr(PHP_OS, 0, 3) == 'WIN') { ! $osType = osWINDOWS; ! } else { ! $osType = osUNIX; ! } ! ! #Because of the differences between versions, this may be needed. ! $usingPHP5 = version_compare(PHP_VERSION, '5.0.0', '>='); ! ! require_once('compatibility.php'); ! ! /** URL of the server. It will be automaticly build including https mode */ ! $ogServer = ''; ! ! if( isset( $_SERVER['SERVER_NAME'] ) ) { ! $ogServerName = $_SERVER['SERVER_NAME']; ! } elseif( isset( $_SERVER['HOSTNAME'] ) ) { ! $ogServerName = $_SERVER['HOSTNAME']; ! } elseif( isset( $_SERVER['HTTP_HOST'] ) ) { ! $ogServerName = $_SERVER['HTTP_HOST']; ! } elseif( isset( $_SERVER['SERVER_ADDR'] ) ) { ! $ogServerName = $_SERVER['SERVER_ADDR']; ! } else { ! $ogServerName = 'localhost'; ! } ! ! # check if server use https: ! $ogProto = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https' : 'http'; ! ! $ogServer = $ogProto.'://' . $ogServerName; ! # If the port is a non-standard one, add it to the URL ! if( isset( $_SERVER['SERVER_PORT'] ) ! && ( ( $ogProto == 'http' && $_SERVER['SERVER_PORT'] != 80 ) ! || ( $ogProto == 'https' && $_SERVER['SERVER_PORT'] != 443 ) ) ) { ! ! $ogServer .= ":" . $_SERVER['SERVER_PORT']; ! } ! ! $ogCookiePath = '/'; ! $ogCookieDomain = ''; ! ! set_include_path( get_include_path().PATH_SEPARATOR."$configdir/".PATH_SEPARATOR."."); ! unset($configdir); ! ! // Enable output compression, if zlib is available and no output has been sent ! if ( function_exists('ob_gzhandler') && !headers_sent() ) { ! ob_start('ob_gzhandler'); ! header('x-of-compressing: yes'); ! } else { ! header('x-of-compressing: no'); ! } ! ! require_once('functions.php'); ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! require_once('dbase.php'); ! require_once('auth.php'); ! require_once('User.php'); ! } ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! require_once('Module.php'); ! require_once('slug.php'); ! require_once('edit.php'); ! require_once('settings.php'); ! } ! require_once('skin.php'); ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $ogSQLTablePrefix = 'ofirst_'; ! $ogDataBaseType = dbMYSQL; ! $ogSQLServer = $ogSQLUser = $ogSQLPassword = false; ! $ogSQLDatabase = 'openfirst'; ! $ogPasswordSaveEnabled = true; ! $ogEncryptionType = eCRYPT; ! require_once('sitesettings.php'); ! } ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $ogDB = ofCreateDataBase($ogDataBaseType, $ogSQLServer, $ogSQLUser, $ogSQLPassword); ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! $ogDB->selectDB($ogSQLDatabase, $ogSQLTablePrefix); ! } ! } ! ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! User::SetupSession(); ! /* ofDebugVar($_SESSION); ! ofDebugVar($_COOKIE);*/ ! if (User::canLogIn()) { ! $ogUser = User::logIn(); ! } else { ! $ogUser = User::loadFromSession(); ! } ! } ! ! // Determine what module the user is viewing ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! $curmodule = str_replace($BasePath, '', $_SERVER['SCRIPT_NAME']); ! $curmodule = substr($curmodule, 1, strpos($curmodule, '/', 2) - 1); ! } ! ! if (!defined('OPENFIRST_NO_INSTALLATION')) { ! // Include the functions using glob(); ! foreach (glob("$fBasePath/includes/functions/*.php") as $filename) { ! include_once($filename); ! } ! } ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! $ogCurrentModule = new BaseModule; ! ! if (!defined('OPENFIRST_INSTALLATION_SCRIPT')) { ! /* This is not going into a function becuase: ! 1. the files should be included in the global scope ! 2. I'd rather iterate through the array once ! */ ! $ogModuleManager = new ModuleManager; ! $res = $ogDB->query('SELECT '.$ogDB->quoteField('dir'). ! ' FROM '.$ogDB->quoteTable('config')); ! if($ogDB->errorNumber() != 0) { ! trigger_error('Error while listing modules!', E_USER_ERROR); ! } ! while($mod =& $ogDB->fetchObject($res)) { ! $dir = $mod->dir; ! $module =& $ogModuleManager->addModuleFromDir($dir); ! if ($dir == $curmodule) $ogCurrentModule =& $module; ! if ($module->getActive()) { ! $dir = $module->getDir(); ! $includes = $module->getIncludes(); ! if (is_array($includes) && count($includes) > 0) { ! foreach ($includes as $include) { ! if ($include != '') { ! include_once($include); ! } ! } ! } ! } ! } ! $ogDB->freeResult($res); ! } ! ! ! /* if (!preg_match('/\A[a-zA-Z0-9]+\z/',session_id())) { ! session_regenerate_id(); ! }*/ ! ! $ogUser->saveData(); ! /* ofDebugVar($_SESSION); ! ofDebugVar($_COOKIE);*/ ! session_write_close(); ! } ?> \ No newline at end of file |