3 * pre.php - Automatically prepend to every page.
5 * SourceForge: Breaking Down the Barriers to Open Source Development
6 * Copyright 1999-2001 (c) VA Linux Systems
7 * http://sourceforge.net
12 require_once $gfcommon.'include/escapingUtils.php';
14 if (isset($_SERVER) && array_key_exists('PHP_SELF', $_SERVER) && $_SERVER['PHP_SELF']) {
15 $_SERVER['PHP_SELF'] = htmlspecialchars($_SERVER['PHP_SELF']);
18 if (isset($GLOBALS) && array_key_exists('PHP_SELF', $GLOBALS) && $GLOBALS['PHP_SELF']) {
19 $GLOBALS['PHP_SELF'] = htmlspecialchars($GLOBALS['PHP_SELF']);
22 // Just say no to link prefetching (Moz prefetching, Google Web Accelerator, others)
23 // http://www.google.com/webmasters/faq.html#prefetchblock
24 if (getStringFromServer('HTTP_X_moz') === 'prefetch'){
25 header(getStringFromServer('SERVER_PROTOCOL') . ' 404 Prefetch Forbidden');
26 trigger_error('Prefetch request forbidden.');
30 if (!isset($no_gz_buffer) || !$no_gz_buffer) {
31 ob_start("ob_gzhandler");
36 // get constants used for flags or status
37 require $gfcommon.'include/constants.php';
41 if ($sys_use_jabber) {
42 require_once $gfcommon.'include/Jabber.class.php';
45 //library to determine browser settings
46 require_once $gfwww.'include/browser.php';
48 //base error library for new objects
49 require_once $gfcommon.'include/Error.class.php';
51 // HTML layout class, may be overriden by the Theme class
52 require_once $gfwww.'include/Layout.class.php';
55 //various html utilities
56 require_once $gfcommon.'include/utils.php';
58 //database abstraction
59 require_once $gfcommon.'include/database-'.$sys_database_type.'.php';
62 require_once $gfcommon.'include/session.php';
65 require_once $gfcommon.'include/System.class.php';
66 if (!$sys_account_manager_type) {
67 $sys_account_manager_type='UNIX';
69 require_once $gfcommon.'include/system/'.$sys_account_manager_type.'.class.php';
70 $SYS=new $sys_account_manager_type();
72 //user functions like get_name, logged_in, etc
73 require_once $gfcommon.'include/User.class.php';
75 //group functions like get_name, etc
76 require_once $gfcommon.'include/Group.class.php';
78 //permission functions
79 require_once $gfcommon.'include/Permission.class.php';
81 //library to set up context help
82 require_once $gfwww.'include/help.php';
85 require_once $gfwww.'include/exit.php';
87 //various html libs like button bar, themable
88 require_once $gfwww.'include/html.php';
90 //forms key generation
91 require_once $gfcommon.'include/forms.php';
97 if (!$GLOBALS['gfconn']) {
98 print "$sys_name Could Not Connect to Database: ".db_error();
103 require_once $gfcommon.'include/Plugin.class.php' ;
104 require_once $gfcommon.'include/PluginManager.class.php' ;
106 // SCM-specific plugins subsystem
107 require_once $gfcommon.'include/SCMPlugin.class.php' ;
109 setup_plugin_manager () ;
112 //determine if they're logged in
115 plugin_hook('after_session_set');
118 if (!session_loggedin() && $sys_force_login == 1 ) {
119 $expl_pathinfo = explode('/',getStringFromServer('REQUEST_URI'));
120 if (getStringFromServer('REQUEST_URI')!='/' && $expl_pathinfo[1]!='account' && $expl_pathinfo[1]!='export' ) exit_not_logged_in();
121 // Show proj* export even if not logged in when force login
122 // If not default web project page would be broken
123 if ($expl_pathinfo[1]=='export' && !ereg("^proj", $expl_pathinfo[2])) exit_not_logged_in();
126 //insert this page view into the database
127 require_once $gfwww.'include/logger.php';
130 // If logged in, set up a $LUSER var referencing
131 // the logged in user's object
133 if (session_loggedin()) {
134 //set up the user's timezone if they are logged in
135 $LUSER =& session_get_user();
136 $LUSER->setUpTheme();
137 header('Cache-Control: private');
141 // Include user Theme
143 require_once $sys_themeroot.$sys_theme.'/Theme.class.php';
149 Timezone must come after logger to prevent messups
154 if (session_loggedin()) {
155 //set up the user's timezone if they are logged in
156 putenv('TZ='. $LUSER->getTimeZone());
158 //just use pacific time as always
163 Now figure out what language file to instantiate
167 require_once $gfcommon.'include/gettext.php';
168 require_once $gfcommon.'include/group_section_texts.php';
170 setup_gettext_from_context();
179 $LUSER - Logged in user object
187 // c-file-style: "bsd"