summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpb1dft <pb1dft@ampache>2006-11-08 19:46:31 +0000
committerpb1dft <pb1dft@ampache>2006-11-08 19:46:31 +0000
commit627efa4dd844c89bb752f4484d1395409c2dbf76 (patch)
tree71f34c36d26e3ecc17e2a22990e6a65f31f413cc
parent3914736c941f9cee4e78d1ee0be61f7216d43cff (diff)
downloadampache-627efa4dd844c89bb752f4484d1395409c2dbf76.tar.gz
ampache-627efa4dd844c89bb752f4484d1395409c2dbf76.tar.bz2
ampache-627efa4dd844c89bb752f4484d1395409c2dbf76.zip
Addition for ip_history and browse for local album art
-rw-r--r--albums.php61
-rw-r--r--templates/show_get_albumart.inc.php12
-rw-r--r--templates/show_ip_history.inc.php4
3 files changed, 61 insertions, 16 deletions
diff --git a/albums.php b/albums.php
index abf2944a..553330ba 100644
--- a/albums.php
+++ b/albums.php
@@ -90,25 +90,56 @@ elseif ($_REQUEST['action'] === 'find_art') {
$search = $artist . " " . $album_name;
- // Attempt to find the art with what we've got
- $images = $album->find_art($_REQUEST['cover'], $search);
- $_SESSION['form']['images'] = $images;
+ //Find out if the cover url is a local filename or an url
+ if (empty($_FILES['file'])){
+ $coverurl = $_REQUEST['cover'];
+
+ // Attempt to find the art with what we've got
+ $images = $album->find_art($_REQUEST['cover'], $search);
+ $_SESSION['form']['images'] = $images;
+
+ if (count($images)) {
+ include(conf('prefix') . '/templates/show_album_art.inc.php');
+ }
+ else {
+ show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection.'),"/albums.php?action=show&amp;album=" . $album->id);
+ }
+
+ $albumname = $album->name;
+ $artistname = $artist;
+
+ // Remember the last typed entry, if there was one
+ if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); }
+ if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); }
+
+ include(conf('prefix') . '/templates/show_get_albumart.inc.php');
- if (count($images)) {
- include(conf('prefix') . '/templates/show_album_art.inc.php');
}
- else {
- show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to Amazon being busy, or the album not being present in their collection.'),"/albums.php?action=show&amp;album=" . $album->id);
- }
-
- $albumname = $album->name;
- $artistname = $artist;
+ elseif (isset($_FILES['file']['tmp_name'])){
+ $album_id = $_REQUEST['album_id'];
+
+ $album = new Album($album_id);
+
+ $dir = dirname($_FILES['file']['tmp_name']) . "/";
+ $filename = $dir . basename($_FILES['file']['tmp_name']);
+ $handle = fopen($filename, "rb");
+ $mime = $_FILES['file']['type'];
- // Remember the last typed entry, if there was one
- if (isset($_REQUEST['album_name'])) { $albumname = scrub_in($_REQUEST['album_name']); }
- if (isset($_REQUEST['artist_name'])) { $artistname = scrub_in($_REQUEST['artist_name']); }
+ $art = '';
+ while(!feof($handle)) {
+ $art .= fread($handle, 1024);
+ }
+ fclose($handle);
+ if (!empty($art)){
+ $album->insert_art($art,$mime);
+ show_confirmation(_("Album Art Inserted"),"","/albums.php?action=show&album=$album_id");
+ }
+ else {
+ show_confirmation(_('Album Art Not Located'),_('Album Art could not be located at this time. This may be due to write acces error, or the file is not received corectly.'),"/albums.php?action=show&amp;album=" . $album->id);
+ }
- include(conf('prefix') . '/templates/show_get_albumart.inc.php');
+ }
+
} // find_art
diff --git a/templates/show_get_albumart.inc.php b/templates/show_get_albumart.inc.php
index b847a980..246e2254 100644
--- a/templates/show_get_albumart.inc.php
+++ b/templates/show_get_albumart.inc.php
@@ -21,7 +21,7 @@
*/
?>
<?php show_box_top(_('Customize Search')); ?>
-<form name="coverart" method="get" action="<?php echo conf('web_path'); ?>/albums.php" style="Displain:inline;">
+<form enctype="multipart/form-data" name="coverart" method="post" action="<?php echo conf('web_path'); ?>/albums.php?action=find_art&album_id=<?php echo $album->id; ?>&artist_name=<?php echo $_POST['artist_name'];?>&album_name=<?php echo $_POST['album_name']; ?>&cover=<?php echo scrub_out($_POST['cover']); ?>" style="Display:inline;">
<table>
<tr>
</tr>
@@ -51,8 +51,18 @@
</tr>
<tr>
<td>
+ <?php echo _('Local Image'); ?>
+ </td>
+ <td>
+ <input type="file" size="40" id="file" name="file" value="" />
+ </td>
+</tr>
+
+<tr>
+ <td>
<input type="hidden" name="action" value="find_art" />
<input type="hidden" name="album_id" value="<?php echo $album->id; ?>" />
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo conf('max_upload_size'); ?>" />
<input type="submit" value="<?php echo _('Get Art'); ?>" />
</td>
</tr>
diff --git a/templates/show_ip_history.inc.php b/templates/show_ip_history.inc.php
index 497082f1..6c15726f 100644
--- a/templates/show_ip_history.inc.php
+++ b/templates/show_ip_history.inc.php
@@ -22,7 +22,11 @@
?>
<?php show_box_top($temp_user->fullname . ' ' . _('IP History')); ?>
<div class="text-action">
+<?php if (isset($_REQUEST['all'])){ ?>
+ <a href="<?php echo conf('web_path')?>/admin/users.php?action=show_ip_history&user_id=<?php echo $temp_user->username?>"><?php echo _('Show Unique'); ?>...</a>
+<?php }else{ ?>
<a href="<?php echo conf('web_path')?>/admin/users.php?action=show_ip_history&user_id=<?php echo $temp_user->username?>&all"><?php echo _('Show All'); ?>...</a>
+<?php }?>
</div>
<table border="0">
<tr class="table-header">