#!/usr/bin/perl #+----------------------------------------+ #| スレッド表示対応掲示板 | #| - BULLETIN BOARD Pro - Ver1.0 98/01/31 | #| bbpro_view2.cgi | #| (c)1997-8 Takeshi Iwanami | #| akira67@po.jah.or.jp | #| http://www.jah.or.jp/~akira67/perl/ | #| ※このスクリプト群はシェアウエアです。 | #| ※継続使用の場合はレジスト料金をお支払 | #| いの上ご利用ください。 | #| ※サポートページの利用規定を遵守してく | #| ださい。再配布および転貸等は一切認めな | #| いものとします。 | #+----------------------------------------+ # このスクリプトは、発言内容を表示するためのものです。 use Pg; use CGI::Carp qw(fatalsToBrowser); require 'jcode.pl'; require 'bbpro_lib_.pl'; require 'bbpro_conf.pl'; require 'tag.pl'; &setver; &conf; umask 0; $ENV{"PGCLIENTENCODING"} = "SJIS"; $border_date = &date_formatting2(time - $new_term * 60 * 60); $query_string = $ENV{'QUERY_STRING'}; &error('引数の指定が間違っています。') if $query_string !~ /^\d{4}$/; $db = Pg::connectdb("dbname = bbpro user = postgres"); $sql = "select * from log where msg_no='$query_string'"; $dataset = $db->exec($sql); if ($msg = $db->errorMessage) { &error($msg,$sql); } if (@data = $dataset->fetchrow) { foreach (@data) { &jcode'convert(*_, 'sjis'); } ($msg_no,$stat,$sled,$g_parent,$parent,$child,$date,$subject,$name, $email,$url,$comment,$remote_host,$user_agent,$passwd,$pre, $script_name,$comment2,$solved,$email_open,$email_send) = @data; $date = date_formatting($date,$date_form); $comment = html_output_escape($comment); $comment2 = html_output_escape($comment2); $subject = html_output_escape($subject); } else { &error("指定された投稿番号(No.$query_string)のデータがありません。"); } $solved = $solved ? "[解決!]" : ""; my %script_name; open(R, "script_name.txt") or error("script_name.txtが開けませんでした。: $!"); while () { chomp; my($k, $v) = split(/\t/); $script_name{$k} = $v; } $sql = "select msg_no,stat,sled, case when parent is null then '0' when parent='' then '0' when msg_no=g_parent then '0' else parent end, subject,name,date,solved from log where g_parent='$g_parent' order by msg_no"; $dataset = $db->exec($sql); if ($msg = $db->errorMessage) { &error($msg,$sql); } while (@data= $dataset->fetchrow) { @d{qw(msg_no stat thread parent subject name date solved)} = @data; jcode::convert(\$d{subject}, 'sjis'); jcode::convert(\$d{name}, 'sjis'); $d{solved} = $d{solved} ? "[解決!]" : ""; if ($d{stat} == -1) { $d{subject} = "(投稿者削除)"; $d{name} = ""; $d{date} = ""; $d{ref_cnt} = ""; } elsif ($d{stat} == 0) { $d{subject} = "(管理者削除)"; $d{name} = ""; $d{date} = ""; $d{ref_cnt} = ""; } else { $d{subject} = html_output_escape($d{subject}); $d{subject} = "$d{subject}$d{solved}"; } if ($d{date} ge $border_date) { $d{new_dsp} = ""; } else { $d{new_dsp} = ""; } $d{date} = sprintf("%d/%d/%d %02d:%02d:%02d", split(/\D+/, $d{date})); $list_format_ = $list_format; # $d{subject} = html_output_escape($d{subject}); $list_format_ =~ s/##([^#]+)##/$d{$1}/eg; $g_parent{$g_parent} = 1; $data{$g_parent}{$d{msg_no}} = [$d{msg_no}, $d{thread}, $list_format_]; defined $parent{$d{parent}} ? ($parent{$d{parent}} .= ",$d{msg_no}") : ($parent{$d{parent}} = $d{msg_no}); } foreach $no(sort { $a <=> $b } keys %{$data{$g_parent}}) { mk_thread($g_parent,$no); } $liststr .= mk_thread2($g_parent); $deleted_by = '投稿者' if $stat eq '-1'; $deleted_by = '管理人' if $stat eq '0'; if ($deleted_by) { &error('指定された発言は'.$deleted_by.'によって削除されています。'); } $sql = "update ref_no set cnt=cnt+1 where msg_no='$query_string'"; $dataset = $db->exec($sql); if ($msg = $db->errorMessage) { &error($msg,$sql); } $sql = "select cnt from ref_no where msg_no='$query_string'"; $dataset = $db->exec($sql); if ($msg = $db->errorMessage) { &error($msg,$sql); } ($ref_cnt) = $dataset->fetchrow; %admin_addr = map { $_ => 1 } qw( 122.249.89.192 203.189.48.99 219.111.0.17 ); unless ($email_open) { $email = "" unless $admin_addr{$ENV{REMOTE_ADDR}}; } my $admin_dellink = $admin_addr{$ENV{REMOTE_ADDR}} ? <この発言を削除する] STR $comment = mk_body($comment, $pre); $comment2 = mk_body($comment2, $pre); $comment2 = $admin_addr{$ENV{REMOTE_ADDR}} ? qq{$comment2} : ""; if ($url) { $url_dsp = <URL : $url STR } if ($script_name) { $script_name_dsp = qq{(関連プログラム名:$script_name{$script_name})}; } print <$title $msg_no $subject$solved $script_name_dsp $res 投稿日時 : $date 投稿者 : $name 接続元 : $remote_host 閲\覧数 : $ref_cnt $url_dsp $comment $comment2 [返事を投稿する] $admin_dellink ☆スレッドリンク☆ $liststr $sfooter HTML exit;
} : ""; if ($url) { $url_dsp = <URL : $url STR } if ($script_name) { $script_name_dsp = qq{(関連プログラム名:$script_name{$script_name})}; } print <$title $msg_no $subject$solved $script_name_dsp $res 投稿日時 : $date 投稿者 : $name 接続元 : $remote_host 閲\覧数 : $ref_cnt $url_dsp $comment $comment2 [返事を投稿する] $admin_dellink ☆スレッドリンク☆ $liststr $sfooter HTML exit;
$comment2 [返事を投稿する] $admin_dellink