From f593f18131d6a0cbf30b558b208e86b9fc957f13 Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Mon, 27 Oct 2008 09:24:34 +0000 Subject: Commit, still no internet paying for it.. curse you free.fr --- artists.php | 2 +- browse.php | 6 - config/ampache.cfg.php.dist | 69 +- docs/CHANGELOG | 12 + docs/INSTALL | 8 +- docs/MIGRATION | 12 +- docs/README | 13 +- lib/class/browse.class.php | 7 + lib/class/catalog.class.php | 1510 +++++++++++----------- lib/class/database_object.abstract.php | 43 +- lib/class/playlist.class.php | 2 +- lib/class/radio.class.php | 25 +- lib/class/song.class.php | 24 +- lib/class/stats.class.php | 11 +- lib/class/tag.class.php | 308 +++-- lib/class/update.class.php | 22 + lib/class/vainfo.class.php | 4 +- lib/debug.lib.php | 10 + lib/init.php | 2 +- lib/log.lib.php | 16 +- lib/search.php | 30 +- login.php | 2 - modules/flash/crossdomain.xml | 4 +- modules/getid3/write.id3v2.php | 2 +- modules/infotools/mp3tunes.class.php | 2 +- play/index.php | 3 +- playlist.php | 15 +- server/tag.ajax.php | 6 +- stats.php | 4 +- templates/base.css | 46 + templates/handheld.css | 106 -- templates/header.inc.php | 10 +- templates/install.css | 6 +- templates/print.css | 6 +- templates/rightbar.inc.php | 1 + templates/show_album_row.inc.php | 1 - templates/show_artist.inc.php | 6 +- templates/show_big_art.inc.php | 2 +- templates/show_create_democratic.inc.php | 4 +- templates/show_denied.inc.php | 2 +- templates/show_disabled_songs.inc.php | 4 +- templates/show_edit_access.inc.php | 3 +- templates/show_edit_album.inc.php | 4 +- templates/show_edit_album_row.inc.php | 4 +- templates/show_edit_artist.inc.php | 2 +- templates/show_edit_artist_row.inc.php | 2 +- templates/show_edit_live_stream_row.inc.php | 10 +- templates/show_edit_playlist_row.inc.php | 2 +- templates/show_edit_playlist_song_row.inc.php | 2 +- templates/show_edit_song.inc.php | 14 +- templates/show_edit_song_row.inc.php | 13 +- templates/show_genre.inc.php | 2 +- templates/show_install.inc.php | 2 +- templates/show_install_account.inc.php | 2 +- templates/show_install_config.inc.php | 2 +- templates/show_install_lang.inc.php | 2 +- templates/show_local_catalog_info.inc.php | 5 +- templates/show_localplay_add_instance.inc.php | 2 +- templates/show_localplay_edit_instance.inc.php | 2 +- templates/show_login_form.inc.php | 4 +- templates/show_manage_shoutbox.inc.php | 2 +- templates/show_object_rating.inc.php | 2 +- templates/show_play_selected.inc.php | 2 +- templates/show_playlist.inc.php | 1 - templates/show_registration_confirmation.inc.php | 6 +- templates/show_stats_newest.inc.php | 26 +- templates/show_stats_popular.inc.php | 7 +- templates/show_tagcloud.inc.php | 53 - templates/show_test.inc.php | 11 +- templates/show_test_config.inc.php | 8 +- templates/show_user_activate.inc.php | 10 +- templates/show_user_registration.inc.php | 8 +- templates/show_verify_catalog.inc.php | 2 +- templates/sidebar_home.inc.php | 2 +- themes/classic/templates/default.css | 2 +- themes/greysme/templates/default.css | 2 +- update.php | 6 +- 77 files changed, 1259 insertions(+), 1338 deletions(-) create mode 100644 templates/base.css delete mode 100644 templates/handheld.css diff --git a/artists.php b/artists.php index 768b698d..ccd65b92 100644 --- a/artists.php +++ b/artists.php @@ -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(); diff --git a/browse.php b/browse.php index d2e2577a..5a76214e 100644 --- a/browse.php +++ b/browse.php @@ -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: diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index 056a2d93..3fa1be12 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -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 . 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: f_title @ $album played by $user->fullname]]> -; FIXME it's hardcoded in lib/rss.lib.php now -;rss_song_description = f_title @ $album played by $user->fullname]]> ;##################################################### diff --git a/docs/CHANGELOG b/docs/CHANGELOG index ce7ed1c6..094bf4d0 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -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) diff --git a/docs/INSTALL b/docs/INSTALL index 17c83713..279e7370 100755 --- a/docs/INSTALL +++ b/docs/INSTALL @@ -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 diff --git a/docs/MIGRATION b/docs/MIGRATION index 4ce13040..5f8cf71b 100755 --- a/docs/MIGRATION +++ b/docs/MIGRATION @@ -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. diff --git a/docs/README b/docs/README index 710176e6..817108bc 100755 --- a/docs/README +++ b/docs/README @@ -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 diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index f245d7fa..4f6b6bcc 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -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; diff --git a/lib/class/catalog.class.php b/lib/class/catalog.class.php index a6b5136a..ec679b43 100644 --- a/lib/class/catalog.class.php +++ b/lib/class/catalog.class.php @@ -1,21 +1,21 @@ id = intval($catalog_id); @@ -62,9 +62,9 @@ class Catalog { /* Get the information from the db */ $info = $this->_get_info(); - foreach ($info as $key=>$value) { - $this->$key = $value; - } + foreach ($info as $key=>$value) { + $this->$key = $value; + } } //constructor @@ -89,32 +89,32 @@ class Catalog { * This poplates an array (filecache) on this object from the database * it is used to speed up the add process */ - private function _create_filecache() { + private function _create_filecache() { - if (count($this->_filecache) == 0) { - $catalog_id = Dba::escape($this->id); - // Get _EVERYTHING_ - $sql = "SELECT `id`,`file` FROM `song` WHERE `catalog`='$catalog_id'"; - $db_results = Dba::query($sql); + if (count($this->_filecache) == 0) { + $catalog_id = Dba::escape($this->id); + // Get _EVERYTHING_ + $sql = "SELECT `id`,`file` FROM `song` WHERE `catalog`='$catalog_id'"; + $db_results = Dba::query($sql); // Populate the filecache - while ($results = Dba::fetch_assoc($db_results)) { - $this->_filecache[strtolower($results['file'])] = $results['id']; - } + while ($results = Dba::fetch_assoc($db_results)) { + $this->_filecache[strtolower($results['file'])] = $results['id']; + } } // end if empty filecache - - } // _create_filecache + + } // _create_filecache /** * format * This makes the object human readable */ - public function format() { + public function format() { - $this->f_name = truncate_with_ellipsis($this->name,Config::get('ellipse_threshold_title')); - $this->f_name_link = '' . scrub_out($this->f_name) . ''; - $this->f_path = truncate_with_ellipsis($this->path,Config::get('ellipse_threshold_title')); - $this->f_update = $this->last_update ? date('d/m/Y h:i',$this->last_update) : _('Never'); + $this->f_name = truncate_with_ellipsis($this->name,Config::get('ellipse_threshold_title')); + $this->f_name_link = '' . scrub_out($this->f_name) . ''; + $this->f_path = truncate_with_ellipsis($this->path,Config::get('ellipse_threshold_title')); + $this->f_update = $this->last_update ? date('d/m/Y h:i',$this->last_update) : _('Never'); $this->f_add = $this->last_add ? date('d/m/Y h:i',$this->last_add) : _('Never'); } // format @@ -129,7 +129,7 @@ class Catalog { $sql = "SELECT `id` FROM `catalog` ORDER BY `name`"; $db_results = Dba::query($sql); - $results = array(); + $results = array(); while ($row = Dba::fetch_assoc($db_results)) { $results[] = $row['id']; @@ -143,12 +143,12 @@ class Catalog { * get_catalog_ids * This returns an array of all catalog ids */ - public static function get_catalog_ids() { + public static function get_catalog_ids() { $sql = "SELECT `id` FROM `catalog`"; $db_results = Dba::query($sql); - while ($r = Dba::fetch_assoc($db_results)) { + while ($r = Dba::fetch_assoc($db_results)) { $results[] = $r['id']; } @@ -164,34 +164,34 @@ class Catalog { */ public static function get_stats($catalog_id=0) { - $results = self::count_songs($catalog_id); - $results = array_merge(self::count_users($catalog_id),$results); + $results = self::count_songs($catalog_id); + $results = array_merge(self::count_users($catalog_id),$results); + + $hours = floor($results['time']/3600); + $size = $results['size']/1048576; + $days = floor($hours/24); + $hours = $hours%24; - $hours = floor($results['time']/3600); - $size = $results['size']/1048576; - $days = floor($hours/24); - $hours = $hours%24; - $time_text = "$days "; - $time_text .= ngettext('day','days',$days); - $time_text .= ", $hours "; - $time_text .= ngettext('hour','hours',$hours); + $time_text .= ngettext('day','days',$days); + $time_text .= ", $hours "; + $time_text .= ngettext('hour','hours',$hours); - $results['time_text'] = $time_text; + $results['time_text'] = $time_text; - if ($size > 1024) { - $total_size = sprintf("%.2f",($size/1024)); - $size_unit = "GB"; - } - else { - $total_size = sprintf("%.2f",$size); - $size_unit = "MB"; - } + if ($size > 1024) { + $total_size = sprintf("%.2f",($size/1024)); + $size_unit = "GB"; + } + else { + $total_size = sprintf("%.2f",$size); + $size_unit = "MB"; + } - $results['total_size'] = $total_size; - $results['size_unit'] = $size_unit; + $results['total_size'] = $total_size; + $results['size_unit'] = $size_unit; - return $results; + return $results; } // get_stats @@ -199,16 +199,16 @@ class Catalog { * clear_stats * This clears all stats for _everything_ */ - public static function clear_stats() { + public static function clear_stats() { /* Whip out everything */ - $sql = "TRUNCATE `object_count`"; - $db_results = Dba::query($sql); + $sql = "TRUNCATE `object_count`"; + $db_results = Dba::query($sql); - $sql = "UDPATE `song` SET `player`='0'"; - $db_results = Dba::query($sql); + $sql = "UDPATE `song` SET `played`='0'"; + $db_results = Dba::query($sql); - return true; + return true; } // clear_stats @@ -218,89 +218,89 @@ class Catalog { * it checks to make sure this path is not already used before creating * the catalog */ - public static function create($data) { + public static function create($data) { // Clean up the path just incase - $data['path'] = rtrim(rtrim(trim($data['path']),'/'),'\\'); + $data['path'] = rtrim(rtrim(trim($data['path']),'/'),'\\'); - $path = Dba::escape($data['path']); + $path = Dba::escape($data['path']); // Make sure the path is readable/exists - if (!is_readable($data['path']) AND $data['type'] == 'local') { - Error::add('general','Error: ' . scrub_out($data['path']) . ' is not readable or does not exist'); - return false; - } + if (!is_readable($data['path']) AND $data['type'] == 'local') { + Error::add('general','Error: ' . scrub_out($data['path']) . ' is not readable or does not exist'); + return false; + } // Make sure this path isn't already in use by an existing catalog - $sql = "SELECT `id` FROM `catalog` WHERE `path`='$path'"; - $db_results = Dba::query($sql); + $sql = "SELECT `id` FROM `catalog` WHERE `path`='$path'"; + $db_results = Dba::query($sql); - if (Dba::num_rows($db_results)) { - Error::add('general','Error: Catalog with ' . $path . ' already exists'); - return false; - } + if (Dba::num_rows($db_results)) { + Error::add('general','Error: Catalog with ' . $path . ' already exists'); + return false; + } - $name = Dba::escape($data['name']); - $catalog_type = Dba::escape($data['type']); - $rename_pattern = Dba::escape($data['rename_pattern']); - $sort_pattern = Dba::escape($data['sort_pattern']); - $gather_types = ' '; //FIXME - $key = Dba::escape($data['key']); + $name = Dba::escape($data['name']); + $catalog_type = Dba::escape($data['type']); + $rename_pattern = Dba::escape($data['rename_pattern']); + $sort_pattern = Dba::escape($data['sort_pattern']); + $gather_types = ' '; //FIXME + $key = Dba::escape($data['key']); - if (!$key) { $key = ' '; } //FIXME + if (!$key) { $key = ' '; } //FIXME // Ok we're good to go ahead and insert this record - $sql = "INSERT INTO `catalog` (`name`,`path`,`add_path`,`catalog_type`,`rename_pattern`,`sort_pattern`,`gather_types`,`key`) " . + $sql = "INSERT INTO `catalog` (`name`,`path`,`add_path`,`catalog_type`,`rename_pattern`,`sort_pattern`,`gather_types`,`key`) " . "VALUES ('$name','$path','','$catalog_type','$rename_pattern','$sort_pattern','$gather_types','$key')"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); - $insert_id = Dba::insert_id(); + $insert_id = Dba::insert_id(); - if (!$insert_id) { - Error::add('general','Catalog Insert Failed check debug logs'); - debug_event('catalog','SQL Failed:' . $sql,'3'); - return false; - } + if (!$insert_id) { + Error::add('general','Catalog Insert Failed check debug logs'); + debug_event('catalog','SQL Failed:' . $sql,'3'); + return false; + } - return $insert_id; + return $insert_id; } // create /** * run_add - * This runs the add to catalog function - * it includes the javascript refresh stuff and then starts rolling + * This runs the add to catalog function + * it includes the javascript refresh stuff and then starts rolling * throught the path for this catalog */ - public function run_add($options) { + public function run_add($options) { if ($this->catalog_type == 'remote') { - show_box_top(_('Running Remote Sync') . '. . .'); - $this->get_remote_catalog($type=0); - show_box_bottom(); - return true; - } + show_box_top(_('Running Remote Sync') . '. . .'); + $this->get_remote_catalog($type=0); + show_box_bottom(); + return true; + } // Catalog Add start - $start_time = time(); + $start_time = time(); - require Config::get('prefix') . '/templates/show_adds_catalog.inc.php'; - flush(); + require Config::get('prefix') . '/templates/show_adds_catalog.inc.php'; + flush(); // Prevent the script from timing out and flush what we've got set_time_limit(0); - $this->add_files($this->path,$options); + $this->add_files($this->path,$options); // If they have checked the box then go ahead and gather the art if ($options['gather_art']) { - $catalog_id = $this->id; - require Config::get('prefix') . '/templates/show_gather_art.inc.php'; - flush(); - $this->get_album_art('',1); - } + $catalog_id = $this->id; + require Config::get('prefix') . '/templates/show_gather_art.inc.php'; + flush(); + $this->get_album_art('',1); + } - return true; + return true; } // run_add @@ -309,88 +309,65 @@ class Catalog { * This returns the current # of songs, albums, artists, genres * in this catalog */ - public static function count_songs($catalog_id='') { + public static function count_songs($catalog_id='') { - if ($catalog_id) { $catalog_search = "WHERE `catalog`='" . Dba::escape($catalog_id) . "'"; } + if ($catalog_id) { $catalog_search = "WHERE `catalog`='" . Dba::escape($catalog_id) . "'"; } - $sql = "SELECT COUNT(`id`),SUM(`time`),SUM(`size`) FROM `song` $catalog_search"; - $db_results = Dba::query($sql); - $data = Dba::fetch_row($db_results); - $songs = $data['0']; - $time = $data['1']; - $size = $data['2']; + $sql = "SELECT COUNT(`id`),SUM(`time`),SUM(`size`) FROM `song` $catalog_search"; + $db_results = Dba::query($sql); + $data = Dba::fetch_row($db_results); + $songs = $data['0']; + $time = $data['1']; + $size = $data['2']; - $sql = "SELECT COUNT(DISTINCT(`album`)) FROM `song` $catalog_search"; - $db_results = Dba::query($sql); - $data = Dba::fetch_row($db_results); - $albums = $data['0']; + $sql = "SELECT COUNT(DISTINCT(`album`)) FROM `song` $catalog_search"; + $db_results = Dba::query($sql); + $data = Dba::fetch_row($db_results); + $albums = $data['0']; - $sql = "SELECT COUNT(DISTINCT(`artist`)) FROM `song` $catalog_search"; - $db_results = Dba::query($sql); - $data = Dba::fetch_row($db_results); - $artists = $data['0']; + $sql = "SELECT COUNT(DISTINCT(`artist`)) FROM `song` $catalog_search"; + $db_results = Dba::query($sql); + $data = Dba::fetch_row($db_results); + $artists = $data['0']; - $results['songs'] = $songs; - $results['albums'] = $albums; - $results['artists'] = $artists; - $results['size'] = $size; - $results['time'] = $time; + $results['songs'] = $songs; + $results['albums'] = $albums; + $results['artists'] = $artists; + $results['size'] = $size; + $results['time'] = $time; - return $results; + return $results; } // count_songs /** * count_users * This returns the total number of users in the ampache instance - */ - public static function count_users($catalog_id='') { + */ + public static function count_users($catalog_id='') { // Count total users - $sql = "SELECT COUNT(id) FROM `user`"; - $db_results = Dba::query($sql); - $data = Dba::fetch_row($db_results); + $sql = "SELECT COUNT(id) FROM `user`"; + $db_results = Dba::query($sql); + $data = Dba::fetch_row($db_results); $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; - $db_results = Dba::query($sql); - $data = Dba::fetch_row($db_results); + $db_results = Dba::query($sql); + $data = Dba::fetch_row($db_results); $results['connected'] = $data['0']; - return $results; + return $results; } // 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 @@ -400,57 +377,57 @@ class Catalog { public function add_files($path,$options) { // Correctly detect the slash we need to use here - if (strstr($path,"/")) { + if (strstr($path,"/")) { $slash_type = '/'; - } - else { + } + else { $slash_type = '\\'; - } + } /* Open up the directory */ $handle = opendir($path); if (!is_resource($handle)) { - debug_event('read',"Unable to Open $path",'5','ampache-catalog'); - Error::add('catalog_add',_('Error: Unable to open') . ' ' . $path); - return false; + debug_event('read',"Unable to Open $path",'5','ampache-catalog'); + Error::add('catalog_add',_('Error: Unable to open') . ' ' . $path); + return false; } /* 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); - return false; + debug_event('read',"Unable to chdir $path",'2','ampache-catalog'); + Error::add('catalog_add',_('Error: Unable to change to directory') . ' ' . $path); + return false; } // Ensure that we've got our cache - $this->_create_filecache(); + $this->_create_filecache(); /* Recurse through this dir and create the files array */ while ( false !== ( $file = readdir($handle) ) ) { /* Skip to next if we've got . or .. */ - if (substr($file,0,1) == '.' || $file == '..') { continue; } + if (substr($file,0,1) == '.' || $file == '..') { continue; } debug_event('read',"Starting work on $file inside $path",'5','ampache-catalog'); /* Create the new path */ $full_file = $path.$slash_type.$file; - /* First thing first, check if file is already in catalog. + /* First thing first, check if file is already in catalog. * This check is very quick, so it should be performed before any other checks to save time */ - if (isset($this->_filecache[strtolower($full_file)])) { - continue; - } - - // Incase this is the second time through clear this variable + if (isset($this->_filecache[strtolower($full_file)])) { + continue; + } + + // Incase this is the second time through clear this variable // if it was set the day before unset($failed_check); - + if (Config::get('no_symlinks')) { - if (is_link($full_file)) { - debug_event('read',"Skipping Symbolic Link $path",'5','ampache-catalog'); + if (is_link($full_file)) { + debug_event('read',"Skipping Symbolic Link $path",'5','ampache-catalog'); continue; } } @@ -459,57 +436,57 @@ 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; } //it's a directory - /* If it's not a dir let's roll with it + /* If it's not a dir let's roll with it * next we need to build the pattern that we will use * to detect if it's a audio file for now the source for * this is in the /modules/init.php file */ $pattern = "/\.(" . Config::get('catalog_file_pattern'); - if ($options['parse_m3u']) { + if ($options['parse_m3u']) { $pattern .= "|m3u)$/i"; } - else { + else { $pattern .= ")$/i"; } - + /* see if this is a valid audio file or playlist file */ if (preg_match($pattern ,$file)) { /* Now that we're sure its a file get filesize */ $file_size = filesize($full_file); - if (!$file_size) { - debug_event('read',"Unable to get filesize for $full_file",'2','ampache-catalog'); - Error::add('catalog_add',sprintf(_('Error: Unable to get filesize for %s'), $full_file)); + if (!$file_size) { + debug_event('read',"Unable to get filesize for $full_file",'2','ampache-catalog'); + Error::add('catalog_add',sprintf(_('Error: Unable to get filesize for %s'), $full_file)); } // file_size check - if (!is_readable($full_file)) { + 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; - } + continue; + } // Check to make sure the filename is of the expected charset - if (function_exists('iconv')) { - if (strcmp($full_file,iconv(Config::get('site_charset'),Config::get('site_charset'),$full_file)) != '0') { - debug_event('read',$full_file . ' has non-' . Config::get('site_charset') . ' characters and can not be indexed','1'); - Error::add('catalog_add', sprintf(_('%s does not match site charset'), $full_file)); - continue; - } + if (function_exists('iconv')) { + if (strcmp($full_file,iconv(Config::get('site_charset'),Config::get('site_charset'),$full_file)) != '0') { + debug_event('read',$full_file . ' has non-' . Config::get('site_charset') . ' characters and can not be indexed','1'); + Error::add('catalog_add', sprintf(_('%s does not match site charset'), $full_file)); + continue; + } } // end if iconv - - if (substr($file,-3,3) == 'm3u' AND $parse_m3u > 0) { + + if (substr($file,-3,3) == 'm3u' AND $parse_m3u > 0) { $this->_playlists[] = $full_file; } // if it's an m3u @@ -519,33 +496,33 @@ class Catalog { /* Stupid little cutesie thing */ $this->count++; if ( !($this->count%10)) { - $file = str_replace(array('(',')','\''),'',$full_file); - echo "\n"; - flush(); + $file = str_replace(array('(',')','\''),'',$full_file); + echo "\n"; + flush(); } // update our current state } // if it's not an m3u - + } //if it matches the pattern else { debug_event('read',"$full_file ignored, non audio file or 0 bytes",'5','ampache-catalog'); } // else not an audio file - } // end while reading directory + } // end while reading directory debug_event('closedir',"Finished reading $path closing handle",'5','ampache-catalog'); // This should only happen on the last run - if ($path == $this->path) { - echo "\n"; - flush(); - } + if ($path == $this->path) { + echo "\n"; + flush(); + } /* Close the dir handle */ @@ -556,10 +533,10 @@ class Catalog { /*! @function get_albums @discussion This gets albums for all songs passed in an array - */ - function get_albums($songs=array()) { + */ + function get_albums($songs=array()) { - foreach ($songs as $song_id) { + foreach ($songs as $song_id) { $sql = "SELECT album FROM song WHERE id='$song_id'"; $db_results = mysql_query($sql, dbh()); $results = mysql_fetch_array($db_results); @@ -574,103 +551,103 @@ class Catalog { * get_album_ids * This returns an array of ids of albums that have songs in this * catalog - */ - public function get_album_ids() { + */ + public function get_album_ids() { - $id = Dba::escape($this->id); - $results = array(); + $id = Dba::escape($this->id); + $results = array(); $sql = "SELECT DISTINCT(song.album) FROM `song` WHERE `song`.`catalog`='$id'"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); - while ($r = Dba::fetch_assoc($db_results)) { - $results[] = $r['album']; - } + while ($r = Dba::fetch_assoc($db_results)) { + $results[] = $r['album']; + } - return $results; + return $results; } // get_album_ids /** * get_album_art - * This runs through all of the needs art albums and trys + * This runs through all of the needs art albums and trys * to find the art for them from the mp3s */ - public function get_album_art($catalog_id=0,$all='') { + public function get_album_art($catalog_id=0,$all='') { // Make sure they've actually got methods - $album_art_order = Config::get('album_art_order'); - if (empty($album_art_order)) { - return true; - } + $album_art_order = Config::get('album_art_order'); + if (empty($album_art_order)) { + return true; + } // Prevent the script from timing out set_time_limit(0); - // If not passed use this - $catalog_id = $catalog_id ? $catalog_id : $this->id; + // If not passed use this + $catalog_id = $catalog_id ? $catalog_id : $this->id; - if ($all) { - $albums = $this->get_album_ids(); + if ($all) { + $albums = $this->get_album_ids(); } - else { - $albums = array_keys(self::$_art_albums); - } - + else { + $albums = array_keys(self::$_art_albums); + } + // Run through them an get the art! - foreach ($albums as $album_id) { + foreach ($albums as $album_id) { // Create the object - $album = new Album($album_id); + $album = new Album($album_id); // We're going to need the name here - $album->format(); - - debug_event('gather_art','Gathering art for ' . $album->name,'5'); - + $album->format(); + + debug_event('gather_art','Gathering art for ' . $album->name,'5'); + // Define the options we want to use for the find art function $options = array( 'album_name' => $album->full_name, 'artist' => $album->artist_name, 'keyword' => $album->artist_name . ' ' . $album->full_name - ); + ); // Return results - $results = $album->find_art($options,1); - - if (count($results)) { + $results = $album->find_art($options,1); + + if (count($results)) { // Pull the string representation from the source - $image = Album::get_image_from_source($results['0']); - if (strlen($image) > '5') { - $album->insert_art($image,$results['0']['mime']); - } - else { + $image = Album::get_image_from_source($results['0']); + if (strlen($image) > '5') { + $album->insert_art($image,$results['0']['mime']); + } + else { debug_event('album_art','Image less then 5 chars, not inserting','3'); - } - $art_found++; - } + } + $art_found++; + } /* Stupid little cutesie thing */ - $search_count++; - if ( !($search_count%5)) { + $search_count++; + if ( !($search_count%5)) { echo "\n"; - flush(); - } //echos song count - + echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');"; + echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');"; + echo "\n\n"; + flush(); + } //echos song count + unset($found); } // foreach albums // One last time for good measure echo "\n"; - flush(); + echo "update_txt('" . $search_count ."','count_art_" . $this->id . "');"; + echo "update_txt('" . addslashes($album->name) . "','read_art_" . $this->id . "');"; + echo "\n\n"; + flush(); - self::$_art_albums = array(); + self::$_art_albums = array(); } // get_album_art @@ -678,21 +655,21 @@ class Catalog { * get_catalog_albums() * Returns an array of the albums from a catalog */ - public static function get_catalog_albums($catalog_id) { + public static function get_catalog_albums($catalog_id) { $results = array(); $sql = "SELECT DISTINCT(`song`.`album`) FROM `song` WHERE `song`.`catalog`='$catalog_id'"; $db_results = Dba::query($sql); - while ($row = Dba::fetch_assoc($db_results)) { - $results[] = $row['album']; + while ($row = Dba::fetch_assoc($db_results)) { + $results[] = $row['album']; } return $results; } // get_catalog_albums - + /** * get_catalog_files @@ -703,12 +680,12 @@ class Catalog { $results = array(); /* Use $this->id if nothing passed */ - $catalog_id = $catalog_id ? Dba::escape($catalog_id) : Dba::escape($this->id); + $catalog_id = $catalog_id ? Dba::escape($catalog_id) : Dba::escape($this->id); $sql = "SELECT `id` FROM `song` WHERE `catalog`='$catalog_id' AND `enabled`='1'"; - $db_results = Dba::query($sql); + $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 @@ -727,7 +704,7 @@ class Catalog { $results = array(); - if ($count) { $limit_clause = " LIMIT $count"; } + if ($count) { $limit_clause = " LIMIT $count"; } $sql = "SELECT id FROM song WHERE enabled='0' $limit_clause"; $db_results = Dba::query($sql); @@ -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 */ @@ -761,17 +738,17 @@ class Catalog { } // Determine the slash type and go from there - if (strstr($path,"/")) { + if (strstr($path,"/")) { $slash_type = '/'; - } - else { + } + else { $slash_type = '\\'; - } + } /* Recurse through this dir and create the files array */ while ( FALSE !== ($file = @readdir($handle)) ) { - $full_file = $path . $slash_type . $file; + $full_file = $path . $slash_type . $file; /* Incase this is the second time through, unset it before checking */ unset($failed_check); @@ -809,43 +786,43 @@ class Catalog { /** * get_duplicate_songs * This function takes a search type and returns a list of all song_ids that - * are likely to be duplicates based on teh search method selected. + * are likely to be duplicates based on teh search method selected. */ public static function get_duplicate_songs($search_method) { - $where_sql = ''; + $where_sql = ''; - if (!$_REQUEST['search_disabled']) { - $where_sql = 'WHERE enabled!=\'0\''; - } + if (!$_REQUEST['search_disabled']) { + $where_sql = 'WHERE enabled!=\'0\''; + } // 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 @@ -855,30 +832,30 @@ class Catalog { * order, it sorts them by longest, higest bitrate, largest filesize, checking * the last one as most likely bad */ - public static function get_duplicate_info($item,$search_type) { - // Build the SQL - $sql = "SELECT `song`.`id`" . + public static function get_duplicate_info($item,$search_type) { + // 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,80 +866,80 @@ 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"; // Run through them an get the art! foreach ($albums as $album_id) { - $album = new Album($album_id); + $album = new Album($album_id); - // If no art, skip - if (!$album->has_art()) { continue; } + // 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'; + if ($image['0']['mime'] == 'image/jpeg') { + $extension = 'jpg'; } - else { + else { $extension = substr($image['0']['mime'],strlen($image['0']['mime'])-3,3); - } - + } + // 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']) { - switch ($methods['metadata']) { + if ($methods['metadata']) { + switch ($methods['metadata']) { 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; - } // end switch + case 'linux': + $meta_file = $dir . '/.directory'; + $string = "Name=$album->full_name\nIcon=$file"; + break; + } // end switch - $meta_handle = fopen($meta_file,"w"); - fwrite($meta_handle,$string); - fclose($meta_handle); + $meta_handle = fopen($meta_file,"w"); + fwrite($meta_handle,$string); + fclose($meta_handle); } // end metadata - $i++; - if (!($i%100)) { - echo "Written: $i. . .\n"; - debug_event('art_write',"$album->name Art written to $file",'5'); - } - } // end if fopen + $i++; + if (!($i%100)) { + echo "Written: $i. . .\n"; + debug_event('art_write',"$album->name Art written to $file",'5'); + } + } // end if fopen else { - debug_event('art_write',"Unable to open $file for writting",'5'); + debug_event('art_write',"Unable to open $file for writting",'5'); echo "Error unable to open file for writting [$file]\n"; } - } // end if fopen worked - + } // end if fopen worked + fclose($file_handle); - } // end foreach + } // end foreach - echo "Album Art Dump Complete\n"; + echo "Album Art Dump Complete\n"; - } // dump_album_art + } // dump_album_art /** * update_last_update @@ -993,15 +970,15 @@ class Catalog { * update_settings * This function updates the basic setting of the catalog */ - public static function update_settings($data) { + public static function update_settings($data) { $id = Dba::escape($data['catalog_id']); $name = Dba::escape($data['name']); $key = Dba::escape($data['key']); $rename = Dba::escape($data['rename_pattern']); $sort = Dba::escape($data['sort_pattern']); - - $sql = "UPDATE `catalog` SET `name`='$name', `key`='$key', `rename_pattern`='$rename', " . + + $sql = "UPDATE `catalog` SET `name`='$name', `key`='$key', `rename_pattern`='$rename', " . "`sort_pattern`='$sort' WHERE `id` = '$id'"; $db_results = Dba::query($sql); @@ -1014,7 +991,7 @@ class Catalog { * updates a single album,artist,song from the tag data * this can be done by 75+ */ - public static function update_single_item($type,$id) { + public static function update_single_item($type,$id) { // Because single items are large numbers of things too set_time_limit(0); @@ -1031,22 +1008,22 @@ class Catalog { $songs = $artist->get_songs(); break; case 'song': - $songs[] = $id; + $songs[] = $id; break; } // end switch type - foreach($songs as $song_id) { - $song = new Song($song_id); + foreach($songs as $song_id) { + $song = new Song($song_id); $info = self::update_song_from_tags($song,'',''); - if ($info['change']) { + if ($info['change']) { $file = scrub_out($song->file); - echo "
\n\t
"; - echo "$file " . _('Updated') . "\n"; - echo $info['text']; - echo "\t
\n

"; - flush(); - } // if change + echo "
\n\t
"; + echo "$file " . _('Updated') . "\n"; + echo $info['text']; + echo "\t
\n

"; + flush(); + } // if change else { echo"
\n\t
"; echo "" . scrub_out($song->file) . "
" . _('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); @@ -1114,74 +1093,77 @@ class Catalog { $new_song->album = self::check_album($album,$new_song->year,$disk); $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']) { - debug_event('update',"$song->file difference found, updating database",'5','ampache-catalog'); - $song->update_song($song->id,$new_song); + if ($info['change']) { + debug_event('update',"$song->file difference found, updating database",'5','ampache-catalog'); + $song->update_song($song->id,$new_song); // Redfine our reference - $song = $new_song; - } - else { + $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 * this function adds new files to an * existing catalog */ - public function add_to_catalog() { + public function add_to_catalog() { - if ($this->catalog_type == 'remote') { - show_box_top(_('Running Remote Update') . '. . .'); + if ($this->catalog_type == 'remote') { + show_box_top(_('Running Remote Update') . '. . .'); $this->get_remote_catalog($type=0); - show_box_bottom(); + show_box_bottom(); return true; - } - - require Config::get('prefix') . '/templates/show_adds_catalog.inc.php'; + } + + require Config::get('prefix') . '/templates/show_adds_catalog.inc.php'; flush(); /* Set the Start time */ $start_time = time(); // Make sure the path doesn't end in a / or \ - $this->path = rtrim($this->path,'/'); + $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 "   " . _('Added Playlist From') . " $file . . . .
\n"; - flush(); + if ($verbose) { + echo "   " . _('Added Playlist From') . " $file . . . .
\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(); - $catalog_id = $this->id; - require Config::get('prefix') . '/templates/show_gather_art.inc.php'; - flush(); - $this->get_album_art(); + $catalog_id = $this->id; + require Config::get('prefix') . '/templates/show_gather_art.inc.php'; + flush(); + $this->get_album_art(); /* Update the Catalog last_update */ $this->update_last_add(); @@ -1197,10 +1179,10 @@ class Catalog { $this->count = 0; } - show_box_top(); + show_box_top(); echo "\n
" . _('Catalog Update Finished') . "... " . _('Total Time') . " [" . date("i:s",$time_diff) . "] " . - _('Total Songs') . " [" . $this->count . "] " . _('Songs Per Seconds') . " [" . $song_per_sec . "]

"; - show_box_bottom(); + _('Total Songs') . " [" . $this->count . "] " . _('Songs Per Seconds') . " [" . $song_per_sec . "]

"; + show_box_bottom(); } // add_to_catalog @@ -1209,57 +1191,57 @@ class Catalog { * get a remote catalog and runs update if needed this requires * the XML RPC stuff and a key to be passed */ - public function get_remote_catalog($type=0) { + public function get_remote_catalog($type=0) { /* Make sure the xmlrpc lib is loaded */ - if (!class_exists('xmlrpc_client')) { - debug_event('xmlrpc',"Unable to load XMLRPC library",'1'); + if (!class_exists('xmlrpc_client')) { + debug_event('xmlrpc',"Unable to load XMLRPC library",'1'); echo "" . _("Error") . ": " . _('Unable to load XMLRPC library, make sure XML-RPC is enabled') . "
\n"; return false; } // end check for class // Handshake and get our token for this little conversation - $token = xmlRpcClient::ampache_handshake($this->path,$this->key); + $token = xmlRpcClient::ampache_handshake($this->path,$this->key); - if (!$token) { - debug_event('XMLCLIENT','Error No Token returned'); - Error::display('general'); + if (!$token) { + debug_event('XMLCLIENT','Error No Token returned'); + Error::display('general'); 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 "

$error_msg

"; - 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("Reading Remote Catalog: $catalog_name ($count Songs) [$this->path]
\n"); + print("Reading Remote Catalog: $catalog_name ($count Songs) [$this->path]
\n"); $total += $count; - } - + } + // Flush the output flush(); @@ -1267,13 +1249,13 @@ class Catalog { $step = '500'; $current = '0'; - while ($total > $current) { + while ($total > $current) { $start = $current; $current += $step; $this->get_remote_song($client,$token,$start,$step); } - echo "

" . _('Completed updating remote catalog(s)') . ".


\n"; + echo "

" . _('Completed updating remote catalog(s)') . ".


\n"; flush(); // Update the last update value @@ -1283,39 +1265,39 @@ class Catalog { } // get_remote_catalog - /** + /** * get_remote_song * This functions takes a start and end point for gathering songs from a remote server. It is broken up * in attempt to get around the problem of very large target catalogs */ - public function get_remote_song($client,$token,$start,$end) { + public function get_remote_song($client,$token,$start,$end) { $encoded_start = new xmlrpcval($start,'int'); $encoded_end = new xmlrpcval($end,'int'); $encoded_key = new xmlrpcval($token,'string'); - $query_array = array($encoded_key,$encoded_start,$encoded_end); + $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...
"; flush(); - } - else { - $error_msg = _('Error connecting to') . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString(); - debug_event('XMLCLIENT',$error_msg,'1'); - echo "

$error_msg

"; - } + } + else { + $error_msg = _('Error connecting to') . " " . $server . " " . _("Code") . ": " . $response->faultCode() . " " . _("Reason") . ": " . $response->faultString(); + debug_event('XMLCLIENT',$error_msg,'1'); + echo "

$error_msg

"; + } return; @@ -1329,40 +1311,40 @@ 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); - $song->album = self::check_album($song->album,$song->year); + $song->artist = self::check_artist($song->artist); + $song->album = self::check_album($song->album,$song->year); $song->file = $root_path . "/play/index.php?song=" . $song->id; $song->catalog = $this->id; // Clear out the song id - unset($song->id); - - if (!$this->check_remote_song($song->file)) { + unset($song->id); + + if (!$this->check_remote_song($song->file)) { $this->insert_remote_song($song); - } + } } // foreach new Songs - // now delete invalid entries - self::clean($this->id); + // now delete invalid entries + self::clean($this->id); } // update_remote_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 + * 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 */ public function clean_catalog() { @@ -1370,20 +1352,20 @@ class Catalog { $dead_files = array(); // Added set time limit because this runs out of time for some people - set_time_limit(0); + set_time_limit(0); require_once Config::get('prefix') . '/templates/show_clean_catalog.inc.php'; - flush(); + flush(); - /* Do a quick check to make sure that the root of the catalog is readable, error if not + /* Do a quick check to make sure that the root of the catalog is readable, error if not * this will minimize the loss of catalog data if mount points fail */ - if (!is_readable($this->path)) { - debug_event('catalog','Catalog path:' . $this->path . ' unreadable, clean failed','1'); - Error::add('general',_('Catalog Root unreadable, stopping clean')); - Error::display('general'); - return false; - } + if (!is_readable($this->path)) { + debug_event('catalog','Catalog path:' . $this->path . ' unreadable, clean failed','1'); + Error::add('general',_('Catalog Root unreadable, stopping clean')); + Error::display('general'); + return false; + } /* Get all songs in this catalog */ @@ -1395,52 +1377,52 @@ 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 "\n"; - flush(); - } //echos song count + echo "\n"; + flush(); + } //echos song count /* Also check the file information */ $file_info = filesize($results['file']); /* If it errors somethings splated, or the files empty */ if (!file_exists($results['file']) OR $file_info < 1) { - + /* Add Error */ - Error::add('general',"Error File Not Found or 0 Bytes: " . $results['file']); + Error::add('general',"Error File Not Found or 0 Bytes: " . $results['file']); /* Remove the file! */ - $sql = "DELETE FROM `song` WHERE `id`='" . $results['id'] . "'"; - $delete_results = Dba::query($sql); + $sql = "DELETE FROM `song` WHERE `id`='" . $results['id'] . "'"; + $delete_results = Dba::query($sql); // Count em! - $dead_files++; + $dead_files++; } //if error } //while gettings songs - + /* Step two find orphaned Arists/Albums * This finds artists and albums that no * longer have any songs associated with them */ - self::clean($catalog_id); - + self::clean($catalog_id); + /* Return dead files, so they can be listed */ - echo "\n"; - show_box_top(); + echo "\n"; + show_box_top(); echo "" . _('Catalog Clean Done') . " [" . $dead_files . "] " . _('files removed') . "
\n"; - echo "" . _('Optimizing Tables') . "...
\n"; - self::optimize_tables(); - show_box_bottom(); + echo "" . _('Optimizing Tables') . "...
\n"; + self::optimize_tables(); + show_box_bottom(); flush(); } //clean_catalog @@ -1451,10 +1433,10 @@ class Catalog { * And checks to see if those specific elements are now orphaned * this is often used in flagging, and is a faster way then calling * the normal clean functions. The assumption is made that this is - * an old song object whoes information has already been updated in the + * an old song object whoes information has already been updated in the * database */ - function clean_single_song($song) { + function clean_single_song($song) { $results = array(); @@ -1462,7 +1444,7 @@ class Catalog { $sql = "SELECT song.artist FROM song WHERE artist='" . $song->artist . "'"; $db_results = mysql_query($sql, dbh()); - if (!mysql_num_rows($db_results)) { + if (!mysql_num_rows($db_results)) { $sql = "DELETE FROM artist WHERE id='" . $song->artist . "'"; $db_results = mysql_query($sql, dbh()); $results['artist'] = true; @@ -1472,7 +1454,7 @@ class Catalog { $sql = "SELECT song.album FROM song WHERE album='" . $song->album . "'"; $db_results = mysql_query($sql, dbh()); - if (!mysql_num_rows($db_results)) { + if (!mysql_num_rows($db_results)) { $sql = "DELETE FROM album WHERE id='" . $song->album . "'"; $db_results = mysql_query($sql, dbh()); $results['album'] = true; @@ -1487,24 +1469,24 @@ class Catalog { * This cleans out tag_maps that are not assoicated with a 'living' object * and then cleans the tags that have no maps */ - public static function clean_tags() { + public static function clean_tags() { - $sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `song` ON `song`.`id`=`tag_map`.`object_id` " . + $sql = "DELETE FROM `tag_map` USING `tag_map` LEFT JOIN `song` ON `song`.`id`=`tag_map`.`object_id` " . "WHERE `tag_map`.`object_type`='song' AND `song`.`id` IS NULL"; - $db_results = Dba::query($sql); + $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); + $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); + $db_results = Dba::query($sql); // Now nuke the tags themselves - $sql = "DELETE FROM `tag` USING `tag` LEFT JOIN `tag_map` ON `tag`.`id`=`tag_map`.`tag_id` " . + $sql = "DELETE FROM `tag` USING `tag` LEFT JOIN `tag_map` ON `tag`.`id`=`tag_map`.`tag_id` " . "WHERE `tag_map`.`id` IS NULL"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); } // clean_tags @@ -1512,22 +1494,22 @@ class Catalog { * clean_shoutbox * This cleans out any shoutbox items that are now orphaned */ - public static function clean_shoutbox() { + public static function clean_shoutbox() { // Clean songs - $sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `song` ON `song`.`id`=`user_shout`.`object_id` " . + $sql = "DELETE FROM `user_shout` USING `user_shout` LEFT JOIN `song` ON `song`.`id`=`user_shout`.`object_id` " . "WHERE `song`.`id` IS NULL AND `user_shout`.`object_type`='song'"; - $db_results = Dba::query($sql); + $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); + $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); + $db_results = Dba::query($sql); } // clean_shoutbox @@ -1543,12 +1525,12 @@ class Catalog { $db_results = Dba::query($sql); /* Now remove any album art that is now dead */ - $sql = "DELETE FROM `album_data` USING `album_data` LEFT JOIN `album` ON `album`.`id`=`album_data`.`album_id` WHERE `album`.`id` IS NULL"; - $db_results = Dba::query($sql); + $sql = "DELETE FROM `album_data` USING `album_data` LEFT JOIN `album` ON `album`.`id`=`album_data`.`album_id` WHERE `album`.`id` IS NULL"; + $db_results = Dba::query($sql); // This can save a lot of space so always optomize - $sql = "OPTIMIZE TABLE `album_data`"; - $db_results = Dba::query($sql); + $sql = "OPTIMIZE TABLE `album_data`"; + $db_results = Dba::query($sql); } // clean_albums @@ -1556,7 +1538,7 @@ class Catalog { * clean_flagged * This functions cleans ou unused flagged items */ - public static function clean_flagged() { + public static function clean_flagged() { /* Do a complex delete to get flagged items where the songs are now gone */ $sql = "DELETE FROM flagged USING flagged LEFT JOIN song ON song.id = flagged.object_id WHERE song.id IS NULL AND object_type='song'"; @@ -1580,17 +1562,17 @@ class Catalog { * clean_playlists * cleans out dead files from playlists */ - public static function clean_playlists() { + public static function clean_playlists() { /* Do a complex delete to get playlist songs where there are no songs */ - $sql = "DELETE FROM `playlist_data` USING `playlist_data` LEFT JOIN `song` ON `song`.`id` = `playlist_data`.`object_id` " . + $sql = "DELETE FROM `playlist_data` USING `playlist_data` LEFT JOIN `song` ON `song`.`id` = `playlist_data`.`object_id` " . "WHERE `song`.`file` IS NULL AND `playlist_data`.`object_type`='song'"; $db_results = Dba::query($sql); // Clear TMP Playlist information as well - $sql = "DELETE FROM `tmp_playlist_data` USING `tmp_playlist_data` LEFT JOIN `song` ON `tmp_playlist_data`.`object_id` = `song`.`id` " . + $sql = "DELETE FROM `tmp_playlist_data` USING `tmp_playlist_data` LEFT JOIN `song` ON `tmp_playlist_data`.`object_id` = `song`.`id` " . "WHERE `song`.`id` IS NULL"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); } // clean_playlists @@ -1598,11 +1580,11 @@ class Catalog { * clean_ext_info * This function clears any ext_info that no longer has a parent */ - public static function clean_ext_info() { + public static function clean_ext_info() { - $sql = "DELETE FROM `song_data` USING `song_data` LEFT JOIN `song` ON `song`.`id` = `song_data`.`song_id` " . + $sql = "DELETE FROM `song_data` USING `song_data` LEFT JOIN `song` ON `song`.`id` = `song_data`.`song_id` " . "WHERE `song`.`id` IS NULL"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); } // clean_ext_info @@ -1612,36 +1594,36 @@ class Catalog { */ public static function clean_stats() { - // Crazy SQL Mojo to remove stats where there are no songs + // Crazy SQL Mojo to remove stats where there are no songs $sql = "DELETE FROM object_count USING object_count LEFT JOIN song ON song.id=object_count.object_id WHERE object_type='song' AND song.id IS NULL"; $db_results = Dba::query($sql); - - // Crazy SQL Mojo to remove stats where there are no albums + + // Crazy SQL Mojo to remove stats where there are no albums $sql = "DELETE FROM object_count USING object_count LEFT JOIN album ON album.id=object_count.object_id WHERE object_type='album' AND album.id IS NULL"; $db_results = Dba::query($sql); - - // Crazy SQL Mojo to remove stats where ther are no artists + + // Crazy SQL Mojo to remove stats where ther are no artists $sql = "DELETE FROM object_count USING object_count LEFT JOIN artist ON artist.id=object_count.object_id WHERE object_type='artist' AND artist.id IS NULL"; $db_results = Dba::query($sql); // Delete the live_stream stat information $sql = "DELETE FROM object_count USING object_count LEFT JOIN live_stream ON live_stream.id=object_count.object_id WHERE object_type='live_stream' AND live_stream.id IS NULL"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); // Delete Song Ratings information - $sql = "DELETE FROM rating USING rating LEFT JOIN song ON song.id=rating.object_id WHERE object_type='song' AND song.id IS NULL"; - $db_results = Dba::query($sql); + $sql = "DELETE FROM rating USING rating LEFT JOIN song ON song.id=rating.object_id WHERE object_type='song' AND song.id IS NULL"; + $db_results = Dba::query($sql); // Delete Album Rating Information - $sql = "DELETE FROM rating USING rating LEFT JOIN album ON album.id=rating.object_id WHERE object_type='album' AND album.id IS NULL"; - $db_results = Dba::query($sql); + $sql = "DELETE FROM rating USING rating LEFT JOIN album ON album.id=rating.object_id WHERE object_type='album' AND album.id IS NULL"; + $db_results = Dba::query($sql); // Delete Artist Rating Information - $sql = "DELETE FROM rating USING rating LEFT JOIN artist ON artist.id=rating.object_id WHERE object_type='artist' AND artist.id IS NULL"; - $db_results = Dba::query($sql); + $sql = "DELETE FROM rating USING rating LEFT JOIN artist ON artist.id=rating.object_id WHERE object_type='artist' AND artist.id IS NULL"; + $db_results = Dba::query($sql); } // clean_stats - + /** * verify_catalog * This function compares the DB's information with the ID3 tags @@ -1649,13 +1631,13 @@ class Catalog { public function verify_catalog($catalog_id) { // Create the object so we have some information on it - $catalog = new Catalog($catalog_id); + $catalog = new Catalog($catalog_id); /* First get the filenames for the catalog */ $sql = "SELECT `id`,`file` FROM `song` WHERE `catalog`='$catalog_id'"; $db_results = Dba::query($sql); $number = Dba::num_rows($db_results); - + require_once Config::get('prefix') . '/templates/show_verify_catalog.inc.php'; flush(); @@ -1663,7 +1645,7 @@ class Catalog { set_time_limit(0); // Caching array for album art, save us some time here - $album_art_check_cache = array(); + $album_art_check_cache = array(); /* Recurse through this catalogs files * and get the id3 tage information, @@ -1673,19 +1655,19 @@ class Catalog { while ($results = Dba::fetch_assoc($db_results)) { debug_event('verify',"Starting work on " . $results['file'],'5','ampache-catalog'); - + if (is_readable($results['file'])) { /* Create the object from the existing database information */ $song = new Song($results['id']); - + unset($skip); /* Make sure the song isn't flagged, we don't update flagged stuff */ - if ($song->has_flag()) { - $skip = true; - } - + if ($song->has_flag()) { + $skip = true; + } + // if the file hasn't been modified since the last_update if (!$skip) { @@ -1698,48 +1680,48 @@ class Catalog { } // end skip - if ($skip) { - debug_event('skip',"$song->file has been skipped due to newer local update or file mod time",'5','ampache-catalog'); + if ($skip) { + 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) ) { - $file = str_replace(array('(',')','\''),'',$song->file); - echo "\n"; - flush(); - } //echos song count - + + /* Stupid little cutesie thing */ + $count++; + if (!($count%10) ) { + $file = str_replace(array('(',')','\''),'',$song->file); + echo "\n"; + flush(); + } //echos song count + } // end if file exists else { - Error::add('general',"$song->file does not exist or is not readable"); - debug_event('read-error',"$song->file does not exist or is not readable, removing",'5','ampache-catalog'); + Error::add('general',"$song->file does not exist or is not readable"); + debug_event('read-error',"$song->file does not exist or is not readable, removing",'5','ampache-catalog'); // Let's go ahead and remove it! - $sql = "DELETE FROM `song` WHERE `id`='" . Dba::escape($song->id) . "'"; - $del_results = Dba::query($sql); + $sql = "DELETE FROM `song` WHERE `id`='" . Dba::escape($song->id) . "'"; + $del_results = Dba::query($sql); } } //end foreach /* After we have updated all the songs with the new information clear any empty albums/artists */ - self::clean($catalog_id); + self::clean($catalog_id); // Update the last_update $this->update_last_update(); - // One final time! + // One final time! echo "\n"; - flush(); + echo "update_txt('" . $this->count . "','count_verify_" . $this->id . "');"; + echo "\n\n"; + flush(); - show_box_top(); + show_box_top(); echo _('Update Finished.') . ' ' . _('Checked') . " $count. $total_updated " . _('songs updated.') . "

"; - show_box_bottom(); + show_box_bottom(); return true; @@ -1750,16 +1732,16 @@ class Catalog { * This is a wrapper function for all of the different cleaning * functions, it runs them in the correct order and takes a catalog_id */ - public static function clean() { + public static function clean() { - self::clean_albums(); - self::clean_artists(); - self::clean_flagged(); - self::clean_stats(); - self::clean_ext_info(); - self::clean_playlists(); - self::clean_shoutbox(); - self::clean_tags(); + self::clean_albums(); + self::clean_artists(); + self::clean_flagged(); + self::clean_stats(); + self::clean_ext_info(); + self::clean_playlists(); + self::clean_shoutbox(); + self::clean_tags(); } // clean @@ -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`" . + $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); + $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); + $db_results = Dba::query($sql); - } // optimize_tables; + } // optimize_tables; /** * check_artist @@ -1801,7 +1783,7 @@ class Catalog { } // Remove the prefix so we can sort it correctly - $prefix_pattern = '/^(' . implode('\\s|',explode('|',Config::get('catalog_prefix_pattern'))) . '\\s)(.*)/i'; + $prefix_pattern = '/^(' . implode('\\s|',explode('|',Config::get('catalog_prefix_pattern'))) . '\\s)(.*)/i'; preg_match($prefix_pattern,$artist,$matches); if (count($matches)) { @@ -1831,20 +1813,20 @@ class Catalog { if ($prefix) { $prefix_txt = "'$prefix'"; } - + $sql = "INSERT INTO `artist` (`name`, `prefix`) VALUES ('$artist',$prefix_txt)"; $db_results = Dba::query($sql); $artist_id = Dba::insert_id(); if (!$db_results) { - Error::add('general',"Inserting Artist:$artist"); + Error::add('general',"Inserting Artist:$artist"); } } // not found // If readonly, and not found return false - else { - return false; - } + else { + return false; + } $array = array($artist => $artist_id); self::$artists = array_merge(self::$artists, $array); @@ -1856,7 +1838,7 @@ class Catalog { /** * check_album - * Takes $album and checks if there then return id else insert and return id + * Takes $album and checks if there then return id else insert and return id */ public static function check_album($album,$album_year=0,$disk='',$readonly='') { @@ -1869,12 +1851,12 @@ class Catalog { /* Ohh no the album has lost it's mojo */ if (!$album) { $album = _('Unknown (Orphaned)'); - unset($album_year); + unset($album_year); } // 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'); + $prefix_pattern = '/^(' . implode('\\s|',explode('|',Config::get('catalog_prefix_pattern'))) . '\\s)(.*)/i'; + debug_event('prefix',$prefix_pattern,'3'); preg_match($prefix_pattern,$album,$matches); if (count($matches)) { @@ -1890,7 +1872,7 @@ debug_event('prefix',$prefix_pattern,'3'); /* Setup the Query */ $sql = "SELECT `id` FROM `album` WHERE `name` = '$album'"; if ($album_year) { $sql .= " AND `year`='$album_year'"; } - if ($album_disk) { $sql .= " AND `disk`='$album_disk'"; } + if ($album_disk) { $sql .= " AND `disk`='$album_disk'"; } if ($prefix) { $sql .= " AND `prefix`='" . Dba::escape($prefix) . "'"; } $db_results = Dba::query($sql); @@ -1899,37 +1881,37 @@ debug_event('prefix',$prefix_pattern,'3'); $album_id = $r['id']; // If we don't have art put it in the 'needs me some art' array - if (!strlen($r['art'])) { - $key = $r['id']; + if (!strlen($r['art'])) { + $key = $r['id']; self::$_art_albums[$key] = $key; } - + } //if found /* If not found create */ elseif (!$readonly) { - $prefix_txt = $prefix ? "'$prefix'" : 'NULL'; + $prefix_txt = $prefix ? "'$prefix'" : 'NULL'; $sql = "INSERT INTO `album` (`name`, `prefix`,`year`,`disk`) VALUES ('$album',$prefix_txt,'$album_year','$album_disk')"; $db_results = Dba::query($sql); $album_id = Dba::insert_id(); if (!$db_results) { - debug_event('album',"Error Unable to insert Album:$album",'2'); + debug_event('album',"Error Unable to insert Album:$album",'2'); } // Add it to the I needs me some album art array - self::$_art_albums[$album_id] = $album_id; + self::$_art_albums[$album_id] = $album_id; } //not found // If not readonly and not found - else { - return false; - } + else { + return false; + } $array = array($album => $album_id); - self::$albums = array_merge(self::$albums,$array); + self::$albums = array_merge(self::$albums,$array); unset($array); return $album_id; @@ -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]; - - 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; + $map_id = Tag::add($object_type,$object_id,$value,'0'); - return $insert_id; + return $map_id; } // check_tag @@ -2007,7 +1963,7 @@ debug_event('prefix',$prefix_pattern,'3'); /* Clean Up the tags */ $results = clean_tag_info($vainfo->tags,$key,$file); - + /* Set the vars here... so we don't have to do the '" . $blah['asd'] . "' */ $title = Dba::escape($results['title']); $artist = $results['artist']; @@ -2021,7 +1977,7 @@ debug_event('prefix',$prefix_pattern,'3'); $disk = $results['disk']; $year = $results['year']; $comment = $results['comment']; - $tag = $results['genre']; + $tag = $results['genre']; $current_time = time(); $lyrics = ' '; @@ -2038,29 +1994,29 @@ debug_event('prefix',$prefix_pattern,'3'); " VALUES ('$add_file','$this->id','$album_id','$artist_id','$title','$bitrate','$rate','$mode','$size','$song_time','$track','$current_time','$year')"; $db_results = Dba::query($sql); - if (!$db_results) { - debug_event('insert',"Unable to insert $file -- $sql" . Dba::error(),'5','ampache-catalog'); - Error::add('catalog_add','Error Adding ' . $file . ' SQL:' . $sql); - } + if (!$db_results) { + debug_event('insert',"Unable to insert $file -- $sql" . Dba::error(),'5','ampache-catalog'); + Error::add('catalog_add','Error Adding ' . $file . ' SQL:' . $sql); + } - $song_id = Dba::insert_id(); + $song_id = Dba::insert_id(); - self::check_tag($tag,$song_id); + self::check_tag($tag,$song_id); /* Add the EXT information */ - $sql = "INSERT INTO `song_data` (`song_id`,`comment`,`lyrics`) " . + $sql = "INSERT INTO `song_data` (`song_id`,`comment`,`lyrics`) " . " VALUES ('$song_id','$comment','$lyrics')"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); if (!$db_results) { - debug_event('insert',"Unable to insert EXT Info for $file -- $sql",'5','ampache-catalog'); + debug_event('insert',"Unable to insert EXT Info for $file -- $sql",'5','ampache-catalog'); } } // insert_local_song /** * insert_remote_song - * takes the information gotten from XML-RPC and + * takes the information gotten from XML-RPC and * inserts it into the local database. The filename * ends up being the url. */ @@ -2069,14 +2025,14 @@ debug_event('prefix',$prefix_pattern,'3'); $url = Dba::escape($song->file); $title = self::check_title($song->title); $title = Dba::escape($title); - $current_time = time(); - + $current_time = time(); + $sql = "INSERT INTO song (file,catalog,album,artist,title,bitrate,rate,mode,size,time,track,addition_time,year)" . " VALUES ('$url','$song->catalog','$song->album','$song->artist','$title','$song->bitrate','$song->rate','$song->mode','$song->size','$song->time','$song->track','$current_time','$song->year')"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); - if (!$db_results) { - debug_event('insert',"Unable to Add Remote $url -- $sql",'5','ampache-catalog'); + if (!$db_results) { + debug_event('insert',"Unable to Add Remote $url -- $sql",'5','ampache-catalog'); echo "Error Adding Remote $url
$sql
\n"; flush(); } @@ -2088,30 +2044,30 @@ debug_event('prefix',$prefix_pattern,'3'); * checks to see if a remote song exists in the database or not * if it find a song it returns the UID */ - public function check_remote_song($url) { + public function check_remote_song($url) { $url = Dba::escape($url); $sql = "SELECT `id` FROM `song` WHERE `file`='$url'"; - $db_results = Dba::query($sql); + $db_results = Dba::query($sql); - if (Dba::num_rows($db_results)) { + if (Dba::num_rows($db_results)) { return true; } - + return false; } // check_remote_song /** * check_local_mp3 - * Checks the song to see if it's there already returns true if found, false if not + * Checks the song to see if it's there already returns true if found, false if not */ public function check_local_mp3($full_file, $gather_type='') { $file_date = filemtime($full_file); if ($file_date < $this->last_add) { - debug_event('Check','Skipping ' . $full_file . ' File modify time before last add run','3'); + debug_event('Check','Skipping ' . $full_file . ' File modify time before last add run','3'); return true; } @@ -2133,23 +2089,23 @@ 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) { + */ + public function import_m3u($filename) { $m3u_handle = fopen($filename,'r'); - + $data = fread($m3u_handle,filesize($filename)); - + $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) { // Remove extra whitespace $value = trim($value); - if (preg_match($pattern,$value)) { + if (preg_match($pattern,$value)) { /* Translate from \ to / so basename works */ $value = str_replace("\\","/",$value); @@ -2157,34 +2113,34 @@ debug_event('prefix',$prefix_pattern,'3'); /* Search for this filename, cause it's a audio file */ $sql = "SELECT `id` FROM `song` WHERE `file` LIKE '%" . Dba::escape($file) . "'"; - $db_results = Dba::query($sql); - $results = Dba::fetch_assoc($db_results); + $db_results = Dba::query($sql); + $results = Dba::fetch_assoc($db_results); if (isset($results['id'])) { $songs[] = $results['id']; } } // if it's a file // Check to see if it's a url from this ampache instance - elseif (substr($value,0,strlen(Config::get('web_path'))) == Config::get('web_path')) { + elseif (substr($value,0,strlen(Config::get('web_path'))) == Config::get('web_path')) { $song_id = intval(Song::parse_song_url($value)); - - $sql = "SELECT COUNT(*) FROM `song` WHERE `id`='$song_id'"; - $db_results = Dba::query($sql); - - if (Dba::num_rows($db_results)) { - $songs[] = $song_id; - } + + $sql = "SELECT COUNT(*) FROM `song` WHERE `id`='$song_id'"; + $db_results = Dba::query($sql); + + if (Dba::num_rows($db_results)) { + $songs[] = $song_id; + } } // end if it's an http url } // end foreach line - debug_event('m3u_parse',"Parsing $filename - Found: " . count($songs) . " Songs",'5'); + debug_event('m3u_parse',"Parsing $filename - Found: " . count($songs) . " Songs",'5'); - if (count($songs)) { + if (count($songs)) { $name = "M3U - " . basename($filename,'.m3u'); - $playlist_id = Playlist::create($name,'public'); + $playlist_id = Playlist::create($name,'public'); - if (!$playlist_id) { return false; } + if (!$playlist_id) { return false; } /* Recreate the Playlist */ $playlist = new Playlist($playlist_id); @@ -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) { - - //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," . + /*! + @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; } + + //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_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()); - - $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 + $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()); + + //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; + + } // merge_stats /** * delete @@ -2258,29 +2214,29 @@ debug_event('prefix',$prefix_pattern,'3'); */ public static function delete($catalog_id) { - $catalog_id = Dba::escape($catalog_id); + $catalog_id = Dba::escape($catalog_id); // First remove the songs in this catalog $sql = "DELETE FROM `song` WHERE `catalog` = '$catalog_id'"; $db_results = Dba::query($sql); // Only if the previous one works do we go on - if (!$db_results) { return false; } + if (!$db_results) { return false; } // Next Remove the Catalog Entry it's self $sql = "DELETE FROM `catalog` WHERE `id` = '$catalog_id'"; $db_results = Dba::query($sql); // Run the Aritst/Album Cleaners... - self::clean($catalog_id); + self::clean($catalog_id); } // delete /*! @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) { @@ -2304,11 +2260,11 @@ debug_event('prefix',$prefix_pattern,'3'); } $db_results = Dba::query($sql); - switch ($type) { - case 'itunes': + switch ($type) { + case 'itunes': echo xml_get_header('itunes'); - - while ($results = Dba::fetch_assoc($db_results)) { + + while ($results = Dba::fetch_assoc($db_results)) { $song = new Song($results['id']); $song->format(); @@ -2333,18 +2289,18 @@ 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)) { - $song = new Song($results['id']); - $song->format(); - echo '"' . $song->id . '","' . $song->title . '","' . $song->artist_full . '","' . $song->album_full . + echo "ID,Title,Artist,Album,Genre,Length,Track,Year,Date Added,Bitrate,Played,File\n"; + while ($results = Dba::fetch_assoc($db_results)) { + $song = new Song($results['id']); + $song->format(); + echo '"' . $song->id . '","' . $song->title . '","' . $song->artist_full . '","' . $song->album_full . '","' . $song->f_genre . '","' . $song->f_time . '","' . $song->f_track . '","' . $song->year . '","' . date("Y-m-d\TH:i:s\Z",$song->addition_time) . '","' . $song->f_bitrate . '","' . $song->played . '","' . $song->file . "\n"; - } - break; + } + break; } // end switch } // export diff --git a/lib/class/database_object.abstract.php b/lib/class/database_object.abstract.php index 2005da55..5c6020c6 100644 --- a/lib/class/database_object.abstract.php +++ b/lib/class/database_object.abstract.php @@ -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) { - - self::$object_cache[$index][$id] = $data; - - return true; + $hasbeenset = false; + + // Set the data if it is set + if (isset($data)) { + self::$object_cache[$index][$id] = $data; + $hasbeenset = true; + } + + return $hasbeenset; } // add_to_cache diff --git a/lib/class/playlist.class.php b/lib/class/playlist.class.php index 37b645d1..5c66e0be 100644 --- a/lib/class/playlist.class.php +++ b/lib/class/playlist.class.php @@ -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; diff --git a/lib/class/radio.class.php b/lib/class/radio.class.php index 09ac9876..ee3cf4aa 100644 --- a/lib/class/radio.class.php +++ b/lib/class/radio.class.php @@ -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 diff --git a/lib/class/song.class.php b/lib/class/song.class.php index 6c97383f..5b94ac38 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -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,', '); @@ -909,7 +919,7 @@ class Song extends database_object { $conf_var = 'transcode_' . $this->type; $conf_type = 'transcode_' . $this->type . '_target'; - + if (Config::get($conf_var)) { $this->_transcode = true; debug_event('auto_transcode','Transcoding to ' . $this->type,'5'); diff --git a/lib/class/stats.class.php b/lib/class/stats.class.php index 9f5cfdae..b57bb56e 100644 --- a/lib/class/stats.class.php +++ b/lib/class/stats.class.php @@ -1,7 +1,7 @@ $value) { - $tag->$key = $value; + if ($type) { + $this->set_object($type,$object_id); } - return $tag; + $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; + } - } // construct_from_name + $this->count = count($data); + + } // set_object /** * build_cache @@ -76,13 +124,13 @@ class Tag extends database_object { * in a single query, cuts down on the connections */ public static function build_cache($ids) { - + if (!is_array($ids) OR !count($ids)) { return false; } $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); - - $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); + // Validate the tag type + if (!self::validate_type($type)) { return false; } + + if (!is_numeric($id)) { return false; } + + $cleaned_value = self::clean_tag($value); + + 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 Dba::num_rows($db_results); + return $map_id; - } // has_object + } // 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='') { + public static function add_tag($value) { - if (!self::validate_type($type)) { - return false; - } - if (!is_numeric($id)) { - return false; - } - // 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); - - // 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']; - - // 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(); - } + $value = Dba::escape($value); + + $sql = "REPLACE INTO `tag` SET `name`='$value'"; + $db_results = Dba::write($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); + + if (!$tag_id || !$id) { return false; } + + $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(); - // 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); - - $row = Dba::fetch_assoc($db_results); - - // 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 (parent::is_cached('tag_name',$value)) { + return parent::get_from_cache('tag_name',$value); + } + + $value = Dba::escape($value); + $sql = "SELECT * FROM `tag` WHERE `name`='$value'"; + $db_results = Dba::read($sql); - // If they pass us nothing, they get nothing - if (!count($object_ids)) { return array(); } - if (!self::validate_type($type)) { return array(); } + $results = Dba::fetch_assoc($db_results); - $lid = '(' . implode(',',$id) . ')'; - $orsql = ''; + 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 ($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_map_' . $type,$object_id)) { + $data = parent::get_from_cache('tag_map_' . $type,$object_id); + return $data['id']; } - //return self::filter_with_prefs($results); - return $results; + $object_id = Dba::escape($object_id); + $tag_id = Dba::escape($tag_id); + $user = Dba::escape($user); + $type = Dba::escape($type); - } // get_man_tags + $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 diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 4ddab260..f09047cc 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -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 ?> diff --git a/lib/class/vainfo.class.php b/lib/class/vainfo.class.php index fb668078..80fed827 100644 --- a/lib/class/vainfo.class.php +++ b/lib/class/vainfo.class.php @@ -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 */ @@ -139,7 +139,7 @@ class vainfo { $this->_raw = $this->_getID3->analyze($this->filename); } catch (Exception $error) { - debug_event('getid3',$error->message,'1'); + debug_event('getid3',$error->message,'1'); } /* Figure out what type of file we are dealing with */ diff --git a/lib/debug.lib.php b/lib/debug.lib.php index 680446bf..3459609c 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -199,12 +199,22 @@ function check_putenv() { if (!ini_set(memory_limit,$new_limit)) { 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 diff --git a/lib/init.php b/lib/init.php index 8bcf8a0f..6a030fc9 100644 --- a/lib/init.php +++ b/lib/init.php @@ -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']; diff --git a/lib/log.lib.php b/lib/log.lib.php index 02ddb1a3..e78812a2 100644 --- a/lib/log.lib.php +++ b/lib/log.lib.php @@ -1,7 +1,7 @@ $event_description \n"; $log_write = error_log($log_line, 3, $log_filename); @@ -49,7 +50,7 @@ function log_event($username='Unknown',$event_name,$event_description,$log_name= as many errors as it can and logs em */ function ampache_error_handler($errno, $errstr, $errfile, $errline) { - + /* Default level of 1 */ $level = 1; @@ -79,6 +80,7 @@ function ampache_error_handler($errno, $errstr, $errfile, $errline) { $level = 2; 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 /** diff --git a/lib/search.php b/lib/search.php index a621fc6e..9f0770da 100644 --- a/lib/search.php +++ b/lib/search.php @@ -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; diff --git a/login.php b/login.php index a313bdbd..b152bca4 100644 --- a/login.php +++ b/login.php @@ -156,5 +156,3 @@ if ($auth['success']) { require Config::get('prefix') . '/templates/show_login_form.inc.php'; ?> - - diff --git a/modules/flash/crossdomain.xml b/modules/flash/crossdomain.xml index f7f2044c..6bd7a671 100644 --- a/modules/flash/crossdomain.xml +++ b/modules/flash/crossdomain.xml @@ -1,3 +1,4 @@ + - - - diff --git a/modules/getid3/write.id3v2.php b/modules/getid3/write.id3v2.php index f122b6b0..5c4ae4d7 100644 --- a/modules/getid3/write.id3v2.php +++ b/modules/getid3/write.id3v2.php @@ -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"'); } diff --git a/modules/infotools/mp3tunes.class.php b/modules/infotools/mp3tunes.class.php index bdde4a38..b7e10e33 100644 --- a/modules/infotools/mp3tunes.class.php +++ b/modules/infotools/mp3tunes.class.php @@ -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'; diff --git a/play/index.php b/play/index.php index cae5b800..6c790f88 100644 --- a/play/index.php +++ b/play/index.php @@ -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 diff --git a/playlist.php b/playlist.php index ca911176..54c94752 100644 --- a/playlist.php +++ b/playlist.php @@ -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&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': diff --git a/server/tag.ajax.php b/server/tag.ajax.php index 2f1fa297..51d86c80 100644 --- a/server/tag.ajax.php +++ b/server/tag.ajax.php @@ -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'; diff --git a/stats.php b/stats.php index 5c725ee7..cdd7b9e9 100644 --- a/stats.php +++ b/stats.php @@ -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 diff --git a/templates/base.css b/templates/base.css new file mode 100644 index 00000000..17a43d97 --- /dev/null +++ b/templates/base.css @@ -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;} + + + diff --git a/templates/handheld.css b/templates/handheld.css deleted file mode 100644 index 5543d671..00000000 --- a/templates/handheld.css +++ /dev/null @@ -1,106 +0,0 @@ - -/* -#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 } - -} diff --git a/templates/header.inc.php b/templates/header.inc.php index 2bc6d190..4caf51d5 100644 --- a/templates/header.inc.php +++ b/templates/header.inc.php @@ -33,23 +33,19 @@ $location = get_location(); - - - - - <?php echo scrub_out(Config::get('site_title')); ?> - <?php echo $location['title']; ?> + - +
-
Loading . . .
diff --git a/templates/install.css b/templates/install.css index f37431df..10eb86eb 100644 --- a/templates/install.css +++ b/templates/install.css @@ -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 */ diff --git a/templates/print.css b/templates/print.css index 05027a52..b2045256 100644 --- a/templates/print.css +++ b/templates/print.css @@ -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; @@ -122,5 +123,4 @@ display: none; } select { display: none; -} - +} \ No newline at end of file diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php index fab81de3..22bc74e6 100644 --- a/templates/rightbar.inc.php +++ b/templates/rightbar.inc.php @@ -32,6 +32,7 @@ id); + Playlist::build_cache($playlists); foreach ($playlists as $playlist_id) { $playlist = new Playlist($playlist_id); $playlist->format(); diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php index 734bacb1..fd712364 100644 --- a/templates/show_album_row.inc.php +++ b/templates/show_album_row.inc.php @@ -44,7 +44,6 @@ - id,'add_tag',_('Add Tag'),'add_album_tag_' . $album->id); ?> diff --git a/templates/show_artist.inc.php b/templates/show_artist.inc.php index 62a54076..2f29d11a 100644 --- a/templates/show_artist.inc.php +++ b/templates/show_artist.inc.php @@ -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')) { ?> -
id); ?>"_artist" style="display:inline;"> +
id, 'artist'); ?>
@@ -38,7 +38,7 @@ if (Config::get('ratings')) { id,'add',_('Add'),'add_' . $artist->id); ?>f_name); ?>
  • - id,'random',_('Random'),'random_' . $artist->id); ?>f_name); ?>> + id,'random',_('Random'),'random_' . $artist->id); ?>f_name); ?>
  • @@ -53,7 +53,7 @@ if (Config::get('ratings')) {
  • /> - +
  • diff --git a/templates/show_big_art.inc.php b/templates/show_big_art.inc.php index 4121fff3..eb9ba0c4 100644 --- a/templates/show_big_art.inc.php +++ b/templates/show_big_art.inc.php @@ -28,7 +28,7 @@ $htmllang = str_replace("_","-",Config::get('lang')); <?php echo Config::get('site_title'); ?> - <?php echo _("Album Art"); ?> - + "; echo "\"\""; diff --git a/templates/show_create_democratic.inc.php b/templates/show_create_democratic.inc.php index 7059cebe..3175da2b 100644 --- a/templates/show_create_democratic.inc.php +++ b/templates/show_create_democratic.inc.php @@ -24,7 +24,7 @@ show_box_top(_('Create Democratic Playlist')); ?> - + @@ -32,7 +32,7 @@ show_box_top(_('Create Democratic Playlist')); ?> - + diff --git a/templates/show_denied.inc.php b/templates/show_denied.inc.php index 1b59cf08..74afe4ef 100644 --- a/templates/show_denied.inc.php +++ b/templates/show_denied.inc.php @@ -25,9 +25,9 @@ Ampache -- Debug Page + - - @@ -53,7 +53,7 @@ - diff --git a/templates/show_edit_access.inc.php b/templates/show_edit_access.inc.php index 14848946..9aa6c25e 100644 --- a/templates/show_edit_access.inc.php +++ b/templates/show_edit_access.inc.php @@ -24,7 +24,7 @@
    +
    +
    - + @@ -65,7 +65,6 @@ - diff --git a/templates/show_edit_album_row.inc.php b/templates/show_edit_album_row.inc.php index c6168972..e1a1a694 100644 --- a/templates/show_edit_album_row.inc.php +++ b/templates/show_edit_album_row.inc.php @@ -24,7 +24,7 @@
    :
    :
    : diff --git a/templates/show_edit_album.inc.php b/templates/show_edit_album.inc.php index e8f30373..41e6ccb7 100644 --- a/templates/show_edit_album.inc.php +++ b/templates/show_edit_album.inc.php @@ -26,13 +26,13 @@
    - +
    - +
    diff --git a/templates/show_edit_artist_row.inc.php b/templates/show_edit_artist_row.inc.php index 9e8ec913..de4c16b2 100644 --- a/templates/show_edit_artist_row.inc.php +++ b/templates/show_edit_artist_row.inc.php @@ -24,7 +24,7 @@
    - + - + diff --git a/templates/show_edit_artist.inc.php b/templates/show_edit_artist.inc.php index 50e256c8..030466a2 100644 --- a/templates/show_edit_artist.inc.php +++ b/templates/show_edit_artist.inc.php @@ -26,7 +26,7 @@
    - +
    - +
    - + diff --git a/templates/show_edit_live_stream_row.inc.php b/templates/show_edit_live_stream_row.inc.php index 475a2e78..48284165 100644 --- a/templates/show_edit_live_stream_row.inc.php +++ b/templates/show_edit_live_stream_row.inc.php @@ -32,19 +32,19 @@
    - + - + - + - + - + diff --git a/templates/show_edit_playlist_row.inc.php b/templates/show_edit_playlist_row.inc.php index 3a1e6161..ce752772 100644 --- a/templates/show_edit_playlist_row.inc.php +++ b/templates/show_edit_playlist_row.inc.php @@ -24,7 +24,7 @@ diff --git a/templates/show_genre.inc.php b/templates/show_genre.inc.php index 630aab61..6e1ee56f 100644 --- a/templates/show_genre.inc.php +++ b/templates/show_genre.inc.php @@ -26,7 +26,7 @@ */ $web_path = Config::get('web_path'); ?> -name)); ?> +name)); ?> [get_album_count(); ?>]
    diff --git a/templates/show_install.inc.php b/templates/show_install.inc.php index b42b6769..799ba65b 100644 --- a/templates/show_install.inc.php +++ b/templates/show_install.inc.php @@ -25,7 +25,7 @@ if (INSTALL != '1') { exit; } Ampache :: For The Love Of Music - Install - + diff --git a/templates/show_install_account.inc.php b/templates/show_install_account.inc.php index 1e6991d3..9c52b93e 100644 --- a/templates/show_install_account.inc.php +++ b/templates/show_install_account.inc.php @@ -26,7 +26,7 @@ if (INSTALL != '1') { exit; } Ampache :: For The Love Of Music - Install - +
    - + type; ${$name} = ' selected="selected"'; ?> diff --git a/templates/show_edit_playlist_song_row.inc.php b/templates/show_edit_playlist_song_row.inc.php index 8a8d612c..fec8c24a 100644 --- a/templates/show_edit_playlist_song_row.inc.php +++ b/templates/show_edit_playlist_song_row.inc.php @@ -24,7 +24,7 @@ diff --git a/templates/show_edit_song.inc.php b/templates/show_edit_song.inc.php index 028d2933..ee2dde80 100644 --- a/templates/show_edit_song.inc.php +++ b/templates/show_edit_song.inc.php @@ -30,7 +30,7 @@ @@ -38,7 +38,7 @@ @@ -46,7 +46,7 @@ @@ -54,25 +54,25 @@ diff --git a/templates/show_edit_song_row.inc.php b/templates/show_edit_song_row.inc.php index 97eb47b1..f8cdc36c 100644 --- a/templates/show_edit_song_row.inc.php +++ b/templates/show_edit_song_row.inc.php @@ -1,7 +1,7 @@
    - + f_link; ?> f_artist_link; ?>
    - +
    album); ?>

    - +
    artist); ?>

    - +
    genre); ?>

    - +
    - +
    - +
    - +
    + - +
    - + artist,true,$song->id); ?> @@ -36,18 +37,14 @@ id,'change','check_inline_song_edit("album", '.$song->id.')'); ?> - genre,'',true,$song->id); ?> -
    -id,'change','check_inline_song_edit("genre", '.$song->id.')'); ?> -
    - + id . '&type=song','download',_('Save Changes'),'save_song_' . $song->id,'edit_song_' . $song->id); ?>
    @@ -44,4 +44,3 @@
    - diff --git a/templates/show_localplay_add_instance.inc.php b/templates/show_localplay_add_instance.inc.php index 224994c7..68d83f22 100644 --- a/templates/show_localplay_add_instance.inc.php +++ b/templates/show_localplay_add_instance.inc.php @@ -27,7 +27,7 @@ $field) { ?>
    diff --git a/templates/show_localplay_edit_instance.inc.php b/templates/show_localplay_edit_instance.inc.php index 49a34d5c..6f3f8d70 100644 --- a/templates/show_localplay_edit_instance.inc.php +++ b/templates/show_localplay_edit_instance.inc.php @@ -26,7 +26,7 @@ $field) { ?> - + diff --git a/templates/show_login_form.inc.php b/templates/show_login_form.inc.php index a5fd3499..44b58be5 100644 --- a/templates/show_login_form.inc.php +++ b/templates/show_login_form.inc.php @@ -55,11 +55,11 @@ function focus(){ document.login.username.focus(); }
    - +
    - +
    get_items(); Browse::set_type('playlist_song'); Browse::add_supplemental_object('playlist',$playlist->id); Browse::set_static_content(1); diff --git a/templates/show_registration_confirmation.inc.php b/templates/show_registration_confirmation.inc.php index 55cb78db..21b30c9a 100644 --- a/templates/show_registration_confirmation.inc.php +++ b/templates/show_registration_confirmation.inc.php @@ -27,16 +27,14 @@ $web_path = Config::get('web_path'); <?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?> - - + + - - diff --git a/templates/show_stats_newest.inc.php b/templates/show_stats_newest.inc.php index 04489b2b..0bd0bb66 100644 --- a/templates/show_stats_newest.inc.php +++ b/templates/show_stats_newest.inc.php @@ -19,23 +19,9 @@ */ ?> -
    - _('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(); - ?> -
    - + + + + + + diff --git a/templates/show_stats_popular.inc.php b/templates/show_stats_popular.inc.php index 648945a9..432f971f 100644 --- a/templates/show_stats_popular.inc.php +++ b/templates/show_stats_popular.inc.php @@ -1,7 +1,7 @@ _('Most Popular Genres')); - show_box_top('','info-box box_popular_genres'); - require Config::get('prefix') . '/templates/show_objects.inc.php'; - show_box_bottom(); ?>
    diff --git a/templates/show_tagcloud.inc.php b/templates/show_tagcloud.inc.php index 882246db..bde48898 100644 --- a/templates/show_tagcloud.inc.php +++ b/templates/show_tagcloud.inc.php @@ -21,56 +21,3 @@ */ $web_path = Config::get('web_path'); ?> -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 ''.$tagbyid[$t]['name'].' '; -} -echo '
    '; -$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 ''.$n.' '; - } -} -*/ -?> - diff --git a/templates/show_test.inc.php b/templates/show_test.inc.php index 43338288..5c193f98 100644 --- a/templates/show_test.inc.php +++ b/templates/show_test.inc.php @@ -25,13 +25,14 @@ Ampache -- Debug Page + - +
    @@ -246,7 +247,7 @@ } $results['web_path'] = $http_type . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . Config::get('web_path'); if ($status['parse_config']) { - echo ""; + echo "      "; } else { $status['check_webpath'] = false; @@ -257,15 +258,15 @@ ]
    - 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.

    Ampache Debug.
    -For the love of Music.

    +Pour l'Amour de la Musique.

    diff --git a/templates/show_test_config.inc.php b/templates/show_test_config.inc.php index 085fa17c..9c1807b0 100644 --- a/templates/show_test_config.inc.php +++ b/templates/show_test_config.inc.php @@ -25,8 +25,6 @@ Ampache -- Config Debug Page - - + +

    Ampache Debug.
    -For the love of Music.

    +Pour l'Amour de la Musique.

    diff --git a/templates/show_user_activate.inc.php b/templates/show_user_activate.inc.php index 99e8796f..4b5b6cc0 100644 --- a/templates/show_user_activate.inc.php +++ b/templates/show_user_activate.inc.php @@ -27,16 +27,15 @@ $web_path = Config::get('web_path'); <?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?> - - + + - - + @@ -48,7 +47,8 @@ $web_path = Config::get('web_path'); ?>

    - ', ''); ?> + ', ''); ?>

    diff --git a/templates/show_user_registration.inc.php b/templates/show_user_registration.inc.php index c435293d..f162c6c6 100644 --- a/templates/show_user_registration.inc.php +++ b/templates/show_user_registration.inc.php @@ -27,16 +27,14 @@ $web_path = Config::get('web_path'); <?php echo Config::get('site_title'); ?> - <?php echo _('Registration'); ?> - - + + - - @@ -62,7 +60,7 @@ if (Config::get('user_agreement')) { ?> - + diff --git a/templates/show_verify_catalog.inc.php b/templates/show_verify_catalog.inc.php index 22a37af3..a915d681 100644 --- a/templates/show_verify_catalog.inc.php +++ b/templates/show_verify_catalog.inc.php @@ -20,7 +20,7 @@ */ show_box_top(); -printf(_('Updating the %s catalog', "[ $catalog->name ]")); +printf(_('Updating the %s catalog'), "[ $catalog->name ]"); echo "
    \n" . $number . " " . _('songs found checking tag information.') . "
    \n\n"; echo _('Verifed') . ":$catalog_verify_found
    "; echo _('Reading') . ":$catalog_verify_directory
    "; diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php index 114cb256..ec37677b 100644 --- a/templates/sidebar_home.inc.php +++ b/templates/sidebar_home.inc.php @@ -43,7 +43,7 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path'); - + diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css index 50483181..ff09bab0 100644 --- a/themes/classic/templates/default.css +++ b/themes/classic/templates/default.css @@ -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 diff --git a/themes/greysme/templates/default.css b/themes/greysme/templates/default.css index d12a4182..a2aff896 100644 --- a/themes/greysme/templates/default.css +++ b/themes/greysme/templates/default.css @@ -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 diff --git a/update.php b/update.php index 844c4e58..1e741dd7 100644 --- a/update.php +++ b/update.php @@ -49,11 +49,11 @@ $htmllang = str_replace("_","-",Config::get('lang'));
    -This page handles all database updates to Ampache starting with 3.3.3.5. According to your database your current version is: . +This page handles all database updates to Ampache starting with 3.3.3.5. According to your database your current version is: . the following updates need to be performed

    @@ -61,7 +61,7 @@ the following updates need to be performed

    - +
    -- cgit