Diff for /loncom/publisher/lonunauthorized.pm between versions 1.17 and 1.17.2.1

version 1.17, 2013/06/07 16:07:49 version 1.17.2.1, 2018/11/26 13:07:41
Line 102  sub handler { Line 102  sub handler {
         if ($ENV{'REDIRECT_URL'} =~ m{^/adm/([^/]+)}) {          if ($ENV{'REDIRECT_URL'} =~ m{^/adm/([^/]+)}) {
             my $action = $1;                 my $action = $1;   
             my ($option,$filename,$filename1,$filename2,$decompress,              my ($option,$filename,$filename1,$filename2,$decompress,
                 $qualifiedfilename);                  $qualifiedfilename,$warning);
               my %deniedactions = &get_denied_action_text();
             if ($ENV{'REDIRECT_QUERY_STRING'} ne '') {              if ($ENV{'REDIRECT_QUERY_STRING'} ne '') {
                 foreach my $pair (split(/&/,$ENV{'REDIRECT_QUERY_STRING'})) {                  foreach my $pair (split(/&/,$ENV{'REDIRECT_QUERY_STRING'})) {
                     my ($name,$value) = split(/=/,$pair);                      my ($name,$value) = split(/=/,$pair);
Line 130  sub handler { Line 131  sub handler {
                             $option = 'cstr';                              $option = 'cstr';
                         }                          }
                     } elsif ($name eq 'filetwo') {                      } elsif ($name eq 'filetwo') {
                         $option = $value;                           $option = $value;
                     }                      }
                 }                  }
                 if (($action eq 'upload') || ($action eq 'testbank')) {                  if (($action eq 'upload') || ($action eq 'testbank')) {
                     if (($filename1 ne '') && ($filename ne '')) {                      if (($filename1 ne '') && ($filename2 ne '')) {
                         $filename = $filename1.$filename2;                          $filename = $filename1.$filename2;
                     }                      }
                 } elsif ($action eq 'cfile') {                  } elsif ($action eq 'cfile') {
Line 144  sub handler { Line 145  sub handler {
                         $filename = $qualifiedfilename;                          $filename = $qualifiedfilename;
                     }                      }
                 }                  }
                 my %deniedactions = &get_denied_action_text();  
                 my $warning;  
                 if ($option eq 'decompress') {                  if ($option eq 'decompress') {
                     $warning = $deniedactions{$option};                      $warning = $deniedactions{$option};
                 } else {                  } else {
Line 165  sub handler { Line 164  sub handler {
                         $r->print('<p class="LC_error">'.                          $r->print('<p class="LC_error">'.
                                   $deniedactions{$action}.'</p><p class="LC_warning">'.                                    $deniedactions{$action}.'</p><p class="LC_warning">'.
                                   &mt('You do not have authoring privileges for this resource').' '.                                    &mt('You do not have authoring privileges for this resource').' '.
                                         '<span class="LC_filename">'.$filename.'</span>'.
                                     '</p>');
                       }
                   } else {
                       $r->print('<p class="LC_error">'.
                                 &mt('You are not permitted to take this action.').
                                 '</p>');
                   }
               } elsif (($action eq 'upload') || ($action eq 'testbank')) {
                   $filename1 = $env{'form.filename1'};
                   $filename2 = $env{'form.filename2'};
                   if (($filename1 ne '') && ($filename2 ne '')) {
                       $filename = $filename1.$filename2;
                   }
                   $warning = $deniedactions{$action};
                   if ($warning) {
                       if ($filename =~ m{^/priv/.+\.\d+\.[^.]+$}) {
                           $r->print('<p class="LC_error">'.
                                     &mt('There is a problem with the filename').' '.
                                     '<span class="LC_filename">'.$filename.'</span></p>'.
                                     '<p class="LC_warning">'.
                                     &mt('The suggested filename may not include the pattern ".number.extension" as LON-CAPA reserves that pattern for its internal versioning mechanism.').
                                     '</p>');
                       } else {
                           $r->print('<p class="LC_error">'.
                                     $deniedactions{$action}.'</p><p class="LC_warning">'.
                                     &mt('You do not have authoring privileges for this resource').' '.
                                       '<span class="LC_filename">'.$filename.'</span>'.                                        '<span class="LC_filename">'.$filename.'</span>'.
                                   '</p>');                                    '</p>');
                     }                      }

Removed from v.1.17  
changed lines
  Added in v.1.17.2.1


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>