Module: nagvis
Branch: master
Commit: 0bbbdac6a7aeb6fbab9f61aee6943940fb2a80e1
URL:    
http://nagvis.git.sourceforge.net/git/gitweb.cgi?p=nagvis/nagvis;a=commit;h=0bbbdac6a7aeb6fbab9f61aee6943940fb2a80e1

Author: LaMi <[email protected]>
Date:   Sun Nov  8 14:36:41 2009 +0100

Implemented automatic session cookie domain detection

---

 share/server/core/classes/GlobalMainCfg.php |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/share/server/core/classes/GlobalMainCfg.php 
b/share/server/core/classes/GlobalMainCfg.php
index 0e3dc78..3d3af84 100644
--- a/share/server/core/classes/GlobalMainCfg.php
+++ b/share/server/core/classes/GlobalMainCfg.php
@@ -90,7 +90,6 @@ class GlobalMainCfg {
                                        'editable' => 1,
                                        'default' => '',
                                        'match' => MATCH_STRING),
-                               //FIXME: auto detect
                                'sesscookiepath' => Array('must' => 1,
                                        'editable' => 1,
                                        'default' => '',
@@ -712,6 +711,9 @@ class GlobalMainCfg {
                                        'locked' => 1,
                                        'match' => MATCH_STRING)));
                
+               // Detect the cookie domain to use
+               $this->setCookieDomainByEnv();
+               
                // Try to get the base path via $_SERVER['SCRIPT_FILENAME']
                $this->validConfig['paths']['base']['default'] = 
$this->getBasePath();
                
$this->setPathsByBase($this->getValue('paths','base'),$this->getValue('paths','htmlbase'));
@@ -757,6 +759,18 @@ class GlobalMainCfg {
        }
        
        /**
+        * Gets the cookie domain from the webservers environment and sets the 
+        * session cookie domain to this value
+        *
+        * @author      Lars Michelsen <[email protected]>
+        */
+       private function setCookieDomainByEnv() {
+               if(isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] 
!== '') {
+                       
$this->validConfig['global']['sesscookiedomain']['default'] = 
$_SERVER['SERVER_NAME'];
+               }
+       }
+       
+       /**
         * Gets the valid configuration definitions from the available 
backends. The
         * definitions were moved to the backends so it is easier to create new
         * backends without any need to modify the main configuration
@@ -832,6 +846,9 @@ class GlobalMainCfg {
                
$this->validConfig['paths']['htmlhovertemplateimages']['default'] = 
$htmlBase.'/userfiles/images/templates/hover/';
                
$this->validConfig['paths']['htmlheadertemplateimages']['default'] = 
$htmlBase.'/userfiles/images/templates/header/';
                
$this->validConfig['paths']['htmlcontexttemplateimages']['default'] = 
$htmlBase.'/userfiles/images/templates/context/';
+               
+               // This option directly relies on the configured htmlBase by 
default
+               $this->validConfig['global']['sesscookiepath']['default'] = 
$htmlBase;
        }
        
        /**


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Nagvis-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nagvis-checkins

Reply via email to