1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-05 10:49:37 +02:00

Commit, still no internet paying for it.. curse you free.fr

This commit is contained in:
Karl 'vollmerk' Vollmer 2008-10-27 09:24:34 +00:00
parent 14019e88c5
commit f593f18131
77 changed files with 1261 additions and 1340 deletions

View file

@ -33,7 +33,7 @@ switch($_REQUEST['action']) {
$object_ids = $artist->get_albums();
$object_type = 'album';
require_once Config::get('prefix') . '/templates/show_artist.inc.php';
break;
break;
case 'show_all_songs':
$artist = new Artist($_REQUEST['artist']);
$artist->format();

View file

@ -33,7 +33,6 @@ require_once 'lib/init.php';
// This page is a little wonky we don't want the sidebar until we know what type we're dealing with
// so we've got a little switch here that creates the type.. this feels hackish...
switch ($_REQUEST['action']) {
case 'tag':
case 'file':
@ -56,25 +55,21 @@ switch($_REQUEST['action']) {
case 'album':
Browse::set_sort('name','ASC');
$album_ids = Browse::get_objects();
Album::build_cache($album_ids,'extra');
Browse::show_objects();
break;
case 'tag':
Browse::set_sort('count','ASC');
$tags = Browse::get_objects();
Tag::build_cache($tags);
Browse::show_objects();
break;
case 'artist':
Browse::set_sort('name','ASC');
$artist_ids = Browse::get_objects();
Artist::build_cache($artist_ids,'extra');
Browse::show_objects();
break;
case 'song':
Browse::set_sort('title','ASC');
$song_ids = Browse::get_objects();
Song::build_cache($song_ids);
Browse::show_objects();
break;
case 'live_stream':
@ -89,7 +84,6 @@ switch($_REQUEST['action']) {
Browse::set_sort('type','ASC');
Browse::set_filter('playlist_type','1');
$playlist_ids = Browse::get_objects();
Playlist::build_cache($playlist_ids);
Browse::show_objects();
break;
default:

View file

@ -191,8 +191,8 @@ require_session = "true"
; POSSIBLE VALUES: id3v1 id3v2 file vorbiscomment
; quicktime ape asf
; DEFAULT: id3v2,id3v1 vorbiscomment quicktime ape
; asf
tag_order = "id3v2,id3v1,vorbiscomment,quicktime,ape,asf"
; asf file
tag_order = "id3v2,id3v1,vorbiscomment,quicktime,ape,asf,file"
; Un comment if don't want ampache to follow symlinks
; DEFAULT: false
@ -230,8 +230,8 @@ ratings = "true"
; This defines the "Min" memory limit for PHP if your php.ini
; has a lower value set Ampache will set it up to this. If you
; set it below 16MB getid3() will not work!
; DEFAULT: 24
;memory_limit = 24
; DEFAULT: 32
;memory_limit = 32
; Album Art Preferred Filename
; Specify a filename to look for if you always give the same filename
@ -254,8 +254,8 @@ ratings = "true"
; ampache to search if you want to disable one of the search
; method simply comment it out valid values are
; POSSIBLE VALUES: db id3 folder amazon lastfm
; DEFAULT: db,id3,folder,lastfm,amazon
album_art_order = "db,id3,folder,lastfm,amazon"
; DEFAULT: db,id3,folder,lastfm
album_art_order = "db,id3,folder,lastfm"
; Album Art
; Set this to true if you want album art displayed on pages besides the
@ -464,25 +464,15 @@ refresh_limit = "60"
; DEFAULT: 48
;min_bit_rate = 48
;######################################################
; These options control how searching works #
;######################################################
; choices are: artist,album,song_title,song_genre,song_year,song_bitrate,song_min_bitrate,song_filename
; DEFAULT: song_title
search_field = song_title
; choices are: exact,fuzzy
; DEFAULT: fuzzy
search_type = fuzzy
;######################################################
; These are commands used to transcode non-streaming
; formats to the target file type for streaming.
; This can be useful in re-encoding file types that don't stream
; very well, or if your player doesn't support some file types.
; This is also the string used when 'downsampling' is selected
; as some people have complained its not bloody obvious, any programs
; referenced in the downsample commands must be installed manually and in
; the web server path, and executable by the web server
; REQUIRED variables
; transcode_TYPE = true/false ## True to force transcode regardless of prefs
; transcode_TYPE_target = TARGET_FILE_TYPE
@ -500,55 +490,26 @@ transcode_flac_target = mp3
;transcode_mp3 = false
transcode_mp3_target = mp3
;transcode_ogg = false
transcode_ogg = ogg
transcode_ogg_target = ogg
; These are the commands that will be run to transcode the file
transcode_cmd_flac = "flac -dc %FILE% | lame -b %SAMPLE% -S - - "
transcode_cmd_m4a = "faad -f 2 -w %FILE% | lame -r -b %SAMPLE% -S - -"
transcode_cmd_mp3 = "mp3splt -qnf %FILE% %OFFSET% %EOF% -o - | lame --mp3input -q 3 -b %SAMPLE% -S - -"
;transcode_cmd_ogg = "mp3splt -qn %FILE% %OFFSET% %EOF% -o - | oggdec -Q -o - - | lame -S -q 3 -b %SAMPLE% -S - -"
transcode_cmd_ogg = "oggsplt -qn %FILE% %OFFSET% %EOF% -o - | oggdec -Q -o - - | lame -S -q 3 -b %SAMPLE% -S - -"
transcode_cmd_ogg = "oggsplt -qn %FILE% %OFFSET% %EOF% -o - | oggdec -Q -o - - | lame -S -q 3 -b %SAMPLE% -S - -"
; Alternative command works better for some people
;transcode_cmd_m4a = "alac %FILE% | lame -h -b %SAMPLE% -S - -"
;transcode_cmd_ogg = "mp3splt -qn %FILE% %OFFSET% %EOF% -o - | oggdec -Q -o - - | lame -S -q 3 -b %SAMPLE% -S - -"
; This line seems to work better for windows, switch if needed
;transcode_cmd_mp3 = "lame -q 3 -b %SAMPLE% -S %FILE% - -"
;######################################################
; these options allow you to configure your rss-feed
; layout. rss exists of two parts, main and song
; main is the information about the feed
; song is the information in the feed. can be multiple
; items.
;
; layout. rss exists of two parts, main and song main is the information about the feed
; song is the information in the feed. can be multiple items.
; use_rss = false (values true | false)
;
;DEFAULT: use_rss = true
use_rss = true
;
;
; rss_main_title = the title for your feed.
; DEFAULT: Ampache for the love of Music
rss_main_title = Ampache for the love of Music
; rss_main_description = the description for your feed
; DEFAULT: Rss feed for Ampache so you can monitor who is listening to what
rss_main_description = Rss feed for Ampache so you can monitor who is listening to what
; rss_main_copyright = here you can enter copyright information if you wish
; DEFAULT: copyright (c) Speedy B for Ampache
rss_main_copyright = copyright (c) Speedy B for Ampache
; rss_song_description = The description of the song.
; It has to start with <![CDATA[
; and end with ]]>. this is because xml wont parse if strange
; characters are used in the id3-tag
; usable items:
; $song->f_title
; $song->f_album
; $user->fullname
; $artist
; $album
; DEFAULT: <![CDATA[$song->f_title @ $album played by $user->fullname]]>
; FIXME it's hardcoded in lib/rss.lib.php now
;rss_song_description = <![CDATA[$song->f_title @ $album played by $user->fullname]]>
;#####################################################

View file

@ -4,6 +4,18 @@
--------------------------------------------------------------------------
v.3.5-Alpha1
- Many other minor improvements (Thx Dipsol)
- Fixed warnings in caching code (Thx Dipsol)
- Massive text cleanup (Thx Dipsol)
- Fixed tag searching and improved some other search methods to
prevent SQL warnings on no results
- Improved Test page checks to more accuratly verify putENV support
- Make network downsampling a little more sane, don't require
access level
- Added caching to Playlist dropdown
- Fixed double caching on some objects
- Added base.css and 4 tag 'font' sizes depending on weight/count
- Fixed inline song edit
- Updated registration multi-byte mail.
- Fixed vainfo.class.php didn't catch exception for first analyze.
- Fixed iconv() returns an empty strings (Thx abs0)

View file

@ -1,7 +1,7 @@
-------------------------------------------------------------------------------
----------------- INSTALL - Ampache v.3.4 ----------------------
----------------- INSTALL - Ampache v.3.5 ----------------------
-------------------------------------------------------------------------------
www.ampache.org
I'm assuming that you have Apache, PHP and MySQL running when you
get to this point.
@ -219,13 +219,13 @@
3.6 Ampache Wiki
Ampache.org has a wiki set up at http://trac.ampache.org/wiki/ which is
Ampache.org has a wiki set up at http://ampache.org/wiki/ which is
full of additional information. Such as specific install instructions
for different OS's like Debian, Slackware, FreeBSD and Windows. It
also explains how to use the additional features and options such as
downsampling and transcoding, Access Control Lists, Ampache and XML-RPC,
Ampache + Amarok, Localplay, Democratic Playback and much much more.
http://trac.ampache.org/wiki/
http://ampache.org/wiki/
3.7 Repositories

View file

@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--------- MIGRATION - Ampache v.3.4 -----------
--------- MIGRATION - Ampache v.3.5 -----------
-------------------------------------------------------------------------------
-- Upgrading ALL VERSIONS --
@ -9,8 +9,14 @@
your old install is copied into the new directory, then follow any
instructions provided via the web interface.
*** If you have any tag issues always run a verify after upgrading **
Specifics for upgrading between versions are provided below
- Migrating from Ampache 3.4.x --> 3.5
* No special instructions
- Migrating from Ampache 3.3.x --> 3.4
The config file format has changed, please follow the instructions
@ -50,6 +56,4 @@
The tools to migrate Ampache 3.0 to 3.1 Are no longer supported
and will not work against the newest versions of the software.
Sorry for any inconvience. If you would like to upgrade from 3.0
to 3.1 without losing your data please download Ampache 3.1.
http://www.ampache.org/downloads/ampache.3.1.tar.gz
Sorry for any inconvience.

View file

@ -1,5 +1,5 @@
-------------------------------------------------------------------------------
--------- README - Ampache v.3.4 -----------
--------- README - Ampache v.3.5 -----------
-------------------------------------------------------------------------------
Contents:
@ -69,8 +69,10 @@ Contents:
- Localplay
- Music Player Daemon (MPD)
- Winamp using (HTTPQ)
- Shoutcast
- Icecast2
- Democratic Vote based playback
- 3rd Party clients using API (Amarok,Coherence)
- 3rd Party clients using API (Amarok,Coherence,Quickplay)
C) Current Translations
@ -90,12 +92,11 @@ Contents:
- French (fr_FR)
D) A Special Thanks:
Thanx to those who've helped us make Ampache so useable:
Thanks to those who've helped us make Ampache so useable:
Scott Kveton - Head Nacho, inventer of all that is Ampache
Robert Hopson - Libglue, Playlists, Ogg support.. and much more
Andy Morgan - Protagonist
Andy Morgan - Sage / Voice of Reason
RosenSama - Previous Developer
Ben Shields - Ampache Logo
Randall Ehren (Initial XML-RPC)
s1amson (lots of beta testing)
Caleb Crome (bug fixes and enhancements)
@ -151,7 +152,7 @@ Contents:
IRC: irc.ampache.org #ampache (Freenode)
Forums: http://ampache.org/forums
Bugs: http://ampache.org/bugs
Wiki: http://ampache.org/bugs/wiki
Wiki: http://ampache.org/wiki
Demo: http://ampache.org/demo
Ampache Development Team

View file

@ -997,6 +997,7 @@ class Browse {
show_box_bottom();
break;
case 'playlist':
Playlist::build_cache($object_ids);
show_box_top(_('Playlists') . $match, $class);
require_once Config::get('prefix') . '/templates/show_playlists.inc.php';
show_box_bottom();
@ -1026,6 +1027,12 @@ class Browse {
require_once Config::get('prefix') . '/templates/show_flagged.inc.php';
show_box_bottom();
break;
case 'tag':
Tag::build_cache($tags);
show_box_top(_('Tag Cloud'),$class);
require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php';
show_box_bottom();
break;
default:
// Rien a faire
break;

View file

@ -1,21 +1,21 @@
<?php
/*
Copyright (c) Ampache.org
All Rights Reserved
Copyright (c) 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 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.
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.
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.
*/
/**
@ -205,7 +205,7 @@ class Catalog {
$sql = "TRUNCATE `object_count`";
$db_results = Dba::query($sql);
$sql = "UDPATE `song` SET `player`='0'";
$sql = "UDPATE `song` SET `played`='0'";
$db_results = Dba::query($sql);
return true;
@ -276,10 +276,10 @@ class Catalog {
if ($this->catalog_type == 'remote') {
show_box_top(_('Running Remote Sync') . '. . .');
$this->get_remote_catalog($type=0);
$this->get_remote_catalog($type=0);
show_box_bottom();
return true;
}
return true;
}
// Catalog Add start
$start_time = time();
@ -353,9 +353,9 @@ class Catalog {
$results['users'] = $data['0'];
// Get the connected users
$time = time();
$last_seen_time = $time - 1200;
$sql = "SELECT count(DISTINCT s.username) FROM session AS s " .
$time = time();
$last_seen_time = $time - 1200;
$sql = "SELECT count(DISTINCT s.username) FROM session AS s " .
"INNER JOIN user AS u ON s.username = u.username " .
"WHERE s.expire > " . $time . " " .
"AND u.last_seen > " . $last_seen_time;
@ -368,29 +368,6 @@ class Catalog {
} // count_users
/*!
@function add_file
@discussion adds a single file
*/
function add_file($filename) {
$file_size = filesize($filename);
$pattern = "/\.[" . conf('catalog_file_pattern') . "]$/i";
if ( preg_match($pattern ,$filename) && ($file_size > 0) && (!preg_match('/\.AppleDouble/', $filename)) ) {
if(!$this->check_local_mp3($filename,$gather_type)) {
$this->insert_local_song($filename,$file_size);
}
debug_event('add_file', "Error: File exists",'2','ampache-catalog');
} // if valid file
debug_event('add_file', "Error: File doesn't match pattern",'2','ampache-catalog');
} // add_file
/**
* add_files
* Recurses throught $this->path and pulls out all mp3s and returns the full
@ -411,7 +388,7 @@ class Catalog {
$handle = opendir($path);
if (!is_resource($handle)) {
debug_event('read',"Unable to Open $path",'5','ampache-catalog');
debug_event('read',"Unable to Open $path",'5','ampache-catalog');
Error::add('catalog_add',_('Error: Unable to open') . ' ' . $path);
return false;
}
@ -459,11 +436,11 @@ class Catalog {
if (is_dir($full_file)) {
$this->add_files($full_file,$options);
/* Change the dir so is_dir works correctly */
if (!chdir($path)) {
debug_event('read',"Unable to chdir $path",'2','ampache-catalog');
Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path);
}
/* Change the dir so is_dir works correctly */
if (!chdir($path)) {
debug_event('read',"Unable to chdir $path",'2','ampache-catalog');
Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path);
}
/* Skip to the next file */
continue;
@ -495,7 +472,7 @@ class Catalog {
if (!is_readable($full_file)) {
// not readable, warn user
debug_event('read',"$full_file is not readable by ampache",'2','ampache-catalog');
debug_event('read',"$full_file is not readable by ampache",'2','ampache-catalog');
Error::add('catalog_add', sprintf(_('%s is not readable by ampache'), $full_file));
continue;
}
@ -519,11 +496,11 @@ class Catalog {
/* Stupid little cutesie thing */
$this->count++;
if ( !($this->count%10)) {
$file = str_replace(array('(',')','\''),'',$full_file);
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');";
echo "update_txt('" . addslashes(htmlentities($file)) . "','add_dir_" . $this->id . "');";
echo "\n</script>\n";
$file = str_replace(array('(',')','\''),'',$full_file);
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');";
echo "update_txt('" . addslashes(htmlentities($file)) . "','add_dir_" . $this->id . "');";
echo "\n</script>\n";
flush();
} // update our current state
@ -540,11 +517,11 @@ class Catalog {
// This should only happen on the last run
if ($path == $this->path) {
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');";
echo "update_txt('" . addslashes(htmlentities($file)) . "','add_dir_" . $this->id . "');";
echo "\n</script>\n";
flush();
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $this->count ."','add_count_" . $this->id . "');";
echo "update_txt('" . addslashes(htmlentities($file)) . "','add_dir_" . $this->id . "');";
echo "\n</script>\n";
flush();
}
@ -556,7 +533,7 @@ class Catalog {
/*!
@function get_albums
@discussion This gets albums for all songs passed in an array
*/
*/
function get_albums($songs=array()) {
foreach ($songs as $song_id) {
@ -633,7 +610,7 @@ class Catalog {
'album_name' => $album->full_name,
'artist' => $album->artist_name,
'keyword' => $album->artist_name . ' ' . $album->full_name
);
);
// Return results
$results = $album->find_art($options,1);
@ -651,24 +628,24 @@ class Catalog {
}
/* Stupid little cutesie thing */
$search_count++;
if ( !($search_count%5)) {
$search_count++;
if ( !($search_count%5)) {
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');";
echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');";
echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');";
echo "\n</script>\n";
flush();
} //echos song count
echo "\n</script>\n";
flush();
} //echos song count
unset($found);
} // foreach albums
// One last time for good measure
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');";
echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');";
echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');";
echo "\n</script>\n";
flush();
echo "\n</script>\n";
flush();
self::$_art_albums = array();
@ -708,7 +685,7 @@ class Catalog {
$sql = "SELECT `id` FROM `song` WHERE `catalog`='$catalog_id' AND `enabled`='1'";
$db_results = Dba::query($sql);
$results = array(); // return an emty array instead of nothing if no objects
$results = array(); // return an emty array instead of nothing if no objects
while ($r = Dba::fetch_assoc($db_results)) {
$results[] = new Song($r['id']);
} //end while
@ -744,7 +721,7 @@ class Catalog {
@function get_files
@discussion Get's an array of .mp3s and returns the filenames
@param $path Get files starting at root $path
*/
*/
function get_files($path) {
/* Set it as an empty array */
@ -820,32 +797,32 @@ class Catalog {
}
// Setup the base SQL
$sql = "SELECT song.id AS song,artist.id AS artist,album.id AS album,title,COUNT(title) AS ctitle".
$sql = "SELECT song.id AS song,artist.id AS artist,album.id AS album,title,COUNT(title) AS ctitle".
" FROM `song` LEFT JOIN `artist` ON `artist`.`id`=`song`.`artist` " .
" LEFT JOIN `album` ON `album`.`id`=`song`.`album` $where_sql GROUP BY `song`.`title`";
// Add any Additional constraints
if ($search_method == "artist_title" OR $search_method == "artist_album_title") {
$sql = $sql.",artist.name";
}
if ($search_method == "artist_title" OR $search_method == "artist_album_title") {
$sql = $sql.",artist.name";
}
if ($search_method == "artist_album_title") {
$sql = $sql.",album.name";
}
if ($search_method == "artist_album_title") {
$sql = $sql.",album.name";
}
// Final componets
$sql = $sql." HAVING COUNT(title) > 1";
$sql = $sql." ORDER BY `ctitle`";
// Final componets
$sql = $sql." HAVING COUNT(title) > 1";
$sql = $sql." ORDER BY `ctitle`";
$db_results = Dba::query($sql);
$db_results = Dba::query($sql);
$results = array();
$results = array();
while ($item = Dba::fetch_assoc($db_results)) {
$results[] = $item;
} // end while
while ($item = Dba::fetch_assoc($db_results)) {
$results[] = $item;
} // end while
return $results;
return $results;
} // get_duplicate_songs
@ -856,29 +833,29 @@ class Catalog {
* the last one as most likely bad
*/
public static function get_duplicate_info($item,$search_type) {
// Build the SQL
$sql = "SELECT `song`.`id`" .
// Build the SQL
$sql = "SELECT `song`.`id`" .
" FROM song,artist,album".
" WHERE song.artist=artist.id AND song.album=album.id".
" AND song.title= '".Dba::escape($item['title'])."'";
if ($search_type == "artist_title" || $search_type == "artist_album_title") {
$sql .=" AND artist.id = '".Dba::escape($item['artist'])."'";
}
if ($search_type == "artist_album_title" ) {
$sql .=" AND album.id = '".Dba::escape($item['album'])."'";
}
if ($search_type == "artist_title" || $search_type == "artist_album_title") {
$sql .=" AND artist.id = '".Dba::escape($item['artist'])."'";
}
if ($search_type == "artist_album_title" ) {
$sql .=" AND album.id = '".Dba::escape($item['album'])."'";
}
$sql .= " ORDER BY `time`,`bitrate`,`size` LIMIT 2";
$db_results = Dba::query($sql);
$sql .= " ORDER BY `time`,`bitrate`,`size` LIMIT 2";
$db_results = Dba::query($sql);
$results = array();
$results = array();
while ($item = Dba::fetch_assoc($db_results)) {
$results[] = $item['id'];
} // end while
while ($item = Dba::fetch_assoc($db_results)) {
$results[] = $item['id'];
} // end while
return $results;
return $results;
} // get_duplicate_info
@ -889,8 +866,8 @@ class Catalog {
*/
public static function dump_album_art($catalog_id,$methods=array()) {
// Get all of the albums in this catalog
$albums = self::get_catalog_albums($catalog_id);
// Get all of the albums in this catalog
$albums = self::get_catalog_albums($catalog_id);
echo "Starting Dump Album Art...\n";
@ -902,12 +879,12 @@ class Catalog {
// If no art, skip
if (!$album->has_art()) { continue; }
$image = $album->get_db_art();
$image = $album->get_db_art();
/* Get the first song in the album */
$songs = $album->get_songs(1);
$song = new Song($songs[0]);
$dir = dirname($song->file);
$songs = $album->get_songs(1);
$song = new Song($songs[0]);
$dir = dirname($song->file);
if ($image['0']['mime'] == 'image/jpeg') {
$extension = 'jpg';
@ -917,12 +894,12 @@ class Catalog {
}
// Try the preferred filename, if that fails use folder.???
$preferred_filename = Config::get('album_art_preferred_filename');
if (!$preferred_filename || strstr($preferred_filename,"%")) { $preferred_filename = "folder.$extension"; }
$preferred_filename = Config::get('album_art_preferred_filename');
if (!$preferred_filename || strstr($preferred_filename,"%")) { $preferred_filename = "folder.$extension"; }
$file = "$dir/$preferred_filename";
if ($file_handle = fopen($file,"w")) {
if (fwrite($file_handle, $image['0']['raw'])) {
$file = "$dir/$preferred_filename";
if ($file_handle = fopen($file,"w")) {
if (fwrite($file_handle, $image['0']['raw'])) {
// Also check and see if we should write out some meta data
if ($methods['metadata']) {
@ -930,12 +907,12 @@ class Catalog {
case 'windows':
$meta_file = $dir . '/desktop.ini';
$string = "[.ShellClassInfo]\nIconFile=$file\nIconIndex=0\nInfoTip=$album->full_name";
break;
break;
default:
case 'linux':
$meta_file = $dir . '/.directory';
$string = "Name=$album->full_name\nIcon=$file";
break;
break;
} // end switch
$meta_handle = fopen($meta_file,"w");
@ -943,12 +920,12 @@ class Catalog {
fclose($meta_handle);
} // end metadata
$i++;
$i++;
if (!($i%100)) {
echo "Written: $i. . .\n";
echo "Written: $i. . .\n";
debug_event('art_write',"$album->name Art written to $file",'5');
}
} // end if fopen
} // end if fopen
else {
debug_event('art_write',"Unable to open $file for writting",'5');
echo "Error unable to open file for writting [$file]\n";
@ -958,9 +935,9 @@ class Catalog {
fclose($file_handle);
} // end foreach
} // end foreach
echo "Album Art Dump Complete\n";
echo "Album Art Dump Complete\n";
} // dump_album_art
@ -1039,14 +1016,14 @@ class Catalog {
$song = new Song($song_id);
$info = self::update_song_from_tags($song,'','');
if ($info['change']) {
if ($info['change']) {
$file = scrub_out($song->file);
echo "<dl>\n\t<dd>";
echo "<strong>$file " . _('Updated') . "</strong>\n";
echo $info['text'];
echo "\t</dd>\n</dl><hr align=\"left\" width=\"50%\" />";
flush();
} // if change
echo "<dl>\n\t<dd>";
echo "<strong>$file " . _('Updated') . "</strong>\n";
echo $info['text'];
echo "\t</dd>\n</dl><hr align=\"left\" width=\"50%\" />";
flush();
} // if change
else {
echo"<dl>\n\t<dd>";
echo "<strong>" . scrub_out($song->file) . "</strong><br />" . _('No Update Needed') . "\n";
@ -1061,6 +1038,7 @@ class Catalog {
* update_song_from_tags
* updates the song info based on tags, this is called from a bunch of different places
* and passes in a full fledged song object, so it's a static function
* FIXME: This is an ugly mess, this really needs to be consolidated and cleaned up
*/
public static function update_song_from_tags(&$song,$sort_pattern='',$rename_pattern='') {
@ -1101,6 +1079,7 @@ class Catalog {
$artist = $results['artist'];
$album = $results['album'];
$disk = $results['disk'];
$tag = $results['genre'];
/* Clean up Old Vars */
unset($vainfo,$key);
@ -1115,24 +1094,27 @@ class Catalog {
$new_song->f_album = $album . " - " . $new_song->year;
$new_song->title = self::check_title($new_song->title,$new_song->file);
// Nothing to assign here this is a multi-value doodly
self::check_tag($tag,$song->id);
/* Since we're doing a full compare make sure we fill the extended information */
$song->fill_ext_info();
$info = Song::compare_song_information($song,$new_song);
$info = Song::compare_song_information($song,$new_song);
if ($info['change']) {
if ($info['change']) {
debug_event('update',"$song->file difference found, updating database",'5','ampache-catalog');
$song->update_song($song->id,$new_song);
$song->update_song($song->id,$new_song);
// Redfine our reference
$song = $new_song;
}
}
else {
debug_event('update',"$song->file no difference found returning",'5','ampache-catalog');
}
return $info;
return $info;
} // update_song_from_tags
} // update_song_from_tags
/**
* add_to_catalog
@ -1158,22 +1140,22 @@ class Catalog {
$this->path = rtrim($this->path,'/');
$this->path = rtrim($this->path,'\\');
// Prevent the script from timing out and flush what we've got
set_time_limit(0);
// Prevent the script from timing out and flush what we've got
set_time_limit(0);
/* Get the songs and then insert them into the db */
$this->add_files($this->path,$type,0,$verbose);
// Foreach Playlists we found
foreach ($this->_playlists as $full_file) {
if ($this->import_m3u($full_file)) {
foreach ($this->_playlists as $full_file) {
if ($this->import_m3u($full_file)) {
$file = basename($full_file);
if ($verbose) {
echo "&nbsp;&nbsp;&nbsp;" . _('Added Playlist From') . " $file . . . .<br />\n";
flush();
echo "&nbsp;&nbsp;&nbsp;" . _('Added Playlist From') . " $file . . . .<br />\n";
flush();
}
} // end if import worked
} // end foreach playlist files
} // end if import worked
} // end foreach playlist files
/* Do a little stats mojo here */
$current_time = time();
@ -1199,7 +1181,7 @@ class Catalog {
show_box_top();
echo "\n<br />" . _('Catalog Update Finished') . "... " . _('Total Time') . " [" . date("i:s",$time_diff) . "] " .
_('Total Songs') . " [" . $this->count . "] " . _('Songs Per Seconds') . " [" . $song_per_sec . "]<br /><br />";
_('Total Songs') . " [" . $this->count . "] " . _('Songs Per Seconds') . " [" . $song_per_sec . "]<br /><br />";
show_box_bottom();
} // add_to_catalog
@ -1213,7 +1195,7 @@ class Catalog {
/* Make sure the xmlrpc lib is loaded */
if (!class_exists('xmlrpc_client')) {
debug_event('xmlrpc',"Unable to load XMLRPC library",'1');
debug_event('xmlrpc',"Unable to load XMLRPC library",'1');
echo "<span class=\"error\"><b>" . _("Error") . "</b>: " . _('Unable to load XMLRPC library, make sure XML-RPC is enabled') . "</span><br />\n";
return false;
} // end check for class
@ -1227,36 +1209,36 @@ class Catalog {
return;
}
// Figure out the host etc
preg_match("/http:\/\/([^\/\:]+):?(\d*)\/*(.*)/", $this->path, $match);
$server = $match['1'];
$port = $match['2'] ? intval($match['2']) : '80';
$path = $match['3'];
// Figure out the host etc
preg_match("/http:\/\/([^\/\:]+):?(\d*)\/*(.*)/", $this->path, $match);
$server = $match['1'];
$port = $match['2'] ? intval($match['2']) : '80';
$path = $match['3'];
$full_url = ltrim("/$path/server/xmlrpc.server.php",'/');
$client = new xmlrpc_client($full_url,$server,$port);
$full_url = ltrim("/$path/server/xmlrpc.server.php",'/');
$client = new xmlrpc_client($full_url,$server,$port);
/* encode the variables we need to send over */
$encoded_key = new xmlrpcval($token,'string');
$encoded_path = new xmlrpcval(Config::get('web_path'),'string');
$xmlrpc_message = new xmlrpcmsg('xmlrpcserver.get_catalogs', array($encoded_key,$encoded_path));
$response = $client->send($xmlrpc_message,30);
$response = $client->send($xmlrpc_message,30);
if ($response->faultCode() ) {
if ($response->faultCode() ) {
$error_msg = _("Error connecting to") . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString();
debug_event('XMLCLIENT',$error_msg,'1');
echo "<p class=\"error\">$error_msg</p>";
return;
return;
}
$data = php_xmlrpc_decode($response->value());
// Print out the catalogs we are going to sync
foreach ($data as $vars) {
foreach ($data as $vars) {
$catalog_name = $vars['name'];
$count = $vars['count'];
print("<b>Reading Remote Catalog: $catalog_name ($count Songs)</b> [$this->path]<br />\n");
print("<b>Reading Remote Catalog: $catalog_name ($count Songs)</b> [$this->path]<br />\n");
$total += $count;
}
@ -1273,7 +1255,7 @@ class Catalog {
$this->get_remote_song($client,$token,$start,$step);
}
echo "<p>" . _('Completed updating remote catalog(s)') . ".</p><hr />\n";
echo "<p>" . _('Completed updating remote catalog(s)') . ".</p><hr />\n";
flush();
// Update the last update value
@ -1296,26 +1278,26 @@ class Catalog {
$query_array = array($encoded_key,$encoded_start,$encoded_end);
$xmlrpc_message = new xmlrpcmsg('xmlrpcserver.get_songs',$query_array);
/* Depending upon the size of the target catalog this can be a very slow/long process */
set_time_limit(0);
$xmlrpc_message = new xmlrpcmsg('xmlrpcserver.get_songs',$query_array);
/* Depending upon the size of the target catalog this can be a very slow/long process */
set_time_limit(0);
// Sixty Second time out per chunk
$response = $client->send($xmlrpc_message,60);
$value = $response->value();
$response = $client->send($xmlrpc_message,60);
$value = $response->value();
if ( !$response->faultCode() ) {
$data = php_xmlrpc_decode($value);
$this->update_remote_catalog($data,$this->path);
if ( !$response->faultCode() ) {
$data = php_xmlrpc_decode($value);
$this->update_remote_catalog($data,$this->path);
$total = $start + $end;
echo _('Added') . " $total...<br />";
flush();
}
else {
$error_msg = _('Error connecting to') . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString();
debug_event('XMLCLIENT',$error_msg,'1');
echo "<p class=\"error\">$error_msg</p>";
}
}
else {
$error_msg = _('Error connecting to') . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString();
debug_event('XMLCLIENT',$error_msg,'1');
echo "<p class=\"error\">$error_msg</p>";
}
return;
@ -1330,13 +1312,13 @@ class Catalog {
function update_remote_catalog($data,$root_path) {
/*
We need to check the incomming songs
to see which ones need to be added
*/
We need to check the incomming songs
to see which ones need to be added
*/
foreach ($data as $serialized_song) {
// Prevent a timeout
set_time_limit(0);
set_time_limit(0);
$song = unserialize($serialized_song);
$song->artist = self::check_artist($song->artist);
@ -1353,7 +1335,7 @@ class Catalog {
} // foreach new Songs
// now delete invalid entries
// now delete invalid entries
self::clean($this->id);
} // update_remote_catalog
@ -1362,7 +1344,7 @@ class Catalog {
/**
* clean_catalog
* Cleans the Catalog of files that no longer exist grabs from $this->id or $id passed
* Doesn't actually delete anything, disables errored files, and returns them in an array
* Doesn't actually delete anything, disables errored files, and returns them in an array
*/
public function clean_catalog() {
@ -1395,16 +1377,16 @@ class Catalog {
/* Recurse through files, put @ to prevent errors poping up */
while ($results = Dba::fetch_assoc($db_results)) {
/* Stupid little cutesie thing */
$count++;
if (!($count%10)) {
/* Stupid little cutesie thing */
$count++;
if (!($count%10)) {
$file = str_replace(array('(',')','\''),'',$results['file']);
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count ."','clean_count_" . $this->id . "');";
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count ."','clean_count_" . $this->id . "');";
echo "update_txt('" . addslashes(htmlentities($file)) . "','clean_dir_" . $this->id . "');";
echo "\n</script>\n";
flush();
} //echos song count
echo "\n</script>\n";
flush();
} //echos song count
/* Also check the file information */
$file_info = filesize($results['file']);
@ -1433,9 +1415,9 @@ class Catalog {
self::clean($catalog_id);
/* Return dead files, so they can be listed */
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count ."','clean_count_" . $this->id . "');";
echo "\n</script>\n";
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count ."','clean_count_" . $this->id . "');";
echo "\n</script>\n";
show_box_top();
echo "<strong>" . _('Catalog Clean Done') . " [" . $dead_files . "] " . _('files removed') . "</strong><br />\n";
echo "<strong>" . _('Optimizing Tables') . "...</strong><br />\n";
@ -1493,11 +1475,11 @@ class Catalog {
"WHERE `tag_map`.`object_type`='song' AND `song`.`id` IS NULL";
$db_results = Dba::query($sql);
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `album` ON `album`.`id`=`tag_map`.`object_id` " .
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `album` ON `album`.`id`=`tag_map`.`object_id` " .
"WHERE `tag_map`.`object_type`='album' AND `album`.`id` IS NULL";
$db_results = Dba::query($sql);
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `artist` ON `artist`.`id`=`tag_map`.`object_id` " .
$sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `artist` ON `artist`.`id`=`tag_map`.`object_id` " .
"WHERE `tag_map`.`object_type`='artist' AND `artist`.`id` IS NULL";
$db_results = Dba::query($sql);
@ -1520,12 +1502,12 @@ class Catalog {
$db_results = Dba::query($sql);
// Clean albums
$sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `album` ON `album`.`id`=`user_shout`.`object_id` " .
$sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `album` ON `album`.`id`=`user_shout`.`object_id` " .
"WHERE `album`.`id` IS NULL AND `user_shout`.`object_type`='album'";
$db_results = Dba::query($sql);
// Clean artists
$sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `artist` ON `artist`.`id`=`user_shout`.`object_id` " .
$sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `artist` ON `artist`.`id`=`user_shout`.`object_id` " .
"WHERE `artist`.`id` IS NULL AND `user_shout`.`object_type`='artist'";
$db_results = Dba::query($sql);
@ -1702,16 +1684,16 @@ class Catalog {
debug_event('skip',"$song->file has been skipped due to newer local update or file mod time",'5','ampache-catalog');
}
/* Stupid little cutesie thing */
$count++;
if (!($count%10) ) {
/* Stupid little cutesie thing */
$count++;
if (!($count%10) ) {
$file = str_replace(array('(',')','\''),'',$song->file);
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count . "','verify_count_" . $catalog_id . "');";
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $count . "','verify_count_" . $catalog_id . "');";
echo "update_txt('" . scrub_out($file) . "','verify_dir_" . $catalog_id . "');";
echo "\n</script>\n";
flush();
} //echos song count
echo "\n</script>\n";
flush();
} //echos song count
} // end if file exists
@ -1731,11 +1713,11 @@ class Catalog {
// Update the last_update
$this->update_last_update();
// One final time!
// One final time!
echo "<script type=\"text/javascript\">\n";
echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');";
echo "\n</script>\n";
flush();
echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');";
echo "\n</script>\n";
flush();
show_box_top();
echo _('Update Finished.') . ' ' . _('Checked') . " $count. $total_updated " . _('songs updated.') . "<br /><br />";
@ -1769,19 +1751,19 @@ class Catalog {
* this can be slow, but is a good idea to do from time to time. This is incase the dba
* isn't doing it... which we're going to assume they aren't
*/
public static function optimize_tables() {
public static function optimize_tables() {
$sql = "OPTIMIZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`flagged`,`now_playing`,`user_preference`,`tag`,`tag_map`,`tmp_playlist`" .
",`tmp_playlist_data`,`playlist`,`playlist_data`";
$db_results = Dba::query($sql);
$sql = "ANALYZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
$sql = "ANALYZE TABLE `song_data`,`song`,`rating`,`catalog`,`session`,`object_count`,`album`,`album_data`" .
",`artist`,`ip_history`,`flagged`,`now_playing`,`user_preference`,`tag`,`tag_map`,`tmp_playlist`" .
",`tmp_playlist_data`,`playlist`,`playlist_data`";
$db_results = Dba::query($sql);
} // optimize_tables;
} // optimize_tables;
/**
* check_artist
@ -1874,7 +1856,7 @@ class Catalog {
// Remove the prefix so we can sort it correctly
$prefix_pattern = '/^(' . implode('\\s|',explode('|',Config::get('catalog_prefix_pattern'))) . '\\s)(.*)/i';
debug_event('prefix',$prefix_pattern,'3');
debug_event('prefix',$prefix_pattern,'3');
preg_match($prefix_pattern,$album,$matches);
if (count($matches)) {
@ -1944,35 +1926,9 @@ debug_event('prefix',$prefix_pattern,'3');
*/
public static function check_tag($value,$object_id,$object_type='song') {
// First see if the tag exists at all
$tag_id = self::$tags[$value];
$map_id = Tag::add($object_type,$object_id,$value,'0');
if ($tag_id) {
// At least we know the tag but sadly we still have to check the map
$tag = new Tag($tag_id);
if ($tag->has_object($object_id,$object_type)) {
return $tag->id;
}
// Oooh well time to add it
Tag::add_tag_map($tag->id,$object_type,$object_id,'0');
return $tag->id;
} // if cached already
// Clean it up and try to create it
$value = Tag::clean_tag($value);
$tag = Tag::construct_from_name($value);
// Figure out the ID so we can cache it
if (!$tag) { $insert_id = Tag::add_tag($object_type,$object_id,$value,'0'); }
else { $insert_id = $tag->id; }
// Add to the cache
self::$tags[$value] = $insert_id;
return $insert_id;
return $map_id;
} // check_tag
@ -2076,7 +2032,7 @@ debug_event('prefix',$prefix_pattern,'3');
$db_results = Dba::query($sql);
if (!$db_results) {
debug_event('insert',"Unable to Add Remote $url -- $sql",'5','ampache-catalog');
debug_event('insert',"Unable to Add Remote $url -- $sql",'5','ampache-catalog');
echo "<span style=\"color: #FOO;\">Error Adding Remote $url </span><br />$sql<br />\n";
flush();
}
@ -2133,7 +2089,7 @@ debug_event('prefix',$prefix_pattern,'3');
* import_m3u
* this takes m3u filename and then attempts to create a Public Playlist based on the filenames
* listed in the m3u
*/
*/
public function import_m3u($filename) {
$m3u_handle = fopen($filename,'r');
@ -2142,7 +2098,7 @@ debug_event('prefix',$prefix_pattern,'3');
$results = explode("\n",$data);
$pattern = '/\.(' . Config::get('catalog_file_pattern') . ')$/i';
$pattern = '/\.(' . Config::get('catalog_file_pattern') . ')$/i';
// Foreach what we're able to pull out from the file
foreach ($results as $value) {
@ -2196,60 +2152,60 @@ debug_event('prefix',$prefix_pattern,'3');
} // import_m3u
/*!
@function merge_stats
@discussion merge stats entries
@param $type the object_type row in object_count to use
@param $oldid the old object_id
@param $newid the new object_id to merge to
@return the number of stats changed
@todo move this to the right file
*/
function merge_stats ($type,$oldid,$newid) {
/*!
@function merge_stats
@discussion merge stats entries
@param $type the object_type row in object_count to use
@param $oldid the old object_id
@param $newid the new object_id to merge to
@return the number of stats changed
@todo move this to the right file
*/
function merge_stats ($type,$oldid,$newid) {
//check data
$accepted_types = array ("artist");
if (!in_array($type,$accepted_types)) { return false; }
//check data
$accepted_types = array ("artist");
if (!in_array($type,$accepted_types)) { return false; }
//now retrieve all of type and oldid
$stats_qstring = "SELECT id,count,userid," .
//now retrieve all of type and oldid
$stats_qstring = "SELECT id,count,userid," .
"(SELECT id FROM object_count WHERE object_type = '$type' AND object_id = '$newid' AND userid=o.userid) AS existingid " .
"FROM object_count AS o WHERE object_type = '$type' AND object_id = '$oldid'";
$stats_query = mysql_query($stats_qstring,dbh());
$oldstats = array();
//now collect needed data into a array
while ($stats_result = mysql_fetch_assoc($stats_query)) {
$userid = $stats_result['userid'];
$oldstats[$userid]['id'] = $stats_result['id'];
$oldstats[$userid]['count'] = $stats_result['count'];
$oldstats[$userid]['existingid'] = $stats_result['existingid'];
}
//now foreach that array, changeing/updateing object_count and if needed deleting old row
$num_changed = 0;
foreach ($oldstats as $userid => $stats) {
//first check if it is a update or insert
if (is_numeric($stats['existingid'])) {
$stats_query = mysql_query($stats_qstring,dbh());
$oldstats = array();
//now collect needed data into a array
while ($stats_result = mysql_fetch_assoc($stats_query)) {
$userid = $stats_result['userid'];
$oldstats[$userid]['id'] = $stats_result['id'];
$oldstats[$userid]['count'] = $stats_result['count'];
$oldstats[$userid]['existingid'] = $stats_result['existingid'];
}
//now foreach that array, changeing/updateing object_count and if needed deleting old row
$num_changed = 0;
foreach ($oldstats as $userid => $stats) {
//first check if it is a update or insert
if (is_numeric($stats['existingid'])) {
$stats_count_change_qstring = "UPDATE object_count SET count = count + '" . $stats['count'] . "' WHERE id = '" . $stats['existingid'] . "'";
mysql_query($stats_count_change_qstring,dbh());
$stats_count_change_qstring = "UPDATE object_count SET count = count + '" . $stats['count'] . "' WHERE id = '" . $stats['existingid'] . "'";
mysql_query($stats_count_change_qstring,dbh());
//then, delete old row
$old_stats_delete_qstring = "DELETE FROM object_count WHERE id ='" . $stats['id'] . "'";
mysql_query($old_stats_delete_qstring,dbh());
//then, delete old row
$old_stats_delete_qstring = "DELETE FROM object_count WHERE id ='" . $stats['id'] . "'";
mysql_query($old_stats_delete_qstring,dbh());
$num_changed++;
} else {
//hasn't yet listened, just change object_id
$stats_artist_change_qstring = "UPDATE object_count SET object_id = '$newid' WHERE id ='" . $stats['id'] . "'";
mysql_query($stats_artist_change_qstring,dbh());
//done!
$num_changed++;
}
}
return $num_changed;
$num_changed++;
} else {
//hasn't yet listened, just change object_id
$stats_artist_change_qstring = "UPDATE object_count SET object_id = '$newid' WHERE id ='" . $stats['id'] . "'";
mysql_query($stats_artist_change_qstring,dbh());
//done!
$num_changed++;
}
}
return $num_changed;
} // merge_stats
} // merge_stats
/**
* delete
@ -2279,8 +2235,8 @@ debug_event('prefix',$prefix_pattern,'3');
/*!
@function remove_songs
@discussion removes all songs sent in $songs array from the
database, it doesn't actually delete them...
*/
database, it doesn't actually delete them...
*/
function remove_songs($songs) {
foreach($songs as $song) {
@ -2333,7 +2289,7 @@ debug_event('prefix',$prefix_pattern,'3');
} // while result
echo xml_get_footer('itunes');
break;
break;
case 'csv':
echo "ID,Title,Artist,Album,Genre,Length,Track,Year,Date Added,Bitrate,Played,File\n";
while ($results = Dba::fetch_assoc($db_results)) {
@ -2344,7 +2300,7 @@ debug_event('prefix',$prefix_pattern,'3');
'","' . date("Y-m-d\TH:i:s\Z",$song->addition_time) . '","' . $song->f_bitrate .
'","' . $song->played . '","' . $song->file . "\n";
}
break;
break;
} // end switch
} // export

View file

@ -31,6 +31,14 @@ abstract class database_object {
// Statistics for debugging
public static $cache_hit = 0;
/**
* get_info
* retrieves the info from the database and puts it in the cache
*
* @param string $id
* @param string $table_name
* @return array
*/
public function get_info($id,$table_name='') {
$table_name = $table_name ? Dba::escape($table_name) : Dba::escape(strtolower(get_class($this)));
@ -58,19 +66,26 @@ abstract class database_object {
*/
public static function is_cached($index,$id) {
$is_cached = isset(self::$object_cache[$index][$id]);
return $is_cached;
return isset(self::$object_cache[$index][$id]);
} // is_cached
/**
* get_from_cache
* get_from_cache
* This attempts to retrive the specified object from the cache we've got here
*
* @param string $index
* @param string $id
* @return array
*/
public static function get_from_cache($index,$id) {
if (isset(self::$object_cache[$index][$id])) {
// Check if the object is set
if (isset(self::$object_cache)
&& isset(self::$object_cache[$index])
&& isset(self::$object_cache[$index][$id])
) {
self::$cache_hit++;
return self::$object_cache[$index][$id];
}
@ -82,12 +97,22 @@ abstract class database_object {
/**
* add_to_cache
* This adds the specified object to the specified index in the cache
*
* @param string $index
* @param string $id
* @param array $data
* @return boolean
*/
public static function add_to_cache($index,$id,$data) {
$hasbeenset = false;
self::$object_cache[$index][$id] = $data;
// Set the data if it is set
if (isset($data)) {
self::$object_cache[$index][$id] = $data;
$hasbeenset = true;
}
return true;
return $hasbeenset;
} // add_to_cache

View file

@ -43,7 +43,7 @@ class Playlist extends database_object {
*/
public function __construct($id) {
$info = $this->get_info($id);
$info = $this->get_info($id);
foreach ($info as $key=>$value) {
$this->$key = $value;

View file

@ -25,7 +25,7 @@
* This handles the internet radio stuff, that is inserted into live_stream
* this can include podcasts or what-have-you
*/
class Radio {
class Radio extends database_object {
/* DB based variables */
public $id;
@ -42,11 +42,7 @@ class Radio {
*/
public function __construct($id) {
$this->id = intval($id);
if (!$this->id) { return false; }
$info = $this->_get_info();
$info = $this->get_info($id,'live_stream');
// Set the vars
foreach ($info as $key=>$value) {
@ -55,23 +51,6 @@ class Radio {
} // constructor
/**
* _get_info
* Private function for getting the information for this object from the database
*/
private function _get_info() {
$id = Dba::escape($this->id);
$sql = "SELECT * FROM `live_stream` WHERE `id`='$id'";
$db_results = Dba::query($sql);
$results = Dba::fetch_assoc($db_results);
return $results;
} // _get_info
/**
* format
* This takes the normal data from the database and makes it pretty

View file

@ -94,7 +94,9 @@ class Song extends database_object {
parent::add_to_cache('song',$row['id'],$row);
$artists[$row['artist']] = $row['artist'];
$albums[$row['album']] = $row['album'];
$tags[$row['tag_id']] = $row['tag_id'];
if ($row['tag_id']) {
$tags[$row['tag_id']] = $row['tag_id'];
}
}
Artist::build_cache($artists);
@ -362,6 +364,15 @@ class Song extends database_object {
foreach ($data as $key=>$value) {
switch ($key) {
case 'artist':
// Don't do anything if we've negative one'd this baby
if ($value == '-1') {
$value = Catalog::check_artist($data['artist_name']);
}
case 'album':
if ($value == '-1') {
$value = Catalog::check_album($data['album_name']);
}
case 'title':
case 'track':
// Check to see if it needs to be updated
@ -372,8 +383,6 @@ class Song extends database_object {
$updated = 1;
}
break;
case 'artist':
case 'album':
default:
// Rien a faire
break;
@ -677,11 +686,12 @@ class Song extends database_object {
// Get the top tags
$tags = Tag::get_top_tags('song',$this->id);
$this->f_tags = '';
foreach ($tags as $tag_id) {
foreach ($tags as $tag_id=>$values) {
$tag = new Tag($tag_id);
$this->f_tags .= $tag->name . ', ';
$tag->format('song',$this->id);
$this->f_tags .= $tag->f_name . ', ';
}
$this->f_tags = rtrim($this->f_tags,', ');

View file

@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2001 - 2007 Ampache.org
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@ -227,11 +227,12 @@ class Stats {
$sql = "SELECT DISTINCT($type) FROM `song` ORDER BY `addition_time` DESC " .
"LIMIT $limit";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($r = Dba::fetch_row($db_results)) {
$object = new $object_name($r['0']);
$items[] = $object;
$items = array();
while ($row = Dba::fetch_row($db_results)) {
$items[] = $row['0'];
} // end while results
return $items;

View file

@ -28,6 +28,11 @@ class Tag extends database_object {
public $id;
public $name;
// constructed
public $weight=0;
public $count=0;
public $owner=0;
/**
* constructor
* This takes a tag id and returns all of the relevent information
@ -50,26 +55,69 @@ class Tag extends database_object {
*/
public static function construct_from_name($name) {
$name = Dba::escape($name);
$tag_id = self::tag_exists($name);
$sql = "SELECT * FROM `tag` WHERE `name`='$name'";
$db_results = Dba::query($sql);
$row = Dba::fetch_assoc($db_results);
if (!$row['id']) { return false; }
parent::add_to_cache('tag',$row['id'],$row);
$tag = new Tag(0);
foreach ($row as $key=>$value) {
$tag->$key = $value;
}
$tag = new Tag($tag_id);
return $tag;
} // construct_from_name
/**
* format
* This makes the tag presentable to the great humans that use this program, other life forms
* will just have to fend for themselves
*/
public function format($type=0,$object_id=0) {
if (!self::validate_type($type)) { return false; }
if ($type) {
$this->set_object($type,$object_id);
}
$size = 3 + ($this->weight-1) - ($this->count-1);
if ($size > 4) { $size = 4; }
if ($this->owner == $GLOBALS['user']->id) {
$action = '?page=tag&action=remove_tag&type=' . scrub_out($type) . '&tag_id=' . intval($this->id) . '&object_id=' . intval($object_id);
$class = "hover-remove ";
}
else {
$action = '?page=tag&action=add_tag&type=' . scrub_out($type) . '&tag_id=' . intval($this->id) . '&object_id=' . intval($object_id);
$class = "hover-add ";
}
$class .= 'tag_size' . $size;
$this->f_name = Ajax::text($action,$this->name,'modify_tag_' . $this->id . '_' . $object_id,'',$class);
} // format
/**
* set_object
* This assoicates the tag with a specified object, we try to get the data
* from the map cache, otherwise I guess we'll just have to look it up
*/
public function set_object($type,$object_id) {
if (parent::is_cached('tag_top_' . $type,$object_id)) {
$data = parent::get_from_cache('tag_top_' . $type,$object_id);
}
else {
$data = self::get_top_tags($type,$object_id);
}
$this->weight = $data[$this->id]['count'];
if (in_array($GLOBALS['user']->id,$data[$this->id]['users'])) {
$this->owner = $GLOBALS['user']->id;
}
$this->count = count($data);
} // set_object
/**
* build_cache
* This takes an array of object ids and caches all of their information
@ -82,7 +130,7 @@ class Tag extends database_object {
$idlist = '(' . implode(',',$ids) . ')';
$sql = "SELECT * FROM `tag` WHERE `id` IN $idlist";
$db_results = Dba::query($sql);
$db_results = Dba::read($sql);
while ($row = Dba::fetch_assoc($db_results)) {
parent::add_to_cache('tag',$row['id'],$row);
@ -102,18 +150,20 @@ class Tag extends database_object {
$type = self::validate_type($type);
$idlist = '(' . implode(',',$ids) . ')';
$sql = "SELECT COUNT(`tag_map`.`id`) AS `count`,`tag`.`id`,`tag_map`.`object_id` FROM `tag_map` " .
"INNER JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " .
"WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id` IN $idlist " .
"GROUP BY `tag_map`.`object_id` ORDER BY `count` DESC";
$sql = "SELECT `tag_map`.`tag_id`,`tag_map`.`object_id`,`tag_map`.`user` FROM `tag_map` " .
"WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id` IN $idlist ";
$db_results = Dba::query($sql);
$tags = array();
while ($row = Dba::fetch_assoc($db_results)) {
$tags[$row['object_id']][] = $row;
$tags[$row['object_id']][$row['tag_id']]['users'][] = $row['user'];
$tags[$row['object_id']][$row['tag_id']]['count']++;
}
foreach ($tags as $id=>$entry) {
parent::add_to_cache('tag_map_' . $type,$id,$entry);
// Run through our origional ids as we want to cache NULL results
foreach ($ids as $id) {
parent::add_to_cache('tag_top_' . $type,$id,$tags[$id]);
}
return true;
@ -121,61 +171,60 @@ class Tag extends database_object {
} // build_map_cache
/**
* has_object
* This checks to see if the current tag element has the specified object
* of the specified type
* add
* This is a wrapper function, it figures out what we need to add, be it a tag
* and map, or just the mapping
*/
public function has_object($object_type,$object_id) {
public static function add($type,$id,$value,$user='') {
$object_type = self::validate_type($object_type);
$object_id = intval($object_id);
$tag_id = intval($this->id);
// Validate the tag type
if (!self::validate_type($type)) { return false; }
$sql = "SELECT * FROM `tag_map` WHERE `object_type`='$object_type' AND `object_id`='$object_id' " .
" AND `tag_id`='$tag_id'";
$db_results = Dba::query($sql);
if (!is_numeric($id)) { return false; }
return Dba::num_rows($db_results);
$cleaned_value = self::clean_tag($value);
} // has_object
if (!strlen($cleaned_value)) { return false; }
$uid = ($user == '') ? intval($user) : intval($GLOBALS['user']->id);
// Check and see if the tag exists, if not create it, we need the tag id from this
if (!$tag_id = self::tag_exists($cleaned_value)) {
$tag_id = self::add_tag($cleaned_value);
}
if (!$tag_id) {
debug_event('Error','Error unable to create tag value:' . $cleaned_value . ' unknown error','1');
return false;
}
// We've got the tag id, let's see if it's already got a map, if not then create the map and return the value
if (!$map_id = self::tag_map_exists($type,$id,$tag_id,$user)) {
$map_id = self::add_tag_map($type,$id,$tag_id,$user);
}
return $map_id;
} // add
/**
* add_tag
* This function adds a new tag, for now we're going to limit the tagging a bit
*/
public static function add_tag($type, $id, $tagval,$user='') {
if (!self::validate_type($type)) {
return false;
}
if (!is_numeric($id)) {
return false;
}
public static function add_tag($value) {
// Clean it up and make it tagish
$tagval = self::clean_tag($tagval);
$value = self::clean_tag($value);
if (!strlen($tagval)) { return false; }
if (!strlen($value)) { return false; }
$uid = ($user == '') ? intval($user) : intval($GLOBALS['user']->id);
$tagval = Dba::escape($tagval);
$type = Dba::escape($type);
$id = intval($id);
$value = Dba::escape($value);
// Check if tag object exists
$sql = "SELECT `tag`.`id` FROM `tag` WHERE `name`='$tagval'";
$db_results = Dba::query($sql) ;
$row = Dba::fetch_assoc($db_results);
$insert_id = $row['id'];
$sql = "REPLACE INTO `tag` SET `name`='$value'";
$db_results = Dba::write($sql);
$insert_id = Dba::insert_id();
// If the tag doesn't exist create it.
if (!count($row)) {
$sql = "INSERT INTO `tag` SET `name`='$tagval'";
$db_results = Dba::query($sql) ;
$insert_id = Dba::insert_id();
}
self::add_tag_map($insert_id,$type,$id);
parent::add_to_cache('tag_name',$value,$insert_id);
return $insert_id;
@ -185,98 +234,107 @@ class Tag extends database_object {
* add_tag_map
* This adds a specific tag to the map for specified object
*/
public static function add_tag_map($tag_id,$object_type,$object_id,$user='') {
public static function add_tag_map($type,$object_id,$tag_id,$user='') {
$uid = ($user == '') ? intval($GLOBALS['user']->id) : intval($user);
$tag_id = intval($tag_id);
$type = self::validate_type($object_type);
if (!self::validate_type($type)) { return false; }
$id = intval($object_id);
// Now make sure this isn't a duplicate
$sql = "SELECT * FROM `tag_map " .
"WHERE `tag_id`='$insert_id' AND `user`='$uid' AND `object_type`='$type' AND `object_id`='$id'";
$db_results = Dba::query($sql);
if (!$tag_id || !$id) { return false; }
$row = Dba::fetch_assoc($db_results);
$sql = "INSERT INTO `tag_map` (`tag_id`,`user`,`object_type`,`object_id`) " .
"VALUES ('$tag_id','$uid','$type','$id')";
$db_results = Dba::write($sql);
$insert_id = Dba::insert_id();
// Only insert it if the current tag for this user doesn't exist
if (!count($row)) {
$sql = "INSERT INTO `tag_map` (`tag_id`,`user`,`object_type`,`object_id`) " .
"VALUES ('$tag_id','$uid','$type','$id')";
$db_results = Dba::query($sql);
$insert_id = Dba::insert_id();
}
else {
$insert_id = $row['id'];
}
parent::add_to_cache('tag_map_' . $type,$insert_id,array('tag_id'=>$tag_id,'user'=>$uid,'object_type'=>$type,'object_id'=>$id));
return $insert_id;
} // add_tag_map
/**
* get_many_tags
* This builds a cache of all of the tags contained by the specified object ids
* of the specified type
* tag_exists
* This checks to see if a tag exists, this has nothing to do with objects or maps
*/
public static function get_many_tags($type, $object_ids) {
public static function tag_exists($value) {
// If they pass us nothing, they get nothing
if (!count($object_ids)) { return array(); }
if (!self::validate_type($type)) { return array(); }
$lid = '(' . implode(',',$id) . ')';
$orsql = '';
if ($objType == 'artist' || $objType == 'album')
$orsql=" or (tag_map.object_id = song.id AND tag_map.object_type='song' and song.$objType in $lid )";
if ($objType == 'artist')
$orsql .= "or (tag_map.object_id = album.id AND tag_map.object_type='album' and $objType.id in $lid )";
$sql = "SELECT DISTINCT tag.id, tag.name, tag_map.user, $objType.id as oid FROM tag, tag_map, song, artist, album WHERE " .
"tag_map.tag_id = tag.id AND ( (tag_map.object_type='$objType' AND $objType.id in $lid AND tag_map.object_id = $objType.id) $orsql) " .
"AND song.album = album.id AND song.artist = artist.id;";
return array();
$results = array();
$db_results = Dba::query($sql) or die(Dba::error());
while ($r = Dba::fetch_assoc($db_results)) {
$uid = intval($r['oid']);
$results[] = $r;
if (parent::is_cached('tag_name',$value)) {
return parent::get_from_cache('tag_name',$value);
}
//return self::filter_with_prefs($results);
return $results;
$value = Dba::escape($value);
$sql = "SELECT * FROM `tag` WHERE `name`='$value'";
$db_results = Dba::read($sql);
} // get_man_tags
$results = Dba::fetch_assoc($db_results);
parent::add_to_cache('tag_name',$results['name'],$results['id']);
return $results['id'];
} // tag_exists
/**
* tag_map_exists
* This looks to see if the current mapping of the current object of the current tag of the current
* user exists, lots of currents... taste good in scones.
*/
public static function tag_map_exists($type,$object_id,$tag_id,$user) {
if (!self::validate_type($type)) { return false; }
if (parent::is_cached('tag_map_' . $type,$object_id)) {
$data = parent::get_from_cache('tag_map_' . $type,$object_id);
return $data['id'];
}
$object_id = Dba::escape($object_id);
$tag_id = Dba::escape($tag_id);
$user = Dba::escape($user);
$type = Dba::escape($type);
$sql = "SELECT * FROM `tag_map` WHERE `tag_id`='$tag_id' AND `user`='$user' AND `object_id`='$object_id' AND `object_type`='$type'";
$db_results = Dba::read($sql);
$results = Dba::fetch_assoc($db_results);
parent::add_to_cache('tag_map_' . $type,$results['id'],$results);
return $results['id'];
} // tag_map_exists
/**
* get_top_tags
* This gets the top tags for the specified object using limit
*/
public static function get_top_tags($type,$object_id,$limit='2') {
public static function get_top_tags($type,$object_id,$limit='10') {
$type = self::validate_type($type);
if (!self::validate_type($type)) { return false; }
if (parent::is_cached('tag_map_' . $type,$object_id)) {
return parent::get_from_cache('tag_map_' . $type,$object_id);
if (parent::is_cached('tag_top_' . $type,$object_id)) {
return parent::get_from_cache('tag_top_' . $type,$object_id);
}
$object_id = intval($object_id);
$limit = intval($limit);
$sql = "SELECT COUNT(`tag_map`.`id`) AS `count`,`tag`.`id` FROM `tag_map` " .
"INNER JOIN `tag` ON `tag`.`id`=`tag_map`.`tag_id` " .
$sql = "SELECT `tag_map`.`tag_id`,`tag_map`.`user` FROM `tag_map` " .
"WHERE `tag_map`.`object_type`='$type' AND `tag_map`.`object_id`='$object_id' " .
"GROUP BY `tag_map`.`object_id` ORDER BY `count` DESC LIMIT $limit";
"LIMIT $limit";
$db_results = Dba::query($sql);
$results = array();
while ($row = Dba::fetch_assoc($db_results)) {
$results[] = $row['id'];
$results[$row['tag_id']]['users'][] = $row['user'];
$results[$row['tag_id']]['count']++;
}
parent::add_to_cache('tag_top_' . $type,$object_id,$results);
return $results;
} // get_top_tags
@ -364,6 +422,26 @@ return array();
} // filter_with_prefs
/**
* remove_map
* This will only remove tag maps for the current user
*/
public function remove_map($type,$object_id) {
if (!self::validate_type($type)) { return false; }
$type = Dba::escape($type);
$tag_id = Dba::escape($this->id);
$object_id = Dba::escape($object_id);
$user_id = Dba::escape($GLOBALS['user']->id);
$sql = "DELETE FROM `tag_map` WHERE `tag_id`='$tag_id' AND `object_type`='$type' AND `object_id`='$object_id' AND `user`='$user_id'";
$db_results = Dba::write($sql);
return true;
} // remove_map
/**
* validate_type
* This validates the type of the object the user wants to tag, we limit this to types

View file

@ -1398,5 +1398,27 @@ class Update {
} // update_350002
/**
* update_350003
* This update tweakes the tag tables a little bit more, we're going to simplify things for the first little bit and then
* then if it all works out we will worry about making it complex again. One thing at a time people...
*/
public static function update_350003() {
$sql = "ALTER TABLE `tag` DROP `order`";
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `tag` DROP INDEX `order`";
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `tag` ADD UNIQUE ( `name` )";
$db_results = Dba::write($sql);
$sql = "ALTER TABLE `tag` CHANGE `name` `name` VARCHAR( 255 )";
$db_results = Dba::write($sql);
} // update_350003
} // end update class
?>

View file

@ -115,7 +115,7 @@ class vainfo {
$this->_getID3->option_tag_lyrics3 = false;
$this->_getID3->encoding = $this->encoding;
$this->_getID3->encoding_id3v1 = $this->encoding_id3v1;
$this->_getID3->encoding_id3v2 = $this->encoding_id3v2;
// $this->_getID3->encoding_id3v2 = $this->encoding_id3v2;
$this->_getID3->option_tags_process = true;
/* Check for ICONV */

View file

@ -200,11 +200,21 @@ function check_putenv() {
return false;
}
// Make sure it actually worked
$current = ini_get('memory_limit');
if ($new_limit != $current) {
return false;
}
/* Check if safe mode is on */
if (ini_get('safe_mode')) {
return false;
}
// See if we can override the set_time_limit();
return true;
} // check_putenv

View file

@ -85,7 +85,7 @@ if (!count($results)) {
}
/** This is the version.... fluf nothing more... **/
$results['version'] = '3.5-Alpha1 (Build 003)';
$results['version'] = '3.5-Alpha1 (Build 004)';
$results['int_config_version'] = '7';
$results['raw_web_path'] = $results['web_path'];

View file

@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2001 - 2006 Ampache.org
Copyright (c) Ampache.org
All Rights Reserved
This program is free software; you can redistribute it and/or
@ -25,15 +25,16 @@
or to a defined log file based on config options
*/
function log_event($username='Unknown',$event_name,$event_description,$log_name='ampache') {
/* Set it up here to make sure it's _always_ the same */
$log_time = time();
/* must have some name */
if (!strlen($log_name)) { $log_name = 'ampache'; }
$username = $username ? $username : 'ampache';
$log_filename = Config::get('log_path') . "/$log_name." . date("Ymd",$log_time) . ".log";
$log_line = date("Y-m-d H:i:s",$log_time) . " { $username } ( $event_name ) - $event_description \n";
$log_line = date("Y-m-d H:i:s",$log_time) . " [$username] ($event_name) -> $event_description \n";
$log_write = error_log($log_line, 3, $log_filename);
@ -80,6 +81,7 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) {
break;
} // end switch
/* Don't log var: Deprecated we know shutup!
* Yea now getid3() spews errors I love it :(
*/
@ -101,9 +103,13 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) {
return false;
}
$log_line = "[$error_name] $errstr on line $errline in $errfile";
$log_line = "[$error_name] $errstr in file $errfile($errline)";
debug_event('PHP Error',$log_line,$level);
// When a dir is defined lets log it to a logfile
if (Config::get('log_path') != "")
log_event("ampache","PHP Error", $log_line);
} // ampache_error_handler
/**

View file

@ -180,18 +180,34 @@ function search_song($data,$operator,$method,$limit) {
"WHERE `object_type`='song' GROUP BY `object_id`";
$db_results = Dba::query($rating_sql);
// Fill it with one value to prevent sql error on no results
$where_sql .= " `song`.`id` IN (";
$end_rating = '';
$ids = array('0');
while ($row = Dba::fetch_assoc($db_results)) {
if ($row['avgrating'] < $value) { continue; }
$where_sql .= $row['object_id'] . ',';
$end_rating = ") $operator";
$ids[] = $row['object_id'];
}
$where_sql = rtrim($where_sql,"`song`.`id` IN (");
$where_sql = rtrim($where_sql,",") . $end_rating;
$where_sql .= implode(',',$ids) . ')';
break;
case 'tag':
// Fill it with one value to prevent sql error on no results
$ids = array('0');
$tag_sql = "SELECT `object_id` FROM `tag` LEFT JOIN `tag_map` ON `tag`.`id`=`tag_map`.`tag_id` " .
"WHERE `tag_map`.`object_type`='song' AND `tag`.`name` $value_string ";
$db_results = Dba::read($tag_sql);
while ($row = Dba::fetch_assoc($db_results)) {
$ids[] = $row['object_id'];
}
$where_sql = " `song`.`id` IN (" . implode(',',$ids) . ")";
break;
default:
// Notzing!
break;

View file

@ -156,5 +156,3 @@ if ($auth['success']) {
require Config::get('prefix') . '/templates/show_login_form.inc.php';
?>
</body>
</html>

View file

@ -1,3 +1,4 @@
<?xml version="1.0"?>
<!-- Copyright (c) 2001 - 2008 Ampache.org
All rights reserved.
@ -14,9 +15,6 @@
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. -->
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>

View file

@ -375,7 +375,7 @@ class getid3_write_id3v2 extends getid3_handler_write
// rewrite file - no tag present or new tag longer than old tag
else
{
if (!$fp_source = @fopen($this->filename, 'rb')) {
throw new getid3_exception('Could not open '.$this->filename.' mode "rb"');
}

View file

@ -288,7 +288,7 @@ class mp3tunes {
$limit = $limit ? intval($limit) : $this->limit;
$offset = $offset ? intval($offset) : '0';
$xml_doc = self::run_query('general'"/lockerSearch?s=$name&count=$limit&set=$offset&type=album");
$xml_doc = self::run_query('general',"/lockerSearch?s=$name&count=$limit&set=$offset&type=album");
// Set the right parent
$this->_containerTag = 'albumList';

View file

@ -282,7 +282,8 @@ if (Config::get('track_user_ip')) {
// If we've got downsample remote enabled
if (Config::get('downsample_remote')) {
if (!Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'25')) {
if (!Access::check_network('network',$_SERVER['REMOTE_ADDR'],$GLOBALS['user']->id,'0')) {
debug_event('downsample','Network Downsample ' . $_SERVER['REMOTE_ADDR'] . ' is not in Local definition','5');
$not_local = true;
}
} // if downsample remote is enabled

View file

@ -65,23 +65,10 @@ switch ($_REQUEST['action']) {
$playlist->remove_songs($_REQUEST['song']);
show_playlist($playlist);
break;
case 'update_playlist':
/* Make sure they've got thems rights */
if (!$playlist->has_access()) {
access_denied();
break;
}
$playlist->update_type($_REQUEST['type']);
$playlist->update_name($_REQUEST['playlist_name']);
$url = conf('web_path') . '/playlist.php?action=show_playlist&amp;playlist_id=' . $playlist->id;
$title = _('Playlist Updated');
$body = "$playlist->name " . _('has been updated and is now') . " $playlist->type";
show_confirmation($title,$body,$url);
break;
case 'show_playlist':
$playlist = new Playlist($_REQUEST['playlist_id']);
$playlist->format();
$object_ids = $playlist->get_items();
require_once Config::get('prefix') . '/templates/show_playlist.inc.php';
break;
case 'show_import_playlist':

View file

@ -29,7 +29,11 @@ switch ($_REQUEST['action']) {
break;
case 'add_tag':
Tag::add_tag_map($_REQUEST['type'],$_REQUEST['object_id'],$_REQUEST['tag_id']);
break;
case 'remove_tag':
$tag = new Tag($_REQUEST['tag_id']);
$tag->remove_map($_REQUEST['type'],$_REQUEST['object_id']);
break;
default:
$results['rfc3514'] = '0x1';

View file

@ -49,9 +49,7 @@ switch ($_REQUEST['action']) {
default:
// Global stuff first
$stats = Catalog::get_stats();
require_once Config::get('prefix') . '/templates/show_local_catalog_info.inc.php';
require_once Config::get('prefix') . '/templates/show_stats_popular.inc.php';
require_once Config::get('prefix') . '/templates/show_stats_newest.inc.php';
require_once Config::get('prefix') . '/templates/show_stats.inc.php';
break;
} // end switch on action

46
templates/base.css Normal file
View file

@ -0,0 +1,46 @@
/*
Copyright (c) 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.
*/
/*****************************************************************************/
/* Base Definitions, may be overwridden by themes
/*****************************************************************************/
/*****************
* Tag Definitions
*****************/
.tag_size1 {
font-size:.6em;
}
.tag_size2 {
font-size:.8em;
}
.tag_size3 {
font-size:1em;
}
.tag_size4 {
font-size:1.2em;
}
a.tag_size1, a.tag_size2, a.tag_size3, a.tag_size4 { text-decoration: none; }
.hover-add:hover { font-weight:900; }
.hover-remove:hover { text-decoration:line-through;}

View file

@ -1,106 +0,0 @@
<!--
/*
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.
*/
-->
/*
#topbar {
display: none;
}
*/
html, address,
blockquote,
body, dd, div,
dl, dt, fieldset, form,
frame, frameset,
h1, h2, h3, h4,
h5, h6, noframes,
ol, p, ul, center,
dir, hr, menu, pre { display: block }
li { display: list-item }
head { display: none }
table { display: block }
tr { display: table-row }
thead { display: table-header-group }
tbody { display: table-row-group }
tfoot { display: table-footer-group }
col { display: table-column }
colgroup { display: table-column-group }
td, th { display: table-cell }
caption { display: table-caption }
th { font-weight: bolder; text-align: center }
caption { text-align: center }
body { margin: 8px }
h1 { font-size: 2em; margin: .67em 0 }
h2 { font-size: 1.5em; margin: .75em 0 }
h3 { font-size: 1.17em; margin: .83em 0 }
h4, p,
blockquote, ul,
fieldset, form,
ol, dl, dir,
menu { margin: 1.12em 0 }
h5 { font-size: .83em; margin: 1.5em 0 }
h6 { font-size: .75em; margin: 1.67em 0 }
h1, h2, h3, h4,
h5, h6, b,
strong { font-weight: bolder }
blockquote { margin-left: 40px; margin-right: 40px }
i, cite, em,
var, address { font-style: italic }
pre, tt, code,
kbd, samp { font-family: monospace }
pre { white-space: pre }
textarea,
input, select { display: block }
big { font-size: 1.17em }
small, sub, sup { font-size: .83em }
sub { vertical-align: sub }
sup { vertical-align: super }
table { border-spacing: 2px; }
thead, tbody,
tfoot { vertical-align: middle }
td, th { vertical-align: inherit }
s, strike, del { text-decoration: line-through }
hr { border: 1px inset }
ol, ul, dir,
menu, dd { margin-left: 40px }
ol { list-style-type: decimal }
ol ul, ul ol,
ul ul, ol ol { margin-top: 0; margin-bottom: 0 }
u, ins { text-decoration: underline }
br:before { content: "\A" }
:before, :after { white-space: pre }
center { text-align: center }
:link, :visited { text-decoration: underline }
:focus { outline: thin dotted invert }
/* Begin bidirectionality settings (do not change) */
BDO[DIR="ltr"] { direction: ltr; unicode-bidi: bidi-override }
BDO[DIR="rtl"] { direction: rtl; unicode-bidi: bidi-override }
*[DIR="ltr"] { direction: ltr; unicode-bidi: embed }
*[DIR="rtl"] { direction: rtl; unicode-bidi: embed }
@media print {
h1 { page-break-before: always }
h1, h2, h3,
h4, h5, h6 { page-break-after: avoid }
ul, ol, dl { page-break-before: avoid }
}

View file

@ -33,23 +33,19 @@ $location = get_location();
<?php
if (Config::get('use_rss')) { ?>
<link rel="alternate" type="application/rss+xml" title="<?php echo Config::get('rss_main_title'); ?>" href="<?php echo $web_path; ?>/rss.php" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Latest Artists Additions'); ?>" href="<?php echo $web_path; ?>/rss.php?type=latestartist" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Latest Albums Additions'); ?>" href="<?php echo $web_path; ?>/rss.php?type=latestalbum" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Most Popular Albums'); ?>" href="<?php echo $web_path; ?>/rss.php?type=popularalbum" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Most Popular Artists'); ?>" href="<?php echo $web_path; ?>/rss.php?type=popularalbum" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Most Popular Songs'); ?>" href="<?php echo $web_path; ?>/rss.php?type=popularsong" />
<link rel="alternate" type="application/rss+xml" title="<?php echo _('Ampache Recently Played'); ?>" href="<?php echo $web_path; ?>/rss.php?type=recentlyplayed" />
<?php } ?>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo scrub_out(Config::get('site_title')); ?> - <?php echo $location['title']; ?></title>
<link rel="stylesheet" href="<?php echo $web_path; ?>/templates/base.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo $web_path; ?><?php echo Config::get('theme_path'); ?>/templates/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="<?php echo $web_path; ?>/templates/print.css" type="text/css" media="print" />
<link rel="stylesheet" href="<?php echo $web_path; ?>/templates/handheld.css" type="text/css" media="handheld" />
</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>
<script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script>
<!-- rfc3514 implementation -->
<div id="rfc3514" style="display:none;">0x0</div>
<div id="maincontainer" <?php
if ($GLOBALS['theme']['orientation'] == 'horizontal') {
@ -78,8 +74,6 @@ if (Config::get('use_rss')) { ?>
<div id="rightbar"><!-- This is the rightbar -->
<?php require_once Config::get('prefix') . '/templates/rightbar.inc.php'; ?>
</div><!-- End rightbar -->
<!-- I hate IE...
<table class="smeg-ie" width="100%"><tr><td> -->
<!-- Tiny little iframe, used to cheat the system -->
<div id="ajax-loading">Loading . . .</div>
<iframe name="util_iframe" id="util_iframe" style="display:none;" src="<?php echo Config::get('web_path'); ?>/util.php"></iframe>

View file

@ -92,7 +92,7 @@ h3 {
/* Table style */
td{
padding:5px;
//background-color: #D9E0E8;
/*background-color: #D9E0E8;*/
font-size: smaller;
}
@ -120,13 +120,13 @@ textarea:focus{
.ok {
font-weight:bold;
color:#009900;
margin:10px 10 10px 10px;
margin:10px 10px 10px 10px;
}
.notok {
font-weight:bold;
color:#FF3300;
margin:10px 10 10px 10px;
margin:10px 10px 10px 10px;
}
/* Bottom */

View file

@ -84,7 +84,7 @@ br:before { content: "\A" }
:before, :after { white-space: pre }
center { text-align: center }
:link, :visited { text-decoration: underline }
:focus { outline: thin dotted invert }
/* :focus { outline: thin invert }*/
/* Begin bidirectionality settings (do not change) */
BDO[DIR="ltr"] { direction: ltr; unicode-bidi: bidi-override }
@ -99,6 +99,7 @@ BDO[DIR="rtl"] { direction: rtl; unicode-bidi: bidi-override }
h1, h2, h3,
h4, h5, h6 { page-break-after: avoid }
ul, ol, dl { page-break-before: avoid }
}
#sidebar {
display: none;
@ -123,4 +124,3 @@ display: none;
select {
display: none;
}

View file

@ -32,6 +32,7 @@
</li>
<?php
$playlists = Playlist::get_users($GLOBALS['user']->id);
Playlist::build_cache($playlists);
foreach ($playlists as $playlist_id) {
$playlist = new Playlist($playlist_id);
$playlist->format();

View file

@ -44,7 +44,6 @@
<?php echo get_user_icon('comment',_('Post Shout')); ?>
</a>
<?php } ?>
<?php echo Ajax::button('?page=tag&action=show_add_tag&type=album&id=' . $album->id,'add_tag',_('Add Tag'),'add_album_tag_' . $album->id); ?>
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo Config::get('web_path'); ?>/batch.php?action=album&amp;id=<?php echo $album->id; ?>">
<?php echo get_user_icon('batch_download',_('Batch Download')); ?>

View file

@ -25,7 +25,7 @@ $title = sprintf(_('Albums by %s'), $artist->full_name);
show_box_top(sprintf(gettext('%s by %s'), ucfirst($object_type) ,$artist->f_name),'info-box');
if (Config::get('ratings')) {
?>
<div id="rating_"<?php echo intval($artist->id); ?>"_artist" style="display:inline;">
<div id="rating_<?php echo intval($artist->id); ?>_artist" style="display:inline;">
<?php show_rating($artist->id, 'artist'); ?>
</div>
<?php } ?>
@ -38,7 +38,7 @@ if (Config::get('ratings')) {
<?php echo Ajax::button('?action=basket&type=artist&id=' . $artist->id,'add',_('Add'),'add_' . $artist->id); ?><?php printf(_('Add All Songs By %s'), $artist->f_name); ?>
</li>
<li>
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $artist->id,'random',_('Random'),'random_' . $artist->id); ?><?php printf(_('Add Random Songs By %s'), $artist->f_name); ?>>
<?php echo Ajax::button('?action=basket&type=artist_random&id=' . $artist->id,'random',_('Random'),'random_' . $artist->id); ?><?php printf(_('Add Random Songs By %s'), $artist->f_name); ?>
</li>
<?php if (Access::check('interface','50')) { ?>
<li>
@ -53,7 +53,7 @@ if (Config::get('ratings')) {
<?php } ?>
<li>
<input type="checkbox" id="show_artist_artCB" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/> <?php echo _('Show Art'); ?>
<?php echo Ajax::observe('show_artist_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1','')); ?>
<?php echo Ajax::observe('show_artist_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1&type=album','')); ?>
</ul>
</div>
<?php show_box_bottom(); ?>

View file

@ -28,7 +28,7 @@ $htmllang = str_replace("_","-",Config::get('lang'));
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo Config::get('site_title'); ?> - <?php echo _("Album Art"); ?></title>
</head>
<body onLoad="self.resizeTo(document.images[0].width+30, document.images[0].height+70)">
<body onload="self.resizeTo(document.images[0].width+30, document.images[0].height+70)">
<?php
echo "<a href=\"javascript:window.close()\" title=\"" . _('Click to close window') . "\">";
echo "<img src=\"" . Config::get('web_path') . "/image.php?id=" . scrub_out($_GET['id']) . "&amp;sid=" . session_id() . "\" border=\"0\" alt=\"\" />";

View file

@ -24,7 +24,7 @@ show_box_top(_('Create Democratic Playlist')); ?>
<table class="tabledata" cellspacing="0" cellpadding="0">
<tr>
<td><?php echo _('Name'); ?></td>
<td><input type="textbox" name="name" value="" /></td>
<td><input type="text" name="name" value="" /></td>
</tr>
<tr>
<td><?php echo _('Base Playlist'); ?></td>
@ -32,7 +32,7 @@ show_box_top(_('Create Democratic Playlist')); ?>
</tr>
<tr>
<td><?php echo _('Cooldown Time'); ?></td>
<td><input type="textbox" size="4" maxlength="6" name="cooldown" value="5" /><?php echo _('minutes'); ?></td>
<td><input type="text" size="4" maxlength="6" name="cooldown" value="5" /><?php echo _('minutes'); ?></td>
</tr>
<tr>
<td><?php echo _('Level'); ?></td>

View file

@ -25,9 +25,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ampache -- Debug Page</title>
<link rel="stylesheet" href="<?php echo Config::get('web_path'); ?>/templates/install.css" type="text/css" media="screen" />
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="<?php echo Config::get('web_path'); ?>/templates/install.css" type="text/css" media="screen" />
<div id="header">
<h1>Ampache :: <?php echo _('Access Denied'); ?></h1>
<p>This Event has been logged</p>

View file

@ -30,7 +30,7 @@
<col id="col_additiontime" />
</colgroup>
<tr class="th-top">
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></td>
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></th>
<th class="cel_song"><?php echo _('Title'); ?></th>
<th class="cel_album"><?php echo _('Album'); ?></th>
<th class="cel_artist"><?php echo _('Artist'); ?></th>
@ -53,7 +53,7 @@
</tr>
<?php } ?>
<tr class="th-bottom">
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></td>
<th class="cel_select"><a href="#" onclick="check_select('song'); return false;"><?php echo _('Select'); ?></a></th>
<th class="cel_song"><?php echo _('Title'); ?></th>
<th class="cel_album"><?php echo _('Album'); ?></th>
<th class="cel_artist"><?php echo _('Artist'); ?></th>

View file

@ -24,7 +24,7 @@
<table class="table-data">
<tr>
<td><?php echo _('Name'); ?>: </td>
<td><input type="textbox" name="name" value="<?php echo scrub_out($access->name); ?>" /></td>
<td><input type="text" name="name" value="<?php echo scrub_out($access->name); ?>" /></td>
</tr>
<tr>
<td><?php echo _('ACL Type'); ?>: </td>
@ -65,7 +65,6 @@
<input type="text" name="key" value="<?php echo scrub_out($access->key); ?>" size="32" maxlength="32" />
</td>
</tr>
</tr>
<tr>
<td><?php echo _('Level'); ?>:</td>
<td>

View file

@ -26,13 +26,13 @@
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Name'); ?></td>
<td>
<input type="textbox" name="name" value="<?php echo scrub_out($album->full_name); ?>">
<input type="text" name="name" value="<?php echo scrub_out($album->full_name); ?>">
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Year'); ?></td>
<td>
<input type="textbox" name="year" value="<?php echo scrub_out($album->year); ?>">
<input type="text" name="year" value="<?php echo scrub_out($album->year); ?>">
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">

View file

@ -24,7 +24,7 @@
<table class="inline-edit" cellpadding="3" cellspacing="0">
<tr>
<td>
<input type="textbox" name="name" value="<?php echo scrub_out($album->full_name); ?>" />
<input type="text" name="name" value="<?php echo scrub_out($album->full_name); ?>" />
</td>
<td>
<?php
@ -37,7 +37,7 @@
?>
</td>
<td>
<input type="textbox" name="year" value="<?php echo scrub_out($album->year); ?>" />
<input type="text" name="year" value="<?php echo scrub_out($album->year); ?>" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $album->id; ?>" />

View file

@ -26,7 +26,7 @@
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Name'); ?></td>
<td>
<input type="textbox" name="name" value="<?php echo scrub_out($artist->name); ?>">
<input type="text" name="name" value="<?php echo scrub_out($artist->name); ?>">
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">

View file

@ -24,7 +24,7 @@
<table class="inline-edit" cellpadding="3" cellspacing="0">
<tr>
<td>
<input type="textbox" name="name" value="<?php echo scrub_out($artist->f_full_name); ?>" />
<input type="text" name="name" value="<?php echo scrub_out($artist->f_full_name); ?>" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $artist->id; ?>" />

View file

@ -32,19 +32,19 @@
</tr>
<tr>
<td>
<input type="textbox" name="name" value="<?php echo scrub_out($radio->name); ?>" size="9" />
<input type="text" name="name" value="<?php echo scrub_out($radio->name); ?>" size="9" />
</td>
<td>
<input type="textbox" name="url" value="<?php echo scrub_out($radio->url); ?>" size ="12" />
<input type="text" name="url" value="<?php echo scrub_out($radio->url); ?>" size ="12" />
</td>
<td>
<input type="textbox" name="site_url" value="<?php echo scrub_out($radio->site_url); ?>" size="9" />
<input type="text" name="site_url" value="<?php echo scrub_out($radio->site_url); ?>" size="9" />
</td>
<td>
<input type="textbox" name="call_sign" value="<?php echo scrub_out($radio->call_sign); ?>" size="6" />
<input type="text" name="call_sign" value="<?php echo scrub_out($radio->call_sign); ?>" size="6" />
</td>
<td>
<input type="textbox" name="frequency" value="<?php echo scrub_out($radio->frequency); ?>" size="6" />
<input type="text" name="frequency" value="<?php echo scrub_out($radio->frequency); ?>" size="6" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $radio->id; ?>" />

View file

@ -24,7 +24,7 @@
<table cellpadding="0" cellspacing="0">
<tr>
<td>
<input type="textbox" name="name" size="9" value="<?php echo scrub_out($playlist->name); ?>" />
<input type="text" name="name" size="9" value="<?php echo scrub_out($playlist->name); ?>" />
</td>
<td>
<?php $name = 'select_' . $playlist->type; ${$name} = ' selected="selected"'; ?>

View file

@ -24,7 +24,7 @@
<table class="inline-edit" cellpadding="3" cellspacing="0">
<tr>
<td>
<input type="textbox" name="track" size="3" maxlength="4" value="<?php echo intval($track['track']); ?>" />
<input type="text" name="track" size="3" maxlength="4" value="<?php echo intval($track['track']); ?>" />
</td>
<td class="cel_song"><?php echo $song->f_link; ?></td>
<td class="cel_artist"><?php echo $song->f_artist_link; ?></td>

View file

@ -30,7 +30,7 @@
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Title'); ?></td>
<td>
<input type="textbox" name="title" value="<?php echo scrub_out($song->title); ?>" size="45" />
<input type="text" name="title" value="<?php echo scrub_out($song->title); ?>" size="45" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
@ -38,7 +38,7 @@
<td>
<?php show_album_select('album',$song->album); ?>
<br /><?php echo _('OR'); ?><br />
<input type="textbox" name="album_string" value="<?php echo scrub_out($song->get_album_name()); ?>" />
<input type="text" name="album_string" value="<?php echo scrub_out($song->get_album_name()); ?>" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
@ -46,7 +46,7 @@
<td>
<?php show_artist_select('artist',$song->artist); ?>
<br /><?php echo _('OR'); ?><br />
<input type="textbox" name="artist_string" value="<?php echo scrub_out($song->get_artist_name()); ?>" />
<input type="text" name="artist_string" value="<?php echo scrub_out($song->get_artist_name()); ?>" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
@ -54,25 +54,25 @@
<td>
<?php show_genre_select('genre',$song->genre); ?>
<br /><?php echo _('OR'); ?><br />
<input type="textbox" name="genre_string" value="<?php echo scrub_out($song->f_genre); ?>" />
<input type="text" name="genre_string" value="<?php echo scrub_out($song->f_genre); ?>" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Track'); ?></td>
<td>
<input type="textbox" name="track" value="<?php echo scrub_out($song->track); ?>" size="3" />
<input type="text" name="track" value="<?php echo scrub_out($song->track); ?>" size="3" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Year'); ?></td>
<td>
<input type="textbox" name="year" value="<?php echo scrub_out($song->year); ?>" size="5" />
<input type="text" name="year" value="<?php echo scrub_out($song->year); ?>" size="5" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">
<td><?php echo _('Comment'); ?></td>
<td>
<input type="textbox" name="comment" value="<?php echo scrub_out($song->comment); ?>" size="45" />
<input type="text" name="comment" value="<?php echo scrub_out($song->comment); ?>" size="45" />
</td>
</tr>
<tr class="<?php echo flip_class(); ?>">

View file

@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2001 - 2008 Ampache.org
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@ -22,8 +22,9 @@
<td colspan="8">
<form method="post" id="edit_song_<?php echo $song->id; ?>">
<table class="inline-edit" cellpadding="3" cellspacing="0">
<tr>
<td>
<input type="textbox" name="title" value="<?php echo scrub_out($song->title); ?>" />
<input type="text" name="title" value="<?php echo scrub_out($song->title); ?>" />
</td>
<td>
<?php show_artist_select('artist',$song->artist,true,$song->id); ?>
@ -36,18 +37,14 @@
<?php echo Ajax::observe('album_select_'.$song->id,'change','check_inline_song_edit("album", '.$song->id.')'); ?>
</td>
<td>
<?php show_genre_select('genre',$song->genre,'',true,$song->id); ?>
<div id="genre_select_song_<?php echo $song->id ?>"></div>
<?php echo Ajax::observe('genre_select_'.$song->id,'change','check_inline_song_edit("genre", '.$song->id.')'); ?>
</td>
<td>
<input type="textbox" name="track" size="3" value="<?php echo scrub_out($song->track); ?>" />
<input type="text" name="track" size="3" value="<?php echo scrub_out($song->track); ?>" />
</td>
<td>
<input type="hidden" name="id" value="<?php echo $song->id; ?>" />
<input type="hidden" name="type" value="song" />
<?php echo Ajax::button('?action=edit_object&id=' . $song->id . '&type=song','download',_('Save Changes'),'save_song_' . $song->id,'edit_song_' . $song->id); ?>
</td>
</tr>
</table>
</form>
</td>

View file

@ -26,7 +26,7 @@
*/
$web_path = Config::get('web_path');
?>
<?php show_box_top(sprintf(_('Viewing %s Genre') $genre->name)); ?>
<?php show_box_top(sprintf(_('Viewing %s Genre'), $genre->name)); ?>
[<?php echo $genre->get_album_count(); ?>]
<a href="<?php echo $web_path; ?>/genre.php?action=show_albums&amp;genre_id=<?php echo $genre->id; ?>">
<?php echo _('Albums'); ?></a><br />

View file

@ -25,7 +25,7 @@ if (INSTALL != '1') { exit; }
<head>
<title>Ampache :: For The Love Of Music - Install</title>
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" Content="text/html; Charset=<?php echo $charset; ?>" />
<meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" />
</head>
<body>
<script src="lib/javascript-base.js" language="javascript" type="text/javascript"></script>

View file

@ -26,7 +26,7 @@ if (INSTALL != '1') { exit; }
<head>
<title>Ampache :: For The Love Of Music - Install</title>
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" Content="text/html; Charset=<?php echo $charset; ?>" />
<meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" />
</head>
<body>
<div id="header">

View file

@ -26,7 +26,7 @@ if (INSTALL != '1') { exit; }
<head>
<title>Ampache :: For The Love Of Music - Install</title>
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" Content="text/html; Charset=<?php echo $charset; ?>" />
<meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" />
</head>
<body>
<div id="header">

View file

@ -26,7 +26,7 @@
<head>
<title>Ampache :: Pour l'Amour de la Musique - Install</title>
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" Content="text/html; Charset=<?php echo $charset; ?>" />
<meta http-equiv="Content-Type" content="text/html; Charset=<?php echo $charset; ?>" />
</head>
<body>
<script src="lib/javascript-base.js" language="javascript" type="text/javascript"></script>

View file

@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2001 - 2007 Ampache.org
Copyright (c) Ampache.org
All Rights Reserved
this program is free software; you can redistribute it and/or
@ -21,7 +21,7 @@
*/
?>
<?php show_box_top(_('Catalog Statistics')); ?>
<i><?php echo _('Catalog Statistics'); ?></i>
<table class="tabledata" cellpadding="3" cellspacing="1">
<tr class="th-top">
<th><?php echo _('Connected Users'); ?></th>
@ -44,4 +44,3 @@
<td><?php echo $stats['time_text']; ?></td>
</tr>
</table>
<?php show_box_bottom(); ?>

View file

@ -27,7 +27,7 @@
<?php foreach ($fields as $key=>$field) { ?>
<tr>
<td><?php echo $field['description']; ?></td>
<td><input type="textbox" name="<?php echo $key; ?>" /></td>
<td><input type="text" name="<?php echo $key; ?>" /></td>
</tr>
<?php } ?>
</table>

View file

@ -26,7 +26,7 @@
<?php foreach ($fields as $key=>$field) { ?>
<tr>
<td><?php echo $field['description']; ?></td>
<td><input type="textbox" name="<?php echo $key; ?>" value="<?php echo scrub_out($instance[$key]); ?>" /></td>
<td><input type="text" name="<?php echo $key; ?>" value="<?php echo scrub_out($instance[$key]); ?>" /></td>
</tr>
<?php } ?>
</table>

View file

@ -55,11 +55,11 @@ function focus(){ document.login.username.focus(); }
<form name="login" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/login.php">
<div class="loginfield" id="usernamefield">
<label for="username"><?php echo _('Login'); ; ?>:</label>
<label for="username"><?php echo _('Username'); ?>:</label>
<input class="text_input" type="text" id="username" name="username" value="<?php echo $_REQUEST['username']; ; ?>" />
</div>
<div class="loginfield" id="passwordfield">
<label for="password"><?php echo _('Password'); ; ?>:</label>
<label for="password"><?php echo _('Password'); ?>:</label>
<input class="text_input" type="password" id="password" name="password" value="" />
</div>
<div class="loginfield" id="remembermefield"><label for="rememberme">

View file

@ -27,7 +27,7 @@ $web_path = Config::get('web_path');
<col id="col_username" />
<col id="col_sticky" />
<col id="col_comment" />
<col id="col_date />
<col id="col_date" />
<col id="col_action" />
</colgroup>
<tr class="th-top">

View file

@ -35,7 +35,7 @@ $base_url = '?action=set_rating&rating_type=' . $rating->type . '&object_id=' .
if ($rating->rating <= 0) {
echo _('not rated yet') . "</li>\n";
}
else printf(_('%s of 5', $rating->preciserating)); echo "</li>\n";
else printf(_('%s of 5'), $rating->preciserating); echo "</li>\n";
for ($i=1; $i<6; $i++)
{

View file

@ -60,7 +60,7 @@ if (is_object($GLOBALS['playlist'])) { ?>
<option value="artist"><?php echo _('Artist'); ?></option>
<option value="year"><?php echo _('Year'); ?></option>
</select>
<input type="textbox" name="update_value" />
<input type="text" name="update_value" />
<input class="button" type="button" value="<?php echo _('Update'); ?>" onclick="return SubmitToPage('songs','<?php echo $web_path; ?>/admin/flag.php?action=mass_update');" />
</td>
</tr>

View file

@ -38,7 +38,6 @@
</div>
<?php show_box_bottom(); ?>
<?php
$object_ids = $playlist->get_items();
Browse::set_type('playlist_song');
Browse::add_supplemental_object('playlist',$playlist->id);
Browse::set_static_content(1);

View file

@ -27,16 +27,14 @@ $web_path = Config::get('web_path');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?></title>
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="<?php echo Config::get('web_path'); ?>/templates/install.css" type="text/css" media="screen" />
<link rel="shortcut icon" href="<?php echo Config::get('web_path'); ?>/favicon.ico" />
</head>
<body>
<div id="header">
<h1><?php echo scrub_out(Config::get('site_title')); ?></h1>
<?php echo _('Registration Complete'); ?>...
</div>
</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>
<script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script>

View file

@ -19,23 +19,9 @@
*/
?>
<div id="recent_added">
<?php
$objects = Stats::get_newest('album');
$headers = array('f_link'=>_('Newest Albums'));
show_box_top('','info-box box_newest_albums');
require Config::get('prefix') . '/templates/show_objects.inc.php';
show_box_bottom();
$objects = Stats::get_newest('artist');
$headers = array('f_name_link'=>_('Newest Artists'));
show_box_top('','info-box box_newest_artists');
require Config::get('prefix') . '/templates/show_objects.inc.php';
show_box_bottom();
$objects = Stats::get_newest('genre');
$headers = array('f_link'=>_('Newest Genres'));
show_box_top('','info-box box_newest_genres');
require Config::get('prefix') . '/templates/show_objects.inc.php';
show_box_bottom();
?>
</div>
<i><?php echo _('Newest Albums'); ?></i>
<?php $object_ids = Stats::get_newest('album'); ?>
<?php require_once Config::get('prefix') . '/templates/show_albums.inc.php'; ?>
<?php $object_ids = Stats::get_newest('artist'); ?>
<i><?php echo _('Newest Artists'); ?></i>
<?php require_once Config::get('prefix') . '/templates/show_artists.inc.php'; ?>

View file

@ -1,7 +1,7 @@
<?php
/*
Copyright (c) 2001 - 2007 Ampache.org
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@ -33,10 +33,5 @@
require Config::get('prefix') . '/templates/show_objects.inc.php';
show_box_bottom();
$objects = Stats::get_top('genre');
$headers = array('f_link'=>_('Most Popular Genres'));
show_box_top('','info-box box_popular_genres');
require Config::get('prefix') . '/templates/show_objects.inc.php';
show_box_bottom();
?>
</div>

View file

@ -21,56 +21,3 @@
*/
$web_path = Config::get('web_path');
?>
<?php show_box_top('', 'info-box');
/* make a map id->name
$tagbyid = array();
foreach ($tagcloudList as $f)
$tagbyid[$f['id']] = $f;
$ar = $_GET;
unset($ar['tag']);
$base = rebuild_query($ar);
$currentTags = array_fill_keys($_SESSION['browse']['filter']['tag'], '1');
$filter=0;
foreach ($_SESSION['browse']['filter']['tag'] as $t) {
if (!$filter) {
$filter = 1;
echo _('Filters(remove): ');
}
$ctags = $currentTags;
unset($ctags[$t]);
$stags = implode(',', array_keys($ctags));
$col = 'black';
$alt = '';
if (isset($tagbyid[$t]['color'])) {
$col = $tagbyid[$t]['color'];
$alt = ' title="owner: '. $tagbyid[$t]['username'].'" ';
}
echo '<a style="color:'. $col.'"'.$alt .' href="' .$base
. 'tag='.$stags.'">'.$tagbyid[$t]['name'].'</a> ';
}
echo '<br/>';
$filter = 0;
foreach ($tagcloudList as $f) {
$n = $f['name'];
$id = $f['id'];
if (!$currentTags[$id]) {
if (!$filter) {
$filter = 1;
echo _('Matching tags: ');
}
$ctags = $currentTags;
$ctags[$id] = 1;
$stags = implode(',', array_keys($ctags));
$col = 'black';
$alt = '';
if (isset($f['color'])) {
$col = $f['color'];
$alt = ' title="owner: '. $f['username'].'" ';
}
echo '<a style="color:'.$col.'"'.$alt.' href="' .$base
. 'tag='.$stags.'">'.$n.'</a> ';
}
}
*/
?>
<?php show_box_bottom(); ?>

View file

@ -25,13 +25,14 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ampache -- Debug Page</title>
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<div id="header">
<h1><?php echo _('Ampache Debug'); ?></h1>
<p><?php echo _('You\'ve reached this page because a configuration error has occured. Debug Information below'); ?></p>
</div>
<div>
<table align="center" cellpadding="3" cellspacing="0">
<tr>
<td><font size="+1"><?php echo _('CHECK'); ?></font></td>
@ -246,7 +247,7 @@
}
$results['web_path'] = $http_type . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . Config::get('web_path');
if ($status['parse_config']) {
echo "<img src=\"" . $results['web_path'] ."/images/ampache.png\" width=\"80\" height=\"15\"/>";
echo "&nbsp;&nbsp;&nbsp;<img src=\"" . $results['web_path'] ."/images/icon_enable.png\" />&nbsp;&nbsp;&nbsp;";
}
else {
$status['check_webpath'] = false;
@ -257,15 +258,15 @@
]
</td>
<td>
This test makes sure that your web_path variable is set correctly and that we are able to get to the index page. If you do not see the ampache
logo here then your web_path is not set correctly.
This test makes sure that your web_path variable is set correctly and that we are able to get to the index page. If you do not see a check mark
here then your web_path is not set correctly.
</td>
</tr>
</table>
</div>
<div id="bottom">
<p><strong>Ampache Debug.</strong><br />
For the love of Music.</p>
Pour l'Amour de la Musique.</p>
</div>
</body>
</html>

View file

@ -25,8 +25,6 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ampache -- Config Debug Page</title>
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="templates/install.css" type="text/css" media="screen" />
<style type="text/css">
body {
@ -36,6 +34,8 @@ body {
padding-left: 10px;
}
</style>
</head>
<body bgcolor="#f0f0f0">
<div id="header">
<h1><?php echo _('Ampache Debug'); ?></h1>
<p>Ampache.cfg.php error detected</p>
@ -47,7 +47,7 @@ If you are upgrading from 3.3.x please see the directions below.</p>
<h3>Migrating from 3.3.x to 3.4.x</h3>
<p>Ampache 3.4 uses a different config parser that is over 10x faster then the previous version. Unfortunately the new parser is
unable to read the old config files. You must run <strong>php /bin/migrate_config.inc</strong> from the command line to create your
unable to read the old config files. From inside the Ampache root directory you must run <strong>php bin/migrate_config.inc</strong> from the command line to create your
new config file.</p>
<p>The following settings will not be migrated by the <strong>migrate_config.inc</strong> script due to major changes between versions. The default
@ -75,7 +75,7 @@ This variable no longer exists, all downsampling/transcoding is handled by the t
</div>
<div id="bottom">
<p><strong>Ampache Debug.</strong><br />
For the love of Music.</p>
Pour l'Amour de la Musique.</p>
</div>
</body>
</html>

View file

@ -27,16 +27,15 @@ $web_path = Config::get('web_path');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?></title>
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="<?php echo Config::get('web_path'); ?>/templates/install.css" type="text/css" media="screen" />
<link rel="shortcut icon" href="<?php echo Config::get('web_path'); ?>/favicon.ico" />
</head>
<body>
<div id="header">
<h1><?php echo Config::get('site_title'); ?></h1>
<?php echo _('Registration'); ?>...
</div>
</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>
<script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script>
@ -48,7 +47,8 @@ $web_path = Config::get('web_path');
?>
<h3><?php echo _('User Activated'); ?></h3>
<p>
<?php printf(_('This User ID is activated and can be used %sLogin%s'), '<a href="' . Config::get('web_path'). '/login.php">', '</a>'); ?></a>
<?php
printf(_('This User ID is activated and can be used %sLogin%s'), '<a href="' . Config::get('web_path'). '/login.php">', '</a>'); ?>
</p>
<?php } else { ?>
<h3><?php echo _('Validation Failed'); ?></h3>

View file

@ -27,16 +27,14 @@ $web_path = Config::get('web_path');
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo Config::get('site_charset'); ?>" />
<title><?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?></title>
</head>
<body bgcolor="#f0f0f0">
<link rel="stylesheet" href="<?php echo Config::get('web_path'); ?>/templates/install.css" type="text/css" media="screen" />
<link rel="shortcut icon" href="<?php echo Config::get('web_path'); ?>/favicon.ico" />
</head>
<body>
<div id="header">
<h1><?php echo scrub_out(Config::get('site_title')); ?></h1>
<?php echo _('Registration'); ?>...
</div>
</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>
<script src="<?php echo $web_path; ?>/modules/prototype/prototype.js" language="javascript" type="text/javascript"></script>
@ -62,7 +60,7 @@ if (Config::get('user_agreement')) { ?>
</tr>
<tr>
<td>
<input type='checkbox' name='accept_agreement'> <?php echo _('I Accept'); ?>
<input type='checkbox' name='accept_agreement' /> <?php echo _('I Accept'); ?>
<?php Error::display('user_agreement'); ?>
</td>
</tr>

View file

@ -20,7 +20,7 @@
*/
show_box_top();
printf(_('Updating the %s catalog', "<strong>[ $catalog->name ]</strong>"));
printf(_('Updating the %s catalog'), "<strong>[ $catalog->name ]</strong>");
echo "<br />\n" . $number . " " . _('songs found checking tag information.') . "<br />\n\n";
echo _('Verifed') . ":<span id=\"verify_count_$catalog_id\">$catalog_verify_found</span><br />";
echo _('Reading') . ":<span id=\"verify_dir_$catalog_id\">$catalog_verify_directory</span><br />";

View file

@ -43,7 +43,7 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
<?php if (in_array('starts_with',$allowed_filters)) { ?>
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);">
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo _('Starts With'); ?></label>
<input type="textbox" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out(Browse::get_filter('starts_with')); ?>" onKeyUp="DelayRun(this,'400','ajaxState','<?php echo Config::get('ajax_url'); ?>?page=browse&action=browse&type=<?php echo Browse::get_type(); ?>&key=starts_with','multi_alpha_filter');">
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out(Browse::get_filter('starts_with')); ?>" onKeyUp="DelayRun(this,'400','ajaxState','<?php echo Config::get('ajax_url'); ?>?page=browse&action=browse&type=<?php echo Browse::get_type(); ?>&key=starts_with','multi_alpha_filter');">
</form>
<?php } // end if alpha_match ?>
<?php if (in_array('minimum_count',$allowed_filters)) { ?>

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2001 - 2007 Ampache.org
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or

View file

@ -1,6 +1,6 @@
/*
Copyright (c) 2001 - 2006 Ampache.org
Copyright (c) Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or

View file

@ -49,11 +49,11 @@ $htmllang = str_replace("_","-",Config::get('lang'));
<body>
<div id="header">
<h1><?php echo _('Ampache Update'); ?></h1>
<p>For the love of Music</p>
<p>Pour l'Amour de la Musique.</p>
</div>
<div id="text-box">
<div class="notify">
This page handles all database updates to Ampache starting with 3.3.3.5. According to your database your current version is: <?php echo Update::format_version($version); ; ?>.
This page handles all database updates to Ampache starting with <strong>3.3.3.5</strong>. According to your database your current version is: <strong><?php echo Update::format_version($version); ; ?></strong>.
the following updates need to be performed<br /><br />
<div style="font-size:1.2em;font-weight:bold;text-align:center;"><?php Error::display('general'); ?></div>
</div>
@ -61,7 +61,7 @@ the following updates need to be performed<br /><br />
<?php Update::display_update(); ?>
<form method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/update.php?action=update">
<?php if (Update::need_update()) { ?><input type="submit" value="Update Now!" /> <?php } ?>
<?php if (Update::need_update()) { ?><input type="submit" value="<?php echo _('Update Now!'); ?>" /> <?php } ?>
</form>
</div>
<div id="bottom">