File:  [LON-CAPA] / loncom / lonencurl.pm
Revision 1.4: download - view: text, annotated - select for diffs
Tue Oct 2 01:10:16 2007 UTC (16 years, 6 months ago) by albertel
Branches: MAIN
CVS tags: version_2_9_X, version_2_9_99_0, version_2_9_1, version_2_9_0, version_2_8_X, version_2_8_99_1, version_2_8_99_0, version_2_8_2, version_2_8_1, version_2_8_0, version_2_7_X, version_2_7_99_1, version_2_7_99_0, version_2_7_1, version_2_7_0, version_2_6_X, version_2_6_99_1, version_2_6_99_0, version_2_6_3, version_2_6_2, version_2_6_1, version_2_6_0, version_2_5_99_1, version_2_5_99_0, version_2_10_X, version_2_10_1, version_2_10_0_RC2, version_2_10_0_RC1, version_2_10_0, loncapaMITrelate_1, bz6209-base, bz6209, bz5969, bz2851, PRINT_INCOMPLETE_base, PRINT_INCOMPLETE, HEAD, GCI_3, GCI_2, GCI_1, BZ5971-printing-apage, BZ5434-fox
- convert exisiting cookie reads/validations to use
   lonnet::check_for_valid_session

    1: 
    2: # The LearningOnline Network
    3: # URL translation for encrypted filenames
    4: #
    5: # $Id: lonencurl.pm,v 1.4 2007/10/02 01:10:16 albertel Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: 
   30: package Apache::lonencurl;
   31: 
   32: use strict;
   33: use Apache::Constants qw(:common :remotehost);
   34: use Apache::lonnet;
   35: use Apache::lonenc;
   36: 
   37: sub handler {
   38:     my $r = shift;
   39: 
   40:     $env{'request.enc'}=1;
   41: 
   42:     my $handle = &Apache::lonnet::check_for_valid_session($r);
   43:     if ($handle ne '') {
   44: # Initialize Environment
   45: 	my $lonidsdir=$r->dir_config('lonIDsDir');
   46: 	&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
   47: # Decrypt URL and redirect
   48: 	my $redirect=&Apache::lonenc::unencrypted($r->uri);
   49: 	if ($r->args) { $redirect.='?'.$r->args; }
   50: 	$r->internal_redirect($redirect);
   51: 	return OK;
   52:     }
   53:     return FORBIDDEN;
   54: }
   55: 
   56: 1;
   57: __END__

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