From ead4cf2a0e9d41b5874dfcb6c753b18ed675cc0c Mon Sep 17 00:00:00 2001
From: Paul Arthur
Date: Mon, 28 Jan 2013 17:39:04 -0500
Subject: [PATCH] Rename vauth to Auth
---
config/ampache.cfg.php.dist | 7 +++----
lib/class/{vauth.class.php => auth.class.php} | 20 +++++++++----------
lib/init.php | 8 ++++----
login.php | 2 +-
logout.php | 2 +-
templates/show_test_config.inc.php | 2 +-
6 files changed, 19 insertions(+), 22 deletions(-)
rename lib/class/{vauth.class.php => auth.class.php} (97%)
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index 4e677594..d46b9514 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -78,11 +78,10 @@ session_cookielife = 0
session_cookiesecure = 0
; Auth Methods
-; This defines which auth methods vauth will attempt
-; to use and in which order, if auto_create isn't enabled
-; The user must exist locally. Local method uses PHP's PAM Auth module
+; This defines which auth methods Auth will attempt to use and in which order.
+; If auto_create isn't enabled the user must exist locally.
; DEFAULT: mysql
-; VALUES: mysql,ldap,http,local
+; VALUES: mysql,ldap,http,pam
auth_methods = "mysql"
; Automatic local password updating
diff --git a/lib/class/vauth.class.php b/lib/class/auth.class.php
similarity index 97%
rename from lib/class/vauth.class.php
rename to lib/class/auth.class.php
index 3d435d4c..8d231f0a 100644
--- a/lib/class/vauth.class.php
+++ b/lib/class/auth.class.php
@@ -21,14 +21,12 @@
*/
/**
- * vauth Class
*
* This class handles all of the session related stuff in Ampache
* it takes over for the vauth libs, and takes some stuff out of other
- * classes where it didn't belong
- *
+ * classes where it didn't belong.
*/
-class vauth {
+class Auth {
/**
* Constructor
@@ -85,11 +83,12 @@ class vauth {
} // logout
/**
- * authenticate
+ * login
+ *
* This takes a username and password and then returns the results
* based on what happens when we try to do the auth.
*/
- public static function authenticate($username, $password) {
+ public static function login($username, $password) {
// Foreach the auth methods
foreach (Config::get('auth_methods') as $method) {
@@ -97,7 +96,7 @@ class vauth {
// Build the function name and call it
$function_name = $method . '_auth';
- if (!method_exists('vauth', $function_name)) {
+ if (!method_exists('Auth', $function_name)) {
continue;
}
@@ -110,7 +109,7 @@ class vauth {
return $results;
- } // authenticate
+ }
/**
* mysql_auth
@@ -158,7 +157,7 @@ class vauth {
$results['error'] = 'MySQL login attempt failed';
return $results;
- } // mysql_auth
+ }
/**
* local_auth
@@ -325,6 +324,5 @@ class vauth {
return $results;
} // http_auth
-} // end of vauth class
-
+}
?>
diff --git a/lib/init.php b/lib/init.php
index 7a9b3dc1..9955c088 100644
--- a/lib/init.php
+++ b/lib/init.php
@@ -82,7 +82,7 @@ if (isset($results['user_ip_cardinality']) && !$results['user_ip_cardinality'])
$results['user_ip_cardinality'] = 42;
}
-/* Variables needed for vauth class */
+/* Variables needed for Auth class */
$results['cookie_path'] = $results['raw_web_path'];
$results['cookie_domain'] = $_SERVER['SERVER_NAME'];
$results['cookie_life'] = $results['session_cookielife'];
@@ -133,7 +133,7 @@ set_memory_limit($results['memory_limit']);
if (!defined('NO_SESSION') && Config::get('use_auth')) {
/* Verify their session */
if (!Session::exists('interface', $_COOKIE[Config::get('session_name')])) {
- vauth::logout($_COOKIE[Config::get('session_name')]);
+ Auth::logout($_COOKIE[Config::get('session_name')]);
exit;
}
@@ -145,7 +145,7 @@ if (!defined('NO_SESSION') && Config::get('use_auth')) {
/* If the user ID doesn't exist deny them */
if (!$GLOBALS['user']->id && !Config::get('demo_mode')) {
- vauth::logout(session_id());
+ Auth::logout(session_id());
exit;
}
@@ -181,7 +181,7 @@ elseif (!Config::get('use_auth')) {
$GLOBALS['user']->access = $auth['access'];
}
if (!$GLOBALS['user']->id AND !Config::get('demo_mode')) {
- vauth::logout(session_id()); exit;
+ Auth::logout(session_id()); exit;
}
$GLOBALS['user']->update_last_seen();
}
diff --git a/login.php b/login.php
index 2a474342..c3d281ea 100644
--- a/login.php
+++ b/login.php
@@ -77,7 +77,7 @@ if (($_POST['username'] && $_POST['password']) ||
$password = '';
}
- $auth = vauth::authenticate($username, $password);
+ $auth = Auth::login($username, $password);
if ($auth['success']) {
$username = $auth['username'];
diff --git a/logout.php b/logout.php
index 0599537c..0558eac9 100644
--- a/logout.php
+++ b/logout.php
@@ -27,5 +27,5 @@
require_once 'lib/init.php';
// To end a legitimate session, just call logout.
-vauth::logout('',false);
+Auth::logout('',false);
?>
diff --git a/templates/show_test_config.inc.php b/templates/show_test_config.inc.php
index 3664ff9d..b8714487 100644
--- a/templates/show_test_config.inc.php
+++ b/templates/show_test_config.inc.php
@@ -54,7 +54,7 @@ new config file.
values from the ampache.cfg.php.dist file will be used.
auth_methods (mysql)
-This defines which auth methods vauth will attempt to use and in which order, if auto_create isn't enabled.
+This defines which auth methods Auth will attempt to use and in which order, if auto_create isn't enabled.
The user must exist locally as well
tag_order (id3v2,id3v1,vorbiscomment,quicktime,ape,asf)