[Mapbender-commits] r4097 - trunk/mapbender/http/frames

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Tue Jun 23 13:15:36 EDT 2009


Author: uli
Date: 2009-06-23 13:15:36 -0400 (Tue, 23 Jun 2009)
New Revision: 4097

Modified:
   trunk/mapbender/http/frames/index.php
   trunk/mapbender/http/frames/login.php
Log:
new session handling included


Modified: trunk/mapbender/http/frames/index.php
===================================================================
--- trunk/mapbender/http/frames/index.php	2009-06-23 17:14:58 UTC (rev 4096)
+++ trunk/mapbender/http/frames/index.php	2009-06-23 17:15:36 UTC (rev 4097)
@@ -18,17 +18,19 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
-require("../php/mb_validateSession.php");
+require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once("../php/mb_validateSession.php");
 require_once(dirname(__FILE__)."/../classes/class_gui.php");
 
-$_SESSION["mb_user_gui"] = $gui_id;
 
+$mapbender_session->set("mb_user_gui",$gui_id);
+
 //
 // check if user is allowed to access current GUI; 
 // if not, return to login screen
 //
-if (!in_array($gui_id, $_SESSION["mb_user_guis"])) {
-	$e = new mb_exception("mb_validateSession.php: User: " . $_SESSION["mb_user_id"] . " not allowed to access GUI " . $gui_id);
+if (!in_array($gui_id, $mapbender_session->get("mb_user_guis"))) {
+	$e = new mb_exception("mb_validateSession.php: User: " . $mapbender_session->get("mb_user_id")  . " not allowed to access GUI " . $gui_id);
 	session_write_close();
 	header("Location: ".LOGIN);
 	die();

Modified: trunk/mapbender/http/frames/login.php
===================================================================
--- trunk/mapbender/http/frames/login.php	2009-06-23 17:14:58 UTC (rev 4096)
+++ trunk/mapbender/http/frames/login.php	2009-06-23 17:15:36 UTC (rev 4097)
@@ -7,7 +7,7 @@
 # the Free Software Foundation; either version 2, or (at your option)
 # any later version.
 #
-# This program is distributed in the hope that it will be useful,
+# This program is distributed in the hope that it will be us*/eful,
 # 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.
@@ -18,6 +18,7 @@
 
 ob_start(); 
 require_once(dirname(__FILE__)."/../../core/globalSettings.php");
+require_once(dirname(__FILE__)."/../../lib/class_mapbender_session.php");
 
 function auth_user($name,$pw){
 	$setEncPw = false;
@@ -59,12 +60,8 @@
 	session_start();
 }
 function killSession(){
-	if (isset($_COOKIE[session_name()])) {
-    	setcookie(session_name(), '', time()-42000, '/');
-	}
-	if(session_id()){
-		session_destroy();
-	}
+	global $mapbender_session;
+	$mapbender_session->kill();
 }
 ?>
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -147,21 +144,22 @@
 		setSession();
 		include(dirname(__FILE__)."/../../conf/session.conf");
 	}	
-	if($_SESSION["mb_user_id"]){
+	if($mapbender_session->get("mb_user_id")){
 		if($row["mb_user_login_count"] <= MAXLOGIN){
 			$sql_del_cnt =  "UPDATE mb_user SET mb_user_login_count = 0 WHERE mb_user_id = $1";
-			$v = array($_SESSION['mb_user_id']);
+			$v = array($mapbender_session->get('mb_user_id'));
 			$t = array("i");
 			db_prep_query($sql_del_cnt, $v, $t);
 			require_once(dirname(__FILE__)."/../php/mb_getGUIs.php");
 			$arrayGUIs = mb_getGUIs($row["mb_user_id"]);
-			$_SESSION["mb_user_guis"] = $arrayGUIs;
-			$_SESSION["mb_login"] = $login;
+			new mb_notice("login.setSession.mb_user_guis: ".serialize($arrayGUIs)." in session: " .session_id());
+			$mapbender_session->set("mb_user_guis",$arrayGUIs);
+			$mapbender_session->set("mb_login",$login);
 			# a gui is explicitly ordered
-			if((isset($_REQUEST["mb_user_myGui"]) || isset($_SESSION["mb_user_myGui"])) && in_array($_REQUEST["mb_user_myGui"], $arrayGUIs)){
+			if((isset($_REQUEST["mb_user_myGui"]) || $mapbender_session->get("mb_user_myGui")) && in_array($_REQUEST["mb_user_myGui"], $arrayGUIs)){
 				unset($arrayGUIs);
 				if(isset($_REQUEST["mb_user_myGui"])){ $arrayGUIs[0] = $_REQUEST["mb_user_myGui"];}
-				else{ $arrayGUIs[0] = $_SESSION["mb_user_myGui"];}
+				else{ $arrayGUIs[0] = $mapbender_session->set("mb_user_myGui");}
 			}
 			#only one gui is provided
 			if(count($arrayGUIs) == 1){



More information about the Mapbender_commits mailing list