[LON-CAPA-cvs] cvs: loncom / lonenc.pm /interface lonmenu.pm

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 11 Nov 2004 20:05:56 -0000


albertel		Thu Nov 11 15:05:56 2004 EDT

  Modified files:              
    /loncom	lonenc.pm 
    /loncom/interface	lonmenu.pm 
  Log:
  - check_encrypt generally useful, mmoving to lonenc
  - unecrypt sets request.enc if it decrypts something
  
  
Index: loncom/lonenc.pm
diff -u loncom/lonenc.pm:1.4 loncom/lonenc.pm:1.5
--- loncom/lonenc.pm:1.4	Wed Nov 10 17:20:50 2004
+++ loncom/lonenc.pm	Thu Nov 11 15:05:56 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # URL translation for encrypted filenames
 #
-# $Id: lonenc.pm,v 1.4 2004/11/10 22:20:50 albertel Exp $
+# $Id: lonenc.pm,v 1.5 2004/11/11 20:05:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -82,6 +82,7 @@
 				  pack("H16",substr($uri,$encidx,16))
 				  );
     }
+    $ENV{'request.enc'}=1;
     return substr($decuri,0,$cmdlength);
 }
 
@@ -103,6 +104,12 @@
     return '/enc/'.$cmdlength.'/'.&Apache::lonnet::escape($encuri);
 }
 
+sub check_encrypt {
+    my $str=shift;
+    if ($ENV{'request.enc'}) { return &Apache::lonenc::encrypted($str); }
+    return $str;
+}
+
 1;
 __END__
 
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.125 loncom/interface/lonmenu.pm:1.126
--- loncom/interface/lonmenu.pm:1.125	Thu Nov 11 14:55:44 2004
+++ loncom/interface/lonmenu.pm	Thu Nov 11 15:05:56 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.125 2004/11/11 19:55:44 albertel Exp $
+# $Id: lonmenu.pm,v 1.126 2004/11/11 20:05:56 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -74,8 +74,8 @@
 
     my $navmaps='';
     my $reloadlink='';
-    my $escurl=&Apache::lonnet::escape(&check_encrypt($ENV{'request.noversionuri'}));
-    my $escsymb=&Apache::lonnet::escape(&check_encrypt($ENV{'request.symb'}));
+    my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'}));
+    my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'}));
     if ($ENV{'browser.interface'} eq 'textual') {
 # Textual display only
 	my %lt=&initlittle();
@@ -473,8 +473,8 @@
 # Registered, graphical output
         } else {
 	    my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0];
-	    $requri=&check_encrypt(&Apache::lonnet::unescape($requri));
-	    my $cursymb=&check_encrypt($ENV{'request.symb'});
+	    $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri));
+	    my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
 	    my $navstatus=&get_nav_status();
 	    $result = (<<ENDREGTHIS);
      
@@ -978,18 +978,12 @@
 NAVCONTROL
 }
 
-sub check_encrypt {
-    my $str=shift;
-    if ($ENV{'request.enc'}) { return &Apache::lonenc::encrypted($str); }
-    return $str;
-}
-
 sub utilityfunctions {
     unless (($ENV{'browser.interface'} eq 'textual')  ||
         ($ENV{'environment.remote'} eq 'off')) { return ''; }
-    my $currenturl=&check_encrypt($ENV{'request.noversionuri'});
+    my $currenturl=&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'});
     
-    my $currentsymb=&check_encrypt($ENV{'request.symb'});
+    my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
     my $nav_control=&nav_control_js();
 return (<<ENDUTILITY)