diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-01-07 20:35:49 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-01-07 20:35:49 +0000 |
commit | b6cfe134badb2d4393e9081b13b2dfca011ed736 (patch) | |
tree | 4f6213e626fa90b4b280b5e663e791559c4a7f8f | |
parent | 90d2acbc54b24b6e8207e12f1cabcbc7541ca447 (diff) | |
download | ampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.tar.gz ampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.tar.bz2 ampache-b6cfe134badb2d4393e9081b13b2dfca011ed736.zip |
* Re-worked Main page of Ampache, adding Album of the moment.
* Moved stats to /stats.php page
* Fixed logic error in resize that could cause nothign to display
if resize was on, but it still failed
* Fixed Upload Album art from Find Album Art
* Added Menu to the TV page
* Fixed logic error that showed localplay if user had access
regardless of global config
* Changed default action of browse.php to song browse
-rw-r--r-- | albums.php | 31 | ||||
-rw-r--r-- | browse.php | 13 | ||||
-rwxr-xr-x | docs/CHANGELOG | 12 | ||||
-rw-r--r-- | image.php | 5 | ||||
-rw-r--r-- | index.php | 50 | ||||
-rw-r--r-- | lib/album.lib.php | 24 | ||||
-rw-r--r-- | lib/class/album.class.php | 3 | ||||
-rw-r--r-- | lib/class/catalog.class.php | 200 | ||||
-rw-r--r-- | lib/ui.lib.php | 8 | ||||
-rw-r--r-- | stats.php | 8 | ||||
-rw-r--r-- | templates/show_all_popular.inc.php | 25 | ||||
-rw-r--r-- | templates/show_all_recent.inc.php | 13 | ||||
-rw-r--r-- | templates/show_index.inc.php | 37 | ||||
-rw-r--r-- | templates/show_random_albums.inc.php | 42 | ||||
-rw-r--r-- | templates/show_tv.inc.php | 17 | ||||
-rw-r--r-- | templates/sidebar.inc.php | 4 | ||||
-rw-r--r-- | tv.php | 3 |
17 files changed, 226 insertions, 269 deletions
@@ -85,12 +85,29 @@ switch ($action) { break; case 'find_art': - + + // If not a user then kick em out if (!$GLOBALS['user']->has_access('25')) { access_denied(); exit; } - + // get the Album information $album = new Album($_REQUEST['album_id']); + // If we've got an upload ignore the rest and just insert it + if (!empty($_FILES['file']['tmp_name'])) { + $path_info = pathinfo($_FILES['file']['name']); + $upload['file'] = $_FILES['file']['tmp_name']; + $upload['mime'] = 'image/' . $path_info['extension']; + $image_data = get_image_from_source($upload); + + if ($image_data) { + $album->insert_art($image_data,$upload['0']['mime']); + show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=" . $_REQUEST['album_id']); + break; + + } // if image data + + } // if it's an upload + // Build the options for our search if (isset($_REQUEST['artist_name'])) { $artist = scrub_in($_REQUEST['artist_name']); @@ -108,13 +125,19 @@ switch ($action) { $options['artist'] = $artist; $options['album_name'] = $album_name; $options['keyword'] = $artist . " " . $album_name; - $options['url'] = $_REQUEST['cover']; // HACK that makes baby jesus cry... $options['skip_id3'] = true; // Attempt to find the art. $images = $album->find_art($options,'6'); + if (isset($_REQUEST['cover'])) { + $path_info = pathinfo($_REQUEST['cover']); + $cover_url[0]['url'] = scrub_in($_REQUEST['cover']); + $cover_url[0]['mime'] = 'image/' . $path_info['extension']; + } + $images = array_merge($cover_url,$images); + // We don't want to store raw's in here so we need to strip them out into a seperate array foreach ($images as $index=>$image) { if (isset($image['raw'])) { @@ -155,8 +178,8 @@ switch ($action) { $album = new Album($album_id); $album->insert_art($image,$mime); - show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id"); + show_confirmation(_('Album Art Inserted'),'',"/albums.php?action=show&album=$album_id"); break; case 'update_from_tags': @@ -105,6 +105,7 @@ switch($action) { } break; + default: case 'song_title': /* Create the Needed Object */ $song = new Song(); @@ -144,18 +145,6 @@ switch($action) { case 'catalog': break; - /* Throw recently added, updated here */ - default: - show_box_top(); - /* Show Most Popular artist/album/songs */ - show_all_popular(); - - /* Show Recent Additions */ - show_all_recent(); - show_box_bottom(); - - break; - } // end Switch $action /* Show the Footer */ diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 79b41f1e..9901b6f9 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,18 @@ -------------------------------------------------------------------------- v.3.3.3 + - Fixed a img resize logic error that could cause no art to + display if resize was on and resize failed + - Added Albums of the Moment to the Front page and removed the + stats information + - Moved Popular/Recent to /stats.php and made Browse by Song the + default browse action + - Fixed missing clean of Genre stats information and a logic + flaw with order of clean functions in the catalog clean + - Fixed Localplay page appearing even if disabled by Admin Config + if user still had distinct permissions + - Added Menu to TV page per request + - Fixed Album Art Upload and Cover URL methods - Fixed play lock with Democratic Play if song no longer exists - Fixed a display issue of the Now Playing on the Democratic play page @@ -59,7 +59,6 @@ switch ($_REQUEST['type']) { $image = get_image_from_source($_SESSION['form']['images'][$key]); $mime = $_SESSION['form']['images'][$key]['mime']; - $data = explode("/",$mime); $extension = $data['1']; @@ -88,11 +87,11 @@ switch ($_REQUEST['type']) { $extension = $data['1']; header("Content-type: $mime"); header("Content-Disposition: filename=" . $album->name . "." . $extension); - if (!$_REQUEST['thumb']) { + if (empty($_REQUEST['thumb'])) { echo $art; } elseif (!img_resize($art,$size,$extension)) { - echo $art; + echo $art; } break; } // end switch type @@ -41,49 +41,9 @@ if (conf('refresh_limit') > 5) { $ajax_url = str_replace("&","&",$ajax_url); require_once(conf('prefix') . '/templates/javascript_refresh.inc.php'); } + +require_once(conf('prefix') . '/templates/show_index.inc.php'); + +show_footer(); + ?> -<div id="np_data"> - <?php show_now_playing(); ?> -</div> <!-- Close Now Playing Div --> -<!-- Recently Played --> -<div id="recently_played"> - <?php - $data = get_recently_played(); - if (count($data)) { require_once(conf('prefix') . '/templates/show_recently_played.inc.php'); } - ?> -</div> -<!-- Big Daddy Table --> -<?php show_box_top(); ?> -<table id="biddaddy"><!-- The Table --> - <tr> - <td valign="top"> - <?php show_local_catalog_info(); ?> - </td> - <td valign="top"> - <?php - if ($items = get_global_popular('album')) { - show_info_box(_('Most Popular Albums'), 'album',$items); - } - ?> - </td> - </tr> - <tr> - <td valign="top"> - <?php - if ($items = get_global_popular('artist')) { - show_info_box(_('Most Popular Artists'), 'artist', $items); - } - ?> - </td> - <td valign="top"> - <?php - if ($items = get_newest('album')) { - show_info_box(_('Newest Album Additions'), '', $items); - } - ?> - </td> - </tr> - </table><!-- End Left table --> -<?php show_box_bottom(); ?> -<!-- End Big Daddy Table --> -<?php show_footer(); ?> diff --git a/lib/album.lib.php b/lib/album.lib.php index d01691b2..134e040e 100644 --- a/lib/album.lib.php +++ b/lib/album.lib.php @@ -59,4 +59,28 @@ function get_image_from_source($data) { } // get_image_from_source +/** + * get_random_albums + * This returns a random number of albums from the catalogs + * this is used by the index to return some 'potential' albums to play + */ +function get_random_albums($count='') { + + if (!$count) { $count = 5; } + + $count = sql_escape($count); + + $sql = "SELECT id FROM album ORDER BY RAND() LIMIT $count"; + $db_results = mysql_query($sql,dbh()); + + $results = array(); + + while ($r = mysql_fetch_assoc($db_results)) { + $results[] = $r['id']; + } + + return $results; + +} // get_random_albums + ?> diff --git a/lib/class/album.class.php b/lib/class/album.class.php index 24f4fac3..6358f489 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -155,11 +155,12 @@ class Album { $this->f_name = "<a href=\"$web_path/albums.php?action=show&album=" . $this->id . "\" title=\"" . scrub_out($this->name) . "\">" . $name . "</a>"; $this->f_link = "<a href=\"$web_path/albums.php?action=show&album=" . scrub_out($this->id) . "\" title=\"" . scrub_out($this->name) . "\">" . $name . "</a>"; $this->f_songs = "<div align=\"center\">" . $this->songs . "</div>"; + if ($this->artist_count == '1') { $this->f_artist = "<a href=\"$web_path/artists.php?action=show&artist=" . $this->artist_id . "\">" . $artist . "</a>"; } else { - $this->f_artist = _("Various"); + $this->f_artist = _('Various'); } if ($this->year == '0') { diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index 311cf457..db60e18c 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -1252,10 +1252,11 @@ class Catalog { */ $this->clean_albums(); $this->clean_artists(); - $this->clean_stats(); $this->clean_playlists(); $this->clean_flagged(); $this->clean_genres(); + $this->clean_stats(); + $this->clean_ext_info(); /* Return dead files, so they can be listed */ if ($verbose) { @@ -1326,25 +1327,6 @@ class Catalog { */ function clean_genres() { - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",mysql_get_server_info())) { - $sql = "SELECT genre.id FROM genre LEFT JOIN song ON song.genre = genre.id WHERE song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - - $sql = "DELETE FROM genre WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - return true; - } - /* Do a complex delete to get albums where there are no songs */ $sql = "DELETE FROM genre USING genre LEFT JOIN song ON song.genre = genre.id WHERE song.id IS NULL"; $db_results = mysql_query($sql, dbh()); @@ -1359,25 +1341,6 @@ class Catalog { */ function clean_albums() { - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",mysql_get_server_info())) { - $sql = "SELECT album.id FROM album LEFT JOIN song ON song.album = album.id WHERE song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - - $sql = "DELETE FROM album WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - return true; - } - /* Do a complex delete to get albums where there are no songs */ $sql = "DELETE FROM album USING album LEFT JOIN song ON song.album = album.id WHERE song.id IS NULL"; $db_results = mysql_query($sql, dbh()); @@ -1390,24 +1353,6 @@ class Catalog { */ function clean_flagged() { - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",mysql_get_server_info())) { - $sql = "SELECT flagged.id FROM flagged LEFT JOIN song ON song.id=flagged.song WHERE song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - $sql = "DELETE FROM flagged WHERE id='$dead[0]'"; - $db_results = mysql_query($sql, dbh()); - } - return true; - } - /* Do a complex delete to get flagged items where the songs are now gone */ $sql = "DELETE FROM flagged USING flagged LEFT JOIN song ON song.id = flagged.song WHERE song.id IS NULL"; $db_results = mysql_query($sql, dbh()); @@ -1422,26 +1367,6 @@ class Catalog { */ function clean_artists() { - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",mysql_get_server_info())) { - $sql = "SELECT artist.id FROM artist LEFT JOIN song ON song.artist = artist.id WHERE song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - - $sql = "DELETE FROM artist WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - return true; - } - - /* Do a complex delete to get artists where there are no songs */ $sql = "DELETE FROM artist USING artist LEFT JOIN song ON song.artist = artist.id WHERE song.id IS NULL"; $db_results = mysql_query($sql, dbh()); @@ -1455,30 +1380,28 @@ class Catalog { */ function clean_playlists() { - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",mysql_get_server_infO())) { - $sql = "SELECT playlist_data.song FROM playlist_data LEFT JOIN song ON song.id = playlist_data.song WHERE song.file IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - $sql = "DELETE FROM playlist_data WHERE song='$dead[0]'"; - $db_results = mysql_query($sql, dbh()); - } - return true; - } - /* Do a complex delete to get playlist songs where there are no songs */ $sql = "DELETE FROM playlist_data USING playlist_data LEFT JOIN song ON song.id = playlist_data.song WHERE song.file IS NULL"; $db_results = mysql_query($sql, dbh()); + // Clear TMP Playlist information as well + $sql = "DELETE FROM tmp_playlist_data USING tmp_playlist_data LEFT JOIN song ON tmp_playlist_data.object_id = song.id WHERE song.id IS NULL"; + $db_results = mysql_query($sql,dbh()); + } // clean_playlists + /** + * clean_ext_info + * This function clears any ext_info that no longer has a parent + */ + function clean_ext_info() { + + // No longer accounting for MySQL 3.23 here, so just run the query + $sql = "DELETE FROM song_ext_data USING song_ext_data LEFT JOIN song ON song.id = song_ext_data.song_id WHERE song.id IS NULL"; + $db_results = mysql_query($sql, dbh()); + + } // clean_ext_info + /*! @function clean_stats @discussion This functions removes stats for songs/albums that no longer exist @@ -1488,83 +1411,28 @@ class Catalog { $version = mysql_get_server_info(); - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",$version)) { - $sql = "SELECT object_count.id FROM object_count LEFT JOIN song ON song.id = object_count.object_id WHERE object_type='song' AND song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - - $sql = "DELETE FROM object_count WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - - } - // We assume this will be 4.0+ - else { - /* Crazy SQL Mojo to remove stats where there are no songs */ - $sql = "DELETE FROM object_count USING object_count LEFT JOIN song ON song.id=object_count.object_id WHERE object_type='song' AND song.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - } - - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",$version)) { - $sql = "SELECT object_count.id FROM object_count LEFT JOIN album ON album.id = object_count.object_id WHERE object_type='album' AND album.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { - - $sql = "DELETE FROM object_count WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - } - // We assume 4.0+ Here - else { - /* Crazy SQL Mojo to remove stats where there are no albums */ - $sql = "DELETE FROM object_count USING object_count LEFT JOIN album ON album.id=object_count.object_id WHERE object_type='album' AND album.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - } + // Crazy SQL Mojo to remove stats where there are no songs + $sql = "DELETE FROM object_count USING object_count LEFT JOIN song ON song.id=object_count.object_id WHERE object_type='song' AND song.id IS NULL"; + $db_results = mysql_query($sql, dbh()); - /* Mysql 3.23 doesn't support our cool query so we have to do it a different way */ - if (preg_match("/^3\./",$version)) { - $sql = "SELECT object_count.id FROM object_count LEFT JOIN artist ON artist.id = object_count.object_id WHERE object_type='artist' AND artist.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - - $results = array(); - - while ($r = mysql_fetch_row($db_results)) { - $results[] = $r; - } - - foreach ($results as $dead) { + // Crazy SQL Mojo to remove stats where there are no albums + $sql = "DELETE FROM object_count USING object_count LEFT JOIN album ON album.id=object_count.object_id WHERE object_type='album' AND album.id IS NULL"; + $db_results = mysql_query($sql, dbh()); + + // Crazy SQL Mojo to remove stats where ther are no artists + $sql = "DELETE FROM object_count USING object_count LEFT JOIN artist ON artist.id=object_count.object_id WHERE object_type='artist' AND artist.id IS NULL"; + $db_results = mysql_query($sql, dbh()); - $sql = "DELETE FROM object_count WHERE id='$dead[0]'"; - $db_results = mysql_query($sql,dbh()); - } - } - // We assume 4.0+ here - else { - /* Crazy SQL Mojo to remove stats where ther are no artists */ - $sql = "DELETE FROM object_count USING object_count LEFT JOIN artist ON artist.id=object_count.object_id WHERE object_type='artist' AND artist.id IS NULL"; - $db_results = mysql_query($sql, dbh()); - } + // Delete genre stat information + $sql = "DELETE FROM object_count USING object_count LEFT JOIN genre ON genre.id=object_count.object_id WHERE object_type='genre' AND genre.id IS NULL"; + $db_results = mysql_query($sql,dbh()); + // Delete the live_stream stat information + $sql = "DELETE FROM object_count USING object_count LEFT JOIN live_stream ON live_stream.id=object_count.object_id WHERE object_type='live_stream' AND live_stream.id IS NULL"; + $db_results = mysql_query($sql,dbh()); } // clean_stats - /*! @function verify_catalog @discussion This function compares the DB's information with the ID3 tags diff --git a/lib/ui.lib.php b/lib/ui.lib.php index af9bca40..bc87289f 100644 --- a/lib/ui.lib.php +++ b/lib/ui.lib.php @@ -619,6 +619,9 @@ function img_resize($image,$size,$type){ } $src = imagecreatefromstring($image); + + if (!$src) { return false; } + $width = imagesx($src); $height = imagesy($src); @@ -626,7 +629,10 @@ function img_resize($image,$size,$type){ $new_h = $size['height']; $img = imagecreatetruecolor($new_w,$new_h); - imagecopyresampled($img,$src,0,0,0,0,$new_w,$new_h,$width,$height); + + if (!imagecopyresampled($img,$src,0,0,0,0,$new_w,$new_h,$width,$height)) { + return false; + } // determine image type and send it to the client switch ($type) { @@ -62,6 +62,14 @@ switch ($action) { $recommended_songs = $working_user->get_recommendations('song'); require_once(conf('prefix') . '/templates/show_user_recommendations.inc.php'); + + show_box_top(); + /* Show Most Popular artist/album/songs */ + show_all_popular(); + + /* Show Recent Additions */ + show_all_recent(); + show_box_bottom(); break; } // end switch on action diff --git a/templates/show_all_popular.inc.php b/templates/show_all_popular.inc.php index 551c453e..e9f12a5c 100644 --- a/templates/show_all_popular.inc.php +++ b/templates/show_all_popular.inc.php @@ -5,9 +5,8 @@ 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. + 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 @@ -24,20 +23,24 @@ <table class="tabledata"> <tr> <td valign="top" > - <?php show_info_box(_("Most Popular Artists"), 'artist', $artists); ?> + <?php show_info_box(_('Most Popular Artists'), 'artist', $artists); ?> </td> <td valign="top" align="left"> - <?php show_info_box(_("Most Popular Albums"), '', $albums); ?> + <?php show_info_box(_('Most Popular Albums'), '', $albums); ?> + </td> + <td valign="top" align="left"> + <?php show_info_box(_('Most Popular Genres'), '', $genres); ?> </td> - </tr> <tr><td colspan="2"> </td></tr> <tr> - <td valign="top" align="left"> - <?php show_info_box(_("Most Popular Genres"), '', $genres); ?> + <td valign="top"> + <?php show_info_box(_('Most Popular Songs'), 'song', $songs); ?> </td> - <td valign="top" > - <?php show_info_box(_("Most Popular Songs"), 'song', $songs); ?> + <td valign="top"> + <?php show_info_box(_('Most Popular Live Streams'),'live_stream',$live_streams); ?> + </td> + <td valign="top"> + <?php show_info_box(_('Most Popular Tags'),'tags',$tags); ?> </td> </tr> -</table> diff --git a/templates/show_all_recent.inc.php b/templates/show_all_recent.inc.php index aec905fe..e0867f0d 100644 --- a/templates/show_all_recent.inc.php +++ b/templates/show_all_recent.inc.php @@ -5,9 +5,8 @@ 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. + 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 @@ -21,13 +20,15 @@ */ ?> -<table class="tabledata"> <tr> <td valign="top"> - <?php show_info_box(_("Newest Artist Additions"), '', $artists); ?> + <?php show_info_box(_('Newest Artist Additions'), '', $artists); ?> </td> <td valign="top"> - <?php show_info_box(_("Newest Album Additions"), '', $albums); ?> + <?php show_info_box(_('Newest Album Additions'), '', $albums); ?> + </td> + <td valign="top"> + <?php show_info_box(_('Newest Live Stream Additions'),'',$tags); ?> </td> </tr> </table> diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php new file mode 100644 index 00000000..bc782046 --- /dev/null +++ b/templates/show_index.inc.php @@ -0,0 +1,37 @@ +<?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 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. + +*/ +?> +<div id="np_data"> + <?php show_now_playing(); ?> +</div> <!-- Close Now Playing Div --> +<!-- Recently Played --> +<div id="recently_played"> + <?php + $data = get_recently_played(); + if (count($data)) { require_once(conf('prefix') . '/templates/show_recently_played.inc.php'); } + ?> +</div> +<div id="random_selection"> + <?php + $albums = get_random_albums('5'); + if (count($albums)) { require_once(conf('prefix') . '/templates/show_random_albums.inc.php'); } + ?> +</div> diff --git a/templates/show_random_albums.inc.php b/templates/show_random_albums.inc.php new file mode 100644 index 00000000..04280235 --- /dev/null +++ b/templates/show_random_albums.inc.php @@ -0,0 +1,42 @@ +<?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 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. + +*/ +$web_path = conf('web_path'); +?> +<?php show_box_top(_('Albums of the Moment')); ?> +<table class="tabledata"> +<tr> + <?php + foreach ($albums as $album_id) { + $album = new Album($album_id); + $album->format(); + ?> + <td> + <a target="_blank" href="<?php echo $web_path; ?>/image.php?type=popup&id=<?php echo $album_id; ?>"> + <img src="<?php echo $web_path; ?>/image.php?thumb=1&id=<?php echo $album_id; ?>" width="75" height="75" border="0"> + </a> + + <br /> + <?php echo $album->f_link; ?> + </td> + <?php } ?> +</tr> +</table> +<?php show_box_bottom(); ?> diff --git a/templates/show_tv.inc.php b/templates/show_tv.inc.php index 567e8ce8..72f8aa92 100644 --- a/templates/show_tv.inc.php +++ b/templates/show_tv.inc.php @@ -22,20 +22,6 @@ $htmllang = str_replace("_","-",conf('lang')); $location = get_location(); -?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $htmllang; ?>" lang="<?php echo $htmllang; ?>"> -<head> -<link rel="shortcut icon" href="<?php echo $web_path; ?>/favicon.ico" /> -<meta http-equiv="Content-Type" content="text/html; charset=<?php echo conf('site_charset'); ?>" /> -<title><?php echo conf('site_title'); ?> - <?php echo $location['title']; ?></title> -<link rel="stylesheet" href="<?php echo $web_path; ?><?php echo conf('theme_path'); ?>/templates/default.css" type="text/css" /> -</head> -<body> -<script src="<?php echo $web_path; ?>/lib/javascript-base.js" language="javascript" type="text/javascript"></script> -<script src="<?php echo $web_path; ?>/modules/kajax/ajax.js" language="javascript" type="text/javascript"></script> -<?php - /** * Check for the refresh mojo, if it's there then require the * refresh_javascript include. Must be greater then 5, I'm not @@ -52,9 +38,6 @@ if (conf('refresh_limit') > 5) { <!-- Left Col --> <div id="tv_left"> <?php show_box_top(_('Controls')); ?> -<div class="text-action"> - <a href="<?php echo conf('web_path'); ?>/index.php"><?php echo _('Home'); ?></a> -</div> <!-- Control DIV --> <div id="tv_control"> <?php diff --git a/templates/sidebar.inc.php b/templates/sidebar.inc.php index 06962c10..6f55def1 100644 --- a/templates/sidebar.inc.php +++ b/templates/sidebar.inc.php @@ -35,8 +35,6 @@ $browse_items[] = array('title'=>_("Albums"),'url'=>'albums.php','active'=>$loca $browse_items[] = array('title'=>_("Artists"),'url'=>'artists.php','active'=>$location['page'], 'cssclass'=>'sidebar_browse_artists'); $browse_items[] = array('title'=>_("Genre"),'url'=>'browse.php?action=genre','active'=>$location['page'], 'cssclass'=>'sidebar_browse_genre'); $browse_items[] = array('title'=>_('Song Title'),'url'=>'browse.php?action=song_title','active'=>$location['page'], 'cssclass'=>'sidebar_browse_song_title'); -$browse_items[] = array('title'=>_("Lists"),'url'=>'browse.php','active'=>$location['page'], 'cssclass'=>'sidebar_browse_lists'); -//$browse_items[] = array('title'=>'File','url'=>'files.php','active'=>''); <!--pb1dft: this can be cleaned up --> $web_path = conf('web_path'); @@ -165,7 +163,7 @@ $web_path = conf('web_path'); </form> </li> <?php } // end if ($GLOBALS['theme']['orientation'] != 'horizontal') ?> -<?php if ($GLOBALS['user']->prefs['localplay_level'] > 0) { ?> +<?php if ($GLOBALS['user']->prefs['localplay_level'] > 0 AND conf('allow_localplay_playback')) { ?> <li id="sidebar_localplay"> <a href="<?php echo $web_path; ?>/localplay.php"><?php echo _('Localplay'); ?></a> </li> @@ -32,6 +32,8 @@ if (!conf('allow_democratic_playback')) { /* Clean up the stuff we need */ $action = scrub_in($_REQUEST['action']); +show_template('header'); + switch ($action) { case 'create_playlist': /* Only Admins Here */ @@ -91,5 +93,6 @@ switch ($action) { break; } // end switch on action +show_footer(); ?> |