Changeset 691

Show
Ignore:
Timestamp:
11/05/06 05:46:27 (2 years ago)
Author:
sven
Message:

try to detect if we're in a subdirectory, and define $CFG->cookiepath with that path to allow elgg-specific cookies

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • devel/lib/elgglib.php

    r659 r691  
    355355 
    356356    //clear session cookies 
    357     setcookie('ElggSession'.$CFG->sessioncookie, '', time() - 3600, '/'); 
    358     setcookie('ElggSessionTest'.$CFG->sessioncookie, '', time() - 3600, '/'); 
     357    setcookie('ElggSession'.$CFG->sessioncookie, '', time() - 3600, $CFG->cookiepath); 
     358    setcookie('ElggSessionTest'.$CFG->sessioncookie, '', time() - 3600, $CFG->cookiepath); 
    359359    //increment database error counters 
    360360    if (isset($CFG->session_error_counter)) { 
     
    35363536    update_record('users',$user); 
    35373537     
    3538     setcookie(AUTH_COOKIE, $ticket, time()+AUTH_COOKIE_LENGTH, '/'); 
     3538    setcookie(AUTH_COOKIE, $ticket, time()+AUTH_COOKIE_LENGTH, $CFG->cookiepath); 
    35393539    global $messages; 
    35403540    $messages[] = __gettext("The system will remember you and automatically log you in next time."); 
  • devel/lib/setup.php

    r653 r691  
    6060if (empty($CFG->disable_templatechanging)) { 
    6161    $CFG->disable_templatechanging = false; 
     62} 
     63 
     64if (empty($CFG->cookiepath)) { 
     65    $pathcomponents = @parse_url($CFG->wwwroot); 
     66    if (!empty($pathcomponents['path'])) { 
     67        $CFG->cookiepath = $pathcomponents['path']; 
     68    } else { 
     69        $CFG->cookiepath = '/'; 
     70    } 
     71    unset($pathcomponents); 
    6272} 
    6373 
     
    257267} 
    258268 
     269// wtf? $noelggcookie is never set - Sven 
    259270if (!isset($noelggcookie)) { 
    260271    session_name('ElggSession'.$CFG->sessioncookie); 
     272    ini_set("session.cookie_path", $CFG->cookiepath); 
    261273    @session_start(); 
    262274    if (! isset($_SESSION['SESSION'])) { 
     
    266278            $_SESSION['SESSION']->has_timed_out = true; 
    267279        } 
    268         setcookie('ElggSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, '/'); 
     280        setcookie('ElggSessionTest'.$CFG->sessioncookie, $_SESSION['SESSION']->session_test, 0, $CFG->cookiepath); 
    269281        $_COOKIE['ElggSessionTest'.$CFG->sessioncookie] = $_SESSION['SESSION']->session_test; 
    270282    } 
  • devel/login/logout.php

    r269 r691  
    1919 
    2020if (isset($_COOKIE[session_name()])) { 
    21     setcookie(session_name(), '', time()-84600, '/'); 
     21    setcookie(session_name(), '', time()-84600, $CFG->cookiepath); 
    2222} 
    2323 
    2424// Remove the any AUTH_COOKIE persistent logins 
    25 setcookie(AUTH_COOKIE, '', time()-84600, '/'); 
     25setcookie(AUTH_COOKIE, '', time()-84600, $CFG->cookiepath); 
    2626 
    2727session_destroy();