Changeset 2391


Ignore:
Timestamp:
03/30/10 17:38:44 (14 years ago)
Author:
niltonneto
Message:

Ticket #1018 - Corrigido validação de sessão em requisições AJAX.

Location:
branches/2.0
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/2.0/expressoMail1_2/js/connector.js

    r1369 r2391  
    343343                                                                if ( typeof data == 'undefined' ) 
    344344                                                                        data = oxmlhttp.responseText; 
     345                                                                // Verify user session 
     346                                                                if(data && data.nosession){ 
     347                                                                // If hold session is setted, dont reload the page ... 
     348                                                                        if(hold_session) { 
     349                                                                                if(typeof(write_msg) == "function" && typeof(get_lang) == "function") 
     350                                                                                        write_msg(get_lang("your session could not be verified.")); 
     351                                                                                else 
     352                                                                                        alert("your session could not be verified."); 
     353                                                                        } 
     354                                                                        else 
     355                                                                                window.location.reload(); 
     356 
     357                                                                        delete _thisObject.requests[id]; 
     358                                                                        _thisObject.requests[id] = null; 
     359                                                                        return false; 
     360                                                                } 
    345361                                                                if(debug_controller) { 
    346362                                                                        document.getElementById("debug_controller").innerHTML += oxmlhttp.responseText; 
  • branches/2.0/header.session.inc.php

    r2178 r2391  
    1111        if (empty($_SESSION['phpgw_session']['session_id']) || ($_SESSION['connection_db_info']['user_auth'] && implode('',$_SESSION['connection_db_info']['user_auth']) !== $connection_id)) 
    1212        { 
    13                 if($_SESSION['connection_db_info']['user_auth']) 
     13                if($_SESSION['connection_db_info']['user_auth'] && !strstr($_SERVER['SCRIPT_URL'],"/controller.php")) { 
    1414                        error_log( '[ INVALID SESSION ] >>>>' . implode('',$_SESSION['connection_db_info']['user_auth']) . '<<<< - >>>>' . $connection_id . '<<<<', 0 ); 
    15                 setcookie("PHPSESSID","",0); 
    16                 setcookie ("sessionid","",0);    
    17                 unset($_SESSION); 
     15                        @require_once dirname( __FILE__ ) . '/logout.php'; 
     16                } 
     17 
     18                setcookie(session_name(),"",0); // Removing session cookie. 
     19                unset($_SESSION);                               // Removing session values. 
     20                // From ExpressoAjax response "nosession" 
     21                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php")){ 
     22                        echo serialize(array("nosession" => true)); 
     23                        exit; 
     24                } 
     25        } 
     26        else{ 
     27                // From ExpressoAjax update session_dla (datetime last access).  
     28                if(strstr($_SERVER['SCRIPT_URL'],"/controller.php")) 
     29                        $_SESSION['phpgw_session']['session_dla'] = time(); 
    1830        } 
    1931?> 
Note: See TracChangeset for help on using the changeset viewer.