diff options
-rw-r--r-- | admin/modules.php | 11 | ||||
-rw-r--r-- | admin/users.php | 4 | ||||
-rw-r--r-- | config/ampache.cfg.php.dist | 4 | ||||
-rwxr-xr-x | docs/CHANGELOG | 40 | ||||
-rw-r--r-- | lib/class/plugin.class.php | 14 | ||||
-rw-r--r-- | lib/class/preference.class.php | 31 | ||||
-rw-r--r-- | lib/debug.lib.php | 13 | ||||
-rw-r--r-- | lib/general.lib.php | 2 | ||||
-rw-r--r-- | lib/init.php | 2 | ||||
-rw-r--r-- | lib/install.php | 2 | ||||
-rw-r--r-- | lib/preferences.php | 2 | ||||
-rw-r--r-- | modules/plugins/Lastfm.plugin.php | 5 |
12 files changed, 81 insertions, 49 deletions
diff --git a/admin/modules.php b/admin/modules.php index bc13eb22..23fc5429 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -77,7 +77,14 @@ switch ($_REQUEST['action']) { break; } $plugin = new Plugin($_REQUEST['plugin']); - $plugin->install(); + if (!$plugin->install()) { + debug_event('plugins','Error: Plugin Install Failed, ' . $_REQUEST['plugin'],'1'); + $url = Config::get('web_path') . '/admin/modules.php?action=show_plugins'; + $title = _('Unable to Install Plugin'); + $body = ''; + show_confirmation($title,$body,$url); + break; + } // Don't trust the plugin to this stuff User::rebuild_all_preferences(); diff --git a/admin/users.php b/admin/users.php index a986bba6..a9a5039d 100644 --- a/admin/users.php +++ b/admin/users.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -97,7 +97,7 @@ switch ($_REQUEST['action']) { $pass1 = scrub_in($_REQUEST['password_1']); $pass2 = scrub_in($_REQUEST['password_2']); - if ($pass1 !== $pass2) { + if ($pass1 !== $pass2 || !strlen($pass1)) { Error::add('password',_("Error Passwords don't match")); } diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index 5f970c6e..472db77c 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -5,9 +5,9 @@ ; This value is used to detect quickly ; if this config file is up to date -; this is compared against a value hardcoded +; this is compared against a value hard-coded ; into the init script -config_version = 6 +config_version = 7 ;################### ; Path Vars # diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 59abdb45..7cecf381 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,14 @@ -------------------------------------------------------------------------- v.3.4 + - Fixed an issue where the plugins could be installed infinite times + if you kept refreshing the install page causing them to break + - Fixed a problem with creating new preferences using the class + functions, and also looking up setable preferences + - Fixed user creation allowing empty password, when login prohibits + login without a password + - Fixed an issue with the config file generation and upped the config + file version to force everyone to get new config files. - Tweak Pruning of Temporary Playlists so it only happens sometimes, not on every single login. This might lead to a larger db but should increase login speed @@ -21,7 +29,7 @@ - Fixed album art thumbs never saving due to incorrect table reference - Fixed download having no filename if no catalog pattern - Fixed issue where 0 sized images could be inserted into the database - artifically inflating its size + artificially inflating its size - Added Playlist and Genre Counts to the XMLAPI Handshake - Added ability to Add Search Results to playlist, or download if batch download is enabled @@ -100,7 +108,7 @@ filters only appear when its logical for them to be there - Fixed filtering of Private Playlists and fixed editing of type of playlist. Default is still public on creation. - - Fixed erronous fseek() when downsampling. + - Fixed erroneous fseek() when downsampling. - Fixed search by stars so that it returns the correct results (Thx alex2008) - Fixed issue where random didn't end correctly when no results found @@ -204,7 +212,7 @@ - Database Update, removed useless config options and tweaked a few others - Fixed last of the missing MPD functionality (Volume & Playlist Clear) - Fixed HTTPQ and improved parsing for urls from MPD & HTTPQ - they now reconize Democratic Playlists + they now recognize Democratic Playlists - Added paging to genre sub-pages - Added missing song data fields to single song view - Fixed display issue with playlists when deleting a song @@ -214,7 +222,7 @@ - Fixed lack of prefix on Albums, improves album art search results (Thx darkside) - Fixed problem with invalid urls populated to localplay methods - under certin conditions + under certain conditions - Fixed Album Art dump bin script - Added paging to the Playlist Song view - Fixed error on catalog Update All @@ -228,18 +236,18 @@ the bottom - Fixed sending URLs directly to MPD - Fixed a problem with automatic downsampling which was referencing - a now non-existant function + a now non-existent function - Massive speed improvement on display and sorting of standard browse functions - Put Ratings back into single song view - - Corrected potential consistancy issue with Play Type dropdown + - Corrected potential consistency issue with Play Type dropdown - Made Access Denied page more friendly, added verbage for demo access -------------------------------------------------------------------------- v.3.4-Alpha3 11/25/2007 - Fixed display problem and lack of link when creating a catalog - - Inital Version of Democratic play working, minor speed improvements + - Initial Version of Democratic play working, minor speed improvements to normal tmpplaylist class due to simplification and removal of democratic related code - Added ability to do batch downloads on the FS failed downloads @@ -249,7 +257,7 @@ - Tweaked catalog add function to improve speed (Thx Karl Hungus) - Added XML API borrows authentication style from Last.FM's scrobbling, allows query of Ampache DB, returns XML - see https://ampache.bountysource.com/wiki/xmlapi + see http://ampache.org/bugs/wiki/XmlApi - Added tweak for Wii so that Flash player opens in current window (Thx Dgn) - Fixed bug where Ampache would incorrectly search for album art @@ -341,7 +349,7 @@ - Added Album Disk support for id3v2 (Thx Hugo Haas) - Updated LastFM pluging, must uninstall/reinstall to make it work will add in auto-update later - - Adjusted LastFM reporting to reduce lag betwen songs. You must + - Adjusted LastFM reporting to reduce lag between songs. You must now currently be logged in for LastFM to report correctly - Fixed a potential PHP error when browsing the last page or a search with 0 results @@ -365,7 +373,7 @@ - Fixed an issue where albums of the moment would show when you had 0 albums - Fixed warnings on Update & typo in Install - - Removed redundent GPL licence file + - Removed redundant GPL licence file - Fixed filesize() issue on config re-gen - Fixed an issue with seeking causing incorrect stats counts - Fixed a potential issue with the kajax.js and checkboxes @@ -393,7 +401,7 @@ (Thx Vlet) - Added Migration script for config file. Also added in sane redirection on config parse failure - - Added initial dyanmic playlist item support, only default + - Added initial dynamic playlist item support, only default and genre work right now. - Added support for Internet Radio Stations - Updated LastFM submission formating to account for changes on @@ -401,7 +409,7 @@ - Fixed LastFM and increased timeout slightly in an attempt to improve success rate - Disabled Search, Random Play & Localplay for Alpha release - - Repalced CC Flash player with the previous GPL based flash player + - Replaced CC Flash player with the previous GPL based flash player used patched 0.2.3 version created by Sylvain of http://www.jamendo.com/fr/ - Round the downsampled content-length @@ -419,7 +427,7 @@ - Start of Complete rewrite, config file format changed, requires manual re-creation of /config/ampache.cfg.php - Updated French and German translations - - Added min song count to Browse Artist, refercing min object count + - Added min song count to Browse Artist, referencing min object count preference - Fixed ratings so that it shows your rating if you've rated it otherwise it shows an average rating @@ -759,7 +767,7 @@ - Fixed file-based parsing so that it can now be given priority over the tags in the files using tag_order in the config file - - Fixed Nowplaying, now div based layout and AJAX refreshed + - Fixed Now playing, now div based layout and AJAX refreshed based on config files refresh_limit - Moved /modules/init.php to /lib/init.php - Removed Checkboxes from Search page and added ability to @@ -810,7 +818,7 @@ types - Fixed a missing web_path reference on playlist edit page - Added Localplay API, check the wiki for more information - https://ampache.bountysource.com/wiki/Localplay + http://ampache.org/bugs/wiki/Localplay - Added Download to Random play along with Size limitation useful for downloading a set amount of music for your mp3 player. @@ -974,10 +982,8 @@ result, now shows all results and allows you to pick the correct one. - Added ability to re-define album art search (Thx csammis) - https://ampache.bountysource.com/Task.View?task_id=86 - Fixed a logic flaw where it would attempt to parse the m3u before all songs were cataloged - https://ampache.bountysource.com/Task.View?task_id=122 - Fixed a problem where updating your normal preferences when use_auth was off would clear admin prefs - Found a few more <? and replaced them with <?php diff --git a/lib/class/plugin.class.php b/lib/class/plugin.class.php index 37f707da..1ae18250 100644 --- a/lib/class/plugin.class.php +++ b/lib/class/plugin.class.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2006 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -163,11 +163,15 @@ class Plugin { * at the end it inserts a row into the update_info table to indicate * That it's installed */ - function install() { + public function install() { - $this->_plugin->install(); + $installed = $this->_plugin->install(); - $this->set_plugin_version($this->_plugin->version); + $version = $this->set_plugin_version($this->_plugin->version); + + if (!$installed OR !$version) { return false; } + + return true; } // install @@ -177,7 +181,7 @@ class Plugin { * at the end it removes the row from the update_info table to indicate * that it isn't installed */ - function uninstall() { + public function uninstall() { $this->_plugin->uninstall(); diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php index 1c299a35..265a2cf4 100644 --- a/lib/class/preference.class.php +++ b/lib/class/preference.class.php @@ -116,6 +116,21 @@ class Preference { } // update_all /** + * exists + * This just checks to see if a preference currently exists + */ + public static function exists($preference) { + + // We assume it's the name + $name = Dba::escape($preference); + $sql = "SELECT * FROM `preference` WHERE `name`='$name'"; + $db_results = Dba::query($sql); + + return Dba::num_rows($db_results); + + } // exists + + /** * has_access * This checks to see if the current user has access to modify this preference * as defined by the preference name @@ -238,8 +253,8 @@ class Preference { $type = Dba::escape($type); $catagory = Dba::escape($catagory); - $sql = "INSERT INTO `preference` (`name`,`description`,`value`,`level`,`catagory`) " . - "VALUES ('$name','$description','$default','$level','$catagory')"; + $sql = "INSERT INTO `preference` (`name`,`description`,`value`,`level`,`type`,`catagory`) " . + "VALUES ('$name','$description','$default','$level','$type','$catagory')"; $db_results = Dba::query($sql); if (!$db_results) { return false; } @@ -256,18 +271,14 @@ class Preference { // First prepare if (!is_numeric($preference)) { - $id = self::id_from_name($preference); - $name = $preference; + $name = Dba::escape($preference); + $sql = "DELETE FROM `preference` WHERE `name`='$name'"; } else { - $name = self::name_from_id($preference); - $id = $preference; + $id = Dba::escape($preference); + $sql = "DELETE FROM `preference` WHERE `id`='$id'"; } - $id = Dba::escape($id); - - // Remove the preference, then the user records of it - $sql = "DELETE FROM `preference` WHERE `id`='$id'"; $db_results = Dba::query($sql); self::rebuild_preferences(); diff --git a/lib/debug.lib.php b/lib/debug.lib.php index d0685b24..60195054 100644 --- a/lib/debug.lib.php +++ b/lib/debug.lib.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2007 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or @@ -236,15 +236,14 @@ function generate_config($current) { $value = $matches[2]; /* Put in the current value */ - if (isset($current[$key]) AND $key != 'config_version') { + if ($key == 'config_version') { + $line = $key . ' = ' . $value; + } + elseif (isset($current[$key])) { $line = $key . ' = "' . $current[$key] . '"'; unset($current[$key]); } // if set - - elseif (isset($array_value[$key])) { - $line = ''; - } - + } // if key $final .= $line . "\n"; diff --git a/lib/general.lib.php b/lib/general.lib.php index 382f5716..e98e4037 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2008 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/lib/init.php b/lib/init.php index f53b81ec..7771d95f 100644 --- a/lib/init.php +++ b/lib/init.php @@ -82,7 +82,7 @@ if (!count($results)) { /** This is the version.... fluf nothing more... **/ $results['version'] = '3.4-RC1'; -$results['int_config_version'] = '6'; +$results['int_config_version'] = '7'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; diff --git a/lib/install.php b/lib/install.php index ae873a46..e0c19ae9 100644 --- a/lib/install.php +++ b/lib/install.php @@ -1,7 +1,7 @@ <?php /* - Copyright (c) 2001 - 2008 Ampache.org + Copyright (c) Ampache.org All rights reserved. This program is free software; you can redistribute it and/or diff --git a/lib/preferences.php b/lib/preferences.php index deb21dde..786e9a38 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -33,7 +33,7 @@ function update_preferences($pref_id=0) { $sql = "SELECT `id`,`name`,`type` FROM `preference`"; /* If it isn't the System Account's preferences */ - if ($pref_id != '-1') { $sql .= " WHERE `type` != 'system'"; } + if ($pref_id != '-1') { $sql .= " WHERE `catagory` != 'system'"; } $db_results = Dba::query($sql); diff --git a/modules/plugins/Lastfm.plugin.php b/modules/plugins/Lastfm.plugin.php index 95acbf79..2cb6ab69 100644 --- a/modules/plugins/Lastfm.plugin.php +++ b/modules/plugins/Lastfm.plugin.php @@ -54,6 +54,9 @@ class AmpacheLastfm { */ public function install() { + // Check and see if it's already installed (they've just hit refresh, those dorks) + if (Preference::exists('lastfm_user')) { return false; } + Preference::insert('lastfm_user','Last.FM Username','','25','string','plugins'); Preference::insert('lastfm_pass','Last.FM Password','','25','string','plugins'); Preference::insert('lastfm_port','Last.FM Submit Port','','25','string','internal'); @@ -61,6 +64,8 @@ class AmpacheLastfm { Preference::insert('lastfm_url','Last.FM Submit URL','','25','string','internal'); Preference::insert('lastfm_challenge','Last.FM Submit Challenge','','25','string','internal'); + return true; + } // install /** |