[LON-CAPA-cvs] cvs: loncom / lonencurl.pm /auth lonlogin.pm lonroles.pm /homework essayresponse.pm /imspackages imsimport.pm /interface coursecatalog.pm groupsort.pm lonannounce.pm loncommon.pm londocs.pm lonevaluate.pm lonfeedback.pm lonhtmlcommon.pm lonindexer.pm lonmanagekeys.pm lonmenu.pm lonmeta.pm lonmsg.pm lonparmset.pm /publisher londiff.pm /xml londefdef.pm rat map.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Tue, 05 Dec 2006 02:56:06 -0000
This is a MIME encoded message
--albertel1165287366
Content-Type: text/plain
albertel Mon Dec 4 21:56:06 2006 EDT
Modified files:
/loncom/interface coursecatalog.pm groupsort.pm lonannounce.pm
loncommon.pm londocs.pm lonevaluate.pm
lonfeedback.pm lonhtmlcommon.pm lonindexer.pm
lonmanagekeys.pm lonmenu.pm lonmeta.pm lonmsg.pm
lonparmset.pm
/loncom/homework essayresponse.pm
/loncom/imspackages imsimport.pm
/loncom/xml londefdef.pm
/loncom/publisher londiff.pm
/rat map.pm
/loncom lonencurl.pm
/loncom/auth lonlogin.pm lonroles.pm
Log:
- lots of \w -> probper regexp replacements
--albertel1165287366
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20061204215606.txt"
Index: loncom/interface/coursecatalog.pm
diff -u loncom/interface/coursecatalog.pm:1.10 loncom/interface/coursecatalog.pm:1.11
--- loncom/interface/coursecatalog.pm:1.10 Wed Oct 18 10:07:47 2006
+++ loncom/interface/coursecatalog.pm Mon Dec 4 21:55:51 2006
@@ -47,8 +47,7 @@
my $lonidsdir=$r->dir_config('lonIDsDir');
my $handle;
if ($lonid) {
- $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
}
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
&Apache::lonnet::transfer_profile_to_env($lonidsdir,$handle);
Index: loncom/interface/groupsort.pm
diff -u loncom/interface/groupsort.pm:1.49 loncom/interface/groupsort.pm:1.50
--- loncom/interface/groupsort.pm:1.49 Tue Sep 12 18:13:05 2006
+++ loncom/interface/groupsort.pm Mon Dec 4 21:55:51 2006
@@ -2,7 +2,7 @@
# The LON-CAPA group sort handler
# Allows for sorting prior to import into RAT.
#
-# $Id: groupsort.pm,v 1.49 2006/09/12 22:13:05 albertel Exp $
+# $Id: groupsort.pm,v 1.50 2006/12/05 02:55:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,7 @@
use Apache::loncommon;
use Apache::lonlocal;
use Apache::lonnet;
+use LONCAPA();
my $iconpath; # variable to be accessible to multiple subroutines
my %hash; # variable to tie to user specific database
@@ -174,7 +175,7 @@
my $url=$token->[2]->{'src'};
my $name=$token->[2]->{'title'};
- $name=~s/ \[\((\d+)\,(\w+)\,(\w+)\)\]$//;
+ $name=~s/ \[\((\d+)\,($LONCAPA::username_re)\,($LONCAPA::domain_re)\)\]$//;
if ($1) {
$$nhash{$url}='<br />'.&mt('Removed by ').
&Apache::loncommon::plainname($2,$3).', '.
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.62 loncom/interface/lonannounce.pm:1.63
--- loncom/interface/lonannounce.pm:1.62 Wed Nov 29 02:46:39 2006
+++ loncom/interface/lonannounce.pm Mon Dec 4 21:55:51 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Announce
#
-# $Id: lonannounce.pm,v 1.62 2006/11/29 07:46:39 raeburn Exp $
+# $Id: lonannounce.pm,v 1.63 2006/12/05 02:55:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -37,6 +37,7 @@
use Apache::lonrss();
use Apache::lonnet;
use HTML::Entities();
+use LONCAPA qw(:match);
my %todayhash;
my %showedcheck;
@@ -92,7 +93,7 @@
foreach my $thiskey (sort keys %resourcedata) {
if ($resourcedata{$thiskey.'.type'}=~/^date/) {
my ($course,$middle,$part,$name)=
- ($thiskey=~/^(\w+)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
+ ($thiskey=~/^($match_courseid)\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);
my %data = ( 'section' => &mt('All Students'));
if ($middle=~/^\[(.*)\]\./) {
my $sec=$1;
@@ -309,7 +310,7 @@
$nextday+=$oneday;
}
foreach my $item (keys(%allcal)) {
- my ($course,$startdate,$enddate)=($item=~/^(\w+)\@(\d+)\_(\d+)$/);
+ my ($course,$startdate,$enddate)=($item=~/^($match_courseid)\@(\d+)\_(\d+)$/);
if (($startdate<$nextday) && ($enddate>=$tk)) {
push(@outp,[$course,$startdate,$enddate,$allcal{$item}]);
}
@@ -375,7 +376,7 @@
$r->print("PRODID:-//LONCAPA//LONCAPA Calendar Output//EN$crlf");
my %allcal=&get_all_calendars();
foreach my $event (keys(%allcal)) {
- my ($courseid,$startdate,$enddate)=($event=~/^(\w+)\@(\d+)\_(\d+)$/);
+ my ($courseid,$startdate,$enddate)=($event=~/^($match_courseid)\@(\d+)\_(\d+)$/);
my $uid=$event;
$uid=~s/[\W\_]/-/gs;
$uid.='@loncapa';
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.486 loncom/interface/loncommon.pm:1.487
--- loncom/interface/loncommon.pm:1.486 Mon Dec 4 20:51:48 2006
+++ loncom/interface/loncommon.pm Mon Dec 4 21:55:51 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.486 2006/12/05 01:51:48 raeburn Exp $
+# $Id: loncommon.pm,v 1.487 2006/12/05 02:55:51 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6289,9 +6289,11 @@
# if specified, key authority is not course, but user
# only active if keyaccess is yes
if ($args->{'keyauth'}) {
- $args->{'keyauth'}=~s/[^\w\@]//g;
- if ($args->{'keyauth'}) {
- $cenv{'keyauth'}=$args->{'keyauth'};
+ my ($user,$domain) = split(':',$args->{'keyauth'});
+ $user = &LONCAPA::clean_username($user);
+ $domain = &LONCAPA::clean_username($domain);
+ if ($user ne '' && $domain ne '');
+ $cenv{'keyauth'}=$user.':'.$domain;
}
}
Index: loncom/interface/londocs.pm
diff -u loncom/interface/londocs.pm:1.263 loncom/interface/londocs.pm:1.264
--- loncom/interface/londocs.pm:1.263 Fri Dec 1 17:17:26 2006
+++ loncom/interface/londocs.pm Mon Dec 4 21:55:52 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Documents
#
-# $Id: londocs.pm,v 1.263 2006/12/01 22:17:26 albertel Exp $
+# $Id: londocs.pm,v 1.264 2006/12/05 02:55:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -42,7 +42,7 @@
use GDBM_File;
use Apache::lonlocal;
use Cwd;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
my $iconpath;
@@ -99,7 +99,7 @@
$ca=$env{'user.name'};
$cd=$env{'user.domain'};
} else {
- ($cd,$ca)=($realm=~/^\/(\w+)\/(\w+)$/);
+ ($cd,$ca)=($realm=~/^\/($match_domain)\/($match_username)$/);
}
my $allowed=0;
my $myhome=&Apache::lonnet::homeserver($ca,$cd);
@@ -366,7 +366,7 @@
if (ref($curRes)) {
my $symb = $curRes->symb();
my $ressymb = $symb;
- if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) {
+ if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
unless ($ressymb =~ m|adm/wrapper/adm|) {
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
}
@@ -613,7 +613,7 @@
if (grep/^$count$/,@$discussions) {
my $ressymb = $symb;
my $mode;
- if ($ressymb =~ m|adm/(\w+)/(\w+)/(\d+)/bulletinboard$|) {
+ if ($ressymb =~ m|adm/($match_domain)/($match_username)/(\d+)/bulletinboard$|) {
unless ($ressymb =~ m|adm/wrapper/adm|) {
$ressymb = 'bulletin___'.$3.'___adm/wrapper/adm/'.$1.'/'.$2.'/'.$3.'/bulletinboard';
}
@@ -698,7 +698,7 @@
}
} elsif ($symb =~ m-lib/templates/examupload\.problem$-) {
$content_type = 'examupload';
- } elsif ($symb =~ m-adm/(\w+)/(\w+)/(\d+)/bulletinboard$-) {
+ } elsif ($symb =~ m-adm/($match_domain)/($match_username)/(\d+)/bulletinboard$-) {
$content_type = 'bulletinboard';
my $contents = &Apache::imsexport::templatedpage($content_type,$3,$count,\@uploads,$1,$2);
if ($contents) {
@@ -1309,7 +1309,7 @@
$url=~/^(.+)\.(\w+)$/;
my $newurl=$1.$newid.'.'.$2;
my $storefn=$newurl;
- $storefn=~s/^\/\w+\/\w+\/\w+\///;
+ $storefn=~s{^/\w+/$match_domain/$match_username/}{};
&Apache::lonclonecourse::writefile
($env{'request.course.id'},$storefn,
&Apache::lonnet::getfile($url));
@@ -1632,7 +1632,7 @@
my $foldertitle=$title;
my $pagetitle=$title;
my $orderidx=$LONCAPA::map::order[$index];
- if ($title=~ /^(\d+)___&&&___(\w+)___&&&___(\w+)___&&&___(.*)$/ ) {
+ if ($title=~ /^(\d+)___&&&___($match_username)___&&&___($match_domain)___&&&___(.*)$/ ) {
$foldertitle=&Apache::lontexconvert::msgtexconverted($4);
$renametitle=$4;
$title='<i>'.&Apache::lonlocal::locallocaltime($1).'</i> '.
@@ -1783,13 +1783,13 @@
if ($uploaded) {
if ($extension eq 'sequence') {
$icon=$iconpath.'/folder_closed.gif';
- $url=~/$coursenum\/([\/\w]+)\.sequence$/;
+ $url=~/\Q$coursenum\E\/([\/\w]+)\.sequence$/;
$url='/adm/coursedocs?';
$folderarg=$1;
$isfolder=1;
} elsif ($extension eq 'page') {
$icon=$iconpath.'/page.gif';
- $url=~/$coursenum\/([\/\w]+)\.page$/;
+ $url=~/\Q$coursenum\E\/([\/\w]+)\.page$/;
$pagearg=$1;
$url='/adm/coursedocs?';
$ispage=1;
@@ -2490,7 +2490,8 @@
my %codebase = ();
my ($upload_result,$upload_output);
if ($allowed) {
- if (($env{'form.uploaddoc.filename'}) && ($env{'form.cmd'}=~/^upload_(\w+)/)) {
+ if (($env{'form.uploaddoc.filename'}) &&
+ ($env{'form.cmd'}=~/^upload_(\w+)/)) {
# Process file upload - phase one - upload and parse primary file.
$upload_result = &process_file_upload(\$upload_output,$coursenum,
$coursedom,\%allfiles,
Index: loncom/interface/lonevaluate.pm
diff -u loncom/interface/lonevaluate.pm:1.19 loncom/interface/lonevaluate.pm:1.20
--- loncom/interface/lonevaluate.pm:1.19 Sun Mar 19 17:22:49 2006
+++ loncom/interface/lonevaluate.pm Mon Dec 4 21:55:52 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Evaluate
#
-# $Id: lonevaluate.pm,v 1.19 2006/03/19 22:22:49 albertel Exp $
+# $Id: lonevaluate.pm,v 1.20 2006/12/05 02:55:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,6 +33,7 @@
use Apache::Constants qw(:common);
use Apache::loncommon();
use Apache::lonenc();
+use LONCAPA();
sub handler {
my $r = shift;
@@ -53,7 +54,7 @@
my $title=&Apache::lonnet::gettitle($feedurl);
my $showurl=&Apache::lonenc::check_encrypt($feedurl);
- my ($rdomain,$rauth)=($feedurl=~/^(\w+)\/(\w+)\//);
+ my ($rdomain,$rauth)=($feedurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\//);
my $prefix=$env{'user.name'}.'@'.$env{'user.domain'}.'___'.
$feedurl.'___';
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.225 loncom/interface/lonfeedback.pm:1.226
--- loncom/interface/lonfeedback.pm:1.225 Thu Nov 30 03:51:20 2006
+++ loncom/interface/lonfeedback.pm Mon Dec 4 21:55:52 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.225 2006/11/30 08:51:20 albertel Exp $
+# $Id: lonfeedback.pm,v 1.226 2006/12/05 02:55:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,7 +44,6 @@
use Apache::lonspeller();
use Apache::longroup;
use Cwd;
-use lib '/home/httpd/lib/perl/';
use LONCAPA;
sub discussion_open {
@@ -2711,7 +2710,7 @@
my %to=();
if ($env{'form.discuss'} eq 'author' ||$author) {
$typestyle.='Submitting as Author Feedback<br />';
- $feedurl=~/^\/res\/(\w+)\/(\w+)\//;
+ $feedurl=~{^/res/($LONAPA::domain_re)/($LONCAPA::username_re)/};
$to{$2.':'.$1}=1;
}
if ($env{'form.discuss'} eq 'question' ||$question) {
Index: loncom/interface/lonhtmlcommon.pm
diff -u loncom/interface/lonhtmlcommon.pm:1.154 loncom/interface/lonhtmlcommon.pm:1.155
--- loncom/interface/lonhtmlcommon.pm:1.154 Thu Nov 9 15:43:07 2006
+++ loncom/interface/lonhtmlcommon.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common html routines
#
-# $Id: lonhtmlcommon.pm,v 1.154 2006/11/09 20:43:07 albertel Exp $
+# $Id: lonhtmlcommon.pm,v 1.155 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,7 +60,6 @@
use Time::HiRes;
use Apache::lonlocal;
use Apache::lonnet;
-use lib '/home/httpd/lib/perl/';
use LONCAPA;
##############################################
@@ -78,7 +77,7 @@
sub authorbombs {
my $url=shift;
$url=&Apache::lonnet::declutter($url);
- my ($udom,$uname)=($url=~/^(\w+)\/(\w+)\//);
+ my ($udom,$uname)=($url=~m{^($LONCAPA::domain_re)/($LONCAPA::username_re)/});
my %bombs=&Apache::lonmsg::all_url_author_res_msg($uname,$udom);
foreach (keys %bombs) {
if ($_=~/^$udom\/$uname\//) {
Index: loncom/interface/lonindexer.pm
diff -u loncom/interface/lonindexer.pm:1.153 loncom/interface/lonindexer.pm:1.154
--- loncom/interface/lonindexer.pm:1.153 Fri Sep 29 14:21:43 2006
+++ loncom/interface/lonindexer.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Directory Indexer
#
-# $Id: lonindexer.pm,v 1.153 2006/09/29 18:21:43 albertel Exp $
+# $Id: lonindexer.pm,v 1.154 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -54,6 +54,7 @@
use Apache::lonlocal;
use Apache::lonsource();
use GDBM_File;
+use LONCAPA qw(:match);
# ---------------------------------------- variables used throughout the module
my %hash; # global user-specific gdbm file
@@ -366,7 +367,7 @@
</script>
ENDHEADER
- my ($headerdom)=($uri=~/^\/res\/(\w+)\//);
+ my ($headerdom)=($uri=~m{^/res/($match_domain)/});
$r->print(&Apache::loncommon::start_page('Browse Resources',$js,
{'domain' => $headerdom,}));
# - Evaluate actions from previous page (both cumulatively and chronologically)
@@ -1199,7 +1200,7 @@
$output='<font size="-2">'.$output.'</font>';
} elsif ($embstyle eq 'img') {
$output='<img alt="'.&mt('Preview').'" src="'.$filelink.'" />';
- } elsif ($filelink=~/^\/res\/(\w+)\/(\w+)\//) {
+ } elsif ($filelink=~m{^/res/($match_domain)/($match_username)/}) {
$output='<img alt="'.&mt('Preview').'" src="http://'.
$Apache::lonnet::hostname{&Apache::lonnet::homeserver($2,$1)}.
'/cgi-bin/thumbnail.gif?url='.$filelink.'" />';
Index: loncom/interface/lonmanagekeys.pm
diff -u loncom/interface/lonmanagekeys.pm:1.20 loncom/interface/lonmanagekeys.pm:1.21
--- loncom/interface/lonmanagekeys.pm:1.20 Mon Jun 5 16:44:12 2006
+++ loncom/interface/lonmanagekeys.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to manage course access keys
#
-# $Id: lonmanagekeys.pm,v 1.20 2006/06/05 20:44:12 raeburn Exp $
+# $Id: lonmanagekeys.pm,v 1.21 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -193,7 +193,7 @@
($cenv{'domain'},$cenv{'num'})=split(/\_/,$env{'form.cid'});
$keytype='auth';
} elsif ($cenv{'keyauth'}) {
- ($cenv{'num'},$cenv{'domain'})=split(/\W/,$cenv{'keyauth'});
+ ($cenv{'num'},$cenv{'domain'})=split(/:/,$cenv{'keyauth'});
$keytype='auth';
} else {
$keytype='course';
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.205 loncom/interface/lonmenu.pm:1.206
--- loncom/interface/lonmenu.pm:1.205 Tue Sep 5 13:35:10 2006
+++ loncom/interface/lonmenu.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.205 2006/09/05 17:35:10 albertel Exp $
+# $Id: lonmenu.pm,v 1.206 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,8 +44,7 @@
use Apache::loncommon();
use Apache::lonenc();
use Apache::lonlocal;
-use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw{:DEFAULT :match);
use vars qw(@desklines $readdesk);
@@ -408,7 +407,7 @@
my $desc = "Enter my resource construction space";
# Set defaults for co-authors
if ($env{'request.role'} =~ /^ca/) {
- ($cadom,$caname)=($env{'request.role'}=~/(\w+)\/(\w+)$/);
+ ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
($top,$bottom) = ('co con-','struct');
$action = "go('/priv/".$caname."');";
$desc = "Enter construction space as co-author";
@@ -430,7 +429,7 @@
my $cfudom='';
if ($env{'request.filename'}) {
my $file=&Apache::lonnet::declutter($env{'request.filename'});
- $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
+ $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
# Check that the user has permission to edit this resource
($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
if (defined($cfudom)) {
@@ -989,7 +988,7 @@
my $caname=$env{'user.name'};
if ($prt eq 'rca') {
($cadom,$caname)=
- ($env{'request.role'}=~/(\w+)\/(\w+)$/);
+ ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
$act =~ s/\$caname/$caname/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
Index: loncom/interface/lonmeta.pm
diff -u loncom/interface/lonmeta.pm:1.189 loncom/interface/lonmeta.pm:1.190
--- loncom/interface/lonmeta.pm:1.189 Mon Nov 20 15:58:30 2006
+++ loncom/interface/lonmeta.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Metadata display handler
#
-# $Id: lonmeta.pm,v 1.189 2006/11/20 20:58:30 banghart Exp $
+# $Id: lonmeta.pm,v 1.190 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -39,8 +39,7 @@
use Apache::lonlocal;
use Apache::lonmysql;
use Apache::lonmsg;
-use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
############################################################
@@ -63,7 +62,7 @@
############################################################
sub get_dynamic_metadata_from_sql {
my ($url) = shift();
- my ($authordom,$author)=($url=~m:^/res/(\w+)/(\w+)/:);
+ my ($authordom,$author)=($url=~m{^/res/($match_domain)/($match_username)/});
if (! defined($authordom)) {
$authordom = shift();
}
@@ -112,7 +111,7 @@
sub dynamicmeta {
my $url=&Apache::lonnet::declutter(shift);
$url=~s/\.meta$//;
- my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//);
+ my ($adomain,$aauthor)=($url=~/^($match_domain)\/($match_username)\//);
my $regexp=$url;
$regexp=~s/(\W)/\\$1/g;
$regexp='___'.$regexp.'___';
@@ -449,7 +448,7 @@
($type eq 'owner') ||
($type eq 'modifyinguser') ||
($type eq 'authorspace')) {
- $value=~s/(\w+)(\:|\@)(\w+)/&authordisplay($1,$3)/gse;
+ $value=~s/($match_username)(\:|\@)($match_domain)/&authordisplay($1,$3)/gse;
return $value;
}
# Gradelevel
@@ -732,14 +731,14 @@
$r->send_http_header;
return OK if $r->header_only;
my ($resdomain,$resuser)=
- (&Apache::lonnet::declutter($uri)=~/^(\w+)\/(\w+)\//);
+ (&Apache::lonnet::declutter($uri)=~/^($match_domain)\/($match_username)\//);
if ($uri=~m:/adm/bombs/(.*)$:) {
$r->print(&Apache::loncommon::start_page('Error Messages'));
# Looking for all bombs?
&report_bombs($r,$uri);
} elsif ($uri=~m|^/editupload/[^/]+/[^/]+/portfolio/|) {
($resdomain,$resuser)=
- (&Apache::lonnet::declutter($uri)=~m|^(\w+)/(\w+)/portfolio|);
+ (&Apache::lonnet::declutter($uri)=~m|^($match_domain)/($match_name)/portfolio|);
$r->print(&Apache::loncommon::start_page('Edit Portfolio File Catalog Information',
undef,
{'domain' => $resdomain,}));
@@ -793,7 +792,7 @@
$uri =~ s:/adm/bombs/::;
$uri = &Apache::lonnet::declutter($uri);
$r->print('<h1>'.&Apache::lonnet::clutter($uri).'</h1>');
- my ($domain,$author)=($uri=~/^(\w+)\/(\w+)\//);
+ my ($domain,$author)=($uri=~/^($match_domain)\/($match_username)\//);
if (&Apache::loncacc::constructaccess('/~'.$author.'/',$domain)) {
if ($env{'form.clearbombs'}) {
&Apache::lonmsg::clear_author_res_msg($uri);
@@ -1060,7 +1059,7 @@
} else {
$r->print('<h4>'.&mt('No Evaluation Data is available for this resource.').'</h4>');
}
- $uri=~/^\/res\/(\w+)\/(\w+)\//;
+ $uri=~/^\/res\/($match_domain)\/($match_username)\//;
if ((($env{'user.domain'} eq $1) && ($env{'user.name'} eq $2))
|| ($env{'user.role.ca./'.$1.'/'.$2})) {
if (exists($dynmeta{'comments'})) {
@@ -1337,7 +1336,7 @@
}
if ($fn =~ m|^$Apache::lonnet::perlvar{'lonDocRoot'}/userfiles|) {
my ($path, $new_fn);
- if ($fn =~ m|\w+/groups/\w+/portfolio/|) {
+ if ($fn =~ m|$match_name/groups/\w+/portfolio/|) {
($path, $new_fn) = ($fn =~ m|/(groups/\w+/portfolio.*)/([^/]*)$|);
} else {
($path, $new_fn) = ($fn =~ m|/(portfolio.*)/([^/]*)$|);
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.186 loncom/interface/lonmsg.pm:1.187
--- loncom/interface/lonmsg.pm:1.186 Wed Nov 1 17:22:31 2006
+++ loncom/interface/lonmsg.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines for messaging
#
-# $Id: lonmsg.pm,v 1.186 2006/11/01 22:22:31 www Exp $
+# $Id: lonmsg.pm,v 1.187 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -33,8 +33,7 @@
use HTML::TokeParser();
use Apache::lonlocal;
use Mail::Send;
-use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
{
my $uniq;
@@ -308,7 +307,7 @@
sub retrieve_author_res_msg {
my $url=shift;
$url=&Apache::lonnet::declutter($url);
- my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
+ my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//);
my %errormsgs=&Apache::lonnet::dump('nohist_res_msgs',$domain,$author);
my $msgs='';
foreach (keys %errormsgs) {
@@ -328,7 +327,7 @@
sub del_url_author_res_msg {
my $url=shift;
$url=&Apache::lonnet::declutter($url);
- my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
+ my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//);
my @delmsgs=();
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) {
if ($_=~/^\Q$url\E\_\d+$/) {
@@ -342,7 +341,7 @@
sub clear_author_res_msg {
my $url=shift;
$url=&Apache::lonnet::declutter($url);
- my ($domain,$author)=($url=~/^(\w+)\/(\w+)\//);
+ my ($domain,$author)=($url=~/^($match_domain)\/($match_username)\//);
my @delmsgs=();
foreach (&Apache::lonnet::getkeys('nohist_res_msgs',$domain,$author)) {
if ($_=~/^\Q$url\E/) {
Index: loncom/interface/lonparmset.pm
diff -u loncom/interface/lonparmset.pm:1.349 loncom/interface/lonparmset.pm:1.350
--- loncom/interface/lonparmset.pm:1.349 Wed Nov 29 17:02:47 2006
+++ loncom/interface/lonparmset.pm Mon Dec 4 21:55:53 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to set parameters for assessments
#
-# $Id: lonparmset.pm,v 1.349 2006/11/29 22:02:47 www Exp $
+# $Id: lonparmset.pm,v 1.350 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -65,7 +65,7 @@
use Apache::lonnavmaps;
use Apache::longroup;
use Apache::lonrss;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
# --- Caches local to lonparmset
@@ -2363,8 +2363,7 @@
my $classlist=&Apache::loncoursedata::get_classlist();
foreach (keys %$classlist) {
- # the following undefs are for 'domain', and 'username' respectively.
- if ($_=~/^(\w+)\:(\w+)$/) {
+ if ($_=~/^($match_username)\:($match_domain)$/) {
my ($tuname,$tudom)=($1,$2);
my $useropt=&Apache::lonnet::get_userresdata($tuname,$tudom);
foreach my $userkey (keys %{$useropt}) {
@@ -2486,7 +2485,7 @@
sub extractuser {
my $key=shift;
- return ($key=~/^$env{'request.course.id'}.\[useropt\:(\w+)\:(\w+)\]\./);
+ return ($key=~/^$env{'request.course.id'}.\[useropt\:($match_username)\:($match_domain)\]\./);
}
sub listdata {
@@ -2544,7 +2543,7 @@
my $section=&mt('All Students');
if ($middle=~/^\[(.*)\]/) {
my $issection=$1;
- if ($issection=~/^useropt\:(\w+)\:(\w+)/) {
+ if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {
$section=&mt('User').": ".&Apache::loncommon::plainname($1,$2);
} else {
$section=&mt('Group/Section').': '.$issection;
@@ -2918,7 +2917,7 @@
$data{'scope_type'} = 'all';
if ($middle=~/^\[(.*)\]/) {
$data{'scope'} = $1;
- if ($data{'scope'}=~/^useropt\:(\w+)\:(\w+)/) {
+ if ($data{'scope'}=~/^useropt\:($match_username)\:($match_domain)/) {
$data{'scope_type'} = 'user';
$data{'scope'} = [$1,$2];
} else {
Index: loncom/homework/essayresponse.pm
diff -u loncom/homework/essayresponse.pm:1.79 loncom/homework/essayresponse.pm:1.80
--- loncom/homework/essayresponse.pm:1.79 Mon Oct 23 06:00:29 2006
+++ loncom/homework/essayresponse.pm Mon Dec 4 21:55:54 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.79 2006/10/23 10:00:29 foxr Exp $
+# $Id: essayresponse.pm,v 1.80 2006/12/05 02:55:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -31,7 +31,6 @@
use Apache::lonxml();
use Apache::lonnet;
use Apache::lonlocal;
-use lib '/home/httpd/lib/perl/';
use LONCAPA;
@@ -153,7 +152,7 @@
my $essayurl=
&Apache::lonnet::declutter($ENV{'REQUEST_URI'});
my ($adom,$aname,$apath)=
- ($essayurl=~/^(\w+)\/(\w+)\/(.*)$/);
+ ($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/);
$apath=&escape($apath);
$apath=~s/\W/\_/gs;
&Apache::lonnet::put('nohist_essay_'.$apath,
Index: loncom/imspackages/imsimport.pm
diff -u loncom/imspackages/imsimport.pm:1.21 loncom/imspackages/imsimport.pm:1.22
--- loncom/imspackages/imsimport.pm:1.21 Mon Nov 27 11:37:36 2006
+++ loncom/imspackages/imsimport.pm Mon Dec 4 21:55:54 2006
@@ -856,7 +856,7 @@
$fn=$env{'form.filename'};
$fn=~s/^http\:\/\/[^\/]+\///;
$fn=~s/^\///;
- $fn=~s/(\~|priv\/)(\w+)//;
+ $fn=~s/(\~|priv\/)($LONCAPA::username_re)//;
$fn=~s/\/+/\//g;
} else {
$r->log_reason($env{'user.name'}.' at '.$env{'user.domain'}.
Index: loncom/xml/londefdef.pm
diff -u loncom/xml/londefdef.pm:1.344 loncom/xml/londefdef.pm:1.345
--- loncom/xml/londefdef.pm:1.344 Mon Nov 6 21:39:39 2006
+++ loncom/xml/londefdef.pm Mon Dec 4 21:55:54 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.344 2006/11/07 02:39:39 albertel Exp $
+# $Id: londefdef.pm,v 1.345 2006/12/05 02:55:54 albertel Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -48,6 +48,7 @@
use Apache::lonmeta();
use Apache::Constants qw(:common);
use File::Basename;
+use LONCAPA();
# use Data::Dumper;
BEGIN {
@@ -4298,15 +4299,15 @@
print $temp_file "$src\n";
my $newsrc = $src;
$newsrc =~ s/(\.gif|\.jpg|\.jpeg)$/\.eps/i;
- $newsrc=~s/\/home\/httpd\/html\/res//;
- $newsrc=~s/\/home\/([^\/]*)\/public_html\//\/$1\//;
- $newsrc=~s/\/\.\//\//;
- $newsrc=~s/\/([^\/]+)\.(ps|eps)/\//;
- if ($newsrc=~/\/home\/httpd\/lonUsers\//) {
- $newsrc=~s/\/home\/httpd\/lonUsers//;
- $newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//;
+ $newsrc=~s{/home/httpd/html/res}{};
+ $newsrc=~s{/home/($LONCAPA::username_re)/public_html/}{/$1/};
+ $newsrc=~s{/\./}{/};
+ $newsrc=~s{/([^/]+)\.(ps|eps)}{/};
+ if ($newsrc=~m{/home/httpd/lonUsers/}) {
+ $newsrc=~s{/home/httpd/lonUsers}{};
+ $newsrc=~s{/($LONCAPA::domain_re)/./././}{/$1/};
}
- if ($newsrc=~/\/userfiles\//) {
+ if ($newsrc=~m{/userfiles/}) {
return ' \graphicspath{{'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
} else {
return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} ';
Index: loncom/publisher/londiff.pm
diff -u loncom/publisher/londiff.pm:1.21 loncom/publisher/londiff.pm:1.22
--- loncom/publisher/londiff.pm:1.21 Tue Sep 19 17:47:29 2006
+++ loncom/publisher/londiff.pm Mon Dec 4 21:55:55 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to show differences between file versions
#
-# $Id: londiff.pm,v 1.21 2006/09/19 21:47:29 albertel Exp $
+# $Id: londiff.pm,v 1.22 2006/12/05 02:55:55 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,7 +40,7 @@
use Apache::loncommon();
use Apache::lonretrieve();
use Apache::lonlocal;
-
+use LONCAPA();
sub get_split_file {
my ($fn,$style)=@_;
@@ -88,12 +88,12 @@
if ($env{'form.filename'}=~/^\/res\//) {
($cudom,$cuname,$env{'form.filename'})=
- ($env{'form.filename'}=~/^\/res\/(\w+)\/(\w+)\/(.*)$/);
+ ($env{'form.filename'}=~m{^/res/($LONCAPA::domain_re)/($LONCAPA::username_re)/(.*)$});
} else {
unless (($cuname,$cudom)=
&Apache::loncacc::constructaccess($env{'form.filename'},
$r->dir_config('lonDefDomain'))) {
- $r->log_reason($cuname.' at '.$cudom.
+ $r->log_reason($cuname.':'.$cudom.
' trying to get diffs file '.$env{'form.filename'}.
' - not authorized',
$r->filename);
@@ -103,7 +103,7 @@
my $efn=$env{'form.filename'};
- $efn=~s/\/\~(\w+)//g;
+ $efn=~s{/\~($LONCAPA::username_re)}{}g;
my @f1=();
my @f2=();
@@ -152,7 +152,7 @@
if ($env{'form.filetwo'}) {
my $efn2=$env{'form.filetwo'};
- $efn2=~s/\/\~(\w+)//g;
+ $efn2=~s{/\~($LONCAPA::username_re)}{}g;
my $fn='/home/'.$cuname.'/public_html/'.$efn2;
@f2=&get_split_file($fn,'local');
$r->print('<tt>'.$efn2.'</tt>');
Index: rat/map.pm
diff -u rat/map.pm:1.2 rat/map.pm:1.3
--- rat/map.pm:1.2 Mon Dec 4 09:59:55 2006
+++ rat/map.pm Mon Dec 4 21:55:55 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# routines for modyfing .sequence and .page files
#
-# $Id: map.pm,v 1.2 2006/12/04 14:59:55 raeburn Exp $
+# $Id: map.pm,v 1.3 2006/12/05 02:55:55 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -690,7 +690,7 @@
}
}
$outstr.="</map>\n";
- if ($fn=~/^\/*uploaded\/(\w+)\/(\w+)\/(.*)$/) {
+ if ($fn=~m{^/*uploaded/($LONCAPA::domain_re)/($LONCAPA::courseid_re)/(.*)$}) {
$env{'form.output'}=$outstr;
my $result=&Apache::lonnet::finishuserfileupload($2,$1,
'output',$3);
Index: loncom/lonencurl.pm
diff -u loncom/lonencurl.pm:1.2 loncom/lonencurl.pm:1.3
--- loncom/lonencurl.pm:1.2 Fri Jul 14 16:20:52 2006
+++ loncom/lonencurl.pm Mon Dec 4 21:55:56 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# URL translation for encrypted filenames
#
-# $Id: lonencurl.pm,v 1.2 2006/07/14 20:20:52 albertel Exp $
+# $Id: lonencurl.pm,v 1.3 2006/12/05 02:55:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,8 +40,7 @@
my $lonid=$cookies{'lonID'};
my $cookie;
if ($lonid) {
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
$env{'request.enc'}=1;
if ((-e "$lonidsdir/$handle.id") && ($handle ne '')) {
Index: loncom/auth/lonlogin.pm
diff -u loncom/auth/lonlogin.pm:1.84 loncom/auth/lonlogin.pm:1.85
--- loncom/auth/lonlogin.pm:1.84 Tue Nov 14 19:53:48 2006
+++ loncom/auth/lonlogin.pm Mon Dec 4 21:55:56 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Login Screen
#
-# $Id: lonlogin.pm,v 1.84 2006/11/15 00:53:48 raeburn Exp $
+# $Id: lonlogin.pm,v 1.85 2006/12/05 02:55:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -84,8 +84,7 @@
my $lonid=$cookies{'lonID'};
my $cookie;
if ($lonid) {
- my $handle=$lonid->value;
- $handle=~s/\W//g;
+ my $handle=&LONCAPA::clean_handle($lonid->value);
my $lonidsdir=$r->dir_config('lonIDsDir');
if (-e "$lonidsdir/$handle.id") {
# Is there an existing token file?
Index: loncom/auth/lonroles.pm
diff -u loncom/auth/lonroles.pm:1.171 loncom/auth/lonroles.pm:1.172
--- loncom/auth/lonroles.pm:1.171 Fri Dec 1 16:52:29 2006
+++ loncom/auth/lonroles.pm Mon Dec 4 21:55:56 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# User Roles Screen
#
-# $Id: lonroles.pm,v 1.171 2006/12/01 21:52:29 albertel Exp $
+# $Id: lonroles.pm,v 1.172 2006/12/05 02:55:56 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -165,7 +165,7 @@
my $authnum=$cnum;
if ($env{'course.'.$cdom.'_'.$cnum.'.keyauth'}) {
($authnum,$authdom)=
- split(/\W/,$env{'course.'.$cdom.'_'.$cnum.'.keyauth'});
+ split(/:/,$env{'course.'.$cdom.'_'.$cnum.'.keyauth'});
}
# check with key authority
unless (&Apache::lonnet::validate_access_key(
--albertel1165287366--