mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
fixed playlist name editing, cant change the type or the genre yet, tweaked lastfm so it recovers from errors a little better, fixed a stupid typo....
This commit is contained in:
parent
93e8513b5b
commit
e0811ddab0
8 changed files with 158 additions and 12 deletions
|
@ -252,13 +252,25 @@ class Playlist {
|
|||
|
||||
} // get_users
|
||||
|
||||
/**
|
||||
* update
|
||||
* This function takes a key'd array of data and runs updates
|
||||
*/
|
||||
public function update($data) {
|
||||
|
||||
if ($data['name'] != $this->name) {
|
||||
$this->update_name($data['name']);
|
||||
}
|
||||
|
||||
} // update
|
||||
|
||||
/**
|
||||
* update_type
|
||||
* This updates the playlist type, it calls the generic update_item function
|
||||
*/
|
||||
function update_type($new_type) {
|
||||
private function update_type($new_type) {
|
||||
|
||||
if ($this->_update_item('type',$new_type,'100')) {
|
||||
if ($this->_update_item('type',$new_type,'50')) {
|
||||
$this->type = $new_type;
|
||||
}
|
||||
|
||||
|
@ -268,9 +280,9 @@ class Playlist {
|
|||
* update_name
|
||||
* This updates the playlist name, it calls the generic update_item function
|
||||
*/
|
||||
function update_name($new_name) {
|
||||
private function update_name($new_name) {
|
||||
|
||||
if ($this->_update_item('name',$new_name,'100')) {
|
||||
if ($this->_update_item('name',$new_name,'50')) {
|
||||
$this->name = $new_name;
|
||||
}
|
||||
|
||||
|
@ -280,16 +292,16 @@ class Playlist {
|
|||
* _update_item
|
||||
* This is the generic update function, it does the escaping and error checking
|
||||
*/
|
||||
function _update_item($field,$value,$level) {
|
||||
private function _update_item($field,$value,$level) {
|
||||
|
||||
if ($GLOBALS['user']->id != $this->user AND !$GLOBALS['user']->has_access($level)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$value = sql_escape($value);
|
||||
$value = Dba::escape($value);
|
||||
|
||||
$sql = "UPDATE playlist SET $field='$value' WHERE id='" . sql_escape($this->id) . "'";
|
||||
$db_results = mysql_query($sql, dbh());
|
||||
$sql = "UPDATE `playlist` SET $field='$value' WHERE `id`='" . Dba::escape($this->id) . "'";
|
||||
$db_results = Dba::query($sql);
|
||||
|
||||
return $db_results;
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ class scrobbler {
|
|||
public $submit_port;
|
||||
public $submit_url;
|
||||
public $queued_tracks;
|
||||
public $reset_handshake = false;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
|
@ -206,16 +207,19 @@ class scrobbler {
|
|||
$split_response = preg_split("/\r\n\r\n/", $buffer);
|
||||
if(!isset($split_response[1])) {
|
||||
$this->error_msg = 'Did not receive a valid response';
|
||||
$this->reset_handshake = true;
|
||||
return false;
|
||||
}
|
||||
$response = explode("\n", $split_response[1]);
|
||||
if(!isset($response[0])) {
|
||||
$this->error_msg = 'Unknown error submitting tracks'.
|
||||
"\nDebug output:\n".$buffer;
|
||||
$this->reset_handshake = true;
|
||||
return false;
|
||||
}
|
||||
if(substr($response[0], 0, 6) == 'FAILED') {
|
||||
$this->error_msg = $response[0];
|
||||
$this->reset_handshake = true;
|
||||
return false;
|
||||
}
|
||||
if(substr($response[0], 0, 7) == 'BADAUTH') {
|
||||
|
@ -224,11 +228,13 @@ class scrobbler {
|
|||
}
|
||||
if (substr($response[0],0,10) == 'BADSESSION') {
|
||||
$this->error_msg = 'Invalid Session passed (' . trim($response[0]) . ')';
|
||||
$this->reset_handshake = true;
|
||||
return false;
|
||||
}
|
||||
if(substr($response[0], 0, 2) != 'OK') {
|
||||
$this->error_msg = 'Response Not ok, unknown error'.
|
||||
"\nDebug output:\n".$buffer;
|
||||
$this->reset_handshake = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue