adding space between) and {

This commit is contained in:
Thomas Mueller
2012-09-07 15:21:03 +02:00
parent 918081f707
commit ccc1960de7
6 changed files with 25 additions and 25 deletions

View File

@@ -11,11 +11,11 @@ class OC_User_FTP extends OC_User_Backend{
private $secure;
private $protocol;
public function __construct($host,$secure=false){
public function __construct($host,$secure=false) {
$this->host=$host;
$this->secure=$secure;
$this->protocol='ftp';
if($this->secure){
if($this->secure) {
$this->protocol.='s';
}
$this->protocol.='://';
@@ -29,17 +29,17 @@ class OC_User_FTP extends OC_User_Backend{
*
* Check if the password is correct without logging in the user
*/
public function checkPassword($uid, $password){
public function checkPassword($uid, $password) {
$url=$this->protocol.$uid.':'.$password.'@'.$this->host.'/';
$result=@opendir($url);
if(is_resource($result)){
if(is_resource($result)) {
return $uid;
}else{
return false;
}
}
public function userExists($uid){
public function userExists($uid) {
return true;
}
}

View File

@@ -9,7 +9,7 @@
class OC_User_IMAP extends OC_User_Backend{
private $mailbox;
public function __construct($mailbox){
public function __construct($mailbox) {
$this->mailbox=$mailbox;
}
@@ -21,11 +21,11 @@ class OC_User_IMAP extends OC_User_Backend{
*
* Check if the password is correct without logging in the user
*/
public function checkPassword($uid, $password){
public function checkPassword($uid, $password) {
$mbox = @imap_open($this->mailbox, $uid, $password);
imap_errors();
imap_alerts();
if($mbox){
if($mbox) {
imap_close($mbox);
return $uid;
}else{
@@ -33,7 +33,7 @@ class OC_User_IMAP extends OC_User_Backend{
}
}
public function userExists($uid){
public function userExists($uid) {
return true;
}
}

View File

@@ -12,7 +12,7 @@ class OC_User_SMB extends OC_User_Backend{
const smbclient='smbclient';
const loginError='NT_STATUS_LOGON_FAILURE';
public function __construct($host){
public function __construct($host) {
$this->host=$host;
}
@@ -24,20 +24,20 @@ class OC_User_SMB extends OC_User_Backend{
*
* Check if the password is correct without logging in the user
*/
public function checkPassword($uid, $password){
public function checkPassword($uid, $password) {
$uidEscaped=escapeshellarg($uid);
$password=escapeshellarg($password);
$result=array();
$command=self::smbclient.' //'.$this->host.'/dummy -U'.$uidEscaped.'%'.$password;
$result=exec($command,$result);
if(substr($result,-strlen(self::loginError))==self::loginError){
if(substr($result,-strlen(self::loginError))==self::loginError) {
return false;
}else{
return $uid;
}
}
public function userExists($uid){
public function userExists($uid) {
return true;
}
}

View File

@@ -12,21 +12,21 @@ class Test_User_FTP extends UnitTestCase{
*/
private $instance;
private function getConfig(){
private function getConfig() {
return include(__DIR__.'/config.php');
}
function skip(){
function skip() {
$config=$this->getConfig();
$this->skipUnless($config['ftp']['run']);
}
function setUp(){
function setUp() {
$config=$this->getConfig();
$this->instance=new OC_User_FTP($config['ftp']['host']);
}
function testLogin(){
function testLogin() {
$config=$this->getConfig();
$this->assertEqual($config['ftp']['user'],$this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password']));
$this->assertFalse($this->instance->checkPassword($config['ftp']['user'],$config['ftp']['password'].'foo'));

View File

@@ -12,21 +12,21 @@ class Test_User_Imap extends UnitTestCase{
*/
private $instance;
private function getConfig(){
private function getConfig() {
return include(__DIR__.'/config.php');
}
function skip(){
function skip() {
$config=$this->getConfig();
$this->skipUnless($config['imap']['run']);
}
function setUp(){
function setUp() {
$config=$this->getConfig();
$this->instance=new OC_User_IMAP($config['imap']['mailbox']);
}
function testLogin(){
function testLogin() {
$config=$this->getConfig();
$this->assertEqual($config['imap']['user'],$this->instance->checkPassword($config['imap']['user'],$config['imap']['password']));
$this->assertFalse($this->instance->checkPassword($config['imap']['user'],$config['imap']['password'].'foo'));

View File

@@ -12,21 +12,21 @@ class Test_User_SMB extends UnitTestCase{
*/
private $instance;
private function getConfig(){
private function getConfig() {
return include(__DIR__.'/config.php');
}
function skip(){
function skip() {
$config=$this->getConfig();
$this->skipUnless($config['smb']['run']);
}
function setUp(){
function setUp() {
$config=$this->getConfig();
$this->instance=new OC_User_SMB($config['smb']['host']);
}
function testLogin(){
function testLogin() {
$config=$this->getConfig();
$this->assertEqual($config['smb']['user'],$this->instance->checkPassword($config['smb']['user'],$config['smb']['password']));
$this->assertFalse($this->instance->checkPassword($config['smb']['user'],$config['smb']['password'].'foo'));