[LON-CAPA-cvs] cvs: modules /raeburn/register Logout.pm

raeburn raeburn at source.lon-capa.org
Fri Mar 10 12:01:09 EST 2017


raeburn		Fri Mar 10 17:01:09 2017 EDT

  Modified files:              
    /modules/raeburn/register	Logout.pm 
  Log:
  - switch to Apache2/mod_perl2 calls.
  
  
Index: modules/raeburn/register/Logout.pm
diff -u modules/raeburn/register/Logout.pm:1.5 modules/raeburn/register/Logout.pm:1.6
--- modules/raeburn/register/Logout.pm:1.5	Mon Mar 11 02:23:14 2013
+++ modules/raeburn/register/Logout.pm	Fri Mar 10 17:01:09 2017
@@ -1,10 +1,14 @@
 package Apache::LON::Logout;
 
-# $Id: Logout.pm,v 1.5 2013/03/11 02:23:14 raeburn Exp $
+# $Id: Logout.pm,v 1.6 2017/03/10 17:01:09 raeburn Exp $
 
 use strict;
-use Apache::RequestRec();
-use Apache::Const qw(OK SERVER_ERROR);
+use Apache2::RequestRec ();
+use Apache2::RequestIO();
+use Apache2::Response();
+use Apache2::Access();
+use Apache2::Connection ();
+use Apache2::Const qw(OK SERVER_ERROR);
 use Apache::LON::processform;
 use DBI;
 use CGI::Cookie;
@@ -36,11 +40,11 @@
              );
 
   # Try to get the authentication cookie.
-    my %headers = $r->headers_in;
-    my %cookiejar = CGI::Cookie->parse($r->header_in('Cookie'));
+    my (%cookiejar) = CGI::Cookie->parse($r->headers_in->{Cookie});
 
     unless($cookiejar{$auth_name}) {
-        &print_html($r,$newurl);
+        $r->content_type('text/html');
+        $r->print(&print_html($newurl));
         return OK;
     }
 
@@ -58,31 +62,31 @@
         $dbh->do("DELETE FROM sessions WHERE id = '$sess_id'");
         $dbh->do("DELETE FROM loncapa_sessions WHERE id = '$sess_id'");
     }
+    $dbh->disconnect;
     my $auth_cookie = new CGI::Cookie (
                                       -name => $auth_name,
                                       -value => { uri => '/' },
                                       -path => '/'
+                                      -httponly => 1,
                                      );
-    $r->headers_out->set('Set-cookie' => $auth_cookie);
+    $r->err_headers_out->add('Set-cookie' => $auth_cookie);
     $r->content_type('text/html');
-    $r->send_http_header;
-    &print_html($r,$newurl);
-    $dbh->disconnect;
+    $r->print(&print_html($newurl));
     return OK;
 }
 
 sub print_html {
-    my ($r,$newurl) = @_;
+    my ($newurl) = @_;
     my $output;
     if ($newurl eq '') {
-        $newurl = "http://loncapa.org/conferences.html";
+        $newurl = "http://loncapa.org/events.html";
     } 
     $output .= <<"END";
 <html>
 <head>
 <title>LON-CAPA support system logout</title>
 <meta http-equiv="pragma" content="no-cache" />
-<meta HTTP-EQUIV="Refresh" CONTENT="10; url=$newurl" />
+<meta HTTP-EQUIV="Refresh" CONTENT="1; url=$newurl" />
 <link type="text/css" rel="stylesheet" href="/css/registration.css">
 END
     &main_box(\$output);
@@ -90,13 +94,14 @@
 <h3>You have successfully logged out</h3>
 If this page does not automatically refresh in a few seconds, please click <a href="$newurl"><u>Continue</u></a>.<br /><br />
     </td>
-    <td align="right" valign="top" width="10"><img src="/images/login/lclogin_r1_c7.gif" width="10" height="10" border="0" alt="">
+    <td align="right" valign="top" width="10"><img src="/images/login/lclogin_r1_c7.gif" width="10" height="10" border="0" alt="" /></td>
+  </tr>
 END
     &main_footer(\$output);
     $output .= <<"END";  
 </body>
 END
-    $r->print($output);
+    return $output;
 }
 
 sub main_box {
@@ -160,11 +165,11 @@
     <td width="698" nowrap valign="top">
       <table border="0" cellpadding="0" cellspacing="0" width="450" class="LC_register">
         <tr>
-          <td width="15" rowspan="2" nowrap><spacer type="block" width="15"></td>
-          <td width="266" align="left" nowrap><img src="/images/login/lonlogos.gif" width="74" height="50" align="left"><br /><nobr><font size="-1">The Learning<i>Online</i> Network with CAPA</font></nobr></td>
-           <td width="15" nowrap><spacer type="block" width="15"></td>
-           <td width="130" align="left" nowrap><img src="/images/login/student.jpg" rowspan="2" width="130" height="85"></td>
-           <td width="24" rowspan="2" nowrap><spacer type="block" width="20"></td>
+          <td width="15"> </td>
+          <td width="74" align="left"><img src="/images/login/lonlogos.gif" width="74" height="50" align="left" alt="logo" /></td>
+          <td width="15"> </td>
+          <td width="320" align="left"><font size="-1"><span style="white-space: nowrap;">The Learning<i>Online</i> Network with CAPA</span></font></td>
+          <td width="26"> </td>
         </tr>
         <tr>
         <td colspan="5" width="450" height="8" class="LC_darker"></td>
@@ -176,10 +181,6 @@
 sub main_footer {
     my $output= shift;
     $$output .= <<"END_OF_FOOT";
-   </td>
- </tr>
-</table>
-<table width="720" border="0" cellpadding="0" cellspacing="0" class="LC_register">
   <tr>
     <td align="left" valign="bottom" width="10"><img src="/images/login/lclogin_r9_c1.gif" width="12" height="10" border="0" alt=""></td>
     <td width="696" nowrap><spacer type="block" width="696"></td>




More information about the LON-CAPA-cvs mailing list