summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-02-29 06:14:46 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2008-02-29 06:14:46 +0000
commit2c337852cff31297d681fb87d3098cc3d9041101 (patch)
tree9853ce94387c4cc7756575598dfb1e2de44a8589 /lib/class
parentc1f2b35e2a18b0752746f5db5794cf18714bc71d (diff)
downloadampache-2c337852cff31297d681fb87d3098cc3d9041101.tar.gz
ampache-2c337852cff31297d681fb87d3098cc3d9041101.tar.bz2
ampache-2c337852cff31297d681fb87d3098cc3d9041101.zip
major corrections to reading of preferences and a few misc fixes which I have now forgotten
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/access.class.php4
-rw-r--r--lib/class/api.class.php8
-rw-r--r--lib/class/browse.class.php2
-rw-r--r--lib/class/localplay.class.php2
-rw-r--r--lib/class/metadata.class.php4
-rw-r--r--lib/class/stream.class.php13
-rw-r--r--lib/class/vauth.class.php9
7 files changed, 19 insertions, 23 deletions
diff --git a/lib/class/access.class.php b/lib/class/access.class.php
index 98fd0b39..bfc7beb9 100644
--- a/lib/class/access.class.php
+++ b/lib/class/access.class.php
@@ -145,7 +145,7 @@ class Access {
return false;
}
if (Config::get('allow_zip_download') AND $GLOBALS['user']->has_access(25)) {
- return $GLOBALS['user']->prefs['download'];
+ return Config::get('download');
}
break;
default:
@@ -237,7 +237,7 @@ class Access {
switch ($type) {
case 'localplay':
// Check their localplay_level
- if ($GLOBALS['user']->prefs['localplay_level'] >= $level) {
+ if (Config::get('localplay_level') >= $level) {
return true;
}
else {
diff --git a/lib/class/api.class.php b/lib/class/api.class.php
index f1ff7a33..bd1b7ce0 100644
--- a/lib/class/api.class.php
+++ b/lib/class/api.class.php
@@ -86,13 +86,19 @@ class Api {
$data['type'] = 'api';
$data['value'] = $timestamp;
$token = vauth::session_create($data);
+
// Insert the token into the streamer
$stream = new Stream();
$stream->user_id = $client->id;
$stream->insert_session($token);
debug_event('API','Login Success, passphrase matched','1');
- return array('auth'=>$token,'api'=>self::$version);
+ // We need to also get the 'last update' of the catalog information in an RFC 2822 Format
+ $sql = "SELECT MAX(`last_update`) AS `update`,MAX(`last_add`) AS `add` FROM `catalog`";
+ $db_results = Dba::query($sql);
+ $row = Dba::fetch_assoc($db_results);
+
+ return array('auth'=>$token,'api'=>self::$version,'update'=>date("r",$row['update']),'add'=>date("r",$row['add']));
} // match
} // end while
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index cf5644b5..98dabce6 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -671,7 +671,7 @@ class Browse {
self::$total_objects = count($object_ids);
// Limit is based on the users preferences
- $limit = $GLOBALS['user']->prefs['offset_limit'] ? $GLOBALS['user']->prefs['offset_limit'] : '25';
+ $limit = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
if (count($object_ids) > self::$start) {
$object_ids = array_slice($object_ids,self::$start,$limit);
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 1a4c8bef..7d793fa1 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -206,7 +206,7 @@ class Localplay {
$this->_player->uninstall();
// If its our current player, reset player to nothing
- if ($GLOBALS['user']->prefs['localplay_controller'] == $this->type) {
+ if (Config::get('localplay_controller') == $this->type) {
Preference::update('localplay_controller',$GLOBALS['user']->id,'');
}
diff --git a/lib/class/metadata.class.php b/lib/class/metadata.class.php
index 9e562090..ca7da903 100644
--- a/lib/class/metadata.class.php
+++ b/lib/class/metadata.class.php
@@ -47,7 +47,7 @@ class metadata {
// For now it's only mystrands
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
- $openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
+ $openstrands = new OpenStrands(Config::get('mystrands_user'),Config::get('mystrands_pass'));
// Make sure auth worked
if (!$openstrands) { return false; }
@@ -101,7 +101,7 @@ class metadata {
// For now it's only mystrands
OpenStrands::set_auth_token(Config::get('mystrands_developer_key'));
- $openstrands = new OpenStrands($GLOBALS['user']->prefs['mystrands_user'],$GLOBALS['user']->prefs['mystrands_pass']);
+ $openstrands = new OpenStrands(Config::get('mystrands_user'),Config::get('mystrands_pass'));
if (!$openstrands) { return false; }
diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php
index 80d05654..fee74523 100644
--- a/lib/class/stream.class.php
+++ b/lib/class/stream.class.php
@@ -223,9 +223,6 @@ class Stream {
}
$song = new Song($song_id);
if ($song->type == ".flac") { $song->type = ".ogg"; }
- if ($GLOBALS['user']->prefs['play_type'] == 'downsample') {
- $ds = $GLOBALS['user']->prefs['sample_rate'];
- }
echo $song->get_url();
} // end foreach
@@ -408,7 +405,7 @@ class Stream {
//FIXME: This needs to go in a template, here for now though
//FIXME: This preference doesn't even exists, we'll eventually
//FIXME: just make it the default
- if ($GLOBALS['user']->prefs['embed_xspf'] == 1 ){
+ if (Config::get('embed_xspf') == 1 ){
header("Location: ".Config::get('web_path')."/index.php?xspf&play_info=".$GLOBALS['user']->playlist->id);
}
else {
@@ -446,7 +443,7 @@ class Stream {
function create_localplay() {
// First figure out what their current one is and create the object
- $localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
+ $localplay = new Localplay(Config::get('localplay_controller'));
$localplay->connect();
//HACK!!!
// Yea.. you know the baby jesus... he's crying right meow
@@ -526,7 +523,7 @@ class Stream {
$max_bitrate = Config::get('max_bit_rate');
$min_bitrate = Config::get('min_bit_rate');
$time = time();
- $user_sample_rate = $GLOBALS['user']->prefs['sample_rate'];
+ $user_sample_rate = Config::get('sample_rate');
$browser = new Browser();
if (!$song_name) {
@@ -705,9 +702,9 @@ class Stream {
if (AJAX_INCLUDE != '1') { return false; }
// If we're doin the flash magic then run away as well
- if ($GLOBALS['user']->prefs['play_type'] == 'xspf_player') { return false; }
+ if (Config::get('play_type') == 'xspf_player') { return false; }
- switch ($GLOBALS['user']->prefs['playlist_method']) {
+ switch (Config::get('playlist_method')) {
default:
case 'clear':
case 'default':
diff --git a/lib/class/vauth.class.php b/lib/class/vauth.class.php
index 5f67e442..b670db2d 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/vauth.class.php
@@ -236,7 +236,7 @@ class vauth {
$session_name = Config::get('session_name');
Config::set('cookie_life',$remember_length,'1');
- setcookie($session_name . '_remember',"Rappelez-vous, rappelez-vous le 27 mars",time() + $remember_length,'/',Config::get('cookie_domain'));
+ setcookie($session_name . '_remember',"Rappelez-vous, rappelez-vous le 27 mars",time() + $remember_length,'/');
} // create_remember_cookie
@@ -301,13 +301,6 @@ class vauth {
// No cookie n go!
if (!isset($_COOKIE[$session_name])) { return false; }
- $key = scrub_in($_COOKIE[$session_name]);
- $data = self::get_session_data($key);
-
- if (!is_array($data)) {
- return false;
- }
-
// Check for a remember me
if (isset($_COOKIE[$session_name . '_remember'])) {
self::create_remember_cookie();