diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-04 09:01:36 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-01-04 09:01:36 +0000 |
commit | ffac7359918b54193dab135d2ab7310271f5902b (patch) | |
tree | 5c8343c419b90ca2c06c2773691ecc8863f9983a | |
parent | 4e9823cd1064cc876b449752b933c89c367d84c6 (diff) | |
download | ampache-ffac7359918b54193dab135d2ab7310271f5902b.tar.gz ampache-ffac7359918b54193dab135d2ab7310271f5902b.tar.bz2 ampache-ffac7359918b54193dab135d2ab7310271f5902b.zip |
fixed a few more playlist functions... cleaned up some code...
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 4 | ||||
-rw-r--r-- | lib/class/playlist.class.php | 4 | ||||
-rw-r--r-- | lib/class/song.class.php | 2 | ||||
-rw-r--r-- | playlist.php | 5 | ||||
-rw-r--r-- | templates/add_catalog.inc | 3 | ||||
-rw-r--r-- | templates/admin_menu.inc | 55 | ||||
-rw-r--r-- | templates/catalog.inc | 15 | ||||
-rw-r--r-- | templates/customize_catalog.inc | 8 | ||||
-rw-r--r-- | templates/header.inc | 2 | ||||
-rw-r--r-- | templates/list_duplicates.inc | 42 |
11 files changed, 38 insertions, 105 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index d60b2d32..86ed47a5 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -6,7 +6,8 @@ v.3.3.2-Beta1 - Added the Import From File action for playlists back. The link was just missing - - Fixed SQL errors with Windows + Mysql5.x (Thx WarrenG) + - Fixed SQL errors with Windows + Mysql5.x songs with empty + genres, are now given a Unknown genre value (Thx WarrenG) - Rewrote entire Playlist class and document to use the new id field in database, also added support for playlist tracks that are based on search critera. NOT FINISHED! diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 19cfd0ba..e7b6357b 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -856,7 +856,7 @@ class Catalog { $new_song->artist = $this->check_artist($artist); $new_song->f_artist = $artist; $new_song->genre = $this->check_genre($genre); - $new_song->f_genre = $genre; + $new_song->f_genre = $new_song->get_genre_name(); $new_song->album = $this->check_album($album,$new_song->year); $new_song->f_album = $album . " - " . $new_song->year; $new_song->title = $this->check_title($new_song->title,$new_song->file); @@ -1793,7 +1793,7 @@ class Catalog { function check_genre($genre) { /* If a genre isn't specified force one */ - if (strlen($genre) < 1) { + if (strlen(trim($genre)) < 1) { $genre = "Unknown (Orphaned)"; } diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 0ab165cd..23b1f5f2 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -224,10 +224,10 @@ class Playlist { } // update_name /** - * update_item + * _update_item * This is the generic update function, it does the escaping and error checking */ - function update_item($field,$value,$level) { + function _update_item($field,$value,$level) { if ($GLOBALS['user']->username != $this->user AND !$GLOBALS['user']->has_access($level)) { return false; diff --git a/lib/class/song.class.php b/lib/class/song.class.php index e0f7dd36..35fca013 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -109,7 +109,7 @@ class Song { "title,bitrate,rate,mode,size,time,track,genre,played,song.enabled,update_time,". "addition_time,flagged.id as flagid,flagged.user as flaguser,flagged.type ". "as flagtype,flagged.date as flagdate,flagged.comment as flagcomment FROM ". - "song LEFT JOIN flagged ON song.id = flagged.song WHERE song.id = '$this->id'"; + "song LEFT JOIN flagged ON song.id = flagged.song WHERE song.id = '" . sql_escape($this->id) . "'"; $db_results = mysql_query($sql, dbh()); $results = mysql_fetch_object($db_results); diff --git a/playlist.php b/playlist.php index 975e2ec8..02b64665 100644 --- a/playlist.php +++ b/playlist.php @@ -54,7 +54,7 @@ switch ($action) { /* Show Confirmation Question */ $message = _('Are you sure you want to delete this playlist') . " " . $playlist->name . "?"; - show_confirm_action(_('Confirm Delete Request'),$message,'playlist.php','action=delete_playlist&playlist_id=' . $playlist->id); + show_confirm_action($message,'playlist.php','action=delete_playlist&playlist_id=' . $playlist->id); break; case 'add_to': case 'add to': @@ -74,12 +74,11 @@ switch ($action) { if ($GLOBALS['user']->username != $playlist->user && !$GLOBALS['user']->has_access(100)) { access_denied(); } - if ($_REQUEST['type'] == 'album') { $song_ids = get_songs_from_type($_REQUEST['type'],$_REQUEST['song_ids'],$_REQUEST['artist_id']); } else { - $song_ids = $_REQUEST['song_ids']; + $song_ids = $_REQUEST['song']; } /* Add the songs */ diff --git a/templates/add_catalog.inc b/templates/add_catalog.inc index f0493269..5d156d99 100644 --- a/templates/add_catalog.inc +++ b/templates/add_catalog.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + $default_id3 = "/usr/bin/id3v2 -a "%a" -A "%A" -t "%t" -g %g -y %y -T %T -c "%c" %filename"; $default_rename = "%a - %T - %t"; $default_sort = "%a/%A"; diff --git a/templates/admin_menu.inc b/templates/admin_menu.inc deleted file mode 100644 index f87d85eb..00000000 --- a/templates/admin_menu.inc +++ /dev/null @@ -1,55 +0,0 @@ -<?php -/* - - Copyright (c) 2001 - 2005 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. - -*/ - -/* - - @header - A template file - -*/ - -$web_path = conf('web_path'); - -$items = array( - _("Users") => "$web_path/admin/users.php", - _("Mail Users") => "$web_path/admin/mail.php", - _("Catalog") => "$web_path/admin/catalog.php", - _("Admin Preferences") => "$web_path/admin/preferences.php", - _("Access Lists") => "$web_path/admin/access.php" - ); - -?> -<ul id="adminmenu"> - - <?php - foreach ( array_keys($items) as $item ) { - if ( _($admin_highlight) == $item ) { - echo "<li class=\"active\"><a class=\"active\" href=\"$items[$item]\">" . $item . "</a></li>\n"; - } - else { - echo "<li><a href=\"$items[$item]\">" . $item . "</a></li>\n"; - } - } - - ?> -</ul> -<br /> diff --git a/templates/catalog.inc b/templates/catalog.inc index 79030725..ab2fb3f3 100644 --- a/templates/catalog.inc +++ b/templates/catalog.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -19,15 +19,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* - - @header - A template file - -*/ - +/** + * Catalog Display + * This template displays all of the catalogs... Currently it's a little cluttered + * It would be great if someone cleaned this up + */ ?> - <br /> <?php if (!function_exists('iconv')) { ?> <div class="fatalerror"><?php echo _("Error: ICONV not found, ID3V2 Tags will not import correctly. See <a href=\"http://php.oregonstate.edu/iconv\">Iconv</a> for information on getting ICONV"); ?></div> diff --git a/templates/customize_catalog.inc b/templates/customize_catalog.inc index 464149ad..a0813036 100644 --- a/templates/customize_catalog.inc +++ b/templates/customize_catalog.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -44,13 +44,13 @@ <tr> <td><?php echo _("ID3 set command"); ?>:</td> <td> - <input size="60" type="text" name="id3_set_command" value="<?php echo htmlspecialchars($catalog->id3_set_command); ?>" /> + <input size="60" type="text" name="id3_set_command" value="<?php echo scrub_out($catalog->id3_set_command); ?>" /> </td> </tr> <tr> <td><?php echo _("Filename pattern"); ?>:</td> <td> - <input size="60" type="text" name="rename_pattern" value="<?php echo htmlspecialchars($catalog->rename_pattern); ?>" /> + <input size="60" type="text" name="rename_pattern" value="<?php echo scrub_out($catalog->rename_pattern); ?>" /> </td> </tr> <tr> @@ -58,7 +58,7 @@ <?php echo _("Folder Pattern"); ?>:<br /><?php echo _("(no leading or ending '/')"); ?> </td> <td> - <input size="60" type="text" name="sort_pattern" value="<?php echo htmlspecialchars($catalog->sort_pattern);?>" /> + <input size="60" type="text" name="sort_pattern" value="<?php echo scrub_out($catalog->sort_pattern);?>" /> </td> </tr> <tr> diff --git a/templates/header.inc b/templates/header.inc index d69cee63..91700508 100644 --- a/templates/header.inc +++ b/templates/header.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/templates/list_duplicates.inc b/templates/list_duplicates.inc index eef2eba0..8bf052dc 100644 --- a/templates/list_duplicates.inc +++ b/templates/list_duplicates.inc @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2005 Ampache.org + Copyright (c) 2001 - 2006 Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -19,37 +19,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - - -/*! - @header - A template file for listing duplicate songs - -*/ ?> <?php show_duplicate_searchbox($search_type) ?> <?php if ( $flags ) { ?> <form method="post" enctype="multipart/form-data" action="<?php echo conf('web_path') . "/admin/song.php?action=disable"; ?>"> -<p style="font-size: 10pt; font-weight: bold;">Duplicate Songs</p> +<p class="header1"><?php echo _('Duplicate Songs'); ?></p> <table class="tabledata" cellspacing="0" cellpadding="0" > <tr class="table-header"> - <td>Disable</td> - <td>Song</td> - <td>Artist</td> - <td>Album</td> - <td>Length</td> - <td>Bitrate</td> - <td>Size</td> - <td>Filename</td> + <td><?php echo _('Disable'); ?></td> + <td><?php echo _('Song'); ?></td> + <td><?php echo _('Artist'); ?></td> + <td><?php echo _('Album'); ?></td> + <td><?php echo _('Length'); ?></td> + <td><?php echo _('Bitrate'); ?></td> + <td><?php echo _('Size'); ?></td> + <td><?php echo _('Filename'); ?></td> </tr> <?php - $class="odd"; foreach ($flags as $flag) { $song = new Song($flag['song']); $song->format_song(); - $class = (++$i%2)?'odd':'even'; $alt_title = $song->title; $formated_title = $song->f_title; @@ -59,11 +50,11 @@ $dinfolist = get_duplicate_info($song,$search_type); foreach ($dinfolist as $dinfo) { - echo "<tr class=\"".$class."\">". + echo "<tr class=\"".flip_class()."\">". "<td><input type=\"checkbox\" name=\"song_ids[]\" value=\"" . $dinfo['songid'] . "\" /></td>". - "<td><a href=\"".conf('web_path')."/song.php?action=m3u&song=$song->id\">".htmlspecialchars($formated_title)."</a> </td>". - "<td><a href=\"".conf('web_path')."/artists.php?action=show&artist=".$dinfo['artistid']."\" title=\"".htmlspecialchars($dinfo['artist'])."\">".htmlspecialchars($dinfo['artist'])."</a> </td>". - "<td><a href=\"".conf('web_path')."/albums.php?action=show&album=".$dinfo['albumid']."\" title=\"".htmlspecialchars($dinfo['album'])."\">".htmlspecialchars($dinfo['album'])."</a> </td>". + "<td><a href=\"".conf('web_path')."/song.php?action=m3u&song=$song->id\">".scrub_out($formated_title)."</a> </td>". + "<td><a href=\"".conf('web_path')."/artists.php?action=show&artist=".$dinfo['artistid']."\" title=\"".scrub_out($dinfo['artist'])."\">".scrub_out($dinfo['artist'])."</a> </td>". + "<td><a href=\"".conf('web_path')."/albums.php?action=show&album=".$dinfo['albumid']."\" title=\"".scrub_out($dinfo['album'])."\">".scrub_out($dinfo['album'])."</a> </td>". "<td>".floor($dinfo['time']/60).":".sprintf("%02d", ($dinfo['time']%60) )."</td>". "<td>".intval($dinfo['bitrate']/1000)."</td>". "<td>".sprintf("%.2f", ($dinfo['size']/1000000))."Mb</td>". @@ -76,11 +67,10 @@ } ?> <tr> -<td colspan="8" class="<?php echo $class; ?>"><input height="15" type="submit" value="Disable Songs" /></td> +<td colspan="8" class="<?php echo flip_class(); ?>"><input height="15" type="submit" value="Disable Songs" /></td> </tr> </table> <?php } else { ?> - -<p> You don't have any duplicate songs. </p> +<p><?php _('You don't have any duplicate songs.'); ?></p> <?php } ?> </form> |