summaryrefslogtreecommitdiffstats
path: root/lib/class/playlist.class.php
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-03 23:04:20 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-09-03 23:04:20 +0000
commite0811ddab09e4574e2d595846b79b54f90b1cbf9 (patch)
tree3d6398ef2a59ff68e6bdbbad307afcd0e53b6f85 /lib/class/playlist.class.php
parent93e8513b5be87aa7cc3db26d7e0c37be938efb07 (diff)
downloadampache-e0811ddab09e4574e2d595846b79b54f90b1cbf9.tar.gz
ampache-e0811ddab09e4574e2d595846b79b54f90b1cbf9.tar.bz2
ampache-e0811ddab09e4574e2d595846b79b54f90b1cbf9.zip
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....
Diffstat (limited to 'lib/class/playlist.class.php')
-rw-r--r--lib/class/playlist.class.php28
1 files changed, 20 insertions, 8 deletions
diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php
index f46bc66f..515edde4 100644
--- a/lib/class/playlist.class.php
+++ b/lib/class/playlist.class.php
@@ -253,12 +253,24 @@ 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;