diff options
-rw-r--r-- | lib/class/scrobbler.class.php | 6 | ||||
-rw-r--r-- | lib/class/user.class.php | 12 | ||||
-rw-r--r-- | login.php | 3 | ||||
-rw-r--r-- | modules/plugins/Lastfm.plugin.php | 6 | ||||
-rw-r--r-- | templates/show_users.inc.php | 8 |
5 files changed, 17 insertions, 18 deletions
diff --git a/lib/class/scrobbler.class.php b/lib/class/scrobbler.class.php index ad379940..26aad0f1 100644 --- a/lib/class/scrobbler.class.php +++ b/lib/class/scrobbler.class.php @@ -42,10 +42,6 @@ class scrobbler { $this->challenge = ''; $this->queued_tracks = array(); - $this->submit_host = $_SESSION['state']['lastfm']['submit_host']; - $this->submit_port = $_SESSION['state']['lastfm']['submit_port']; - $this->submit_url = $_SESSION['state']['lastfm']['submit_url']; - } // scrobbler /** @@ -120,7 +116,7 @@ class scrobbler { return false; } - $this->challenge = $response[1]; + $data['challenge'] = $response[1]; return $data; } // handshake diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 8cb28513..32b5d59d 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -512,10 +512,10 @@ class User { * enable * this enables the current user */ - function enable() { + public function enable() { $sql = "UPDATE `user` SET `disabled`='0' WHERE id='" . $this->id . "'"; - $db_results = mysql_query($sql,dbh()); + $db_results = Dba::query($sql); return true; @@ -574,11 +574,11 @@ class User { if (!empty($this->prefs['lastfm_user']) AND !empty($this->prefs['lastfm_pass'])) { $song_info->format(); - $lastfm = new scrobbler($this->prefs['lastfm_user'],$this->prefs['lastfm_pass']); - $lastfm->submit_host = $this->prefs['lastfm_host']; - $lastfm->submit_port = $this->prefs['lastfm_port']; - $lastfm->submit_url = $this->prefs['lastfm_url']; + $lastfm->submit_host = $this->prefs['lastfm_host']; + $lastfm->submit_port = $this->prefs['lastfm_port']; + $lastfm->submit_url = $this->prefs['lastfm_url']; + $lastfm->challenge = $this->prefs['lastfm_challenge']; 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'); @@ -141,9 +141,12 @@ if ($auth['success']) { $port_id = get_preference_id('lastfm_port'); $url_id = get_preference_id('lastfm_url'); $host_id = get_preference_id('lastfm_host'); + $challenge_id = get_preference_id('lastfm_challenge'); update_preference($user->id,'lastfm_port',$port_id,$handshake['submit_port']); update_preference($user->id,'lastfm_host',$host_id,$handshake['submit_host']); update_preference($user->id,'lastfm_url',$url_id,$handshake['submit_url']); + update_preference($user->id,'lastfm_challenge',$challenge_id,$handshake['challenge']); + } // if LastFM diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php index 59fca6d6..c0896b71 100644 --- a/modules/plugins/Lastfm.plugin.php +++ b/modules/plugins/Lastfm.plugin.php @@ -66,6 +66,10 @@ class AmpacheLastfm { "VALUES ('lastfm_url',' ','Last.FM Submission url','5','string','internal')"; $db_results = Dba::query($sql); + $sql = "INSERT INTO preference (`name`,`value`,`description`,`level`,`type`,`catagory`) " . + "VALUES ('lastfm_challenge',' ','Last.FM Submission Challenge','5','string','internal')"; + $db_results = Dba::query($sql); + } // install /** @@ -77,7 +81,7 @@ class AmpacheLastfm { /* We need to remove the preivously added preferences */ $sql = "DELETE FROM `preference` WHERE `name`='lastfm_pass' OR `name`='lastfm_user' " . - "OR `name`='lastfm_url' OR `name`='lastfm_host' OR `name`='lastfm_port'"; + "OR `name`='lastfm_url' OR `name`='lastfm_host' OR `name`='lastfm_port' OR `name`='lastfm_challenge'"; $db_results = Dba::query($sql); } // uninstall diff --git a/templates/show_users.inc.php b/templates/show_users.inc.php index bc9dadb4..d2571cbe 100644 --- a/templates/show_users.inc.php +++ b/templates/show_users.inc.php @@ -25,7 +25,7 @@ $web_path = Config::get('web_path'); <table class="tabledata" cellpadding="0" cellspacing="0" border="0"> <tr class="table-header" align="center"> <td colspan="11"> - <?php if ($view->offset_limit) { require Config::get('prefix') . '/templates/list_header.inc'; } ?> + <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?> </td> </tr> <tr class="table-header"> @@ -86,13 +86,9 @@ foreach ($object_ids as $user_id) { <a href="<?php echo $web_path; ?>/admin/users.php?action=show_edit&user_id=<?php echo $client->id; ?>"> <?php echo get_user_icon('edit'); ?> </a> -<!-- <a href="<?php echo $web_path; ?>/preferences.php?action=user&user_id=<?php echo $client->id; ?>"> - <?php echo get_user_icon('preferences'); ?> - </a> ---> <?php //FIXME: Fix this for the extra permission levels - if ($working_user->disabled == '1') { + if ($client->disabled == '1') { echo "<a href=\"".$web_path."/admin/users.php?action=enable&user_id=$client->id\">" . get_user_icon('enable') . "</a>"; } else { |