summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--admin/shout.php58
-rwxr-xr-xdocs/CHANGELOG2
-rw-r--r--lib/class/browse.class.php4
-rw-r--r--lib/class/shoutbox.class.php46
-rw-r--r--lib/class/user.class.php4
-rw-r--r--lib/rss.php2
-rw-r--r--lib/stream.lib.php4
-rw-r--r--register.php2
-rw-r--r--shout.php9
-rw-r--r--templates/show_add_shout.inc.php2
-rw-r--r--templates/show_edit_shout.inc.php46
-rw-r--r--templates/show_manage_shoutbox.inc.php9
-rw-r--r--templates/show_shout_row.inc.php17
-rw-r--r--templates/show_user_registration.inc.php2
-rw-r--r--templates/sidebar_admin.inc.php2
15 files changed, 188 insertions, 21 deletions
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 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 ampache.org
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License v2
+ as published by the Free Software Foundation
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+require_once '../lib/init.php';
+
+if (!Access::check('interface','100')) {
+ access_denied();
+ exit;
+}
+
+show_header();
+
+// Switch on the incomming action
+switch ($_REQUEST['action']) {
+ case 'edit_shout':
+ $shout_id = $_POST['shout_id'];
+ $update = shoutBox::update($_POST);
+ show_confirmation(_('Shoutbox Post Updated'),'','admin/shout.php');
+ break;
+ case 'show_edit':
+ $shout = new shoutBox($_REQUEST['shout_id']);
+ $object = shoutBox::get_object($shout->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 " <title><![CDATA[$song->title]]></title>\n";
echo " <link>$web_path/stream.php?action=single_song&amp;song_id=".$item['object_id']."</link>\n";
echo " <description><![CDATA[$user->fullname played $song->title - $song->f_artist $time_string]]></description>\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 @@
</tr>
<?php if (Access::check('interface','50')) { ?>
<tr>
- <td><input type="checkbox" name="sticky" value="0" /> <strong><?php echo _('Make Sticky'); ?></strong></td>
+ <td><input type="checkbox" name="sticky" /> <strong><?php echo _('Make Sticky'); ?></strong></td>
</tr>
<?php } ?>
<tr>
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 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 Ampache.org
+ All rights reserved.
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; version 2
+ of the License.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+?>
+<?php show_box_top(_('Edit existing Shoutbox Post')); ?>
+<form method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/admin/shout.php?action=edit_shout">
+<input type="hidden" name="shout_id" value="<?php echo $shout->id; ?>" />
+<table class="tabledata" cellpadding="0" cellspacing="0">
+<tr>
+ <td><strong>Created by: <?php echo $client->f_link; ?> for <?php echo $object->f_link; ?></strong>
+<tr>
+<tr>
+ <td><strong>Comment:</strong>
+</tr>
+<tr>
+ <td><textarea rows="5" cols="70" name="comment"><?php echo $shout->text; ?></textarea></td>
+</tr>
+<tr>
+ <td><input type="checkbox" name="sticky" <?php if ($shout->sticky == "1") { echo "checked"; } ?>/> <strong><?php echo _('Make Sticky'); ?></strong></td>
+</tr>
+<tr>
+ <td>
+ <input type="submit" value="<?php echo _('Update'); ?>" />
+ </td>
+</tr>
+</table>
+</form>
+<?php show_box_bottom(); ?>
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');
<col id="col_username" />
<col id="col_sticky" />
<col id="col_comment" />
+ <col id="col_date />
<col id="col_action" />
</colgroup>
<tr class="th-top">
@@ -34,11 +35,18 @@ $web_path = Config::get('web_path');
<th class="cel_username"><?php echo _('User'); ?></th>
<th class="cel_flag"><?php echo _('Sticky'); ?></th>
<th class="cel_comment"><?php echo _('Comment'); ?></th>
+ <th class="cel_date"><?php echo _('Date Added'); ?></th>
<th class="cel_action"><?php echo _('Action'); ?></th>
</tr>
<?php
foreach ($object_ids as $shout_id) {
$shout = new shoutBox($shout_id);
+ $shout->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';
?>
<?php } if (!count($object_ids)) { ?>
@@ -51,6 +59,7 @@ foreach ($object_ids as $shout_id) {
<th class="cel_username"><?php echo _('User'); ?></th>
<th class="cel_sticky"><?php echo _('Sticky'); ?></th>
<th class="cel_comment"><?php echo _('Comment'); ?></th>
+ <th class="cel_date"><?php echo _('Date Added'); ?></th>
<th class="cel_action"><?php echo _('Action'); ?></th>
</tr>
</table>
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 @@
?>
<tr id="flagged_<?php echo $shout->id; ?>" class="<?php echo flip_class(); ?>">
- <td class="cel_object"><?php echo $shout->f_name; ?></td>
- <td class="cel_username"><?php echo $shout->f_user; ?></td>
- <td class="cel_sticky"><?php $shout->sticky; ?></td>
- <td class="cel_comment"><?php echo scrub_out($shout->comment); ?></td>
+ <td class="cel_object"><?php echo $object->f_link; ?></td>
+ <td class="cel_username"><?php echo $client->f_link; ?></td>
+ <td class="cel_sticky"><?php echo $shout->sticky; ?></td>
+ <td class="cel_comment"><?php echo scrub_out($shout->text); ?></td>
+ <td class="cel_date"><?php echo $shout->date; ?></td>
<td class="cel_action">
+
+ <a href="<?php echo $web_path; ?>/admin/shout.php?action=show_edit&amp;shout_id=<?php echo $shout->id; ?>">
+ <?php echo get_user_icon('edit'); ?>
+ </a>
+
+ <a href="<?php echo $web_path; ?>/admin/shout.php?action=delete&amp;shout_id=<?php echo $shout->id; ?>">
+ <?php echo get_user_icon('delete'); ?>
+ </a>
</td>
</tr>
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')) { ?>
</tr>
</table>
<?php if (Config::get('captcha_public_reg')) { ?>
- <?php echo captcha::form(); ?>
+ <?php echo captcha::form("&rarr;&nbsp;"); ?>
<?php Error::display('captcha'); ?>
<?php } ?>
<table>
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 @@
<li id="sb_admin_ot_ExportCatalog"><a href="<?php echo $web_path; ?>/admin/export.php"><?php echo _('Export Catalog'); ?></a></li>
<li id="sb_admin_ot_ManageFlagged"><a href="<?php echo $web_path; ?>/admin/flag.php"><?php echo _('Manage Flagged'); ?></a></li>
<?php if (Config::get('shoutbox')) { ?>
- <li id="sb_admin_ot_ManageShoutbox"><a href="<?php echo $web_path; ?>/shout.php?action=show_manage"><?php echo _('Manage Shoutbox'); ?></a></li>
+ <li id="sb_admin_ot_ManageShoutbox"><a href="<?php echo $web_path; ?>/admin/shout.php"><?php echo _('Manage Shoutbox'); ?></a></li>
<?php } ?>
</ul>
</li>