From 6bd576a9fe2524f5c662767206efdebf0b43c8ab Mon Sep 17 00:00:00 2001 From: pb1dft Date: Sat, 23 Feb 2008 23:44:31 +0000 Subject: - Fixed Sorting on Admin->Browse Users - Fixed Shoutbox and shoutbox management (pb1dft) --- admin/shout.php | 58 ++++++++++++++++++++++++++++++++ docs/CHANGELOG | 2 ++ lib/class/browse.class.php | 4 +-- lib/class/shoutbox.class.php | 46 +++++++++++++++++++++++++ lib/class/user.class.php | 4 +++ lib/rss.php | 2 +- lib/stream.lib.php | 4 +-- register.php | 2 +- shout.php | 9 +---- templates/show_add_shout.inc.php | 2 +- templates/show_edit_shout.inc.php | 46 +++++++++++++++++++++++++ templates/show_manage_shoutbox.inc.php | 9 +++++ templates/show_shout_row.inc.php | 17 +++++++--- templates/show_user_registration.inc.php | 2 +- templates/sidebar_admin.inc.php | 2 +- 15 files changed, 188 insertions(+), 21 deletions(-) create mode 100644 admin/shout.php create mode 100644 templates/show_edit_shout.inc.php diff --git a/admin/shout.php b/admin/shout.php new file mode 100644 index 00000000..9a398c5e --- /dev/null +++ b/admin/shout.php @@ -0,0 +1,58 @@ +object_type,$shout->object_id); + $object->format(); + $client = new User($shout->user); + $client->format(); + require_once Config::get('prefix') . '/templates/show_edit_shout.inc.php'; + break; + case 'delete': + $shout_id = shoutBox::delete($_REQUEST['shout_id']); + show_confirmation(_('Shoutbox Post Deleted'),'','admin/shout.php'); + break; + default: + Browse::set_type('shoutbox'); + Browse::set_simple_browse(1); + $shoutbox_ids = Browse::get_objects(); + Browse::show_objects($shoutbox_ids); + break; +} // end switch on action + +show_footer(); +?> diff --git a/docs/CHANGELOG b/docs/CHANGELOG index fcb21b05..757d9e81 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.4-Beta2 + - Fixed Sorting on Admin->Browse Users + - Fixed Shoutbox and shoutbox management (pb1dft) - Fixed some minor glitches in user registration ( pb1dft ) - Fixed typo that caused mail to always mail to everyone. - Fixed an issue with user auth in XML API always registering as 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); diff --git a/lib/rss.php b/lib/rss.php index 7f583380..99c7ebaf 100644 --- a/lib/rss.php +++ b/lib/rss.php @@ -201,7 +201,7 @@ switch ($type) { $song = new Song($item['object_id']); $song->format(); $user = new User($item['user']); - $user->format_user(); + $user->format(); echo " <![CDATA[$song->title]]>\n"; echo " $web_path/stream.php?action=single_song&song_id=".$item['object_id']."\n"; echo " fullname played $song->title - $song->f_artist $time_string]]>\n"; diff --git a/lib/stream.lib.php b/lib/stream.lib.php index 588f9251..89ba2b87 100644 --- a/lib/stream.lib.php +++ b/lib/stream.lib.php @@ -26,8 +26,8 @@ function show_now_playing() { // GC! - Stream::gc_session(); - Stream::gc_now_playing(); +// Stream::gc_session(); +// Stream::gc_now_playing(); $web_path = Config::get('web_path'); $results = get_now_playing(); diff --git a/register.php b/register.php index f0b3fc4b..28981e30 100644 --- a/register.php +++ b/register.php @@ -39,7 +39,7 @@ require_once Config::get('prefix') . '/modules/validatemail/validateEmail.php'; /* Don't even include it if we aren't going to use it */ if (Config::get('captcha_public_reg')) { define ("CAPTCHA_INVERSE", 1); - require_once Config::get('prefix') . '/modules/captcha/captcha.php'; + include Config::get('prefix') . '/modules/captcha/captcha.php'; } diff --git a/shout.php b/shout.php index 728100e6..21a2d303 100644 --- a/shout.php +++ b/shout.php @@ -30,7 +30,6 @@ switch ($_REQUEST['action']) { access_denied(); exit; } - $shout_id = shoutBox::create($_POST); header("Location:" . Config::get('web_path')); break; @@ -41,14 +40,8 @@ switch ($_REQUEST['action']) { // Now go ahead and display the page where we let them add a comment etc require_once Config::get('prefix') . '/templates/show_add_shout.inc.php'; break; - case 'show_manage': - Browse::set_type('shoutbox'); - Browse::set_simple_browse(1); - $shoutbox_ids = Browse::get_objects(); - Browse::show_objects($shoutbox_ids); - break; default: - + header("Location:" . Config::get('web_path')); break; } // end switch on action diff --git a/templates/show_add_shout.inc.php b/templates/show_add_shout.inc.php index 9d1ead88..c52565f2 100644 --- a/templates/show_add_shout.inc.php +++ b/templates/show_add_shout.inc.php @@ -31,7 +31,7 @@ - + diff --git a/templates/show_edit_shout.inc.php b/templates/show_edit_shout.inc.php new file mode 100644 index 00000000..2709b90d --- /dev/null +++ b/templates/show_edit_shout.inc.php @@ -0,0 +1,46 @@ + + +
+ + + + + + + + + + + + + + + +
Created by: f_link; ?> for f_link; ?> +
Comment: +
sticky == "1") { echo "checked"; } ?>/>
+ +
+
+ diff --git a/templates/show_manage_shoutbox.inc.php b/templates/show_manage_shoutbox.inc.php index 33c10c2d..9394aaab 100644 --- a/templates/show_manage_shoutbox.inc.php +++ b/templates/show_manage_shoutbox.inc.php @@ -27,6 +27,7 @@ $web_path = Config::get('web_path'); + @@ -34,11 +35,18 @@ $web_path = Config::get('web_path'); + format(); + $object = shoutBox::get_object($shout->object_type,$shout->object_id); + $object->format(); + $client = new User($shout->user); + $client->format(); + require Config::get('prefix') . '/templates/show_shout_row.inc.php'; ?> @@ -51,6 +59,7 @@ foreach ($object_ids as $shout_id) { + diff --git a/templates/show_shout_row.inc.php b/templates/show_shout_row.inc.php index 25990cca..a57b8594 100644 --- a/templates/show_shout_row.inc.php +++ b/templates/show_shout_row.inc.php @@ -21,10 +21,19 @@ ?> - f_name; ?> - f_user; ?> - sticky; ?> - comment); ?> + f_link; ?> + f_link; ?> + sticky; ?> + text); ?> + date; ?> + + + + + + + + diff --git a/templates/show_user_registration.inc.php b/templates/show_user_registration.inc.php index 43cdbbea..f35e6bfe 100644 --- a/templates/show_user_registration.inc.php +++ b/templates/show_user_registration.inc.php @@ -123,7 +123,7 @@ if (Config::get('user_agreement')) { ?> - + diff --git a/templates/sidebar_admin.inc.php b/templates/sidebar_admin.inc.php index fbe589fa..d5f25803 100644 --- a/templates/sidebar_admin.inc.php +++ b/templates/sidebar_admin.inc.php @@ -49,7 +49,7 @@
  • -
  • +
  • -- cgit