146 lines
4.0 KiB
Perl
Executable File
146 lines
4.0 KiB
Perl
Executable File
#! /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;
|