home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet 1996 World Exposition
/
park.org.s3.amazonaws.com.7z
/
park.org.s3.amazonaws.com
/
cgi-bin
/
Japan
/
Theme
/
theme_add_comment_translated.pl
< prev
next >
Wrap
Perl Script
|
2017-09-21
|
4KB
|
171 lines
#!/usr/local/bin/perl
# theme_add_comment_translated.pl
# Comments construction program in Japan theme pavilion
# to add translated comment to English comments file
#
# 96/03/08 by haruki@st.rim.or.jp
# 96/03/27 updated by haruki@st.rim.or.jp
#
# THIS CODE USES THESE LIBRARIES
#
# cgi-lib.pl Copyright 1994 Steven E. Brenner
#
# jcode.pl Copyright (c) 1991,1992 Software Research Associates, Inc.
# Original by srekcah@sra.co.jp, Feb 1992
# Maintained by Kazumasa Utashiro <utashiro@sra.co.jp>
#
require 'cgi-lib.pl';
require 'jcode.pl';
&ReadParse(*in); # initialize for cgi-lib
#
# ñññφñññφñ╩╩╤┐⌠ñ╬Ñ╗Ñ├Ñ╚
#
$date = `date`;
chop($date);
#
# Ñ│ÑßÑ≤Ñ╚ñ≥─╔╡¡ñ╣ñδÑ╒ÑíÑñÑδñ╬░╠├╓ñ≥╞└ñδ
#
$ac_comment_file = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments_e.html";
$ac_comment_url = "http://chat.expo96.ad.jp/Japan/Theme/sense";
$ac_tmp = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments_e.html.new";
#
# HTMLÑ╪Ñ├Ñ└╜╨╬╧
#
print "Location: http://chat.expo96.ad.jp/Japan/Theme/forStaff/\n\n";
#
# Ñ│ÑßÑ≤Ñ╚ñ¼╢⌡ñ╩ñΘ╜¬╬╗
#
if (!$in{'theme_comment_translated'}) {
&err("Sorry, your comment seems contains no data.\n");
}
#
# ñ└ñ∞ñ½ñ¼╜±ñ¡╣■ñ≤ñ╟ñññδ┤╓ñ╧┬╘ñ─
# ñóñ▐ñΩ┬╘ñ─ñ╩ñΘ╜¬╬╗
#
for($count = 0; -f "$ac_tmp"; $count++) {
sleep(1);
&err("Sorry, another person is writing now.") if ($count > 5);
}
#
# Ñ│ÑßÑ≤Ñ╚ñ╬└░╖┴(▓■╣╘▓■╣╘ñ≥<p>ñ╦)
#
$in{'theme_comment_translated'} =~ s/\r//g;
$in{'theme_comment_translated'} =~ s/\n\n/<\/p><p>/g;
$in{'theme_comment_translated'} =~ s/\n//g;
$in{'theme_comment_translated'} =~ s/<p><\/p>//g;
#
# ─╔╡¡Ñ╒ÑíÑñÑδñ╦╦Σñß╣■ñ≤ñ╟íótmpñ╦╜±ñ¡ñ└ñ╣
#
open (TMP, ">$ac_tmp") || &err("Can not open temporary file");
open (FILE, "$ac_comment_file") || &err("Can not open comment file");
while(<FILE>) {
if (/<!---INSERT HERE--->/) {
if ($in{'commenter'} eq "Readers' Comment") {
print TMP "<!---INSERT HERE--->\n";
print TMP "<!------------ Comments from user ---------->\n";
print TMP "<table width=450>\n<tr><td width=33 valign=top>\n";
print TMP "<img src=\"$ac_comment_url/image/zo1.gif\"";
print TMP "width=32 height=23>\n</td>\n<td width=300>\n";
if ($in{'theDate'}) {
print TMP "<font size=1><b>$in{'theDate'}<br>\n";
} else {
print TMP "<font size=1><b>$date (Japan)<br>\n";
}
if ($in{'theName'}) {
print TMP "From: $in{'theName'}<br>";
}
print TMP "translated at: $date<br>";
print TMP "</b></font><br>";
$code = &jcode'convert($in{'theme_comment_translated'}, 'jis');
print TMP "$in{'theme_comment_translated'}";
print TMP "</p></td><td width=67></td></tr>\n</table>\n";
} elsif ($in{'commenter'} eq "Staff Comment") {
print TMP "<!---INSERT HERE--->\n";
print TMP "<!------------ Comments from staff ---------->\n";
print TMP "<table width=450>\n<tr><td width=107></td>\n";
print TMP "<td width=280>\n";
if ($in{'theDate'}) {
print TMP "<font size=1><b>$in{'theDate'}<br>\n";
} else {
print TMP "<font size=1><b>$date (Japan)<br>\n";
}
print TMP "translated at: $date<br>";
print TMP "From: \"sensorium\" staff</b></font><br><br>";
$code = &jcode'convert($in{'theme_comment_translated'}, 'jis');
print TMP "$in{'theme_comment_translated'}";
print TMP "</p>";
print TMP "<td width=33 valign=top><img src=\"$ac_comment_url/image/zo2.gif\"></td>\n";
print TMP "</tr>\n</table>\n";
}
} else {
print TMP $_;
}
}
close(FILE);
close(TMP);
#
# tmp ñ╬╞Γ═╞ñ≥Ñ│ÑßÑ≤Ñ╚ñ╬HTMLÑ╒ÑíÑñÑδñ╪╛σ╜±ñ¡
#
open (TMP, "<$ac_tmp") || &err("Can not open tmp file");
open (FILE, ">$ac_comment_file") || &err("Can not open comment file");
while(<TMP>) {
print FILE $_;
}
close(FILE);
close(TMP);
#
#╔╕╜α╜╨╬╧ñ╪ñ╬╜╨╬╧ñ╧ñ╖ñ╩ññ
#
#
# tmp Ñ╒ÑíÑñÑδ║∩╜ⁿ
#
unlink "$ac_tmp";
#
# ╜¬╬╗
#
exit(0);
### sub routines ###
#
# JIS ñ╟printñ╣ñδ
#
sub ac_kprint {
($ac_print_line) = @_;
$code = &jcode'convert(*ac_print_line, 'jis');
print "$ac_print_line";
}
#
# Ñ¿ÑΘí╝ñ╬╛∞╣τ
#
sub err{
print "<html><head>\n";
print "<title>result</title>";
print "</head><body bgcolor=\"#ffffff\">\n";
local($msg) = @_;
print "<p>$msg</p>\n";
close FILE;
close TMP;
unlink "$ac_tmp";
print "</BODY></HTML>\n";
exit;
}