@@ -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 )) { |
@@ -157,12 +157,13 @@ |
||
| 157 | 157 | * @return boolean string |
| 158 | 158 | */ |
| 159 | 159 | private function isUsernameValid($username) { |
| 160 | - if (strlen($username) <= 2) |
|
| 161 | - return "Benutzername ist zu kurz."; |
|
| 162 | - else if (preg_match('~[a-zäöo][a-zäöu_0-9-]+~i', $username) !== 1) |
|
| 163 | - return "Benutzername enthält ungültige Zeichen"; |
|
| 164 | - else if (strpos($username, ' ') !== false) |
|
| 165 | - return "Leerzeichen sind im Benutzernamen nicht erlaubt"; |
|
| 160 | + if (strlen($username) <= 2) { |
|
| 161 | + return "Benutzername ist zu kurz."; |
|
| 162 | + } else if (preg_match('~[a-zäöo][a-zäöu_0-9-]+~i', $username) !== 1) { |
|
| 163 | + return "Benutzername enthält ungültige Zeichen"; |
|
| 164 | + } else if (strpos($username, ' ') !== false) { |
|
| 165 | + return "Leerzeichen sind im Benutzernamen nicht erlaubt"; |
|
| 166 | + } |
|
| 166 | 167 | |
| 167 | 168 | return true; |
| 168 | 169 | } |
@@ -154,7 +154,7 @@ |
||
| 154 | 154 | * Returns true if valid, of not it returns a string with information about the reason |
| 155 | 155 | * |
| 156 | 156 | * @param string $username |
| 157 | - * @return boolean string |
|
| 157 | + * @return string|boolean string |
|
| 158 | 158 | */ |
| 159 | 159 | private function isUsernameValid($username) { |
| 160 | 160 | if (strlen($username) <= 2) |
@@ -115,8 +115,9 @@ |
||
| 115 | 115 | public function userExists($username) { |
| 116 | 116 | $userList = $this->getUserList(); |
| 117 | 117 | |
| 118 | - if (isset ($userList [$username])) |
|
| 119 | - return true; |
|
| 118 | + if (isset ($userList [$username])) { |
|
| 119 | + return true; |
|
| 120 | + } |
|
| 120 | 121 | |
| 121 | 122 | return false; |
| 122 | 123 | } |
@@ -104,6 +104,9 @@ |
||
| 104 | 104 | return $usernameDeleted; |
| 105 | 105 | } |
| 106 | 106 | |
| 107 | + /** |
|
| 108 | + * @param string $newContent |
|
| 109 | + */ |
|
| 107 | 110 | private function replaceHtPasswdContent($newContent) { |
| 108 | 111 | $fp = fopen($this->filename, 'w'); |
| 109 | 112 | fwrite($fp, $newContent); |