Diff for /loncom/interface/londocs.pm between versions 1.484.2.72.2.2 and 1.484.2.72.2.5

version 1.484.2.72.2.2, 2017/09/15 23:15:55 version 1.484.2.72.2.5, 2018/04/29 17:33:52
Line 2598  sub apply_fixups { Line 2598  sub apply_fixups {
                     }                      }
                 }                  }
             }              }
             for (my $i=0; $i<@LONCAPA::map::order; $i++) {              my $total = scalar(@LONCAPA::map::order) - 1;
               for (my $i=$total; $i>=0; $i--) {
                 my $idx = $LONCAPA::map::order[$i];                  my $idx = $LONCAPA::map::order[$i];
                 if (defined($LONCAPA::map::resources[$idx])) {                  if (defined($LONCAPA::map::resources[$idx])) {
                     my $changed;                      my $changed;
Line 2608  sub apply_fixups { Line 2609  sub apply_fixups {
                         splice(@LONCAPA::map::order,$i,1);                          splice(@LONCAPA::map::order,$i,1);
                         if (ref($currparam{$idx}) eq 'ARRAY') {                          if (ref($currparam{$idx}) eq 'ARRAY') {
                             foreach my $name (@{$currparam{$idx}}) {                              foreach my $name (@{$currparam{$idx}}) {
                                 &LONCAPA::map::delparameter($idx,'parameter_'.$name);                                  &LONCAPA::map::delparameter($idx,$name);
                             }                              }
                         }                          }
                         next;                          next;
Line 2650  sub apply_fixups { Line 2651  sub apply_fixups {
             foreach my $idx (keys(%remparam)) {              foreach my $idx (keys(%remparam)) {
                 if (ref($remparam{$idx}) eq 'ARRAY') {                  if (ref($remparam{$idx}) eq 'ARRAY') {
                     foreach my $name (@{$remparam{$idx}}) {                         foreach my $name (@{$remparam{$idx}}) {   
                         &LONCAPA::map::delparameter($idx,'parameter_'.$name);                          &LONCAPA::map::delparameter($idx,$name);
                     }                      }
                 }                  }
             }              }
Line 3925  END Line 3926  END
                     }                      }
                 }                  }
                 if ($url ne '') {                  if ($url ne '') {
                     $url.=(($url=~/\?/)?'&':'?').'symb='.&HTML::Entities::encode($shownsymb,'"<>&');                      $url.=(($url=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
                 }                  }
             } elsif (!$env{'request.role.adv'}) {              } elsif (!$env{'request.role.adv'}) {
                 my $checkencrypt;                  my $checkencrypt;
Line 3946  END Line 3947  END
                     my $shownsymb = &Apache::lonenc::encrypted($symb);                      my $shownsymb = &Apache::lonenc::encrypted($symb);
                     my $shownurl = &Apache::lonenc::encrypted($url);                      my $shownurl = &Apache::lonenc::encrypted($url);
                     if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) {                      if (&Apache::lonnet::symbverify($shownsymb,$shownurl)) {
                         $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&HTML::Entities::encode($shownsymb,'"<>&');                          $url = $shownurl.(($shownurl=~/\?/)?'&':'?').'symb='.&escape($shownsymb);
                         if ($env{'request.enc'} ne '') {                          if ($env{'request.enc'} ne '') {
                             delete($env{'request.enc'});                              delete($env{'request.enc'});
                         }                          }
Line 4985  sub handler { Line 4986  sub handler {
         $disabled = ' disabled="disabled"';          $disabled = ' disabled="disabled"';
     }      }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['inhibitmenu']);
       if ($env{'form.inhibitmenu'}) {
           unless ($env{'form.inhibitmenu'} eq 'yes') {
               delete($env{'form.inhibitmenu'});
           }
       }
   if ($allowed && $env{'form.verify'}) {    if ($allowed && $env{'form.verify'}) {
       &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');        &init_breadcrumbs('verify','Verify Content','Docs_Verify_Content');
       &verifycontent($r);        &verifycontent($r);
Line 5018  sub handler { Line 5024  sub handler {
                                              'forcesupplement','forcestandard',                                               'forcesupplement','forcestandard',
                                              'tools','symb','command','supppath']);                                               'tools','symb','command','supppath']);
   
       foreach my $item ('forcesupplement','forcestandard','tools') {
           next if ($env{'form.'.$item} eq '');
           unless ($env{'form.'.$item} eq '1') {
               delete($env{'form.'.$item});
           }
       }
   
       if ($env{'form.command'}) {
           unless ($env{'form.command'} =~ /^(direct|directnav|editdocs|editsupp|contents|home)$/) {
               delete($env{'form.command'});
           }
       }
   
       if ($env{'form.symb'}) {
           my ($mapurl,$id,$resurl) = &Apache::lonnet::decode_symb($env{'form.symb'});
           unless (($id =~ /^\d+$/) && (&Apache::lonnet::is_on_map($resurl))) {
               delete($env{'form.symb'});
           }
       }
 # standard=1: this is a "new-style" course with an uploaded map as top level  # standard=1: this is a "new-style" course with an uploaded map as top level
 # standard=2: this is a "old-style" course, and there is nothing we can do  # standard=2: this is a "old-style" course, and there is nothing we can do
   
Line 5040  sub handler { Line 5065  sub handler {
     my $toolsflag=0;      my $toolsflag=0;
     if ($env{'form.tools'}) { $toolsflag=1; }      if ($env{'form.tools'}) { $toolsflag=1; }
   
       if ($env{'form.folderpath'} ne '') {
           my @items = split(/\&/,$env{'form.folderpath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if (($odd) && (!$supplementalflag) && ($items[$i] !~ /^[^:]*:(|\d+):(|1):(|1):(|1):(|1)$/)) {
                   $badpath = 1;
               } elsif ((!$odd) && ($items[$i] !~ /^(default|supplemental)(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.folderpath'});
           }
       }
   
       if ($env{'form.supppath'} ne '') {
           my @items = split(/\&/,$env{'form.supppath'});
           my $badpath;
           for (my $i=0; $i<@items; $i++) {
               my $odd = $i%2;
               if ((!$odd) && ($items[$i] !~ /^supplemental(|_\d+)$/)) {
                   $badpath = 1;
               }
               last if ($badpath);
           }
           if ($badpath) {
               delete($env{'form.supppath'});
           }
       }
   
     my $script='';      my $script='';
     my $showdoc=0;      my $showdoc=0;
     my $addentries = {};      my $addentries = {};
Line 6039  my %suporderhash = ( Line 6096  my %suporderhash = (
 sub embedded_form_elems {  sub embedded_form_elems {
     my ($phase,$primaryurl,$newidx) = @_;      my ($phase,$primaryurl,$newidx) = @_;
     my $folderpath = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');      my $folderpath = &HTML::Entities::encode($env{'form.folderpath'},'<>&"');
       $newidx =~s /\D+//g;
     return <<STATE;      return <<STATE;
     <input type="hidden" name="folderpath" value="$folderpath" />      <input type="hidden" name="folderpath" value="$folderpath" />
     <input type="hidden" name="cmd" value="upload_embedded" />      <input type="hidden" name="cmd" value="upload_embedded" />
Line 6059  sub embedded_destination { Line 6117  sub embedded_destination {
     } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {      } elsif ($folder =~ /^(default|supplemental)_(\d+)$/) {
         $destination .=  $2.'/';          $destination .=  $2.'/';
     }      }
     $destination .= $env{'form.newidx'};      my $newidx = $env{'form.newidx'};
       $newidx =~s /\D+//g;
       if ($newidx) {
           $destination .= $newidx;
       }
     my $dir_root = '/userfiles';      my $dir_root = '/userfiles';
     return ($destination,$dir_root);      return ($destination,$dir_root);
 }  }
Line 6085  sub decompression_info { Line 6147  sub decompression_info {
     }      }
     unshift(@hiddens,$pathitem);      unshift(@hiddens,$pathitem);
     foreach my $item (@hiddens) {      foreach my $item (@hiddens) {
           if ($item eq 'newidx') {
               next if ($env{'form.'.$item} =~ /\D/);
           }
         if ($env{'form.'.$item}) {          if ($env{'form.'.$item}) {
             $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.              $hiddenelem .= '<input type="hidden" name="'.$item.'" value="'.
                            &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";                             &HTML::Entities::encode($env{'form.'.$item},'<>&"').'" />'."\n";

Removed from v.1.484.2.72.2.2  
changed lines
  Added in v.1.484.2.72.2.5


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