diff options
author | pb1dft <pb1dft@ampache> | 2008-02-23 23:44:31 +0000 |
---|---|---|
committer | pb1dft <pb1dft@ampache> | 2008-02-23 23:44:31 +0000 |
commit | 6bd576a9fe2524f5c662767206efdebf0b43c8ab (patch) | |
tree | 79a1c7b402517e650cf5cd7008c1eb14accd5528 /lib/class | |
parent | a79d27c52ace4b0c13fc0e5f88b4d857b85557e1 (diff) | |
download | ampache-6bd576a9fe2524f5c662767206efdebf0b43c8ab.tar.gz ampache-6bd576a9fe2524f5c662767206efdebf0b43c8ab.tar.bz2 ampache-6bd576a9fe2524f5c662767206efdebf0b43c8ab.zip |
- Fixed Sorting on Admin->Browse Users
- Fixed Shoutbox and shoutbox management (pb1dft)
Diffstat (limited to 'lib/class')
-rw-r--r-- | lib/class/browse.class.php | 4 | ||||
-rw-r--r-- | lib/class/shoutbox.class.php | 46 | ||||
-rw-r--r-- | lib/class/user.class.php | 4 |
3 files changed, 52 insertions, 2 deletions
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 2b04db39..bf72bbe9 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -219,7 +219,7 @@ class Browse { $valid_array = array('name','user'); break; case 'shoutbox': - $valud_array = array('date','user','sticky'); + $valid_array = array('date','user','sticky'); break; case 'live_stream': $valid_array = array('name','call_sign','frequency'); @@ -393,7 +393,7 @@ class Browse { $sql = "SELECT `flagged`.`id` FROM `flagged` "; break; case 'shoutbox': - $sql - "SELECT `user_shout`.`id` FROM `user_shout` "; + $sql = "SELECT `user_shout`.`id` FROM `user_shout` "; break; case 'playlist_song': case 'song': diff --git a/lib/class/shoutbox.class.php b/lib/class/shoutbox.class.php index 98d14548..9e4eafd6 100644 --- a/lib/class/shoutbox.class.php +++ b/lib/class/shoutbox.class.php @@ -173,5 +173,51 @@ class shoutBox { } // create + /** + * update + * This takes a key'd array of data as input and updates a shoutbox entry + */ + public static function update($data) { + + $id = Dba::escape($data['shout_id']); + $text = Dba::escape(strip_tags($data['comment'])); + $sticky = make_bool($data['sticky']); + + $sql = "UPDATE `user_shout` SET `text`='$text', `sticky`='$sticky' WHERE `id`='$id'"; + $db_results = Dba::query($sql); + + return true; + + } // create + + /** + * format + * this function takes the object and reformats some values + */ + + public function format() { + + if ( $this->sticky == "0" ) { $this->sticky = "No"; } else { $this->sticky = "Yes"; } + + $this->date = date("m\/d\/Y - H:i",$this->date); + + return true; + + } //format + + /** + * delete + * this function deletes a specific shoutbox entry + */ + + public function delete($shout_id) { + + // Delete the shoutbox post + + $sql = "DELETE FROM `user_shout` WHERE `id`='$shout_id'"; + $db_results = Dba::query($sql); + + } // delete + } // shoutBox class ?> diff --git a/lib/class/user.class.php b/lib/class/user.class.php index 9f4e6715..d548f1f3 100644 --- a/lib/class/user.class.php +++ b/lib/class/user.class.php @@ -883,6 +883,10 @@ class User { $sql = "DELETE FROM `user_vote` WHERE `user`='$this->id'"; $db_results = Dba::query($sql); + // Delete their shoutbox posts + $sql = "DELETE FROM `user_shout` WHERE `user='$this->id'"; + $db_results = Dba::query($sql); + // Delete the user itself $sql = "DELETE FROM `user` WHERE `id`='$this->id'"; $db_results = Dba::query($sql); |