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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217
|
<?php
/**
* pre.php - Automatically prepend to every page.
*
* SourceForge: Breaking Down the Barriers to Open Source Development
* Copyright 1999-2001 (c) VA Linux Systems
* http://sourceforge.net
*
* @version $Id: pre.php 4431 2005-06-22 09:24:56Z vittal $
*/
if (isset($_SERVER) && array_key_exists('PHP_SELF', $_SERVER) && $_SERVER['PHP_SELF']) {
$_SERVER['PHP_SELF'] = htmlspecialchars($_SERVER['PHP_SELF']);
}
if (isset($GLOBALS) && array_key_exists('PHP_SELF', $GLOBALS) && $GLOBALS['PHP_SELF']) {
$GLOBALS['PHP_SELF'] = htmlspecialchars($GLOBALS['PHP_SELF']);
}
// Just say no to link prefetching (Moz prefetching, Google Web Accelerator, others)
// http://www.google.com/webmasters/faq.html#prefetchblock
if (!empty($_SERVER['HTTP_X_moz']) && $_SERVER['HTTP_X_moz'] === 'prefetch'){
header($_SERVER['SERVER_PROTOCOL'] . ' 404 Prefetch Forbidden');
trigger_error('Prefetch request forbidden.');
exit;
}
if (!isset($no_gz_buffer) || !$no_gz_buffer) {
ob_start("ob_gzhandler");
}
// get constants used for flags or status
require('common/include/constants.php');
require('local.inc');
/*
redirect to proper hostname to get around certificate problem on IE 5
*/
if ($HTTP_HOST != $GLOBALS['sys_default_domain'] && $HTTP_HOST != $GLOBALS['sys_fallback_domain']) {
if (strtoupper($_SERVER['HTTPS']) == 'ON') {
header ("Location: https://".$GLOBALS['sys_default_domain']."$REQUEST_URI");
} else {
header ("Location: http://".$GLOBALS['sys_default_domain']."$REQUEST_URI");
}
exit;
}
//
if ($sys_use_jabber) {
require_once('common/include/Jabber.class');
}
//library to determine browser settings
require_once('www/include/browser.php');
//base error library for new objects
require_once('common/include/Error.class');
// HTML layout class, may be overriden by the Theme class
require_once('www/include/Layout.class');
//various html utilities
require_once('common/include/utils.php');
//database abstraction
require_once('common/include/database.php');
//security library
require_once('common/include/session.php');
//system library
require_once('common/include/System.class');
if (!$sys_account_manager_type) {
$sys_account_manager_type='UNIX';
}
require_once('common/include/system/'.$sys_account_manager_type.'.class');
$SYS=new $sys_account_manager_type();
//user functions like get_name, logged_in, etc
require_once('common/include/User.class');
//group functions like get_name, etc
require_once('common/include/Group.class');
//permission functions
require_once('common/include/Permission.class');
// escaping lib
require_once('common/include/escapingUtils.php');
//library to set up context help
require_once('www/include/help.php');
//exit_error library
require_once('www/include/exit.php');
//various html libs like button bar, themable
require_once('www/include/html.php');
// #### Connect to db
db_connect();
if (!$conn) {
print "$sys_name Could Not Connect to Database: ".db_error();
exit;
}
// Plugins subsystem
require_once('common/include/Plugin.class') ;
require_once('common/include/PluginManager.class') ;
// SCM-specific plugins subsystem
require_once('common/include/SCM.class') ;
setup_plugin_manager () ;
//determine if they're logged in
session_set();
plugin_hook('after_session_set');
//mandatory login
if (!session_loggedin() && $sys_force_login == 1 ) {
$expl_pathinfo = explode('/',$REQUEST_URI);
if ($REQUEST_URI!='/' && $expl_pathinfo[1]!='account' && $expl_pathinfo[1]!='export' ) exit_not_logged_in();
// Show proj* export even if not logged in when force login
// If not default web project page would be broken
if ($expl_pathinfo[1]=='export' && !ereg("^proj", $expl_pathinfo[2])) exit_not_logged_in();
}
//insert this page view into the database
require_once('www/include/logger.php');
//
// If logged in, set up a $LUSER var referencing
// the logged in user's object
//
if (session_loggedin()) {
//set up the user's timezone if they are logged in
$LUSER =& session_get_user();
$LUSER->setUpTheme();
header('Cache-Control: private');
}
//
// Include user Theme
//
require_once($sys_themeroot.$sys_theme.'/Theme.class');
$HTML=new Theme();
/*
Timezone must come after logger to prevent messups
*/
if (session_loggedin()) {
//set up the user's timezone if they are logged in
putenv('TZ='. $LUSER->getTimeZone());
} else {
//just use pacific time as always
}
/*
Now figure out what language file to instantiate
*/
require_once('www/include/BaseLanguage.class');
if (!$sys_lang) {
$sys_lang="English";
}
if (session_loggedin()) {
$Language=new BaseLanguage();
$Language->loadLanguageID($LUSER->getLanguage());
} else {
//if you aren't logged in, check your browser settings
//and see if we support that language
//if we don't support it, just use default language
if ($HTTP_ACCEPT_LANGUAGE) {
$classname = getLanguageClassName($HTTP_ACCEPT_LANGUAGE);
}
if (!$classname) {
$classname=$sys_lang;
}
$Language=new BaseLanguage();
$Language->loadLanguage($classname);
}
setlocale (LC_TIME, $Language->getText('system','locale'));
$sys_strftimefmt = $Language->getText('system','strftimefmt');
$sys_datefmt = $Language->getText('system','datefmt');
$sys_shortdatefmt = $Language->getText('system','shortdatefmt');
/*
RESERVED VARIABLES
$conn
$session_hash
$Language
$LUSER - Logged in user object
$HTML
$sys_datefmt
$sys_shortdatefmt
*/
?>
|