Files
selima-perl/htdocs/wov/magicat/archive/cgi-bin/guestbook.cgi
2026-03-10 21:31:43 +08:00

146 lines
4.0 KiB
Perl
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#! /usr/bin/perl -w
# Woman's Voice
# 1-guestbook.cgi: The guestbook.
# Copyright (c) 2003-2021 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: 2003-04-06
use 5.008;
use utf8;
use strict;
use warnings;
use lib $ENV{"DOCUMENT_ROOT"} . qw(/magicat/lib/perl5);
use Selima::wov;
local $SIG{"__DIE__"} = \&http_500;
my $d = new Selima::Destroy;
# Prototype declaration
sub main();
sub check_get();
sub check_post();
sub html_page($);
sub html_foreword();
initenv(-session => 0,
-this_table => "guestbook",
-dbi_lock => {"guestbook" => LOCK_EX},
-lastmod => 1,
-page_param => {"keywords" => N_("your voice"),
"class" => "guestbook",
"javascripts" => [qw(/scripts/guestbook.js)]});
main;
exit 0;
sub main() {
local ($_, %_);
my ($error, $processor);
# If the request is a GET query
if ($ENV{"REQUEST_METHOD"} ne "POST") {
$error = check_get;
# If an error occurs
if (defined $error) {
html_page $error;
# Display the page
} else {
html_page retrieve_status;
}
# If a form was POSTed from the client
} else {
$error = check_post;
# If an error occurs
if (defined $error) {
error_redirect $error;
# Else, save the data
} else {
$processor = new Selima::wov::Processor::Guestbook::Public($POST);
$processor->process;
http_303 $REQUEST_FILE;
}
}
return;
}
# check_get: Check the GET arguments
sub check_get() {
local ($_, %_);
# Old styled page number
http_301 $REQUEST_FILE if defined $GET->param("no");
# List handler handles its own error
return;
}
# check_post: Check the POSTed form
sub check_post() {
local ($_, %_);
my ($checker, $error);
# Run the checker
$checker = new Selima::wov::Checker::Guestbook::Public(curform);
$error = $checker->check(qw(message name identity location
email url flood dup spam));
return $error if defined $error;
# OK
return;
}
# html_page: Display the page
sub html_page($) {
local ($_, %_);
my ($status, $LIST, $FORM, $args);
$status = $_[0];
$FORM = new Selima::wov::Form::Guestbook::Public($status);
$LIST = new Selima::wov::List::Guestbook::Public;
$args = $LIST->page_param;
html_header "妳的女聲", "Your Voice", $args;
html_foreword;
html_errmsg $status;
$FORM->html;
$LIST->html;
html_footer $args;
return;
}
##################################
# Subroutines to manage the data #
##################################
# html_foreword: Print the HTML foreword
sub html_foreword() {
local ($_, %_);
print << "EOT";
<div class="intro">
<p>發聲就是政治是權力是對主體性的要求</p>
<p>女聲就是女人的聲音聲音有的好聽有的不好聽有的悅耳有的嘈雜
也許\是學者是政要是學生是女兒是媽媽是女同性戀是雙性戀
女工是菲傭是公娼是私娼是雛妓是打工辣妹是家庭主婦是心理
女性可能都是也可能都不是這些都是女人她們的聲音都同等重要
差異中尋求最適合自己的生存策略</p>
<p>更重要的是身為女人是政治行動不只是天生的命運</p>
</div>
EOT
return;
}
no utf8;