Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 8cd05ad6

Von Moritz Bunkus vor fast 14 Jahren hinzugefügt

  • ID 8cd05ad64866ce200f888a35723ae4b7e24a2012
  • Vorgänger bd74780c
  • Nachfolger 61352a49

Globale Variablen $::userspath, $::templates, $::membersfile nach %::lx_office_conf verschoben

Unterschiede anzeigen:

bin/mozilla/admin.pl
144 144
    ::end_of_request();
145 145
  }
146 146

  
147
  if (-f $main::memberfile) {
147
  my $memberfile = $::lx_office_conf{paths}->{memberfile};
148
  if (-f $memberfile) {
148 149
    my $memberdir = "";
149 150

  
150
    if ($main::memberfile =~ m|^.*/|) {
151
    if ($memberfile =~ m|^.*/|) {
151 152
      $memberdir = $&;
152 153
    }
153 154

  
......
155 156

  
156 157
    $form->{title} = $locale->text('User data migration');
157 158
    $form->header();
158
    print $form->parse_html_template('admin/user_migration', { 'memberfile' => $main::memberfile,
159
    print $form->parse_html_template('admin/user_migration', { 'memberfile' => $memberfile,
159 160
                                                               'backupdir'  => $backupdir });
160 161

  
161 162
    ::end_of_request();
......
179 180
  $main::auth->set_session_value('rpw', $form->{rpw});
180 181
  $main::auth->create_or_refresh_session();
181 182

  
182
  if (!-f $main::memberfile) {
183
  my $memberfile = $::lx_office_conf{paths}->{memberfile};
184
  if (!-f $memberfile) {
183 185
    # New installation -- create a standard group with full access
184 186
    my %members;
185 187
    my $group = {
......
203 205

  
204 206
  my $memberdir = "";
205 207

  
206
  if ($main::memberfile =~ m|^.*/|) {
208
  my $memberfile = $::lx_office_conf{paths}->{memberfile};
209
  if ($memberfile =~ m|^.*/|) {
207 210
    $memberdir = $&;
208 211
  }
209 212

  
......
213 216
    $form->error(sprintf($locale->text('The directory "%s" could not be created:\n%s'), $backupdir, $!));
214 217
  }
215 218

  
216
  copy $main::memberfile, "users/member-file-migration/members";
219
  copy $memberfile, "users/member-file-migration/members";
217 220

  
218
  my $in = IO::File->new($main::memberfile, "r");
221
  my $in = IO::File->new($memberfile, "r");
219 222

  
220 223
  $form->error($locale->text('Could not open the old memberfile.')) if (!$in);
221 224

  
......
266 269
    }
267 270
  }
268 271

  
269
  unlink $main::memberfile;
272
  unlink $memberfile;
270 273

  
271 274
  my @member_list = sort { lc $a->{login} cmp lc $b->{login} } values %members;
272 275

  
......
341 344
  map { $_->{templates} =~ s|.*/||; } values %members;
342 345

  
343 346
  $form->{title}   = "Lx-Office ERP " . $locale->text('Administration');
344
  $form->{LOCKED}  = -e "$main::userspath/nologin";
347
  $form->{LOCKED}  = -e _nologin_file_name();
345 348
  $form->{MEMBERS} = [ @members{sort { lc $a cmp lc $b } keys %members} ];
346 349

  
347 350
  $form->header();
......
411 414
  }
412 415

  
413 416
  # is there a templates basedir
414
  if (!-d "$main::templates") {
415
    $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates));
417
  if (!-d $::lx_office_conf{paths}->{templates}) {
418
    $form->error(sprintf($locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
416 419
  }
417 420

  
418
  opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO");
421
  opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO");
419 422
  my @all     = readdir(TEMPLATEDIR);
420
  my @alldir  = sort grep { -d "$main::templates/$_" && !/^\.\.?$/ } @all;
421
  my @allhtml = sort grep { -f "$main::templates/$_" && /\.html$/ } @all;
423
  my @alldir  = sort grep { -d ($::lx_office_conf{paths}->{templates} . "/$_") && !/^\.\.?$/ } @all;
424
  my @allhtml = sort grep { -f ($::lx_office_conf{paths}->{templates} . "/$_") &&  /\.html$/ } @all;
422 425
  closedir TEMPLATEDIR;
423 426

  
424 427
  @alldir = grep !/\.(html|tex|sty|odt|xml|txb)$/, @alldir;
......
497 500
  }
498 501

  
499 502
  # is there a basedir
500
  if (!-d "$main::templates") {
501
    $form->error(sprintf($locale->text("The directory %s does not exist."), $main::templates));
503
  if (!-d $::lx_office_conf{paths}->{templates}) {
504
    $form->error(sprintf($locale->text("The directory %s does not exist."), $::lx_office_conf{paths}->{templates}));
502 505
  }
503 506

  
504 507
  # add base directory to $form->{templates}
505 508
  $form->{templates} =~ s|.*/||;
506
  $form->{templates} =  "$main::templates/$form->{templates}";
509
  $form->{templates} =  $::lx_office_conf{paths}->{templates} . "/$form->{templates}";
507 510

  
508 511
  my $myconfig = new User($form->{login});
509 512

  
......
522 525
  $myconfig->save_member();
523 526

  
524 527
  $form->{templates}       =~ s|.*/||;
525
  $form->{templates}       =  "$main::templates/$form->{templates}";
528
  $form->{templates}       =  $::lx_office_conf{paths}->{templates} . "/$form->{templates}";
526 529
  $form->{mastertemplates} =~ s|.*/||;
527 530

  
528 531
  # create user template directory and copy master files
......
534 537
      umask(007);
535 538

  
536 539
      # copy templates to the directory
537
      opendir TEMPLATEDIR, "$main::templates/." or $form->error("$main::templates : $ERRNO");
540
      opendir TEMPLATEDIR, $::lx_office_conf{paths}->{templates} or $form->error($::lx_office_conf{paths}->{templates} . " : $ERRNO");
538 541
      my @templates = grep /$form->{mastertemplates}.*?\.(html|tex|sty|odt|xml|txb)$/,
539 542
        readdir TEMPLATEDIR;
540 543
      closedir TEMPLATEDIR;
541 544

  
542 545
      foreach my $file (@templates) {
543
        open(TEMP, "$main::templates/$file")
544
          or $form->error("$main::templates/$file : $ERRNO");
546
        open(TEMP, $::lx_office_conf{paths}->{templates} . "/$file")
547
          or $form->error($::lx_office_conf{paths}->{templates} . "/$file : $ERRNO");
545 548

  
546 549
        $file =~ s/\Q$form->{mastertemplates}\E-//;
547 550
        open(NEW, ">$form->{templates}/$file")
......
1097 1100
  my $form   = $main::form;
1098 1101
  my $locale = $main::locale;
1099 1102

  
1100
  unlink "$main::userspath/nologin";
1103
  unlink _nologin_file_name();;
1101 1104

  
1102 1105
  $form->{callback} = "admin.pl?action=list_users";
1103 1106

  
......
1109 1112
  my $form   = $main::form;
1110 1113
  my $locale = $main::locale;
1111 1114

  
1112
  open(FH, ">$main::userspath/nologin")
1115
  open(FH, ">" . _nologin_file_name())
1113 1116
    or $form->error($locale->text('Cannot create Lock!'));
1114 1117
  close(FH);
1115 1118

  
......
1180 1183
  ::end_of_request() if SL::DBUpgrade2->new(form => $::form, dbdriver => 'Pg', auth => 1)->apply_admin_dbupgrade_scripts(1);
1181 1184
}
1182 1185

  
1186
sub _nologin_file_name {
1187
  return $::lx_office_conf{paths}->{userspath} . '/nologin';
1188
}
1189

  
1183 1190
1;

Auch abrufbar als: Unified diff