summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/browse.class.php4
-rw-r--r--lib/class/shoutbox.class.php46
-rw-r--r--lib/class/user.class.php4
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);