summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--amp-mpd.php263
-rwxr-xr-xdocs/CHANGELOG4
-rw-r--r--lib/class/catalog.class.php8
-rwxr-xr-xmodules/id3/vainfo.class.php4
-rw-r--r--modules/kajax/README (renamed from mpd.php)23
-rw-r--r--stats.php17
-rw-r--r--templates/sidebar.inc.php20
7 files changed, 36 insertions, 303 deletions
diff --git a/amp-mpd.php b/amp-mpd.php
deleted file mode 100644
index 1a95f331..00000000
--- a/amp-mpd.php
+++ /dev/null
@@ -1,263 +0,0 @@
-<?php
-/*
- * nj-jukebox.php - Netjuke MPD-based jukebox.
- * Copyright (C) 2003 Benjamin Carlisle (bcarlisle@24oz.com)
- * http://mpd.24oz.com/
- *
- * This has been modified to work with Ampache (http://www.ampache.org) It was
- * initially written for NetJuke (http://netjuke.sourceforge.net/)
- *
- * 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
- */
-
-require_once("modules/init.php");
-
-
-/* We need to create a MPD object here */
-
-$myMpd = init_mpd();
-
-if (is_object($myMpd)) {
- switch ($_REQUEST['action']) {
- case "add":
- if (!$user->has_access(25)) { break; }
- $song_ids = array();
- $song_ids[0] = $_REQUEST[song_id];
- addToPlaylist( $myMpd, $song_ids );
- break;
- case "rem":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->PLRemove($_REQUEST[id])) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case ' > ':
- case "play":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->Play()) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "stop":
- case ' X ':
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->Stop()) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case ' | | ':
- case ' = ':
- case "pause":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->Pause()) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case '|< ':
- case "Prev":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->Previous()) ) echo "ERROR: " . $myMpd->errStr."\n";
- mpd_redirect();
- break;
- case ' >|';
- case "Next":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->Next()) ) echo "ERROR: " . $myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "shuffle":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->PLShuffle()) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "clear":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->PLClear()) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "loop":
- if (!$user->has_access(25)) { break; }
- if ($_REQUEST['val'] == "On") { $_REQUEST['val'] = '1'; }
- else { $_REQUEST['val'] = '0'; }
- if ( is_null($myMpd->SetRepeat($_REQUEST['val'])) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "random":
- if (!$user->has_access(25)) { break; }
- if ($_REQUEST['val'] == "On") { $_REQUEST['val'] = '1'; }
- else { $_REQUEST['val'] = '0'; }
- if ( is_null($myMpd->SetRandom($_REQUEST['val']))) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "adjvol":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->AdjustVolume($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "setvol":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->SetVolume($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "skipto":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->SkipTo($_REQUEST[val])) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "pladd":
- if (!$user->has_access(25)) { break; }
- $plist = new Playlist( $_REQUEST[pl_id] );
- $song_ids = $plist->get_songs();
- addToPlaylist( $myMpd, $song_ids );
- break;
- case "albadd":
- if (!$user->has_access(25)) { break; }
- $album = new Album( $_REQUEST[alb_id] );
- $song_ids = $album->get_song_ids( );
- addToPlaylist( $myMpd, $song_ids );
- break;
- case "show_control":
- require (conf('prefix') . "/templates/show_mpdplay.inc");
- break;
- case "mute":
- if (!$user->has_access(25)) { break; }
- if ( is_null($myMpd->SetVolume(0)) ) echo "ERROR: " .$myMpd->errStr."\n";
- mpd_redirect();
- break;
- case "condPL":
- if (!$user->has_access(25)) { break; }
- $condPL = (conf('condPL')==1 ? 0 : 1);
- conf(array('condPL' => $condPL),1);
- $pref_id = get_preference_id('condPL');
- $user->update_preference($pref_id,$condPL);
- mpd_redirect();
- break;
- case "crop":
- if (!$user->has_access(25)) { break; }
- $pl = $myMpd->playlist;
- $cur = $myMpd->current_track_id;
- foreach ($pl as $id => $entry ) {
- if ($id != $cur) {
- { if ( is_null($myMpd->PLRemove($id < $cur ? 0 : 1))) {echo "ERROR: " .$myMpd->errStr."\n"; } }
- }
- }
- mpd_redirect();
- break;
- case "plact":
- if (!$user->has_access(25)) { break; }
- switch ($_REQUEST['todo'])
- {
- case "Add to Playlist":
- if( isset( $_REQUEST['song'] ) ) {
- $pl = $myMpd->playlist;
- if( is_null($pl) ) {
- echo "ERROR: ".$myMpd->errStr."\n";
- } else {
- $mpd_dir = conf('mpd_dir') . '/';
- $pl_ids = scrub_in( $_REQUEST['song'] );
-
- // basically copied from playlist.php Add to case
- $pl_id = scrub_in( $_REQUEST['playlist_id'] );
- $playlist = new Playlist($pl_id);
- if( $pl_id == 0 ) { // new playlist
- $playlist_name = _("New Playlist") . " - " . date("m/j/y, g:i a");
- $playlist->create($playlist_name, $user->username, 'private');
- $pl_id = $playlist->id;
- }
-
- // need to detect file or URL method to get id's differently
- if( conf('mpd_method') == 'file' ) {
- foreach( $pl as $id => $entry ) {
- // remember in_array( needle, haystack )
- if( in_array( $id, $pl_ids ) ) {
- $song_files[] = $mpd_dir . $entry['file'];
- }
- }
- foreach( $song_files as $song_file ) {
- $song_file = sql_escape( $song_file );
- $sql = "SELECT id FROM song WHERE `file` = '$song_file'";
- $db_results = mysql_query( $sql, dbh() );
- $results = mysql_fetch_object( $db_results );
- $song_ids[] = $results->id;
- }
- } else {
- // left edge @ song= and right at &
- foreach( $pl as $id => $entry ) {
- if( in_array( $id, $pl_ids ) ) {
- $temp_split_array = split( 'song=', $entry['file'] );
- $temp_split_array = split( '&', $temp_split_array[1] );
- $song_ids[] = $temp_split_array[0];
- }
- }
- }
- if (isset($song_ids) && is_array($song_ids)) {
- $playlist->add_songs($song_ids, true); // $is_ordered = true
- }
- }
- }
- // would be nice to redirect to the playlist page for the new $pl_id, but header( "Location: " ) doesn't seem to do it
- $page = 'playlist.php?playlist_id=' . $pl_id . '&action=view_list';
- break;
- case "Delete":
- $shrunkby =0;
- foreach ($_REQUEST['song'] as $id ) {
- if ( is_null($myMpd->PLRemove($id-$shrunkby)) ) echo "ERROR: " .$myMpd->errStr."\n";
- $shrunkby++;
- }
- break;
- case "move Next":
- /* This does not work yet */
- $fromabovenp = 0;
- $frombelownp = 0;
- $reversed = array_reverse ($_REQUEST[song]);
- foreach ($reversed as $id => $entry) {
- echo "id=".$id;
- if ($id > $myMpd->current_track_id) {
- echo " fromabovenp=".$fromabovenp." source=".$id+$fromabovenp." dest=".($myMpd->current_track_id+1)."<br>";
- if (is_null($myMpd->PLMoveTrack($id+$fromabovenp,$myMpd->current_track_id+1))) echo "ERROR: ".$myMpd->errStr."\n";
- $fromabovenp++;
- }
- elseif ($id < $myMpd->current_track_id) {
- echo " frombelownp=".$frombelownp." source=".$id." dest=".$myMpd->current_track_id+1-frombelownp."<br>";
- if (is_null($myMpd->PLMoveTrack($id,$myMpd->current_track_id+1-frombelownp))) echo "ERROR: ".$myMpd->errStr."\n";
- $frombelownp++;
- }
- }
- break;
- default:
- echo "todo='".$_REQUEST['todo']."'<br>";
- foreach ($_REQUEST[song] as $id => $entry)
- {
- echo "id=".$id." entry=".$entry."_REQUEST[song][id]=".$_REQUEST[song][$id]."<br>";
- }
- }
- if( $page ) {
- mpd_redirect( $page );
- } else {
- mpd_redirect();
- }
- break;
- case "movenext":
- if (!$user->has_access(25)) { break; }
- if ($_REQUEST[val] < $myMpd->current_track_id) $offset=-1;
- if (is_null($myMpd->PLMoveTrack($_REQUEST[val],$myMpd->current_track_id+1+$offset)))
- echo "ERROR: ".$myMpd->errStr."\n";
- mpd_redirect();
- break;
- default:
- mpd_redirect();
- break;
- } // end switch
-
- // We're done let's disconnect
- $myMpd->Disconnect();
-} // end else
-?>
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 5b36f684..c284afa1 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,10 @@
--------------------------------------------------------------------------
v.3.3.2-Beta3
+ - Fixed a missing close tag on the catalog build if ampache was
+ unable to get the filesize of a file
+ - Fixed link to Statistics page, user link has been missing
+ since the new interface was put into place
- Added new getid3() wrapper (vainfo) should resolve the
id3 tags in oggs issue that some people were having
and makes file only tag basis possible. requires
diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php
index e4262ddb..9f782d46 100644
--- a/lib/class/catalog.class.php
+++ b/lib/class/catalog.class.php
@@ -372,7 +372,7 @@ class Catalog {
if (!$file_size) {
debug_event('read',"Unable to get filesize for $full_file",'2','ampache-catalog');
- echo "<font class=\"error\">" . _("Error: Unable to get filesize for") . " $full_file <br />";
+ echo "<span class=\"error\">" . _("Error: Unable to get filesize for") . " $full_file</span><br />";
} // file_size check
if (is_readable($full_file)) {
@@ -394,7 +394,7 @@ class Catalog {
/* Stupid little cutesie thing */
$this->count++;
- if ( !($this->count%conf('catalog_echo_count')) ) {
+ if ( !($this->count%conf('catalog_echo_count')) AND $verbose) {
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $this->count . "','count_add_" . $this->id ."');";
echo "</script>\n";
@@ -487,7 +487,7 @@ class Catalog {
/* Stupid little cutesie thing */
$search_count++;
- if ( !($search_count%conf('catalog_echo_count')) ) {
+ if ( !($search_count%conf('catalog_echo_count'))) {
echo "<script language=\"JavaScript\">";
echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');";
echo "</script>\n";
@@ -782,7 +782,7 @@ class Catalog {
return true;
}
- echo _('Found') . ": <span id=\"count\">" . _('None') . "</span><br />\n";
+ echo _('Found') . ": <span id=\"count_add_" . $this->id . "\">" . _('None') . "</span><br />\n";
flush();
/* Get the songs and then insert them into the db */
diff --git a/modules/id3/vainfo.class.php b/modules/id3/vainfo.class.php
index 92cdeb0c..d9efe341 100755
--- a/modules/id3/vainfo.class.php
+++ b/modules/id3/vainfo.class.php
@@ -381,8 +381,8 @@ class vainfo {
function _clean_tag($tag,$encoding='') {
- if ($this->_iconv AND $this->encoding != $encoding) {
- $tag = iconv('UTF-8','ISO-8859-1',$tag);
+ if ($this->_iconv) {
+ $tag = iconv('UTF-8',conf('site_charset'),$tag);
}
return $tag;
diff --git a/mpd.php b/modules/kajax/README
index be667ebc..b945c5dd 100644
--- a/mpd.php
+++ b/modules/kajax/README
@@ -1,4 +1,3 @@
-<?php
/*
Copyright (c) 2001 - 2006 Ampache.org
@@ -19,21 +18,7 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
-/*!
- @header MPD control
- @discussion Ampache MPD control center
-
-*/
-require_once("modules/init.php");
-$myMpd = init_mpd();
-show_template('header');
-if (conf('refresh_limit') > 0) { show_template('javascript_refresh'); }
-
-if ($user->prefs['play_type'] == 'mpd') {
- show_mpd_control();
- show_mpd_pl();
-}
-
-show_footer();
-?>
+/**
+ * Library Created by Kevin Riker
+ * Modified by Karl Vollmer
+ */
diff --git a/stats.php b/stats.php
index 7bb232e8..ec64e39d 100644
--- a/stats.php
+++ b/stats.php
@@ -1,6 +1,9 @@
<?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
@@ -22,7 +25,7 @@
Show us the stats for the server and this user
*/
-require_once("modules/init.php");
+require_once('modules/init.php');
/* If we are a full admin then we can see other peoples stats! */
if ($GLOBALS['user']->has_access(100) AND isset($_REQUEST['user_id'])) {
@@ -35,7 +38,7 @@ else {
show_template('header');
?>
-<span class="header1"><?php echo $working_user->fullname; ; ?>'s Favorites:</span>
+<span class="header1"><?php echo $working_user->fullname; ?><?php echo _('Favorites'); ?>:</span>
<table cellpadding="5" cellspacing="5" border="0" width="100%">
<tr>
@@ -46,7 +49,7 @@ show_template('header');
show_info_box('Favorite Artists', 'artist', $items);
}
else {
- print("<p> Not enough data for favorite artists.</p>");
+ echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
}
?>
</td>
@@ -58,7 +61,7 @@ show_template('header');
show_info_box('Favorite Songs', 'your_song', $items);
}
else {
- print("<p> Not enough data for favorite songs.</p>");
+ echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
}
?>
</td>
@@ -70,12 +73,10 @@ show_template('header');
show_info_box('Favorite Albums', 'album', $items);
}
else {
- print("<p> Not enough data for favorite albums.</p>");
+ echo "<span class=\"error\">" . _('Not Enough Data') . "</span>";
}
?>
</td>
</tr>
</table>
-<br />
-
-<?php show_page_footer ('Stats', '',$working_user->prefs['display_menu']);?>
+<?php show_footer(); ?>
diff --git a/templates/sidebar.inc.php b/templates/sidebar.inc.php
index 8520f863..f9a7ea92 100644
--- a/templates/sidebar.inc.php
+++ b/templates/sidebar.inc.php
@@ -40,6 +40,17 @@ $browse_items[] = array('title'=>_("Lists"),'url'=>'browse.php','active'=>$locat
//$browse_items[] = array('title'=>'File','url'=>'files.php','active'=>''); <!--pb1dft: this can be cleaned up -->
$web_path = conf('web_path');
+
+/* Setup the Location page mojo for setting
+ * the active LI here
+ */
+switch ($location['page']) {
+
+
+
+
+} // end switch on location page thingy
+
?>
<ul id="navlist">
<li<?php
@@ -114,14 +125,9 @@ $web_path = conf('web_path');
}?>>
<a href="<?php echo $web_path; ?>/playlist.php"><?php echo _("Playlists"); ?></a>
</li>
-<?php if ($GLOBALS['user']->prefs['play_type'] == 'mpd') { ?>
- <li<?php
- if ($location['page'] == "mpd.php"){
- echo " id=\"activetopmenu\" ";
- }?>>
- <a href="<?php echo $web_path; ?>/mpd.php"><?php echo _("Local Play"); ?></a>
+ <li>
+ <a href="<?php echo $web_path; ?>/stats.php"><?php echo _('Statistics'); ?></a>
</li>
-<?php } // end if ($GLOBALS['user']->prefs['play_type'] == 'mpd') ?>
<li<?php
if ($location['page'] == "search.php"){
echo " id=\"activetopmenu\" ";