NCCOOS Trac Projects: Top | Web | Platforms | Processing | Viz | Sprints | Sandbox | (Wind)

root/Chameleon/trunk/Chameleon/session.inc.php

Revision 13 (checked in by jcleary, 17 years ago)

Latest Chameleon code checkout from previous repository

Line 
1 <?php
2 // define the path to the components folder
3 //%DMPEAR_COMMON%
4 //%DMPEAR_WEBCOMMON%
5 if(!defined("COMMON"))
6 define( "COMMON"str_replace("\\","/",dirname(__FILE__))."/../common/" );
7 if(!defined("WEBCOMMON"))
8 define( "WEBCOMMON", dirname($_SERVER['PHP_SELF'])."/../common/" );
9
10 if (!defined("CONFIG_PATH"))
11 define("CONFIG_PATH", "../../config/");
12
13 include_once(COMMON."logger/logfile.php");
14 include_once(COMMON."logger/logger.php");
15 include_once(COMMON."logger/error_manager.php");
16
17 if (defined("LOAD_MAPSESSION"))
18 {
19     // include wrapper file(s)
20     include_once(COMMON."wrapper/map_session.php" );
21 }
22
23 include_once(COMMON."session/session.php");
24
25 installSessionDirectoryHandler();
26 $GLOBALS['bSessionOK'] = initializeSession("sid");
27 if ($GLOBALS['bSessionOK'])
28 {
29     
30     // convert the global session reference if necessary
31     if ( PHP_OS == "WINNT" || PHP_OS == "WIN32" )
32     {
33         if ( version_compare( phpversion(), "4.2.1" ) < 0 )
34         {
35             $_SESSION = &$HTTP_SESSION_VARS;
36         }
37     }
38     
39     /* ============================================================================
40     * Setup logging objects
41     * ========================================================================= */
42     /*
43     $aszLog = explode(".", basename($_SERVER["PHP_SELF"]));
44     $gLogFile = new LogFile( $_SESSION["gszLogPath"].$aszLog[0]."_session.inc.log",
45     LOG_TO_FILE, true );
46     // set the max log level
47     $gLogFile->setMaxLogLevel( $_SESSION["gnLogLevel"] );
48     */
49     //starting the session resumes everything where we left off at the end of the
50     //last script
51     if (!isset($_SESSION["gErrorManager"]))
52     {
53         $_SESSION['gErrorManager'] = new ErrorManager($_SESSION['gbLogError']);
54     }
55     
56     if (defined("LOAD_MAPSESSION"))
57     {
58         // ensure that the mapscript module is loaded
59         if (!extension_loaded("MapScript")) dl($_SESSION['gszMapscriptModule']);
60         
61         // create a new map session object
62         if ($_SESSION['gnMapSessionMode'] == "1")
63         {
64             $oMapSession = new MapSession_RW;
65         }
66         else
67         {
68             $oMapSession = new MapSession_R;
69         }
70         
71         // set the global log file and error manager
72         $oMapSession->setLogFile( $gLogFile );
73         $oMapSession->setErrorManager( $_SESSION["gErrorManager"] );
74         
75         // set the temp directory for the map session
76         $oMapSession->setTempDir( $_SESSION['gszTmpPath'] );
77         
78         
79         /* ============================================================================
80         * Re-instate the previous map state
81         * ========================================================================= */
82         $oMapSession->restoreState( $_SESSION["gszCurrentState"], $_SESSION['gszMapName'],dirname( $_SESSION['gszMapName'] ) );
83     }
84     
85     $http_form_vars = (count($_POST) > 0) ?
86     $_POST : ((count($_GET) > 0) ? $_GET : array() );
87     
88     /* ============================================================================
89     * Setup the translation object(s)
90     * ========================================================================= */
91     // suppress the error constant (not defined when this page is called because
92     // error object was passed through the session)
93     if ( !defined("ERROR_CRITICAL") )
94     {
95         // define
96         define("ERROR_CRITICAL", 2);
97     }
98     
99     // include the mlt file
100     include_once( COMMON."mlt/mlt.php" );
101     
102     // create a new MLT object
103     $oMLT = new MLTdBase( $_SESSION['gszCurrentLanguage'] );
104     $oMLT->setLogFile( $gLogFile );
105     $oMLT->setErrorManager( $_SESSION["gErrorManager"] );
106     
107     // create a new common MLT object
108     $oCommonMLT = new MLTdBase( $_SESSION['gszCurrentLanguage'] );
109     
110     $oCommonMLT->setLogFile( $gLogFile );
111     $oCommonMLT->setErrorManager( $_SESSION["gErrorManager"] );
112     
113     // load the resourcre file into memory
114     if (isset( $GLOBALS["szLanguageResource"] ))
115     {
116         $oMLT->loadResource( $GLOBALS["szLanguageResource"], $_SESSION['aszLang'] );
117     }
118     
119     // load common resources
120     $oCommonMLT->loadResource( str_replace("\\", "/", $_SESSION['gszCorePath']).
121                                "/common.dbf", $_SESSION['aszLang'] );
122     
123     if (isset($_SESSION['gszCSSFile']))
124     {
125         $szCSSFile = $_SESSION['gszCSSFile'];
126     }
127     else
128     {
129         $szCSSFile = $_SESSION['gszCoreWebPath']."/skins/default/css/popup.css";
130     }
131 }
132 else if (!isset($GLOBALS['bInvalidSessionDontFail']))
133 {
134     ?>
135 <html><head>
136 <title>Invalid Session</title>
137 </head>
138 <body>Your session is invalid or has expired.</body>
139 </html>
140     <?php
141     exit;
142 }
143 ?>
144
Note: See TracBrowser for help on using the browser.