- $file = "webdav/".$directory."/webdav-user";
- if ($myconfig->{$directory}) {
- open (HTACCESS, "$file") or die "cannot open webdav-user $!\n";
- while (<HTACCESS>) {
- ($login,$password) = split(/:/, $_);
- if ($login ne $form->{login}) {
- $newfile .= $_;
- }
- }
- close (HTACCESS);
- open (HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
- $newfile .= $myconfig->{login}.":".$myconfig->{password}."\n";
- print (HTACCESS $newfile);
- close (HTACCESS);
- }
- else {
- $form->{$directory} = 0;
- open (HTACCESS, "$file") or die "cannot open webdav-user $!\n";
- while (<HTACCESS>) {
- ($login,$password) = split(/:/, $_);
- if ($login ne $form->{login}) {
- $newfile .= $_;
- }
- }
- close (HTACCESS);
- open (HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
- print (HTACCESS $newfile);
- close (HTACCESS);
- }
+ $file = "webdav/" . $directory . "/webdav-user";
+ if ($myconfig->{$directory}) {
+ open(HTACCESS, "$file") or die "cannot open webdav-user $!\n";
+ while (<HTACCESS>) {
+ ($login, $password) = split(/:/, $_);
+ if ($login ne $form->{login}) {
+ $newfile .= $_;
+ }
+ }
+ close(HTACCESS);
+ open(HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
+ $newfile .= $myconfig->{login} . ":" . $myconfig->{password} . "\n";
+ print(HTACCESS $newfile);
+ close(HTACCESS);
+ } else {
+ $form->{$directory} = 0;
+ open(HTACCESS, "$file") or die "cannot open webdav-user $!\n";
+ while (<HTACCESS>) {
+ ($login, $password) = split(/:/, $_);
+ if ($login ne $form->{login}) {
+ $newfile .= $_;
+ }
+ }
+ close(HTACCESS);
+ open(HTACCESS, "> $file") or die "cannot open webdav-user $!\n";
+ print(HTACCESS $newfile);
+ close(HTACCESS);