[Mapbender-commits] r4245 - trunk/mapbender/lib
svn_mapbender at osgeo.org
svn_mapbender at osgeo.org
Fri Jun 26 07:20:45 EDT 2009
Author: uli
Date: 2009-06-26 07:20:44 -0400 (Fri, 26 Jun 2009)
New Revision: 4245
Added:
trunk/mapbender/lib/class_Mapbender_session.php
Removed:
trunk/mapbender/lib/class_mapbender_session.php
Log:
renamed class
Copied: trunk/mapbender/lib/class_Mapbender_session.php (from rev 4241, trunk/mapbender/lib/class_mapbender_session.php)
===================================================================
--- trunk/mapbender/lib/class_Mapbender_session.php (rev 0)
+++ trunk/mapbender/lib/class_Mapbender_session.php 2009-06-26 11:20:44 UTC (rev 4245)
@@ -0,0 +1,99 @@
+<?php
+/**
+ * manages the session-handling and the access to session-variables
+ * @class
+ */
+
+ require_once(dirname(__FILE__)."/../http/classes/class_mb_exception.php");
+ require_once(dirname(__FILE__)."/class_Singleton.php");
+ class Mapbender_session extends Singleton{
+
+ private $id ;
+
+ /**
+ * @constructor
+ */
+ protected function __construct() {
+ $id = false;
+ new mb_notice("session.mapbender_session.instantiated ... ");
+ }
+
+ public static function singleton()
+ {
+ return parent::singleton(__CLASS__);
+ }
+
+ /**
+ * sets the value of the session-variable
+ * @param String name the name of the session-variable
+ * @param Mixed value the new value of the session-variable
+ */
+ public function set($name, $value){
+ $this->start();
+ $_SESSION[$name] = $value;
+ new mb_notice("session.setSessionVariable.set: " . $name ." = ". $value);
+ session_write_close();
+ }
+
+ /* pushs the array of the session-variable
+ * @param String name the name of the session-variable
+ * @param Mixed value the new value of the session-variable
+ */
+ public function push($name, $value){
+ //not implemented yet
+ // todo
+ }
+
+ /**
+ * returns the value of the session-variable
+ * @param String name the name of the session-variable
+ */
+ public function get($name){
+ $this->start();
+ if(isset($_SESSION[$name])){
+ return $_SESSION[$name];
+ }
+ else{
+ new mb_exception("some want to acces the sessionVariable: ".$name." but it's not set!'");
+ return false;
+ }
+ session_write_close();
+ }
+
+ /**
+ * sets a new session-id
+ * @param String id the new id of the session
+ */
+ public function setId($id){
+ $this->id = $id;
+
+ }
+
+ /**
+ * starts the new session
+ */
+ private function start(){
+ if(session_id() == ''){
+ new mb_notice("session.sessionStart.noActiveId");
+ }
+ if($this->id){
+ session_id($this->id);
+ new mb_notice("session.sessionStart.changeId to: ". session_id());
+ }
+ session_start();
+ new mb_notice("session.sessionStart.id: ". session_id());
+ }
+
+ /*
+ * kills the current session
+ */
+ public function kill(){
+ if (isset($_COOKIE[session_name()])) {
+ setcookie(session_name(), '', time()-42000, '/');
+ }
+ if(session_id()){
+ session_destroy();
+ }
+ }
+ }
+?>
Deleted: trunk/mapbender/lib/class_mapbender_session.php
===================================================================
--- trunk/mapbender/lib/class_mapbender_session.php 2009-06-26 11:18:16 UTC (rev 4244)
+++ trunk/mapbender/lib/class_mapbender_session.php 2009-06-26 11:20:44 UTC (rev 4245)
@@ -1,99 +0,0 @@
-<?php
-/**
- * manages the session-handling and the access to session-variables
- * @class
- */
-
- require_once(dirname(__FILE__)."/../http/classes/class_mb_exception.php");
- require_once(dirname(__FILE__)."/class_Singleton.php");
- class Mapbender_session extends Singleton{
-
- private $id ;
-
- /**
- * @constructor
- */
- protected function __construct() {
- $id = false;
- new mb_notice("session.mapbender_session.instantiated ... ");
- }
-
- public static function singleton()
- {
- return parent::singleton(__CLASS__);
- }
-
- /**
- * sets the value of the session-variable
- * @param String name the name of the session-variable
- * @param Mixed value the new value of the session-variable
- */
- public function set($name, $value){
- $this->start();
- $_SESSION[$name] = $value;
- new mb_notice("session.setSessionVariable.set: " . $name ." = ". $value);
- session_write_close();
- }
-
- /* pushs the array of the session-variable
- * @param String name the name of the session-variable
- * @param Mixed value the new value of the session-variable
- */
- public function push($name, $value){
- //not implemented yet
- // todo
- }
-
- /**
- * returns the value of the session-variable
- * @param String name the name of the session-variable
- */
- public function get($name){
- $this->start();
- if(isset($_SESSION[$name])){
- return $_SESSION[$name];
- }
- else{
- new mb_exception("some want to acces the sessionVariable: ".$name." but it's not set!'");
- return false;
- }
- session_write_close();
- }
-
- /**
- * sets a new session-id
- * @param String id the new id of the session
- */
- public function setId($id){
- $this->id = $id;
-
- }
-
- /**
- * starts the new session
- */
- private function start(){
- if(session_id() == ''){
- new mb_notice("session.sessionStart.noActiveId");
- }
- if($this->id){
- session_id($this->id);
- new mb_notice("session.sessionStart.changeId to: ". session_id());
- }
- session_start();
- new mb_notice("session.sessionStart.id: ". session_id());
- }
-
- /*
- * kills the current session
- */
- public function kill(){
- if (isset($_COOKIE[session_name()])) {
- setcookie(session_name(), '', time()-42000, '/');
- }
- if(session_id()){
- session_destroy();
- }
- }
- }
-?>
More information about the Mapbender_commits
mailing list