summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-22 18:32:09 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-07-22 18:32:09 +0000
commitff606dbefca94580b56a081c5d3089037a2d033d (patch)
treebdc9cb8ea8d3b5d8e9b1ebe313ce163990a75d0c
parent472072028560aa178211ae248fc0dad4526533c7 (diff)
downloadampache-ff606dbefca94580b56a081c5d3089037a2d033d.tar.gz
ampache-ff606dbefca94580b56a081c5d3089037a2d033d.tar.bz2
ampache-ff606dbefca94580b56a081c5d3089037a2d033d.zip
removed some old/legacy functions fixed download and merged it into the /play
-rw-r--r--download/index.php101
-rw-r--r--lib/class/album.class.php4
-rw-r--r--lib/class/artist.class.php2
-rw-r--r--lib/class/song.class.php6
-rw-r--r--lib/ui.lib.php237
-rw-r--r--play/index.php50
-rw-r--r--server/ajax.server.php15
-rw-r--r--templates/show_edit_song_row.inc.php47
-rw-r--r--templates/show_song_row.inc.php41
-rw-r--r--templates/show_songs.inc.php22
10 files changed, 162 insertions, 363 deletions
diff --git a/download/index.php b/download/index.php
deleted file mode 100644
index ff4b0e9e..00000000
--- a/download/index.php
+++ /dev/null
@@ -1,101 +0,0 @@
-<?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.
-
-*/
-
-/*!
- @header Download Document
- @discussion Downloads a song to the user, if they have download permission.
- Special thanks to the Horde project for their Browser class that makes this so easy.
-*/
-
-require '../lib/init.php';
-require Config::get('prefix') . '/modules/horde/Browser.php';
-
-$browser = new Browser();
-
-/* If we are running a demo, quick while you still can! */
-if (conf('demo_mode') || !$GLOBALS['user']->has_access('25') || !$GLOBALS['user']->prefs['download']) {
- debug_event('access_denied',"Download Access Denied, " . $GLOBALS['user']->username . " doesn't have sufficent rights",'3');
- access_denied();
-}
-
-/*
- If they are using access lists let's make sure
- that they have enough access to play this mojo
-*/
-if (conf('access_control')) {
- $access = new Access(0);
- if (!$access->check('stream', $_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'50') ||
- !$access->check('network', $_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'50')) {
- debug_event('access_denied', "Download Access Denied, " . $_SERVER['REMOTE_ADDR'] . " does not have download level",'3');
- access_denied();
- }
-} // access_control is enabled
-
-/* Check for a song id */
-if (!$_REQUEST['song_id']) {
- echo "Error: No Song found, download failed";
- debug_event('download','No Song found, download failed','2');
-}
-
-/* If we're got require_session check for a valid session */
-if (conf('require_session')) {
- if (!session_exists(scrub_in($_REQUEST['sid']))) {
- die(_("Session Expired: please log in again at") . " " . conf('web_path') . "/login.php");
- debug_event('session_expired',"Download Access Denied: " . $GLOBALS['user']->username . "'s session has expired",'3');
- }
-} // if require_session
-
-
-/* If the request is to download it... why is this here? */
-if ($_REQUEST['action'] == 'download') {
- $song = new Song($_REQUEST['song_id']);
- $song->format_song();
- $song->format_type();
- $song_name = str_replace('"'," ",$song->f_artist_full . " - " . $song->title . "." . $song->type);
-
- /* Because of some issues with IE remove ? and / from the filename */
- $song_name = str_replace(array('?','/','\\'),"_",$song_name);
-
- // Use Horde's Browser class to send the right headers for different browsers
- // Should get the mime-type from the song rather than hard-coding it.
- header("Content-Length: " . $song->size);
- $browser->downloadHeaders($song_name, $song->mime, false, $song->size);
- $fp = fopen($song->file, 'r');
-
- /* We need to check and see if throttling is enabled */
- $speed = intval(conf('throttle_download'));
- if ($speed > 0) {
- while(!feof($fp)) {
- echo fread($fp, round($speed*1024));
- flush();
- sleep(1);
- }
- } // if limiting
- /* Otherwise just pump it out as fast as you can */
- else {
- fpassthru($fp);
- } // else no limit
-
- fclose($fp);
-
-} // If they've requested a download
-
-?>
diff --git a/lib/class/album.class.php b/lib/class/album.class.php
index f03a1990..fc54f390 100644
--- a/lib/class/album.class.php
+++ b/lib/class/album.class.php
@@ -184,11 +184,11 @@ class Album {
foreach ($data as $key=>$value) { $this->$key = $value; }
/* Truncate the string if it's to long */
- $this->f_name = scrub_out(truncate_with_ellipse($this->name,Config::get('ellipse_threshold_album')));
+ $this->f_name = scrub_out(truncate_with_ellipsis($this->name,Config::get('ellipsis_threshold_album')));
$this->f_name_link = "<a href=\"$web_path/albums.php?action=show&amp;album=" . scrub_out($this->id) . "\" title=\"" . scrub_out($this->name) . "\">" . $this->f_name . "</a>";
$this->f_title = $name;
if ($this->artist_count == '1') {
- $artist = scrub_out(truncate_with_ellipse(trim($this->artist_prefix . ' ' . $this->artist_name),Config::get('ellipse_threshold_album')));
+ $artist = scrub_out(truncate_with_ellipsis(trim($this->artist_prefix . ' ' . $this->artist_name),Config::get('ellipsis_threshold_album')));
$this->f_artist = "<a href=\"$web_path/artists.php?action=show&amp;artist=" . $this->artist_id . "\">" . $artist . "</a>";
}
else {
diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php
index eb18b539..3de53153 100644
--- a/lib/class/artist.class.php
+++ b/lib/class/artist.class.php
@@ -183,7 +183,7 @@ class Artist {
public function format() {
/* Combine prefix and name, trim then add ... if needed */
- $name = truncate_with_ellipse(trim($this->prefix . " " . $this->name));
+ $name = truncate_with_ellipsis(trim($this->prefix . " " . $this->name));
$this->f_name = $name;
//FIXME: This shouldn't be scrubing right here!!!!
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 4200ff2a..1dd7aa20 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -629,14 +629,14 @@ class Song {
// Format the album name
$this->f_album_full = $this->get_album_name();
- $this->f_album = truncate_with_ellipse($this->f_album_full,Config::get('ellipse_threshold_album'));
+ $this->f_album = truncate_with_ellipsis($this->f_album_full,Config::get('ellipse_threshold_album'));
// Format the artist name
$this->f_artist_full = $this->get_artist_name();
- $this->f_artist = truncate_with_ellipse($this->f_artist_full,Config::get('ellipse_threshold_artist'));
+ $this->f_artist = truncate_with_ellipsis($this->f_artist_full,Config::get('ellipse_threshold_artist'));
// Format the title
- $this->f_title = truncate_with_ellipse($this->title,Config::get('ellipse_threshold_title'));
+ $this->f_title = truncate_with_ellipsis($this->title,Config::get('ellipse_threshold_title'));
// Create Links for the different objects
$this->f_link = "<a href=\"" . Config::get('web_path') . "/stream.php?action=single_song&amp;song_id=" . $this->id . "\">$this->f_title</a>";
diff --git a/lib/ui.lib.php b/lib/ui.lib.php
index d7aaa0aa..7ae9e4ec 100644
--- a/lib/ui.lib.php
+++ b/lib/ui.lib.php
@@ -70,18 +70,6 @@ function flip_class($array=0) {
} // flip_class
/**
- * clear_now_playing
- * Clears the now playing information incase something has
- * gotten stuck in there
- */
-function clear_now_playing() {
-
- $sql = "TRUNCATE TABLE `now_playing`";
- $db_results = Dba::query($sql);
-
-} // clear_now_playing
-
-/**
* _
* checks to see if the alias _ is defined
* if it isn't it defines it as a simple return
@@ -95,14 +83,6 @@ if (!function_exists('_')) {
} // if _ isn't defined
/**
- * show_admin_menu
- * shows the admin menu
- */
-function show_admin_menu ($admin_highlight) {
- include(conf('prefix') . "/templates/admin_menu.inc");
-} // show_admin_menu
-
-/**
* access_denied
* throws an error if they try to do something
* that they aren't allowed to
@@ -188,21 +168,6 @@ function show_local_control () {
} // show_local_control
/**
- * truncate_with_ellipse
- * truncates a text file to specified length by adding
- * thre dots (ellipse) to the end
- * (Thx Nedko Arnaudov)
- * @todo Fix Spelling!
- * @depreciated
- */
-function truncate_with_ellipse($text, $max=27) {
-
- /* Run the function with the correct spelling */
- return truncate_with_ellipsis($text,$max);
-
-} // truncate_with_ellipse
-
-/**
* truncate_with_ellipsis
* Correct Spelling function that truncates text to a specific lenght
* and appends three dots, or an ellipsis to the end
@@ -327,8 +292,7 @@ function get_now_playing($filter='') {
* if they don't: insert them
*
*/
-
-function set_artist_rating($artist_id, $rate_user, $rating) {
+function set_artist_rating ($artist_id, $rate_user, $rating) {
$artist_id = sql_escape($artist_id);
$sql = "SELECT * FROM ratings WHERE user='$rate_user' AND object_type='artist' AND object_id='$artist_id'";
@@ -646,84 +610,6 @@ function show_genre($genre_id) {
} // show_genre
-function show_random_play_bar() {
-
- require (conf('prefix') . '/templates/show_random_play_bar.inc.php');
-
-} // show_random_play_bar()
-
-
-/*
- * show_artist_pulldown()
- *
- * Helper functions for album and artist functions
- *
- */
-function show_artist_pulldown ($artist_id,$select_name='artist') {
-
- $sq = "SELECT `id`,`name` FROM `artist` ORDER BY `name`";
- $db_results = Dba::query($sq);
-
- echo "\n<select name=\"$select_name\">\n";
-
- while ($data = Dba::fetch_assoc($db_results)) {
-
- if ( $artist_id == $data['id'] ) {
- echo "\t<option value=\"" . $data['id'] . "\" selected=\"selected\">". scrub_out($data['name']) . "</option>\n";
- }
- else {
- echo "\t<option value=\"" . $data['id'] . "\">". scrub_out($data['name']) ."</option>\n";
- }
-
- } // end while fetching artists
-
- echo "</select>\n";
-
-} // show_artist_pulldown
-
-/**
- * show_catalog_pulldown
- * This has been changed, first is the name of the
- * dropdown select, the second is the style to be applied
- *
- */
-function show_catalog_pulldown ($name='catalog',$style) {
-
- $sql = "SELECT `id`,`name` FROM `catalog` ORDER BY `name`";
- $db_result = Dba::query($sql);
-
- echo "\n<select name=\"" . $name . "\" style=\"" . $style . "\">\n";
-
- echo "<option value=\"-1\">" . _('All') . "</option>\n";
-
- while ($r = Dba::fetch_assoc($db_result)) {
- $catalog_name = scrub_out($r['name']);
-
- if ( $catalog == $r['id'] ) {
- echo " <option value=\"" .$r['id'] . "\" selected=\"selected\">$catalog_name</option>\n";
- }
- else {
- echo " <option value=\"" . $r['id'] . "\">$catalog_name</option>\n";
- }
- }
- echo "\n</select>\n";
-
-} // show_catalog_pulldown
-
-
-/**
- * show_submenu
- * This shows the submenu mojo for the sidebar, and I guess honestly anything
- * else you would want it to... takes an array of items which have ['url'] ['title']
- * and ['active']
- */
-function show_submenu($items) {
-
- require Config::get('prefix') . '/templates/subnavbar.inc.php';
-
-} // show_submenu
-
-
/**
* get_location
* This function gets the information about said persons currently location
@@ -840,49 +726,6 @@ function show_preference_box($preferences) {
} // show_preference_box
-
-/**
- * show_genre_pulldown
- * This shows a select of all of the genres, it takes the name of the select
- * the currently selected and then the size
- *
- */
-function show_genre_pulldown ($name,$selected='',$size=1,$width=0,$style='') {
-
- /* Get them genre hippies */
- $sql = "SELECT genre.id,genre.name FROM genre ORDER BY genre.name";
- $db_result = Dba::query($sql);
-
- if ($size > 0) {
- $multiple_txt = "multiple=\"multiple\" size=\"$size\"";
- }
- if ($style) {
- $style_txt = "style=\"$style\"";
- }
-
- echo "<select name=\"" . $name . "[]\" $multiple_txt $style_txt>\n";
- echo "\t<option value=\"-1\">" . _("All") . "</option>\n";
-
- while ($r = Dba::fetch_assoc($db_result)) {
-
- if ($width > 0) {
- $r['name'] = truncate_with_ellipsis($r['name'],$width);
- }
-
- $r['name'] = scrub_out($r['name']);
-
- if ( $selected == $r['id'] ) {
- echo "\t<option value=\"" . $r['id'] . "\" selected=\"selected\">" . $r['name'] . "</option>\n";
- }
- else {
- echo " <option value=\"" . $r['id'] . "\">" . $r['name'] . "</option>\n";
- }
- } // end while
-
- echo "</select>\n";
-
-} // show_genre_pulldown
-
/**
* good_email
* Don't get me started... I'm sure the indenting is still wrong on this
@@ -1024,24 +867,6 @@ function show_playlist_import() {
} // show_playlist_import
/**
- * show_songs
- * Still not happy with this function, but at least it's in the right
- * place now
- */
-function show_songs ($song_ids, $playlist, $album=0) {
-
- $dbh = dbh();
-
- $totaltime = 0;
- $totalsize = 0;
-
- require (conf('prefix') . "/templates/show_songs.inc");
-
- return true;
-
-} // show_songs
-
-/**
* show_album_select
* This displays a select of every album that we've got in Ampache, (it can be hella long) it's used
* by the Edit page, it takes a $name and a $album_id
@@ -1050,10 +875,10 @@ function show_album_select($name='album',$album_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name, prefix FROM album ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name`, `prefix` FROM `album` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$album_name = trim($r['prefix'] . " " . $r['name']);
if ($r['id'] == $album_id) {
@@ -1076,10 +901,10 @@ function show_artist_select($name='artist', $artist_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name, prefix FROM artist ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name`, `prefix` FROM `artist` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$artist_name = trim($r['prefix'] . " " . $r['name']);
if ($r['id'] == $artist_id) {
@@ -1103,10 +928,10 @@ function show_genre_select($name='genre',$genre_id=0) {
echo "<select name=\"$name\">\n";
- $sql = "SELECT id, name FROM genre ORDER BY name";
- $db_results = mysql_query($sql, dbh());
+ $sql = "SELECT `id`, `name` FROM `genre` ORDER BY `name`";
+ $db_results = Dba::query($sql);
- while ($r = mysql_fetch_assoc($db_results)) {
+ while ($r = Dba::fetch_assoc($db_results)) {
$selected = '';
$genre_name = $r['name'];
if ($r['id'] == $genre_id) {
@@ -1146,7 +971,6 @@ function show_catalog_select($name='catalog',$catalog_id=0,$style='') {
} // show_catalog_select
-
/**
* show_user_select
* This one is for users! shows a select/option statement so you can pick a user
@@ -1397,24 +1221,6 @@ function xml_get_footer($type){
} //xml_get_footer
/**
- * get_users
- * This returns an array of user objects and takes an sql statement
- */
-function get_users($sql) {
-
- $db_results = mysql_query($sql,dbh());
-
- $results = array();
-
- while ($u = mysql_fetch_assoc($db_results)) {
- $results[] = new User($u['id']);
- }
-
- return $results;
-
-} // get_users
-
-/**
* ajax_include
* This does an ob_start, getcontents, clean
* on the specified require, only works if you
@@ -1431,27 +1237,4 @@ function ajax_include($include) {
} // ajax_include
-/**
- * ajax_button
- * This is a generic function that generates the on(whateva) URL for ajaxie hotness
- * it takes a action url, icon name, alt tag and form_id (option)
- */
-function ajax_button($action,$icon,$alt,$post_id='') {
-
- $url = Config::get('ajax_url') . $action;
- $icon_url = Config::get('web_path') . '/images/icons/' . $icon . '.png';
-
- if ($post) {
- $ajax_string = "ajaxPost('$url','$post');";
- }
- else {
- $ajax_string = "ajaxPut('$url');";
- }
-
- $string = "<span onclick=\"$ajax_string;return true\">\n\t<img src=\"$icon_url\" border=\"0\" style=\"cursor:pointer;\" alt=\"$alt\" />\n</span>\n";
-
- return $string;
-
-} // ajax_button
-
?>
diff --git a/play/index.php b/play/index.php
index fe26e8e1..7520fc5a 100644
--- a/play/index.php
+++ b/play/index.php
@@ -141,6 +141,7 @@ if (!$song->file OR ( !is_readable($song->file) AND $catalog->catalog_type != 'r
echo "Error: Invalid Song Specified, file not found or file unreadable";
exit;
}
+
/* Run Garbage Collection on Now Playing */
gc_now_playing();
@@ -168,8 +169,7 @@ if ($catalog->catalog_type == 'remote') {
exit;
} // end if remote catalog
-// Put this song in the now_playing table
-$lastid = insert_now_playing($song->id,$uid,$song->time);
+
// make fread binary safe
set_magic_quotes_runtime(0);
@@ -179,6 +179,43 @@ ignore_user_abort(TRUE);
// Format the song name
$song_name = $song->f_artist_full . " - " . $song->title . "." . $song->type;
+
+/* If they are just trying to download make sure they have rights
+ * and then present them with the download file
+ */
+if ($_GET['action'] == 'download' AND $GLOBALS['user']->prefs['download']) {
+
+ // STUPID IE
+ $song_name = str_replace(array('?','/','\\'),"_",$song_name);
+
+ // Use Horde's Browser class to send the headers
+ header("Content-Length: " . $song->size);
+ $browser = new Browser();
+ $browser->downloadHeaders($song_name,$song->mime,false,$song->size);
+ $fp = fopen($song->file,'rb');
+
+ if (!is_resource($fp)) {
+ debug_event('file_read_error',"Error: Unable to open $song->file for downloading",'2');
+ exit();
+ }
+
+ // Check to see if we should be throttling because we can get away with it
+ if ($GLOBALS['user']->prefs['rate_limit'] > 0) {
+ while (!feof($fp)) {
+ echo fread($fp,round($GLOBALS['user']->prefs['rate_limit']*1024));
+ flush();
+ sleep(1);
+ }
+ }
+ else {
+ fpassthru($fp);
+ }
+
+ fclose($fp);
+ exit();
+
+} // if they are trying to download and they can
+
$startArray = sscanf( $_SERVER[ "HTTP_RANGE" ], "bytes=%d-" );
$start = $startArray[0];
@@ -214,7 +251,7 @@ else {
// Send file, possible at a byte offset
$fp = fopen($song->file, 'rb');
-if (!is_resource($fp)) {
+ if (!is_resource($fp)) {
debug_event('file_read_error',"Error: Unable to open $song->file for reading",'2');
cleanup_and_exit($lastid);
}
@@ -223,13 +260,12 @@ if (!is_resource($fp)) {
// We need to check to see if they are rate limited
$chunk_size = '4096';
-if ($GLOBALS['user']->prefs['rate_limit'] > 0) {
- $chunk_size = $GLOBALS['user']->prefs['rate_limit'];
-}
-
// Attempted fix, pimp up the size a bit
$song->size = $song->size + ($chunk_size*2);
+// Put this song in the now_playing table
+$lastid = insert_now_playing($song->id,$uid,$song->time);
+
if ($start) {
debug_event('seek','Content-Range header recieved, skipping ahead ' . $start . ' bytes out of ' . $song->size,'5');
$browser->downloadHeaders($song_name, $song->mime, false, $song->size);
diff --git a/server/ajax.server.php b/server/ajax.server.php
index f0443aa3..93d2865c 100644
--- a/server/ajax.server.php
+++ b/server/ajax.server.php
@@ -44,9 +44,20 @@ switch ($action) {
$album = new Album($_GET['id']);
$album->format();
break;
+ case 'artist':
+ $key = 'artist_' . $_GET['id'];
+ $artist = new Artist($_GET['id']);
+ $artist->format();
+ break;
+ case 'song':
+ $key = 'song_' . $_GET['id'];
+ $song = new Song($_GET['id']);
+ $song->format();
+ break;
default:
- // Bad type
- die;
+ $key = 'rfc3514';
+ echo xml_from_array(array($key=>'0x1'));
+ exit;
break;
} // end switch on type
diff --git a/templates/show_edit_song_row.inc.php b/templates/show_edit_song_row.inc.php
new file mode 100644
index 00000000..dba9c6ee
--- /dev/null
+++ b/templates/show_edit_song_row.inc.php
@@ -0,0 +1,47 @@
+<?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.
+
+*/
+?>
+<td colspan="8">
+<form method="post" id="edit_song_<?php echo $song->id; ?>">
+<table border="0" cellpadding="3" cellspacing="0">
+<td>
+ <input type="textbox" name="name" value="<?php echo scrub_out($song->title); ?>" />
+</td>
+<td>
+ <?php show_artist_select('artist',$song->artist); ?>
+</td>
+<td>
+ <?php show_album_select('album',$song->album); ?>
+</td>
+<td>
+ <?php show_genre_select('genre',$song->genre); ?>
+</td>
+<td>
+ <input type="textbox" size="3" value="<?php echo scrub_out($song->track); ?>" />
+</td>
+<td>
+ <input type="hidden" name="id" value="<?php echo $album->id; ?>" />
+ <input type="hidden" name="type" value="album" />
+ <?php echo Ajax::button('?action=edit_object&id=' . $song->id . '&type=song','download',_('Save Changes'),'save_song_' . $song->id,'edit_song_' . $song->id); ?>
+</td>
+</table>
+</form>
+</td>
diff --git a/templates/show_song_row.inc.php b/templates/show_song_row.inc.php
new file mode 100644
index 00000000..cc6668ec
--- /dev/null
+++ b/templates/show_song_row.inc.php
@@ -0,0 +1,41 @@
+<?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.
+
+*/
+?>
+<td>
+ <?php echo Ajax::button('?action=basket&atype=song&id=' . $song->id,'add',_('Add'),'add_' . $song->id); ?>
+</td>
+<td><?php echo $song->f_link; ?></td>
+<td><?php echo $song->f_artist_link; ?></td>
+<td><?php echo $song->f_album_link; ?></td>
+<td><?php echo $song->f_genre_link; ?></td>
+<td><?php echo $song->f_track; ?></td>
+<td><?php echo $song->f_time; ?></td>
+<td>
+ <?php if ($GLOBALS['user']->prefs['download']) { ?>
+ <a href="<?php echo Config::get('web_path'); ?>/play/index.php?action=download&amp;uid=<?php echo $GLOBALS['user']->id; ?>&amp;song=<?php echo $song->id; ?>&amp;sid=<?php echo session_id(); ?>">
+ <?php echo get_user_icon('download',_('Download')); ?>
+ </a>
+ <?php } ?>
+
+ <?php if ($GLOBALS['user']->has_access(100)) { ?>
+ <?php echo Ajax::button('?action=show_edit_object&type=song&id=' . $song->id,'edit',_('Edit'),'edit_song_' . $song->id); ?>
+ <?php } ?>
+</td>
diff --git a/templates/show_songs.inc.php b/templates/show_songs.inc.php
index 224b552f..4f2e1e9f 100644
--- a/templates/show_songs.inc.php
+++ b/templates/show_songs.inc.php
@@ -47,26 +47,8 @@ $ajax_url = Config::get('ajax_url');
$song = new Song($song_id);
$song->format();
?>
-<tr class="<?php echo flip_class(); ?>">
- <td>
- <?php echo Ajax::button('?action=basket&atype=song&id=' . $song->id,'add',_('Add'),'add_' . $song->id); ?>
- </td>
- <td><?php echo $song->f_link; ?></td>
- <td><?php echo $song->f_artist_link; ?></td>
- <td><?php echo $song->f_album_link; ?></td>
- <td><?php echo $song->f_genre_link; ?></td>
- <td><?php echo $song->f_track; ?></td>
- <td><?php echo $song->f_time; ?></td>
- <td>
- <span>
- <?php echo get_user_icon('flag_off','flag',_('Flag')); ?>
- </span>
- <?php if ($GLOBALS['user']->has_access(100)) { ?>
- <span>
- <?php echo get_user_icon('edit','',_('Edit')); ?>
- </span>
- <?php } ?>
- </td>
+<tr class="<?php echo flip_class(); ?>" id="song_<?php echo $song->id; ?>">
+ <?php require Config::get('prefix') . '/templates/show_song_row.inc.php'; ?>
</tr>
<?php } ?>
</table>