Changeset 1340

Show
Ignore:
Timestamp:
12/10/07 12:28:47 (13 months ago)
Author:
vollmerk
Message:

fixed ajax requests with invalid session not causing logout

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/docs/CHANGELOG

    r1337 r1340  
    55-------------------------------------------------------------------------- 
    66  v.3.4-Alpha4  
     7        - Fixed a bug where ajax actions wouldn't trigger a redirect to login 
     8                when session expired, instead they would just break 
    79        - Fixed a bug with Random Play if you had no artists/albums/playlists 
    810        - Fixed Admin's ability to modify other users preferences 
  • trunk/lib/class/update.class.php

    r1335 r1340  
    248248                $version[] = array('version' => '340012','description'=>$update_string);  
    249249 
    250                 $update_string = '- Removed Unused Preferneces.<br />' .  
     250                $update_string = '- Removed Unused Preferences.<br />' .  
    251251                                '- Changed Localplay Config to Localplay Access.<br />' .  
    252252                                '- Changed all XML-RPC acls to RPC to reflect inclusion of new API.<br />'; 
  • trunk/lib/general.lib.php

    r1335 r1340  
    4343        return "$d[0].$d[1].$d[2].$d[3]"; 
    4444} // int2ip 
    45  
    46 /* 
    47  * Conf function by Robert Hopson 
    48  * call it with a $parm name to retrieve 
    49  * a var, pass it a array to set them 
    50  * to reset a var pass the array plus 
    51  * Clobber! replaces global $conf; 
    52 */ 
    53 /*function conf($param,$clobber=0) 
    54 { 
    55         static $params = array(); 
    56  
    57         if(is_array($param)) 
    58         //meaning we are setting values 
    59         { 
    60                 foreach ($param as $key=>$val) 
    61                 { 
    62                         if(!$clobber && isset($params[$key])) 
    63                         { 
    64                                 echo "Error: attempting to clobber $key = $val\n"; 
    65                                 exit(); 
    66                         } 
    67                         $params[$key] = $val; 
    68                 } 
    69                 return true; 
    70         } 
    71         else 
    72         //meaning we are trying to retrieve a parameter 
    73         { 
    74                 if($params[$param]) return $params[$param]; 
    75                 else return; 
    76         } 
    77 } //conf 
    78  
    79 function error_results($param,$clobber=0) 
    80 {                
    81         static $params = array(); 
    82          
    83         if(is_array($param)) 
    84         //meaning we are setting values 
    85         { 
    86                 foreach ($param as $key=>$val) 
    87                 {        
    88                         if(!$clobber && isset($params[$key])) 
    89                         { 
    90                                 echo "Error: attempting to clobber $key = $val\n"; 
    91                                 exit();  
    92                         } 
    93                         $params[$key] = $val; 
    94                 } 
    95                 return true; 
    96         }                
    97         else             
    98         //meaning we are trying to retrieve a parameter 
    99         { 
    100                 if($params[$param]) return $params[$param]; 
    101                 else return; 
    102         } 
    103 } //error_results 
    104 */ 
    10545 
    10646/** 
     
    525465        // if so use the iframe to redirect 
    526466        if (AJAX_INCLUDE == '1') {  
    527                 $_SESSION['iframe']['target'] = Config::get('web_path') . '/login.php';  
    528                 $results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>'; 
     467                ob_end_clean();  
     468                ob_start();  
     469 
     470                /* Set the correct headers */ 
     471                header("Content-type: text/xml; charset=" . Config::get('site_charset')); 
     472                header("Content-Disposition: attachment; filename=ajax.xml"); 
     473                header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT"); 
     474                header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
     475                header("Cache-Control: no-store, no-cache, must-revalidate"); 
     476                header("Pragma: no-cache"); 
     477 
     478                $target = Config::get('web_path') . '/login.php';  
     479                $results['rfc3514'] = '<script type="text/javascript">reload_logout("'.$target.'")</script>'; 
    529480                echo xml_from_array($results); 
    530481        }  
  • trunk/lib/javascript-base.js

    r1302 r1340  
    9393}  
    9494 
     95// Log them out 
     96function reload_logout(target) {  
     97        window.location = target; 
     98} 
     99 
    95100function popup_art(url) { 
    96101        var newwindow; 
  • trunk/util.php

    r1302 r1340  
    1919 
    2020*/ 
    21  
    2221require_once 'lib/init.php'; 
    2322