Changeset 16068

Show
Ignore:
Timestamp:
04/11/08 15:34:07 (6 months ago)
Author:
rambo
Message:

be less liberal about spewing session cookies around

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/MidCOM_2_8/midcom.core/midcom/config/midcom_config.php

    r15503 r16068  
    507507$GLOBALS['midcom_config_default']['auto_formatter'] = array(); 
    508508 
     509/** 
     510 * Sessioning service, disabling the service will help with external caches. 
     511 * The second option is to allow logged in users to benefit from the service 
     512 */ 
     513$GLOBALS['midcom_config_default']['sessioning_service_enable'] = true; 
     514$GLOBALS['midcom_config_default']['sessioning_service_always_enable_for_users'] = true; 
     515 
    509516/* ----- Include the site config ----- */ 
    510517/* This should be replaced by $_MIDGARD constructs */ 
  • branches/MidCOM_2_8/midcom.core/midcom/services/_sessioning.php

    r14775 r16068  
    7171        $started = true; 
    7272 
     73    } 
     74 
     75    function _initialize($unconditional_start = false) 
     76    { 
     77        static $initialized = false; 
     78        if ($initialized) 
     79        { 
     80            return true; 
     81        } 
     82 
     83        if (   !$GLOBALS['midcom_config']['sessioning_service_enable'] 
     84            && !(   $GLOBALS['midcom_config']['sessioning_service_always_enable_for_users'] 
     85                 && $_MIDGARD['user'] 
     86                 ) 
     87            ) 
     88        { 
     89            return false; 
     90        } 
     91 
     92        // Try to start session only if the client sends the id OR we need to set data 
     93        if (   !isset($_REQUEST[session_name()]) 
     94            && !$unconditional_start) 
     95        { 
     96            return false; 
     97        } 
     98 
    7399        @session_start(); 
    74100 
     
    81107            $_SESSION["midcom_session_data"]["midcom.service.sessioning"]["startup"] = serialize(time()); 
    82108        } 
     109        $initialized = true; 
     110        return true; 
    83111    } 
    84112 
     
    94122    function exists ($domain, $key) 
    95123    { 
     124        if (!$this->_initialize()) 
     125        { 
     126            return false; 
     127        } 
    96128        if (! array_key_exists($domain, $_SESSION["midcom_session_data"])) 
    97129        { 
     
    195227    function set ($domain, $key, $value) 
    196228    { 
     229        if (!$this->_initialize(true)) 
     230        { 
     231            return false; 
     232        } 
    197233        static $no_cache = false; 
    198234        if (!$no_cache)