diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/class/localplay.class.php | 5 | ||||
-rw-r--r-- | lib/class/scrobbler.class.php | 8 | ||||
-rw-r--r-- | lib/class/update.class.php | 49 | ||||
-rw-r--r-- | lib/preferences.php | 13 |
4 files changed, 56 insertions, 19 deletions
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php index 3f8dbb8a..e048dd17 100644 --- a/lib/class/localplay.class.php +++ b/lib/class/localplay.class.php @@ -224,6 +224,9 @@ class Localplay { // Load the controller and then check for its preferences $localplay = new Localplay($controller); + // If we can't even load it no sense in going on + if (!isset($localplay->_player)) { return false; } + $preferences = $localplay->get_preferences(); foreach ($preferences as $preference) { @@ -575,7 +578,7 @@ class Localplay { */ public function get_preferences() { - $preferences = $this->_player->preferences(); + $preferences = $this->_player->get_preferences(); return $preferences; diff --git a/lib/class/scrobbler.class.php b/lib/class/scrobbler.class.php index 78c5f36e..dd9775c3 100644 --- a/lib/class/scrobbler.class.php +++ b/lib/class/scrobbler.class.php @@ -181,10 +181,16 @@ class scrobbler { $i++; } - $as_socket = @fsockopen($this->submit_host, $this->submit_port, $errno, $errstr, 5); + if (!trim($this->submit_host) || !$this->submit_port) { + $this->reset_handshake = true; + return false; + } + + $as_socket = @fsockopen($this->submit_host, intval($this->submit_port), $errno, $errstr, 5); if(!$as_socket) { $this->error_msg = $errstr; + $this->reset_handshake = true; return false; } diff --git a/lib/class/update.class.php b/lib/class/update.class.php index 30a8440b..e7b3a03c 100644 --- a/lib/class/update.class.php +++ b/lib/class/update.class.php @@ -21,7 +21,7 @@ /** * Update Class * this class handles updating from one version of - * maintain to the next. Versions are a 6 digit number + * ampache to the next. Versions are a 6 digit number * 220000 * ^ * Major Revision @@ -82,8 +82,8 @@ class Update { // If no table if (!Dba::num_rows($db_results)) { - - $version = '310000'; + // They can't upgrade, they are too old + header("Location: test.php"); } // if table isn't found @@ -115,7 +115,7 @@ class Update { /** * need_update * checks to see if we need to update - * maintain at all + * ampache at all */ public static function need_update() { @@ -232,6 +232,12 @@ class Update { $version[] = array('version' => '340009','description' => $update_string); + $update_string = '- Removed Playlist Add preference.<br />' . + '- Moved Localplay* preferences to options.<br />' . + '- Tweaked Default Playlist Method.<br />' . + '- Change wording on Localplay preferences.<br />'; + $version[] = array('version' => '340010','description'=>$update_string); + return $version; } // populate_version @@ -938,5 +944,40 @@ class Update { } // update_340009 + /** + * update_340010 + * Bunch of minor tweaks to the preference table + */ + public static function update_340010() { + + $sql = "UPDATE `preference` SET `catagory`='options' WHERE `name` LIKE 'localplay_%'"; + $db_results = Dba::query($sql); + + $sql = "DELETE FROM `preference` WHERE `name`='playlist_add'"; + $db_results = Dba::query($sql); + + $sql = "UPDATE `preference` SET `catagory`='plugins' WHERE (`name` LIKE 'mystrands_%' OR `name` LIKE 'lastfm_%') AND `catagory`='options'"; + $db_results = Dba::query($sql); + + $sql = "UPDATE `preference` SET `value`='default' WHERE `name`='playlist_method'"; + $db_results = Dba::query($sql); + + $sql = "UPDATE `preference` SET `description`='Localplay Config' WHERE `name`='localplay_level'"; + $db_results = Dba::query($sql); + + /* Fix every users preferences */ + $sql = "SELECT `id` FROM `user`"; + $db_results = Dba::query($sql); + + User::fix_preferences('-1'); + + while ($r = Dba::fetch_assoc($db_results)) { + User::fix_preferences($r['id']); + } // while results + + self::set_version('db_version','340010'); + + } // update_340010 + } // end update class ?> diff --git a/lib/preferences.php b/lib/preferences.php index b7efc09d..b017803f 100644 --- a/lib/preferences.php +++ b/lib/preferences.php @@ -322,23 +322,10 @@ function create_preference_input($name,$value) { } // foreach themes echo "</select>\n"; break; - case 'random_method': - echo "<select name=\"$name\">\n"; - echo "\t<option value=\"default\">" . _('Pure Random') . "</option>"; - echo "\t<option value=\"album\">" . _('Related Album') . "</option>"; - echo "\t<option value=\"genre\">" . _('Related Genre') . "</option>"; - echo "</select>\n"; - break; case 'mystrands_pass': case 'lastfm_pass': echo "<input type=\"password\" size=\"16\" name=\"$name\" value=\"******\" />"; break; - case 'playlist_add': - echo "<select name=\"$name\">\n"; - echo "\t<option value=\"append\">" . _('Append to Existing') . "</option>\n"; - echo "\t<option value=\"default\">" . _('Default') . "</option>\n"; - echo "</select>\n"; - break; case 'playlist_method': ${$value} = ' selected="selected"'; echo "<select name=\"$name\">\n"; |