summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 20:28:47 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 20:28:47 +0000
commitc0f55e26b29d5115f0d71a6583035acf3327cffc (patch)
tree778526f8c9af6a3e4a04ff731c0d81308a50aa2e /lib
parentc13392b861fe83c2e28dd7804cfba563fcc61b3c (diff)
downloadampache-c0f55e26b29d5115f0d71a6583035acf3327cffc.tar.gz
ampache-c0f55e26b29d5115f0d71a6583035acf3327cffc.tar.bz2
ampache-c0f55e26b29d5115f0d71a6583035acf3327cffc.zip
fixed ajax requests with invalid session not causing logout
Diffstat (limited to 'lib')
-rw-r--r--lib/class/update.class.php2
-rw-r--r--lib/general.lib.php75
-rw-r--r--lib/javascript-base.js5
3 files changed, 19 insertions, 63 deletions
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index c34cd012..130ed2c6 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -247,7 +247,7 @@ class Update {
$version[] = array('version' => '340012','description'=>$update_string);
- $update_string = '- Removed Unused Preferneces.<br />' .
+ $update_string = '- Removed Unused Preferences.<br />' .
'- Changed Localplay Config to Localplay Access.<br />' .
'- Changed all XML-RPC acls to RPC to reflect inclusion of new API.<br />';
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 60a461d0..417ca483 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -43,66 +43,6 @@ function int2ip($i) {
return "$d[0].$d[1].$d[2].$d[3]";
} // int2ip
-/*
- * Conf function by Robert Hopson
- * call it with a $parm name to retrieve
- * a var, pass it a array to set them
- * to reset a var pass the array plus
- * Clobber! replaces global $conf;
-*/
-/*function conf($param,$clobber=0)
-{
- static $params = array();
-
- if(is_array($param))
- //meaning we are setting values
- {
- foreach ($param as $key=>$val)
- {
- if(!$clobber && isset($params[$key]))
- {
- echo "Error: attempting to clobber $key = $val\n";
- exit();
- }
- $params[$key] = $val;
- }
- return true;
- }
- else
- //meaning we are trying to retrieve a parameter
- {
- if($params[$param]) return $params[$param];
- else return;
- }
-} //conf
-
-function error_results($param,$clobber=0)
-{
- static $params = array();
-
- if(is_array($param))
- //meaning we are setting values
- {
- foreach ($param as $key=>$val)
- {
- if(!$clobber && isset($params[$key]))
- {
- echo "Error: attempting to clobber $key = $val\n";
- exit();
- }
- $params[$key] = $val;
- }
- return true;
- }
- else
- //meaning we are trying to retrieve a parameter
- {
- if($params[$param]) return $params[$param];
- else return;
- }
-} //error_results
-*/
-
/**
* session_exists
* checks to make sure they've specified a valid session, can handle xmlrpc
@@ -524,8 +464,19 @@ function logout() {
// Do a quick check to see if this is an AJAX'd logout request
// if so use the iframe to redirect
if (AJAX_INCLUDE == '1') {
- $_SESSION['iframe']['target'] = Config::get('web_path') . '/login.php';
- $results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
+ ob_end_clean();
+ ob_start();
+
+ /* Set the correct headers */
+ header("Content-type: text/xml; charset=" . Config::get('site_charset'));
+ header("Content-Disposition: attachment; filename=ajax.xml");
+ header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+ header("Cache-Control: no-store, no-cache, must-revalidate");
+ header("Pragma: no-cache");
+
+ $target = Config::get('web_path') . '/login.php';
+ $results['rfc3514'] = '<script type="text/javascript">reload_logout("'.$target.'")</script>';
echo xml_from_array($results);
}
diff --git a/lib/javascript-base.js b/lib/javascript-base.js
index 8d4bb1e1..9742f54d 100644
--- a/lib/javascript-base.js
+++ b/lib/javascript-base.js
@@ -92,6 +92,11 @@ function reload_util(target) {
document.getElementById('util_iframe').src = document.getElementById('util_iframe').src;
}
+// Log them out
+function reload_logout(target) {
+ window.location = target;
+}
+
function popup_art(url) {
var newwindow;
newwindow=window.open(url, "ampache_art", "menubar=no,toolbar=no,location=no,directories=no");