Ticket #26: fix-cookie-domain.diff

File fix-cookie-domain.diff, 1.5 KB (added by westi, 2 years ago)

Only set a cookie domain if really wanted

  • gp-settings.php

    ### Eclipse Workspace Patch 1.0
    #P glotpress
     
    226226// So, make all local variables, global 
    227227gp_set_globals( get_defined_vars() ); 
    228228 
     229/** 
     230 * It is possible to define this in wp-config.php and it will be used as the domain for all cookies. 
     231 * Set it carefully for sharing cookies amonst subdomains 
     232 *  
     233 * @link http://curl.haxx.se/rfc/cookie_spec.html 
     234 */ 
     235if ( !defined('GP_COOKIE_DOMAIN') ) 
     236        define('GP_COOKIE_DOMAIN', false); 
     237 
    229238if ( !class_exists( 'WP_Auth' ) ) { 
    230239        require_once( BACKPRESS_PATH . 'class.wp-auth.php' ); 
    231240        $cookies = array(); 
    232241        $cookies['auth'][] = array( 
    233                 'domain' => isset($_SERVER['HTTP_HOST'])? $_SERVER['HTTP_HOST'] : '' , 
     242                'domain' => GP_COOKIE_DOMAIN, 
    234243                'path' => gp_url_path(), 
    235244                'name' => gp_const_get( 'GP_AUTH_COOKIE', 'glotpress_auth' ), 
    236245        ); 
    237246        $cookies['secure_auth'][] = array( 
    238                 'domain' => isset($_SERVER['HTTP_HOST'])? $_SERVER['HTTP_HOST'] : '' , 
     247                'domain' => GP_COOKIE_DOMAIN, 
    239248                'path' => gp_url_path(), 
    240249                'name' => gp_const_get( 'GP_SECURE_AUTH_COOKIE', 'glotpress_sec_auth' ), 
    241250                'secure' => 'true', 
    242251        ); 
    243252 
    244253        $cookies['logged_in'][] = array( 
    245                 'domain' => isset($_SERVER['HTTP_HOST'])? $_SERVER['HTTP_HOST'] : '' , 
     254                'domain' => GP_COOKIE_DOMAIN, 
    246255                'path' => gp_url_path(), 
    247256                'name' => gp_const_get( 'GP_LOGGED_IN_COOKIE', 'glotpress_logged_in' ), 
    248257        );