[LON-CAPA-cvs] cvs: loncom /interface lonfeedback.pm
raeburn
raeburn at source.lon-capa.org
Fri Nov 3 17:36:28 EDT 2017
raeburn Fri Nov 3 21:36:28 2017 EDT
Modified files:
/loncom/interface lonfeedback.pm
Log:
- Sanity checking.
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.373 loncom/interface/lonfeedback.pm:1.374
--- loncom/interface/lonfeedback.pm:1.373 Tue May 30 00:01:32 2017
+++ loncom/interface/lonfeedback.pm Fri Nov 3 21:36:27 2017
@@ -1,7 +1,7 @@
# The LearningOnline Network
# Feedback
#
-# $Id: lonfeedback.pm,v 1.373 2017/05/30 00:01:32 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.374 2017/11/03 21:36:27 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -45,7 +45,7 @@
use Apache::lonspeller();
use Apache::longroup;
use Cwd;
-use LONCAPA;
+use LONCAPA qw(:DEFAULT :match);
sub discussion_open {
my ($status,$symb)=@_;
@@ -696,21 +696,28 @@
#Create zip file in prtspool
- my $imszipfile = '/prtspool/'.
- $env{'user.name'}.'_'.$env{'user.domain'}.'_'.
- time.'_'.rand(1000000000).'.zip';
- my $cwd = &getcwd();
- my $imszip = '/home/httpd/'.$imszipfile;
- chdir $tempexport;
- open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
- close(OUTPUT);
- chdir $cwd;
- $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive[_2]',
+ if (($env{'user.name'} =~ /^$match_username$/)
+ && ($env{'user.domain'} =~ /^$match_domain$/)) {
+ my $now = time();
+ my $imszipfile = '/prtspool/'.
+ join('_',$env{'user.name'},$env{'user.domain'},$now).
+ '_'.rand(1000000000).'.zip';
+ my $cwd = &getcwd();
+ my $imszip = '/home/httpd/'.$imszipfile;
+ chdir $tempexport;
+ open(OUTPUT, "zip -r $imszip * 2> /dev/null |");
+ close(OUTPUT);
+ chdir $cwd;
+ $discussion .= &mt('Download the zip file from [_1]Discussion Posting Archive[_2]',
'<a href="'.$imszipfile.'">','</a>').'<br />';
- if ($copyresult) {
- $discussion .= '<span class="LC_error">'.
- &mt('The following errors occurred during export:').
- '</span><br />'.$copyresult;
+ if ($copyresult) {
+ $discussion .= '<span class="LC_error">'.
+ &mt('The following errors occurred during export:').
+ '</span><br />'.$copyresult;
+ }
+ } else {
+ $discussion .= '<p class="LC_error">'.
+ &mt('Unfortunately you will not be able to retrieve an archive of the discussion posts at this time, because there was a problem creating the zip file.').'</p>';
}
}
} else {
More information about the LON-CAPA-cvs
mailing list