[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm

raeburn raeburn at source.lon-capa.org
Sun Jul 27 07:14:36 EDT 2014


raeburn		Sun Jul 27 11:14:36 2014 EDT

  Modified files:              
    /loncom/publisher	lonpublisher.pm 
  Log:
  - Additional arg for set_allow() - $type, which is the attribute (in the tag) 
    which requires an allow to be set.
  - For $type = src or href remove any query string appended to the url before
    setting the value of the src in the allow tag.
  
  
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.289 loncom/publisher/lonpublisher.pm:1.290
--- loncom/publisher/lonpublisher.pm:1.289	Wed Jan 15 18:49:56 2014
+++ loncom/publisher/lonpublisher.pm	Sun Jul 27 11:14:36 2014
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Publication Handler
 #
-# $Id: lonpublisher.pm,v 1.289 2014/01/15 18:49:56 bisitz Exp $
+# $Id: lonpublisher.pm,v 1.290 2014/07/27 11:14:36 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -468,7 +468,7 @@
 #########################################
 #########################################
 sub set_allow {
-    my ($allow,$logfile,$target,$tag,$oldurl)=@_;
+    my ($allow,$logfile,$target,$tag,$oldurl,$type)=@_;
     my $newurl=&urlfixup($oldurl,$target);
     my $return_url=$oldurl;
     print $logfile 'GUYURL: '.$tag.':'.$oldurl.' - '.$newurl."\n";
@@ -480,6 +480,11 @@
 	($newurl !~ /^mailto:/i) &&
 	($newurl !~ /^(?:http|https|ftp):/i) &&
 	($newurl !~ /^\#/)) {
+        if (($type eq 'src') || ($type eq 'href')) {
+            if ($newurl =~ /^([^?]+)\?[^?]*$/) {
+                $newurl = $1;
+            }
+        }
 	$$allow{&absoluteurl($newurl,$target)}=1;
     }
     return $return_url;
@@ -723,7 +728,7 @@
 			    if ($key =~ /^$type$/i) {
 				$parms{$key}=&set_allow(\%allow,$logfile,
 							$target,$tag,
-							$parms{$key});
+							$parms{$key},$type);
 			    }
 			}
 		    }
@@ -836,7 +841,7 @@
                                 }
                             }
                         }
-                        $outstring .= $script
+                        $outstring .= $script;
                     }
                 }
 	    } elsif ($token->[0] eq 'E') {




More information about the LON-CAPA-cvs mailing list