From: Aldo "xoen" Giambelluca Date: Mon, 19 Jul 2010 16:52:49 +0000 (+0200) Subject: Reverted to self::$classType syntax and fixed the use of self in non-object X-Git-Tag: v3.0~332^2~4 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9c124a8dbf7c63c8353d3ef6148a618620a3ee3c;p=nextcloud-server.git Reverted to self::$classType syntax and fixed the use of self in non-object --- diff --git a/inc/User/database.php b/inc/User/database.php index e083c30a7dc..d0bcf56fa96 100755 --- a/inc/User/database.php +++ b/inc/User/database.php @@ -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 * diff --git a/inc/User/ldap.php b/inc/User/ldap.php index da0e2d04573..37ca441fc07 100755 --- a/inc/User/ldap.php +++ b/inc/User/ldap.php @@ -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 { } - -?> \ No newline at end of file diff --git a/inc/User/mod_auth.php b/inc/User/mod_auth.php index 11cb4bafd4a..059bb7b5aaa 100755 --- a/inc/User/mod_auth.php +++ b/inc/User/mod_auth.php @@ -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'); diff --git a/inc/lib_user.php b/inc/lib_user.php index d3c2b9f9109..09ab1a3ddb5 100755 --- a/inc/lib_user.php +++ b/inc/lib_user.php @@ -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(); } }