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");
35 require $gfcommon.'include/config.php';
37 // get constants used for flags or status
38 require $gfcommon.'include/constants.php';
42 if ($sys_use_jabber) {
43 require_once $gfcommon.'include/Jabber.class.php';
46 //library to determine browser settings
47 require_once $gfwww.'include/browser.php';
49 //base error library for new objects
50 require_once $gfcommon.'include/Error.class.php';
52 // HTML layout class, may be overriden by the Theme class
53 require_once $gfwww.'include/Layout.class.php';
56 //various html utilities
57 require_once $gfcommon.'include/utils.php';
59 //database abstraction
60 require_once $gfcommon.'include/database-'.$sys_database_type.'.php';
63 require_once $gfcommon.'include/session.php';
66 require_once $gfcommon.'include/System.class.php';
67 if (!$sys_account_manager_type) {
68 $sys_account_manager_type='UNIX';
70 require_once $gfcommon.'include/system/'.$sys_account_manager_type.'.class.php';
71 $SYS=new $sys_account_manager_type();
73 //user functions like get_name, logged_in, etc
74 require_once $gfcommon.'include/User.class.php';
76 //group functions like get_name, etc
77 require_once $gfcommon.'include/Group.class.php';
79 //permission functions
80 require_once $gfcommon.'include/Permission.class.php';
82 //library to set up context help
83 require_once $gfwww.'include/help.php';
86 require_once $gfwww.'include/exit.php';
88 //various html libs like button bar, themable
89 require_once $gfwww.'include/html.php';
91 //forms key generation
92 require_once $gfcommon.'include/forms.php';
98 if (!$GLOBALS['gfconn']) {
99 print "$sys_name Could Not Connect to Database: ".db_error();
104 require_once $gfcommon.'include/Plugin.class.php' ;
105 require_once $gfcommon.'include/PluginManager.class.php' ;
107 // SCM-specific plugins subsystem
108 require_once $gfcommon.'include/SCMPlugin.class.php' ;
110 setup_plugin_manager () ;
113 //determine if they're logged in
116 plugin_hook('after_session_set');
119 if (!session_loggedin() && $sys_force_login == 1 ) {
120 $expl_pathinfo = explode('/',getStringFromServer('REQUEST_URI'));
121 if (getStringFromServer('REQUEST_URI')!='/' && $expl_pathinfo[1]!='account' && $expl_pathinfo[1]!='export' ) exit_not_logged_in();
122 // Show proj* export even if not logged in when force login
123 // If not default web project page would be broken
124 if ($expl_pathinfo[1]=='export' && !ereg("^proj", $expl_pathinfo[2])) exit_not_logged_in();
127 //insert this page view into the database
128 require_once $gfwww.'include/logger.php';
131 // If logged in, set up a $LUSER var referencing
132 // the logged in user's object
134 if (session_loggedin()) {
135 //set up the user's timezone if they are logged in
136 $LUSER =& session_get_user();
137 $LUSER->setUpTheme();
138 header('Cache-Control: private');
142 // Include user Theme
144 require_once $sys_themeroot.$sys_theme.'/Theme.class.php';
150 Timezone must come after logger to prevent messups
155 if (session_loggedin()) {
156 //set up the user's timezone if they are logged in
157 putenv('TZ='. $LUSER->getTimeZone());
159 //just use pacific time as always
164 Now figure out what language file to instantiate
168 require_once $gfcommon.'include/gettext.php';
169 require_once $gfcommon.'include/group_section_texts.php';
171 setup_gettext_from_context();
180 $LUSER - Logged in user object
188 // c-file-style: "bsd"