diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-14 06:13:32 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-08-14 06:13:32 +0000 |
commit | 089cd9100a6b94602df62e07e5b7a9b2c563ef95 (patch) | |
tree | 73ad2d782245e593b0fc98d98cd31dfe3e1e4ac8 /lib | |
parent | ab9aec092c66f090eb77ac6a53e37a02a9aecbbf (diff) | |
download | ampache-089cd9100a6b94602df62e07e5b7a9b2c563ef95.tar.gz ampache-089cd9100a6b94602df62e07e5b7a9b2c563ef95.tar.bz2 ampache-089cd9100a6b94602df62e07e5b7a9b2c563ef95.zip |
tweaked theme a tad, updated lastfm plugin, requires remove/readadd to work correctly
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/scrobbler.class.php | 8 | ||||
-rw-r--r-- | lib/class/user.class.php | 31 | ||||
-rw-r--r-- | lib/preferences.php | 6 |
3 files changed, 11 insertions, 34 deletions
diff --git a/lib/class/scrobbler.class.php b/lib/class/scrobbler.class.php index 8b8ca5a7..ad379940 100644 --- a/lib/class/scrobbler.class.php +++ b/lib/class/scrobbler.class.php @@ -112,16 +112,16 @@ class scrobbler { } if(preg_match('/http:\/\/(.*):(\d+)(.*)/', $response[2], $matches)) { - $_SESSION['state']['lastfm']['submit_host'] = $matches[1]; - $_SESSION['state']['lastfm']['submit_port'] = $matches[2]; - $_SESSION['state']['lastfm']['submit_url'] = $matches[3]; + $data['submit_host'] = $matches[1]; + $data['submit_port'] = $matches[2]; + $data['submit_url'] = $matches[3]; } else { $this->error_msg = 'Invalid POST URL returned, unable to continue'; return false; } $this->challenge = $response[1]; - return true; + return $data; } // handshake diff --git a/lib/class/user.class.php b/lib/class/user.class.php index dce54353..8cb28513 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -574,13 +574,11 @@ class User { if (!empty($this->prefs['lastfm_user']) AND !empty($this->prefs['lastfm_pass'])) { $song_info->format(); - // We're also going to need the session here - $data = $this->get_newest_session(); - + $lastfm = new scrobbler($this->prefs['lastfm_user'],$this->prefs['lastfm_pass']); - $lastfm->submit_host = $data['state']['lastfm']['submit_host']; - $lastfm->submit_port = $data['state']['lastfm']['submit_port']; - $lastfm->submit_url = $data['state']['lastfm']['submit_url']; + $lastfm->submit_host = $this->prefs['lastfm_host']; + $lastfm->submit_port = $this->prefs['lastfm_port']; + $lastfm->submit_url = $this->prefs['lastfm_url']; if (!$lastfm->queue_track($song_info->f_artist_full,$song_info->f_album_full,$song_info->title,time(),$song_info->time)) { debug_event('LastFM','Error: Queue Failed: ' . $lastfm->error_msg,'3'); @@ -1119,27 +1117,6 @@ class User { } // rebuild_all_preferences - /** - * get_newest_session - * This will find the latest active session for this user and return an array from the serialized value - */ - public function get_newest_session() { - - $username = Dba::escape($this->username); - $time = time(); - - $sql = "SELECT `value` FROM `session` WHERE `username`='$username' AND `expire` > '$time' ORDER BY `expire` DESC"; - $db_results = Dba::query($sql); - - $row = Dba::fetch_assoc($db_results); - $string = trim($row['value']); - - $value = unseralize($string); - - return $value; - - } // get_newest_session - } //end user class ?> diff --git a/lib/preferences.php b/lib/preferences.php index 66338a05..97c0f370 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -371,10 +371,10 @@ function create_preference_input($name,$value) { */ function get_preference_id($name) { - $sql = "SELECT id FROM preferences WHERE name='" . sql_escape($name) . "'"; - $db_results = mysql_query($sql, dbh()); + $sql = "SELECT `id` FROM `preference` WHERE `name`='" . Dba::escape($name) . "'"; + $db_results =Dba::query($sql); - $results = mysql_fetch_assoc($db_results); + $results = Dba::fetch_assoc($db_results); return $results['id']; |