@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * Returns true if valid, of not it returns a String with information about the reason |
| 153 | 153 | * |
| 154 | 154 | * @param string $username |
| 155 | - * @return boolean string |
|
| 155 | + * @return string|boolean string |
|
| 156 | 156 | */ |
| 157 | 157 | private function isUsernameValid($username) { |
| 158 | 158 | if (strlen ( $username ) <= 2) |
@@ -167,7 +167,6 @@ discard block |
||
| 167 | 167 | /** |
| 168 | 168 | * Returns true if valid, of not it returns a String with information about the reason |
| 169 | 169 | * |
| 170 | - * @param string $username |
|
| 171 | 170 | * @return boolean string |
| 172 | 171 | */ |
| 173 | 172 | private function isPasswordValid($password) { |
@@ -155,12 +155,13 @@ |
||
| 155 | 155 | * @return boolean string |
| 156 | 156 | */ |
| 157 | 157 | private function isUsernameValid($username) { |
| 158 | - if (strlen ( $username ) <= 2) |
|
| 159 | - return "Benutzername ist zu kurz."; |
|
| 160 | - else if (preg_match ( '~[a-zäöo][a-zäöu_0-9-]+~i', $username ) !== 1) |
|
| 161 | - return "Benutzername enthält ungültige Zeichen"; |
|
| 162 | - else if (strpos ( $username, ' ' ) !== false) |
|
| 163 | - return "Leerzeichen sind im Benutzernamen nicht erlaubt"; |
|
| 158 | + if (strlen ( $username ) <= 2) { |
|
| 159 | + return "Benutzername ist zu kurz."; |
|
| 160 | + } else if (preg_match ( '~[a-zäöo][a-zäöu_0-9-]+~i', $username ) !== 1) { |
|
| 161 | + return "Benutzername enthält ungültige Zeichen"; |
|
| 162 | + } else if (strpos ( $username, ' ' ) !== false) { |
|
| 163 | + return "Leerzeichen sind im Benutzernamen nicht erlaubt"; |
|
| 164 | + } |
|
| 164 | 165 | return true; |
| 165 | 166 | } |
| 166 | 167 | |
@@ -108,6 +108,9 @@ |
||
| 108 | 108 | return $usernameDeleted; |
| 109 | 109 | } |
| 110 | 110 | |
| 111 | + /** |
|
| 112 | + * @param string $newContent |
|
| 113 | + */ |
|
| 111 | 114 | private function replaceHtPasswdContent($newContent) { |
| 112 | 115 | // file_put_contents ( $this->filename, $newContent ); |
| 113 | 116 | $fp = fopen ( $this->filename, 'w' ); |
@@ -120,8 +120,9 @@ |
||
| 120 | 120 | public function userExists($username) { |
| 121 | 121 | $userList = $this->getUserList (); |
| 122 | 122 | |
| 123 | - if (isset ( $userList [$username] )) |
|
| 124 | - return true; |
|
| 123 | + if (isset ( $userList [$username] )) { |
|
| 124 | + return true; |
|
| 125 | + } |
|
| 125 | 126 | |
| 126 | 127 | return false; |
| 127 | 128 | } |
@@ -140,6 +140,9 @@ |
||
| 140 | 140 | $this->assertFalse($service->userExists('not Existant'), "User 'not Existant' should not exist"); |
| 141 | 141 | } |
| 142 | 142 | |
| 143 | + /** |
|
| 144 | + * @param string $filename |
|
| 145 | + */ |
|
| 143 | 146 | protected function getNumberOfLines($filename) { |
| 144 | 147 | $cont = file_get_contents($filename); |
| 145 | 148 | $lines = explode("\n", $cont); |
@@ -36,8 +36,9 @@ discard block |
||
| 36 | 36 | $username |
| 37 | 37 | ) ); |
| 38 | 38 | |
| 39 | - if ($eResult->stopped ()) |
|
| 40 | - return $eResult->last (); |
|
| 39 | + if ($eResult->stopped ()) { |
|
| 40 | + return $eResult->last (); |
|
| 41 | + } |
|
| 41 | 42 | |
| 42 | 43 | return ! in_array ( $username, $this->not_deletable_users ); |
| 43 | 44 | } |
@@ -47,8 +48,9 @@ discard block |
||
| 47 | 48 | 'user' => $username |
| 48 | 49 | ) ); |
| 49 | 50 | |
| 50 | - if ($eResult->stopped ()) |
|
| 51 | - return $eResult->last (); |
|
| 51 | + if ($eResult->stopped ()) { |
|
| 52 | + return $eResult->last (); |
|
| 53 | + } |
|
| 52 | 54 | |
| 53 | 55 | /* If parameter is an array => allow only users in list. IF parameter is boolean, return boolean value */ |
| 54 | 56 | if (is_array ( $this->user_with_management_permission )) { |