Annotation of loncom/cgi/takeonline.pl, revision 1.4

1.1       www         1: #!/usr/bin/perl
1.3       raeburn     2: $|=1;
1.1       www         3: # Take machine online
                      4: #
1.4     ! raeburn     5: # $Id: takeonline.pl,v 1.3 2008/11/28 20:50:25 raeburn Exp $
1.1       www         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: 
1.3       raeburn    30: use strict;
                     31: use lib '/home/httpd/lib/perl/';
                     32: use Apache::lonlocal;
                     33: use LONCAPA::loncgi;
1.4     ! raeburn    34: use LONCAPA::lonauthcgi;
1.3       raeburn    35: 
                     36: print "Content-type: text/html\n\n";
                     37: 
                     38: &main();
                     39: 
                     40: sub main {
1.4     ! raeburn    41:     if (!&LONCAPA::lonauthcgi::check_ipbased_access('takeonline')) {
1.3       raeburn    42:         if (!&LONCAPA::loncgi::check_cookie_and_load_env()) {
                     43:             &Apache::lonlocal::get_language_handle();
                     44:             print &LONCAPA::loncgi::missing_cookie_msg();
                     45:             return;
                     46:         }
                     47: 
1.4     ! raeburn    48:         if (!&LONCAPA::lonauthcgi::can_view('takeonline')) {
1.3       raeburn    49:             &Apache::lonlocal::get_language_handle();
1.4     ! raeburn    50:             print &LONCAPA::lonauthcgi::unauthorized_msg('takeonline');
1.3       raeburn    51:             return;
                     52:         }
                     53:     }
                     54: 
                     55:     &Apache::lonlocal::get_language_handle();
                     56: 
                     57:     print '<html><body bgcolor="#FFFFFF"><h1>'.&Apache::lonlocal::mt('Take Online').'</h1>';
                     58:     system('cp /home/httpd/html/origindex.html /home/httpd/html/index.html');
                     59:     system('rm /home/httpd/html/lon-status/reroute.txt');
                     60:     print '</body></html>';
                     61: }

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