summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/playlist.lib.php14
-rw-r--r--modules/lib.php95
-rw-r--r--playlist.php11
-rw-r--r--templates/show_playlist_box.inc.php7
-rw-r--r--templates/show_playlist_edit.inc.php51
-rw-r--r--templates/show_playlists.inc.php18
7 files changed, 84 insertions, 113 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index bc0b855d..a7d6ff49 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.3.2-Beta2
+ - Fixed a problem with the playlist update confirmation page
- Fixed css issues with preferences (Thx WarrenG)
- Added dump album art command line script and tweaked catalog
build display.
diff --git a/lib/playlist.lib.php b/lib/playlist.lib.php
index 4dd54c5f..253912e0 100644
--- a/lib/playlist.lib.php
+++ b/lib/playlist.lib.php
@@ -86,6 +86,20 @@ function show_playlist_menu() {
} // show_playlist_menu
/**
+ * show_playlist_edit
+ * This function shows the edit form for a playlist, nothing special here
+ */
+function show_playlist_edit($playlist_id) {
+
+ $playlist = new Playlist($playlist_id);
+ /* Chuck em out if they don't have the rights */
+ if (!$playlist->has_access()) { access_denied(); return false; }
+
+ require_once (conf('prefix') . '/templates/show_playlist_edit.inc.php');
+
+} // show_playlist_edit
+
+/**
* get_playlists
* This function takes private,adminprivate or public and returns an array of playlist objects
* that match, it checks permission
diff --git a/modules/lib.php b/modules/lib.php
index 98034290..8dcbb873 100644
--- a/modules/lib.php
+++ b/modules/lib.php
@@ -424,103 +424,10 @@ ECHO;
}
-
-function show_playlist_edit ( $playlist ) {
-
- $username = $GLOBALS['user']->username;
-
- if (check_playlist_access($playlist->id,$username) == false) {
- show_playlist_access_error($playlist, $username);
- return;
- }
-
- $plname = $playlist->name;
- $self = conf('web_path') . "/playlist.php";
-
- print <<<ECHO
-<form name="songs" method="post" action="$self">
-<input type="hidden" name="playlist_id" value="$playlist->id" />
-<table class="text-box">
- <tr class="header2">
- <td colspan="2">Editing Playlist</td>
- </tr>
- <tr>
- <td align="left"> Name: </td>
- <td align="left">
- <input type="text" name="new_playlist_name" value="$plname" size="20" />
- </td>
- </tr>
- <tr>
- <td align="left"> Type: </td>
- <td align="left">
- <select name="type">
-ECHO;
-
- if ($playlist->type == 'public') {
- echo "<option value=\"public\" selected=\"selected\">Public</option>";
- }
- else {
- echo "<option value=\"public\">Public</option>";
- }
-
- if ($playlist->type == 'private') {
- echo "<option value=\"private\" selected=\"selected\">Private</option>";
- }
- else {
- echo "<option value=\"private\">Private</option>";
- }
-
- print <<<ECHO
- </select>
- </td>
- </tr>
- <tr>
- <td align="left"> &nbsp; </td>
- <td align="left">
- <input type="submit" name="action" value="Update" />
- </td>
- </tr>
-</table>
-</form>
-ECHO;
-
-}
-
-
-// See if this user has access to work on this list
-function check_playlist_access ($playlist_id, $username) {
-
- $dbh = dbh();
-
- $sql = "SELECT playlist.id FROM playlist, user" .
- " WHERE playlist.id = '$playlist_id'" .
- " AND playlist.user = user.username" .
- " AND user.username = '$username'";
- $db_result = mysql_query($sql, $dbh);
-
- if ( mysql_num_rows($db_result) == 1) {
- return TRUE;
- }
- else {
- if (!conf('use_auth')) {
- return TRUE;
- }
- // check to see if this user is an admin
- if ($user = get_user($username)) {
- if ( $user->access == 'admin' ) {
- return TRUE;
- }
- }
- }
-
- // If we get here, access is denied
- return FALSE;
-
-}
-
/**
* show_playlist_dropdown
* Hacking this for now... will fix tomorrow evening
+ * Hmm Vollmer Lies... it's been a lot longer then said tomorrow evening...
*/
function show_playlist_dropdown ($playlist_id=0,$no_new=false) {
diff --git a/playlist.php b/playlist.php
index 828784bd..1f802202 100644
--- a/playlist.php
+++ b/playlist.php
@@ -112,7 +112,7 @@ switch ($action) {
show_confirmation(_('Playlist Created'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been created'),'playlist.php');
break;
case 'edit':
- show_playlist_edit($playlist);
+ show_playlist_edit($_REQUEST['playlist_id']);
break;
case 'new':
show_playlist_create();
@@ -127,7 +127,7 @@ switch ($action) {
$playlist->remove_songs($_REQUEST['song']);
show_playlist($playlist);
break;
- case 'update':
+ case 'update_playlist':
/* Make sure they've got thems rights */
if (!$playlist->has_access()) {
access_denied();
@@ -135,8 +135,11 @@ switch ($action) {
}
$playlist->update_type($_REQUEST['type']);
- $playlist->update_name($_REQUEST['new_playlist_name']);
- show_confirmation(_('Playlist Updated'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been updated'),'playlist.php?action=show_playlist&amp;playlist_id=' . $playlist->id);
+ $playlist->update_name($_REQUEST['playlist_name']);
+ $url = conf('web_path') . '/playlist.php?action=show_playlist&amp;playlist_id=' . $playlist->id;
+ $title = _('Playlist Updated');
+ $body = "$playlist->name " . _('has been updated and is now') . " $playlist->type";
+ show_confirmation($title,$body,$url);
break;
case 'show_playlist':
show_playlist($playlist);
diff --git a/templates/show_playlist_box.inc.php b/templates/show_playlist_box.inc.php
index 6e595743..98f5b680 100644
--- a/templates/show_playlist_box.inc.php
+++ b/templates/show_playlist_box.inc.php
@@ -34,14 +34,15 @@ $playlist_id = scrub_out($_REQUEST['playlist_id']);
<td>
<span class="header1"><?php echo _('Playlist Actions'); ?></span><br />
<ul class="text-action">
- <li><a href="<?php echo $web_path; ?>/playlist.php?action=new"><?php echo _('Create New Playlist'); ?></a></li>
- <li><a href="<?php echo $web_path; ?>/playlist.php"><?php echo _('View All Playlists'); ?></a></li>
- <li><a href="<?php echo $web_path; ?>/playlist.php?action=show_import_playlist"><?php echo _('Import From File'); ?></a></li>
<?php if ($_REQUEST['playlist_id']) { ?>
+ <li><a href="<?php echo $web_path; ?>/playlist.php?action=edit&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Edit Playlist'); ?></a></li>
<li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Normalize Tracks'); ?></a></li>
<li><a href="<?php echo $web_path; ?>/song.php?action=play_selected&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play This Playlist'); ?></a></li>
<li><a href="<?php echo $web_path; ?>/playlist.php?action=show_delete_playlist&amp;playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Delete This Playlist'); ?></a></li>
<?php } ?>
+ <li><a href="<?php echo $web_path; ?>/playlist.php?action=new"><?php echo _('Create New Playlist'); ?></a></li>
+ <li><a href="<?php echo $web_path; ?>/playlist.php"><?php echo _('View All Playlists'); ?></a></li>
+ <li><a href="<?php echo $web_path; ?>/playlist.php?action=show_import_playlist"><?php echo _('Import From File'); ?></a></li>
</ul>
</td>
</tr>
diff --git a/templates/show_playlist_edit.inc.php b/templates/show_playlist_edit.inc.php
new file mode 100644
index 00000000..afb12056
--- /dev/null
+++ b/templates/show_playlist_edit.inc.php
@@ -0,0 +1,51 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2006 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; either version 2
+ of the License, or (at your option) any later version.
+
+ 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.
+
+*/
+?>
+<form method="post" action="<?php echo $web_path; ?>/playlist.php" enctype="multipart/form-data">
+<table class="text-box">
+<tr>
+ <td colspan="2" class="header2"><?php echo _('Editing Playlist'); ?></td>
+</tr>
+<tr>
+ <td><?php echo _('Name'); ?>:</td>
+ <td align="left">
+ <input type="text" name="playlist_name" value="<?php echo scrub_out($playlist->name); ?>" size="<?php echo strlen($playlist->name)+3; ?>" />
+ </td>
+</tr>
+<tr>
+ <td valign="top"><?php echo _('Type'); ?>:</td>
+ <td>
+ <?php $select_name = 'selected_' . $playlist->type; ${$select_name} = "checked=\"checked\""; ?>
+ <input type="radio" name="type" value="public" <?php echo $selected_public; ?>/><?php echo _('Public'); ?><br />
+ <input type="radio" name="type" value="private" <?php echo $selected_private; ?>/><?php echo _('Private'); ?><br />
+ </td>
+</tr>
+<tr>
+ <td>&nbsp;</td>
+ <td>
+ <input type="hidden" name="playlist_id" value="<?php echo $playlist->id; ?>" />
+ <input type="hidden" name="action" value="update_playlist" />
+ <input type="submit" value="<?php echo _('Update'); ?>" />
+ </td>
+</tr>
+</table>
+</form>
diff --git a/templates/show_playlists.inc.php b/templates/show_playlists.inc.php
index c8feb382..a18cb651 100644
--- a/templates/show_playlists.inc.php
+++ b/templates/show_playlists.inc.php
@@ -49,27 +49,21 @@ foreach ($playlists as $playlist) {
<td><?php echo scrub_out($playlist_user->fullname); ?></td>
<td>
| <a href="<?php echo $web_path; ?>/playlist.php?action=show_playlist&amp;playlist_id=<?php echo $playlist->id; ?>">
- <?php echo _('View'); ?>
- </a>
+ <?php echo _('View'); ?></a>
<?php if (($GLOBALS['user']->username == $playlist->user) || ($GLOBALS['user']->has_access(100))) { ?>
| <a href="<?php echo $web_path; ?>/playlist.php?action=edit&amp;playlist_id=<?php echo $playlist->id; ?>">
- <?php echo _('Edit'); ?>
- </a>
+ <?php echo _('Edit'); ?></a>
| <a href="<?php echo $web_path; ?>/playlist.php?action=show_delete_playlist&amp;playlist_id=<?php echo $playlist->id; ?>">
- <?php echo _('Delete'); ?>
- </a>
+ <?php echo _('Delete'); ?></a>
<?php } ?>
<?php if ($count > 0) { ?>
| <a href="<?php echo $web_path; ?>/song.php?action=playlist&amp;playlist_id=<?php echo $playlist->id; ?>">
- <?php echo _('Play'); ?>
- </a>
+ <?php echo _('Play'); ?></a>
| <a href="<?php echo $web_path; ?>/song.php?action=playlist_random&amp;playlist_id=<?php echo $playlist->id; ?>">
- <?php echo _('Random'); ?>
- </a>
+ <?php echo _('Random'); ?></a>
<?php if (batch_ok()) { ?>
| <a href="<?php echo $web_path; ?>/batch.php?action=pl&amp;id=<?php echo $playlist->id; ?>">
- <?php echo _('Download'); ?>
- </a>
+ <?php echo _('Download'); ?></a>
<?php } ?>
<?php } ?>
|