diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-11-04 08:15:40 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2006-11-04 08:15:40 +0000 |
commit | b315ff2d260209c2d99ee056ed974585caf9f6cf (patch) | |
tree | 4c3e13f84b5b6cce764fb587c7a245c02b50a3b3 | |
parent | 2169a44d52a35ed05ca098235247dde078bd223d (diff) | |
download | ampache-b315ff2d260209c2d99ee056ed974585caf9f6cf.tar.gz ampache-b315ff2d260209c2d99ee056ed974585caf9f6cf.tar.bz2 ampache-b315ff2d260209c2d99ee056ed974585caf9f6cf.zip |
some minror tweaks
-rwxr-xr-x | docs/CHANGELOG | 7 | ||||
-rw-r--r-- | install.php | 7 | ||||
-rw-r--r-- | lib/class/stream.class.php | 5 | ||||
-rw-r--r-- | lib/init.php | 28 | ||||
-rw-r--r-- | lib/install.php | 11 | ||||
-rw-r--r-- | modules/vauth/session.lib.php | 1 |
6 files changed, 39 insertions, 20 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index d350b09a..42faef18 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,13 @@ -------------------------------------------------------------------------- v.3.3.3-Alpha2 + - Added more error checking to install, won't let you continue + without a valid MySQL connection, rather then relying + on the db_select() to fail + - Fixed a session race condition if you turn use_auth off and on + and a user log in while use_auth if off + - Fixed a potential foreach error if no songs passed to stream + now logs error and gently returns the user - Added ability for Admins to define the required permission level for individual preferences - Added WavPack support diff --git a/install.php b/install.php index b1d0b303..db59dd59 100644 --- a/install.php +++ b/install.php @@ -5,9 +5,8 @@ All rights reserved. This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + 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 @@ -39,8 +38,6 @@ require_once('modules/vauth/init.php'); if ($_SERVER['HTTPS'] == 'on') { $http_type = "https://"; } else { $http_type = "http://"; } - - $prefix = dirname(__FILE__); $configfile = "$prefix/config/ampache.cfg.php"; diff --git a/lib/class/stream.class.php b/lib/class/stream.class.php index 7d0566bb..d9777879 100644 --- a/lib/class/stream.class.php +++ b/lib/class/stream.class.php @@ -60,6 +60,11 @@ class Stream { */ function start() { + if (!is_array($this->songs)) { + debug_event('stream','Error: No Songs Passed on ' . $this->type . ' stream','2'); + return false; + } + $methods = get_class_methods('Stream'); $create_function = "create_" . $this->type; if (in_array($create_function,$methods)) { diff --git a/lib/init.php b/lib/init.php index 5458ce43..154ad5f7 100644 --- a/lib/init.php +++ b/lib/init.php @@ -5,9 +5,8 @@ All rights reserved. This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. + 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 @@ -20,12 +19,9 @@ */ -/*! - @header INIT file - Take care of our init grunt work so we don't scatter paths - all over the place. - -*/ +/*** + * DO NOT EDIT THIS FILE + ***/ // Set the Error level manualy... I'm to lazy to fix notices error_reporting(E_ALL ^ E_NOTICE); @@ -37,8 +33,6 @@ $prefix = realpath($ampache_path . "/../"); $configfile = "$prefix/config/ampache.cfg.php"; require_once($prefix . "/lib/general.lib.php"); -/*********************STOP EDITING*********************************/ - /* Check to see if this is Http or https */ @@ -73,7 +67,7 @@ if (!$results = read_config($configfile,0)) { } /** This is the version.... fluf nothing more... **/ -$results['version'] = '3.3.3-Alpha2 Build (002)'; +$results['version'] = '3.3.3-Alpha2 Build (003)'; $results['raw_web_path'] = $results['web_path']; $results['web_path'] = $http_type . $_SERVER['HTTP_HOST'] . $results['web_path']; @@ -257,8 +251,16 @@ if (in_array("http",$results['auth_methods'])) { // If we don't want a session if (!isset($no_session) AND conf('use_auth')) { - if (!vauth_check_session()) { logout(); exit(); } + /* Verify Their session */ + if (!vauth_check_session()) { logout(); exit; } + + /* Create the new user */ $user = new User($_SESSION['userdata']['username']); + + /* If they user ID doesn't exist deny them */ + if (!$user->uid) { logout(); exit; } + + /* Load preferences and theme */ init_preferences(); set_theme(); $user->set_preferences(); diff --git a/lib/install.php b/lib/install.php index a45d1c98..70b38780 100644 --- a/lib/install.php +++ b/lib/install.php @@ -83,9 +83,10 @@ function install_check_status($configfile) { */ $results = read_config($GLOBALS['configfile'], 0, 0); $dbh = check_database($results['local_host'],$results['local_username'],$results['local_pass']); - + if (is_resource($dbh)) { - mysql_select_db($results['local_db'],$dbh); + $db_select = mysql_select_db($results['local_db'],$dbh); + $sql = "SELECT * FROM user"; $db_results = @mysql_query($sql, $dbh); if (!@mysql_num_rows($db_results)) { @@ -93,6 +94,7 @@ function install_check_status($configfile) { } } + /* Defaut to no */ return false; @@ -110,6 +112,11 @@ function install_insert_db($username,$password,$hostname,$database) { /* Attempt to make DB connection */ $dbh = @mysql_pconnect($hostname,$username,$password); + if (!is_resource($dbh)) { + $GLOBALS['error']->add_error('general',"Error: Unable to make Database Connection " . mysql_error()); + return false; + } + /* Check/Create Database as needed */ $db_selected = @mysql_select_db($database, $dbh); if (!$db_selected) { diff --git a/modules/vauth/session.lib.php b/modules/vauth/session.lib.php index 6a7727c2..c9225ebf 100644 --- a/modules/vauth/session.lib.php +++ b/modules/vauth/session.lib.php @@ -159,6 +159,7 @@ function vauth_get_session($key) { if (!count($results)) { vauth_error("Query: $sql failed to return results " . mysql_error()); + return false; } return $results; |