Reverted to self::$classType syntax and fixed the use of self in non-object

This commit is contained in:
Aldo "xoen" Giambelluca 2010-07-19 18:52:49 +02:00
parent 42d603c5b3
commit 9c124a8dbf
4 changed files with 57 additions and 59 deletions

View File

@ -28,7 +28,7 @@
*
*/
class OC_USER_Database extends OC_USER {
/**
* Check if the login button is pressed and logg the user in
*
@ -54,8 +54,7 @@ class OC_USER_Database extends OC_USER {
return('');
}
/**
* Try to create a new user
*
@ -76,7 +75,7 @@ class OC_USER_Database extends OC_USER {
return ($result) ? true : false;
}
}
/**
* Try to login a user
*
@ -100,7 +99,7 @@ class OC_USER_Database extends OC_USER {
return false;
}
}
/**
* Check if the logout button is pressed and logout the user
*
@ -113,7 +112,7 @@ class OC_USER_Database extends OC_USER {
$_SESSION['username_clean'] = '';
}
}
/**
* Check if a user is logged in
*
@ -125,7 +124,7 @@ class OC_USER_Database extends OC_USER {
return false;
}
}
/**
* Try to create a new group
*
@ -143,7 +142,7 @@ class OC_USER_Database extends OC_USER {
return false;
}
}
/**
* Get the ID of a user
*
@ -169,7 +168,7 @@ class OC_USER_Database extends OC_USER {
return 0;
}
}
/**
* Get the ID of a group
*
@ -195,7 +194,7 @@ class OC_USER_Database extends OC_USER {
return 0;
}
}
/**
* Get the name of a group
*
@ -216,7 +215,7 @@ class OC_USER_Database extends OC_USER {
return 0;
}
}
/**
* Check if a user belongs to a group
*
@ -238,7 +237,7 @@ class OC_USER_Database extends OC_USER {
return false;
}
}
/**
* Add a user to a group
*
@ -264,11 +263,11 @@ class OC_USER_Database extends OC_USER {
return true;
}
}
public static function generatePassword() {
return uniqId();
}
/**
* Get all groups the user belongs to
*
@ -289,7 +288,7 @@ class OC_USER_Database extends OC_USER {
return $groups;
}
/**
* Set the password of a user
*
@ -304,7 +303,7 @@ class OC_USER_Database extends OC_USER {
return $result ? true : false;
}
/**
* Check the password of a user
*

View File

@ -23,11 +23,10 @@
require_once 'mod_auth.php';
/**
* Class for usermanagement in a SQL Database
* eg mysql, sqlite
* Class for usermanagement in a SQL Database (e.g. MySql, SQLite)
*/
class OC_USER_LDAP extends OC_USER_MOD_AUTH {
}
?>

View File

@ -67,7 +67,7 @@ class OC_USER_MOD_AUTH extends OC_USER {
*
*/
public static function logoutLisener() {
if( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
if ( isset($_GET['logoutbutton']) AND isset($_SESSION['username']) ) {
header('WWW-Authenticate: Basic realm="ownCloud"');
header('HTTP/1.0 401 Unauthorized');
die('401 Unauthorized');

View File

@ -29,11 +29,11 @@ if ( !$CONFIG_INSTALLED ) {
$_SESSION['username_clean'] = '';
}
//cache the userid's an groupid's
// Cache the userid's an groupid's
if ( !isset($_SESSION['user_id_cache']) ) {
$_SESSION['user_id_cache'] = array();
}
if( !isset($_SESSION['group_id_cache']) ) {
if ( !isset($_SESSION['group_id_cache']) ) {
$_SESSION['group_id_cache'] = array();
}
@ -44,125 +44,125 @@ if( !isset($_SESSION['group_id_cache']) ) {
*
*/
class OC_USER {
public static $classType;
/**
* Check if the login button is pressed and logg the user in
*
*/
public static function loginLisener() {
return self::classType->loginLisener();
return self::$classType->loginLisener();
}
/**
* Try to create a new user
*
*/
public static function createUser($username, $password) {
return self::classType->createUser($username, $password);
return self::$classType->createUser($username, $password);
}
/**
* Try to login a user
*
*/
public static function login($username, $password) {
return self::classType->login($username, $password);
return self::$classType->login($username, $password);
}
/**
* Check if the logout button is pressed and logout the user
*
*/
public static function logoutLisener() {
return self::classType->logoutLisener();
return self::$classType->logoutLisener();
}
/**
* Check if a user is logged in
*
*/
public static function isLoggedIn() {
return self::classType->isLoggedIn();
return self::$classType->isLoggedIn();
}
/**
* Try to create a new group
*
*/
public static function createGroup($groupName) {
return self::classType->createGroup($groupName);
return self::$classType->createGroup($groupName);
}
/**
* Get the ID of a user
*
*/
public static function getUserId($username, $noCache=false) {
return self::classType->getUserId($username, $noCache);
return self::$classType->getUserId($username, $noCache);
}
/**
* Get the ID of a group
*
*/
public static function getGroupId($groupName, $noCache=false) {
return self::classType->getGroupId($groupName, $noCache);
return self::$classType->getGroupId($groupName, $noCache);
}
/**
* Get the name of a group
*
*/
public static function getGroupName($groupId, $noCache=false) {
return self::classType->getGroupName($groupId, $noCache);
return self::$classType->getGroupName($groupId, $noCache);
}
/**
* Check if a user belongs to a group
*
*/
public static function inGroup($username, $groupName) {
return self::classType->inGroup($username, $groupName);
return self::$classType->inGroup($username, $groupName);
}
/**
* Add a user to a group
*
*/
public static function addToGroup($username, $groupName) {
return self::classType->addToGroup($username, $groupName);
return self::$classType->addToGroup($username, $groupName);
}
public static function generatePassword() {
return uniqId();
}
/**
* Get all groups the user belongs to
*
*/
public static function getUserGroups($username) {
return self::classType->getUserGroups($username);
return self::$classType->getUserGroups($username);
}
/**
* Set the password of a user
*
*/
public static function setPassword($username, $password) {
return self::classType->setPassword($username, $password);
return self::$classType->setPassword($username, $password);
}
/**
* Check the password of a user
*
*/
public static function checkPassword($username, $password) {
return self::classType->checkPassword($username, $password);
return self::$classType->checkPassword($username, $password);
}
}
@ -174,24 +174,24 @@ function set_OC_USER() {
global $CONFIG_BACKEND;
if ( isset($CONFIG_BACKEND) ) {
switch( $CONFIG_BACKEND ) {
switch ( $CONFIG_BACKEND ) {
case 'mysql':
case 'sqlite':
require_once 'User/database.php';
self::classType = new OC_USER_Database();
OC_USER::$classType = new OC_USER_Database();
break;
case 'ldap':
require_once 'User/ldap.php';
self::classType = new OC_USER_LDAP();
OC_USER::$classType = new OC_USER_LDAP();
break;
default:
require_once 'User/database.php';
self::classType = new OC_USER_Database();
OC_USER::$classType = new OC_USER_Database();
break;
}
} else {
require_once 'User/database.php';
self::classType = new OC_USER_Database();
OC_USER::$classType = new OC_USER_Database();
}
}