Files
2026-03-10 21:31:43 +08:00

72 lines
1.9 KiB
Perl

# Selima Website Content Management System
# LogOut.pm: The log-out processor.
# Copyright (c) 2006-2018 imacat.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Author: imacat <imacat@mail.imacat.idv.tw>
# First written: 2006-03-19
package Selima::Processor::LogOut;
use 5.008;
use strict;
use warnings;
use base qw(Selima::Processor);
use Selima::ChkPriv;
use Selima::Guest;
use Selima::LogIn;
use Selima::LogOut;
use Selima::Logging;
use Selima::ScptPriv;
use Selima::ShortCut;
# new: Initialize the processor
sub new : method {
local ($_, %_);
my ($self, $class);
($class, @_) = @_;
$self = $class->SUPER::new(@_);
$self->{"sn"} = get_login_sn;
$self->{"is_sql"} = 0;
$self->{"modified"} = 1;
$self->{"is_admin"} = is_guest()? is_admin_script: is_admin;
return $self;
}
# _save_cols: Save the column deposit
# Make it a null function
sub _save_cols : method {}
# _other_tasks: Perform tasks other than column updates
sub _other_tasks : method {
$_[0]->{"userid"} = get_login_id;
logout;
}
# _actlog: Log the activity
sub _actlog : method {
# Log the guest log out, too
return actlog "Log out with s/n " . $_[0]->{"sn"} . ".", $_[0]->{"userid"};
}
# _ret_status: Return the process status
sub _ret_status : method {
return {"msg"=>N_("You have successfully logged out."),
"isform"=>0,
"is_admin"=>$_[0]->{"is_admin"}};
}
return 1;