--- loncom/interface/lonsupportreq.pm 2013/01/04 19:07:17 1.67.2.1 +++ loncom/interface/lonsupportreq.pm 2013/11/26 03:17:06 1.74 @@ -1,5 +1,5 @@ # -# $Id: lonsupportreq.pm,v 1.67.2.1 2013/01/04 19:07:17 raeburn Exp $ +# $Id: lonsupportreq.pm,v 1.74 2013/11/26 03:17:06 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,6 +36,7 @@ use Apache::lonhtmlcommon; use Apache::lonnet; use Apache::lonlocal; use Apache::lonacc(); +use Apache::lonauth(); use Apache::courseclassifier; use LONCAPA qw(:DEFAULT :match); use HTML::Entities; @@ -113,7 +114,7 @@ sub print_request_form { $formname = 'logproblem'; my $machine = &Apache::lonnet::absolute_url(); my $sourceurl = $machine.$origurl; - $server = $machine.&cleanup_html($origurl); + $server = $machine.&Apache::loncommon::cleanup_html($origurl); $server =~ s/\?.*$//; my %lt = &Apache::lonlocal::texthash ( email => 'The e-mail address you entered', @@ -494,6 +495,18 @@ ENDJS $num ++; $i = $num%2; } + } else { + my $lonhost = $r->dir_config('lonHostID'); + my ($captchaform,$error) = + &Apache::loncommon::captcha_display('login',$lonhost); + if ($captchaform) { + $output .= &Apache::lonhtmlcommon::row_title(&mt('Validation'),undef, + $css[$i])."\n". + $captchaform."\n". + &Apache::lonhtmlcommon::row_closure(); + $num ++; + $i = $num%2; + } } $output .= &Apache::lonhtmlcommon::row_title($lt{'fini'},undef,$css[$i]); $output .= <dir_config('lonHostID'); + my ($captcha_chk,$captcha_error) = + &Apache::loncommon::captcha_response('login',$lonhost); + if ($captcha_chk != 1) { + $r->print(&Apache::loncommon::start_page('Support request failed',undef, + {'function' => $function, + 'add_entries' => { + topmargin => "0", + marginheight => "0", + }, + 'only_body' => 1,})); + if ($r->uri eq '/adm/helpdesk') { + &print_header($r,$url,'process'); + } + $r->print('

'.&mt('Support request failed').'

'. + ''. + &mt('Validation of the code you entered failed.'). + &Apache::loncommon::end_page()); + return; + } + } my @ENVvars = ('HTTP_HOST','HTTP_USER_AGENT','REMOTE_ADDR','SERVER_ADDR','SERVER_NAME'); my @envvars = ('browser.os','browser.type','browser.version','user.home','request.role'); my @loncvars = ('user.name','user.domain','request.course.sec','request.course.id'); @@ -602,10 +641,8 @@ sub print_request_receipt { adin => 'Additional information recorded', ); - my (@ok_ccs,@bad_ccs,$badccmsg,$okcclist,$public,$homeserver); - if (($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) { - $public = 1; - } else { + my (@ok_ccs,@bad_ccs,$badccmsg,$okcclist,$homeserver); + unless ($public) { if (($env{'user.name'} ne '') && ($env{'user.domain'} ne '')) { $homeserver = &Apache::lonnet::homeserver($env{'user.name'}, $env{'user.domain'}); @@ -639,10 +676,10 @@ sub print_request_receipt { } if (@bad_ccs == 1) { if ($bad_ccs[0] ne '') { - $badccmsg .= '
'.&mt('The following Cc e-mail address is invalid: ').&cleanup_html($bad_ccs[0]); + $badccmsg .= '
'.&mt('The following Cc e-mail address is invalid: ').&Apache::loncommon::cleanup_html($bad_ccs[0]); } } elsif (@bad_ccs > 1) { - $badccmsg .= '
'.&mt('The following Cc e-mail addresses are invalid: '). &cleanup_html(join(', ',@bad_ccs)); + $badccmsg .= '
'.&mt('The following Cc e-mail addresses are invalid: '). &Apache::loncommon::cleanup_html(join(', ',@bad_ccs)); } } $env{'form.user'} = "'".$env{'form.uname'}.':'.$env{'form.udom'}."'"; @@ -665,7 +702,7 @@ END if ($env{'form.'.$item} ne '') { if ($item eq 'description') { my $descrip = $env{'form.description'}; - $descrip = &cleanup_html($descrip); + $descrip = &Apache::loncommon::cleanup_html($descrip); $descrip =~ s|[\n\r\f]|
|g; $displaymsg .= ''. @@ -673,20 +710,20 @@ END } elsif ($item eq 'sourceurl') { my $showurl = $env{'form.sourceurl'}; $showurl =~ s/\?.*$//; - $showurl = &cleanup_html($showurl); + $showurl = &Apache::loncommon::cleanup_html($showurl); $displaymsg .= ''. "$lt{$item}: $showurl
\n"; } elsif ($item eq 'cc') { if ($okcclist) { - my $showcclist = &cleanup_html($okcclist); + my $showcclist = &Apache::loncommon::cleanup_html($okcclist); $displaymsg .= ''. "$lt{$item}: $showcclist
\n"; } } else { my $showitem = $env{'form.'.$item}; - $showitem = &cleanup_html($showitem); + $showitem = &Apache::loncommon::cleanup_html($showitem); $displaymsg .= ''. "$lt{$item}: $showitem
\n"; @@ -707,7 +744,7 @@ END $r->print(<<"END"); $start_page -
+
END @@ -777,8 +814,7 @@ END my $attachmentpath = ''; my $attachmentsize = ''; - if ((defined($env{'user.name'})) && ($env{'user.name'} ne 'public') - && ($env{'user.domain'} ne 'public')) { + if ((defined($env{'user.name'})) && (!$public)) { if ($homeserver && $env{'form.screenshot.filename'}) { $attachmentsize = length($env{'form.screenshot'}); if ($attachmentsize > 131072) { @@ -929,6 +965,10 @@ sub print_header { } else { $linkback = &HTML::Entities::encode($origurl,'"<>&'); } + my $loginhelp = &Apache::lonauth::loginhelpdisplay(); + if ($loginhelp eq '') { + $loginhelp = '/adm/loginproblems.html'; + } $r->print(<<"END"); @@ -941,7 +981,7 @@ sub print_header {
- + $getstartlink @@ -990,26 +1030,4 @@ sub get_domain { return $codedom; } -sub cleanup_html { - my ($incoming) = @_; - my $outgoing; - if ($incoming ne '') { - $outgoing = $incoming; - $outgoing =~ s/;/;/g; - $outgoing =~ s/\#/#/g; - $outgoing =~ s/\&/&/g; - $outgoing =~ s//>/g; - $outgoing =~ s/\(/(/g; - $outgoing =~ s/\)/)/g; - $outgoing =~ s/"/"/g; - $outgoing =~ s/'/'/g; - $outgoing =~ s/\$/$/g; - $outgoing =~ s{/}{/}g; - $outgoing =~ s/=/=/g; - $outgoing =~ s/\\/\/g - } - return $outgoing; -} - 1;