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_test.pl
< prev
next >
Wrap
Perl Script
|
2017-09-21
|
4KB
|
174 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
#
# 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
#
# éóéδéóéδé╚ò╧Éöé╠âZâbâg
#
$date = `date`;
chop($date);
#
# âRâüâôâgé≡Æ╟ïLé╖éΘâtâ@âCâïé╠ê╩Æué≡ô╛éΘ
#
$ac_comment_file = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments_test.html";
$ac_comment_url = "http://chat.expo96.ad.jp/Japan/Theme/sense";
$ac_tmp = "/stage/htdocs/Japan/Theme/logs/theme_ac_comments_test.html.new";
#
# HTMLâwâbâ_Åoù═
#
#print "Content-type: text/html\n\n";
print "Location: http://chat.expo96.ad.jp/Japan/Theme/forStaff/\n\n";
#
# âRâüâôâgé¬ï≤é╚éτÅIù╣
#
if (!$in{'theme_comment_translated'}) {
&err("Sorry, your comment seems contains no data.\n");
}
#
# é╛éΩé⌐é¬Åæé½ì₧é±é┼éóéΘè╘é═æ╥é┬
# éáé▄éΦæ╥é┬é╚éτÅIù╣
#
for($count = 0; -f "$ac_tmp"; $count++) {
sleep(1);
&err("Sorry, another person is writing now.") if ($count > 5);
}
#
# âRâüâôâgé╠É«î`(ëⁿìsëⁿìsé≡<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;
#
# Æ╟ïLâtâ@âCâïé╔ûäé▀ì₧é±é┼üAtmpé╔Åæé½é╛é╖
#
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 é╠ôαùeé≡âRâüâôâgé╠HTMLâtâ@âCâïé╓ÅπÅæé½
#
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);
#
# ÉVé╡éóôαùeé≡òWÅÇÅoù═é╓Åoù═
#
#open (FILE, "<$ac_comment_file") || &err("Can not open comment file");
#while(<FILE>) {
# &ac_kprint($_);
#}
#
# tmp âtâ@âCâïìφÅ£
#
unlink "$ac_tmp";
#
# ÅIù╣
#
exit(0);
### sub routines ###
#
# JIS é┼printé╖éΘ
#
sub ac_kprint {
($ac_print_line) = @_;
$code = &jcode'convert(*ac_print_line, 'jis');
print "$ac_print_line";
}
#
# âGâëü[é╠ÅΩìç
#
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;
}