summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-25 02:47:56 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-25 02:47:56 +0000
commita2c471bd18fb5e38763bb0dfd563aca3a54aed1b (patch)
treec110bd8da54fd0006cd2f32ea2f1c32f9582395b
parent74ff21838d600bc36014953db8e6c51db7ce33a4 (diff)
downloadampache-a2c471bd18fb5e38763bb0dfd563aca3a54aed1b.tar.gz
ampache-a2c471bd18fb5e38763bb0dfd563aca3a54aed1b.tar.bz2
ampache-a2c471bd18fb5e38763bb0dfd563aca3a54aed1b.zip
reimplemented the session function check
-rw-r--r--image.php2
-rw-r--r--lib/class/vauth.class.php20
-rw-r--r--lib/log.lib.php4
-rw-r--r--stream.php18
4 files changed, 19 insertions, 25 deletions
diff --git a/image.php b/image.php
index da443b0f..1120329d 100644
--- a/image.php
+++ b/image.php
@@ -32,7 +32,7 @@ require 'lib/init.php';
// Check to see if they've got an interface session or a valid API session, if not GTFO
if (!vauth::session_exists('interface',$_COOKIE[Config::get('session_name')]) AND !vauth::session_exists('api',$_REQUEST['auth'])) {
- debug_event('DENIED','Image Access from Sid:' . $_REQUEST['sid'] . ' OR Auth:' . $_REQUEST['auth'],'1');
+ debug_event('DENIED','Image Access, Checked Cookie Session and Auth:' . $_REQUEST['auth'],'1');
exit;
}
diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php
index cc9b23e2..4066b4be 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/vauth.class.php
@@ -73,9 +73,9 @@ class vauth {
$results = self::get_session_data($key);
- if (strlen($results['value']) < 1) {
+ if (is_array($results)) {
debug_event('SESSION','Error unable to read session from key ' . $key . ' no data found','1');
- return '';
+ return false;
}
return $results['value'];
@@ -98,7 +98,7 @@ class vauth {
$sql = "UPDATE `session` SET `value`='$value', `expire`='$expire' WHERE `id`='$key'";
$db_results = Dba::query($sql);
- debug_event('SESSION','Writing to ' . $key . ' with expire ' . $expire . ' DBError:' . Dba::error(),'5');
+ debug_event('SESSION','Writing to ' . $key . ' with expire ' . $expire . ' DBError:' . Dba::error(),'6');
return $db_results;
@@ -116,7 +116,7 @@ class vauth {
$sql = "DELETE FROM `session` WHERE `id`='$key'";
$db_results = Dba::query($sql);
- debug_event('SESSION','Deleting Session with key:' . $key,'5');
+ debug_event('SESSION','Deleting Session with key:' . $key,'6');
// Destory our cookie!
setcookie(Config::get('session_name'),'',time() - 86400);
@@ -141,7 +141,8 @@ class vauth {
/**
* logout
* This is called when you want to log out and nuke your session
- * //FIXME: move all logout logic here
+ * This is the function used for the Ajax logouts, if no id is passed
+ * it tries to find one from the session
*/
public static function logout($key='') {
@@ -285,7 +286,7 @@ class vauth {
return false;
}
- debug_event('SESSION','Session Created:' . $key,'5');
+ debug_event('SESSION','Session Created:' . $key,'6');
return $key;
@@ -400,7 +401,7 @@ class vauth {
$sql = "UPDATE `session` SET `expire`='$expire' WHERE `id`='$sid'";
$db_results = Dba::query($sql);
- debug_event('SESSION','Session:' . $sid . ' Has been Extended to ' . $expire,'5');
+ debug_event('SESSION','Session:' . $sid . ' Has been Extended to ' . $expire,'6');
return $db_results;
@@ -412,6 +413,11 @@ class vauth {
*/
public static function _auto_init() {
+ if (!function_exists('session_start')) {
+ header("Location:" . Config::get('web_path') . "/test.php");
+ exit;
+ }
+
session_set_save_handler(array('vauth','open'),array('vauth','close'),array('vauth','read'),array('vauth','write'),array('vauth','destroy'),array('vauth','gc'));
} // auto init
diff --git a/lib/log.lib.php b/lib/log.lib.php
index 83786c67..e7e9510a 100644
--- a/lib/log.lib.php
+++ b/lib/log.lib.php
@@ -89,6 +89,10 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) {
return false;
}
+ if (strstr($errstr,"date.timezone")) {
+ $errstr = "You have not set a timezone (date.timezone) in your php.ini file. Please set it.";
+ }
+
/* The XML-RPC lib is broken, well kind of
* shut your pie hole
*/
diff --git a/stream.php b/stream.php
index 322f5ee7..c8118e88 100644
--- a/stream.php
+++ b/stream.php
@@ -34,21 +34,6 @@ $web_path = Config::get('web_path');
* action switch
*/
switch ($_REQUEST['action']) {
- case 'play_selected':
- $type = scrub_in($_REQUEST['type']);
- if ($type == 'album') {
- $song_ids = get_songs_from_type($type, $_POST['song'], $_REQUEST['artist_id']);
- }
- elseif ($_REQUEST['playlist_id']) {
- $playlist = new Playlist($_REQUEST['playlist_id']);
- $song_ids = $playlist->get_songs($_REQUEST['song']);
- }
- else {
- $song_ids = $_POST['song'];
- }
- // Make sure they actually passed soemthing
- if (!count($song_ids)) { header("Location:" . return_referer()); exit; }
- break;
case 'basket':
// Pull in our items (multiple types)
$objects = $GLOBALS['user']->playlist->get_items();
@@ -77,8 +62,7 @@ switch ($_REQUEST['action']) {
} // end foreach
// Check to see if 'clear' was passed if it was then we need to reset the basket
- // FIXME: We need to reload the rightbar when we do this... sigh...
- if ($_REQUEST['playlist_method'] == 'clear' || $GLOBALS['user']->prefs['playlist_method'] == 'clear') {
+ if ( ($_REQUEST['playlist_method'] == 'clear' || $GLOBALS['user']->prefs['playlist_method'] == 'clear') AND $GLOBALS['user']->prefs['play_method'] != 'xspf_player') {
$GLOBALS['user']->playlist->clear();
}