"Fossies" - the Fresh Open Source Software Archive

Member "absence-v2.1/cgi-bin/nph-absence-logout.pl" (10 Dec 2013, 2065 Bytes) of package /linux/www/web-absence-2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "nph-absence-logout.pl" see the Fossies "Dox" file reference documentation.

    1 #!/usr/bin/perl
    2 
    3 #======================================================================
    4 #    This file is part of Absence.
    5 #
    6 #    Absence is free software: you can redistribute it and/or modify
    7 #    it under the terms of the GNU General Public License as published by
    8 #    the Free Software Foundation, either version 3 of the License, or
    9 #    (at your option) any later version.
   10 #
   11 #    Absence is distributed in the hope that it will be useful,
   12 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
   13 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   14 #    GNU General Public License for more details.
   15 #
   16 #    You should have received a copy of the GNU General Public License
   17 #    along with Absence.  If not, see <http://www.gnu.org/licenses/>.
   18 #======================================================================
   19 
   20 # $Id: nph-absence-logout.pl 113 2013-12-10 23:24:16Z urban $
   21 
   22 use CGI;
   23 
   24 $CGI::POST_MAX = 300;
   25 $CGI::DISABLE_UPLOADS = 1;
   26 
   27 BEGIN {
   28     if ($ENV{QUERY_STRING} =~ /^instance=(\S+)$/) {
   29         # an instance has been specified
   30         $ENV{INSTANCE_NAME} = $1;
   31         $COOKIE_NAME = "absence-$1";
   32     } else {
   33         $COOKIE_NAME = 'absence';
   34     }
   35 }
   36 
   37 use AbsenceConfig;
   38 my $TOP_PAGE    = AbsenceConfig::fetch('top_page');
   39 my $AUTH_REALM  = AbsenceConfig::fetch('auth_realm');
   40 my $COLOR_MAIN  = AbsenceConfig::fetch('wp_main');
   41 my $VERSION     = '2.0.1';
   42 
   43 logout();
   44 
   45 #=========================================================================
   46 
   47 sub _logout
   48 {
   49     my $q = new CGI;
   50 
   51     print $q->redirect(
   52         -uri    => 'http://www.unix-wissen.de' . $TOP_PAGE,
   53         -nph    => 1,
   54         -www_authenticate   => qq[Digest realm="$AUTH_REALM"],
   55         -status => '401',
   56     );
   57 }
   58 
   59 sub logout
   60 {
   61     my $q = new CGI;
   62 
   63     print $q->header(
   64         -type               => 'text/html',
   65         -status             => '401 Authorization required',
   66         -expires            => '+3d',
   67         -charset            => 'utf-8',
   68         -nph                => 1,
   69         -www_authenticate   => qq[Digest realm="$AUTH_REALM"],
   70         ),
   71         $q->start_html(
   72             -title  => 'Absence: logged off',
   73             -BGCOLOR => $COLOR_MAIN,
   74             -script => "top.location = '$TOP_PAGE'",
   75         ),
   76         "logged off.",
   77         $q->end_html();
   78 }