1 |
wakaba |
1.1 |
#!/usr/bin/perl |
2 |
|
|
## This file is euc-jisx0213 encoding. |
3 |
|
|
|
4 |
wakaba |
1.3 |
#use Suika::CGI; |
5 |
wakaba |
1.1 |
$myvesion = '1.00 (2001-08-22)'; |
6 |
|
|
|
7 |
|
|
$about_perl = <<"EOH"; |
8 |
|
|
<address class="version" style="font-size: 50%"> |
9 |
|
|
FlasH BBS Pro v1.41 [��<a href="http://www7.big.or.jp/~jawa/">Shigeto Nakazawa</a>] ��١�����<a href="http://www.ne.jp/asahi/minazuki/bakera/">��̵��Ф���</a>����¤ |
10 |
|
|
+ <a href="mailto:wakaba\@suika.fam.cx">����</a>�� quick hack $myversion |
11 |
|
|
</address> |
12 |
|
|
EOH |
13 |
|
|
|
14 |
|
|
## h12-05-06 ��̵��Ф��� <bakera@star.email.ne.jp> |
15 |
|
|
## h09-01-17 �����@��߷�ſ� <jawa@big.or.jp> |
16 |
|
|
## FlasH BBS Pro 1.41 <http://www7.big.or.jp/~jawa/> |
17 |
|
|
|
18 |
|
|
#�������� |
19 |
|
|
$max_size = 512 * 1024; |
20 |
|
|
$max_msg = 2000; |
21 |
|
|
$admin_email = 'blue-oceans@suika.fam.cx'; |
22 |
|
|
$this_name = 'board'; |
23 |
|
|
$gif_allnews = ''; |
24 |
|
|
$gif_news = ''; |
25 |
|
|
$gif_new_news = ''; |
26 |
|
|
$gif_width = 20; |
27 |
|
|
$gif_height = 14; |
28 |
|
|
$default_title = '��̾������Ʋ�����'; |
29 |
|
|
$default_name = '��̾����ɤ���'; |
30 |
|
|
$default_email = '�Żҥᥤ�륢�ɥ쥹��ɤ�����(��ά��ǽ)'; |
31 |
|
|
$default_comment = '��ʸ��ɤ���'; |
32 |
|
|
$arc_dir = './log/'; |
33 |
|
|
$log_dir = './log/'; |
34 |
|
|
$base_url = "http://suika.fam.cx/~okuchuu/blue-oceans/"; |
35 |
|
|
$rfc_base_uri = 'http://dnsbalance.ring.gr.jp/pub/doc/RFC'; |
36 |
|
|
$logfile = $log_dir.'bo.log'; |
37 |
|
|
|
38 |
|
|
#���å��ե����븡�л��Υ�ȥ饤��� |
39 |
|
|
$retry = 3; |
40 |
|
|
|
41 |
|
|
#ʸ�������� |
42 |
|
|
$mojicode = "euc"; |
43 |
wakaba |
1.3 |
require 'jcode.pl'; |
44 |
wakaba |
1.1 |
|
45 |
|
|
#NN2 �� charset=EUC-JP ������Ȳ�����餷���� |
46 |
|
|
if( $ENV{'HTTP_USER_AGENT'} =~ /compatible/ ){ |
47 |
|
|
$charset = ';charset=EUC-JP'; |
48 |
|
|
}elsif( $ENV{'HTTP_USER_AGENT'} =~ /Mozilla\/2.0/ ){ |
49 |
|
|
$charset = ''; |
50 |
|
|
}else{ |
51 |
|
|
$charset = ';charset=EUC-JP'; |
52 |
|
|
} |
53 |
|
|
|
54 |
|
|
&read_form; |
55 |
|
|
|
56 |
|
|
#�ѥ����ν��� |
57 |
|
|
#�ǥե���� |
58 |
|
|
$uri_mode = 'all'; |
59 |
|
|
$tree = 0; |
60 |
|
|
$new_kiji = 10; |
61 |
|
|
$max_tree = 10; |
62 |
|
|
$nazo = ''; |
63 |
|
|
$indent = 'ul'; |
64 |
|
|
$max_depth = 40; |
65 |
|
|
$margin = 3; |
66 |
|
|
|
67 |
|
|
$ID = $OPT{'id'}; |
68 |
|
|
$uri_query = "id=$ID"; |
69 |
|
|
$form_query = "<input type=\"hidden\" name=\"id\" value=\"$ID\">"; |
70 |
|
|
if($OPT{'link'}){ |
71 |
|
|
$uri_mode = $OPT{'link'}; |
72 |
|
|
&add_query('link', $uri_mode); |
73 |
|
|
} |
74 |
|
|
if($OPT{'tree'}){ |
75 |
|
|
$tree = $OPT{'tree'}; |
76 |
|
|
&add_query('tree', $tree); |
77 |
|
|
} |
78 |
|
|
if($OPT{'new_kiji'}){ |
79 |
|
|
$new_kiji = $OPT{'new_kiji'}; |
80 |
|
|
&add_query('new_kiji', $new_kiji); |
81 |
|
|
} |
82 |
|
|
if($OPT{'tmp_new_kiji'}){ |
83 |
|
|
$new_kiji = $OPT{'tmp_new_kiji'}; |
84 |
|
|
#���Υѥ����ϥ������ȿ�Ǥ��ʤ��� |
85 |
|
|
} |
86 |
|
|
if($OPT{'max_tree'}){ |
87 |
|
|
$max_tree = $OPT{'max_tree'}; |
88 |
|
|
&add_query('max_tree',$max_tree); |
89 |
|
|
} |
90 |
|
|
if($OPT{'nazo'}){ |
91 |
|
|
$nazo = $OPT{'nazo'}; |
92 |
|
|
&add_query('nazo', $nazo) if ( $nazo ne 'only' ); |
93 |
|
|
} |
94 |
|
|
if($OPT{'indent'}){ |
95 |
|
|
$indent = $OPT{'indent'}; |
96 |
|
|
&add_query('indent', $indent); |
97 |
|
|
} |
98 |
|
|
if($OPT{'max_depth'}){ |
99 |
|
|
$max_depth = $OPT{'max_depth'}; |
100 |
|
|
&add_query('max_depth', $max_depth); |
101 |
|
|
} |
102 |
|
|
if($OPT{'margin'}){ |
103 |
|
|
$margin = $OPT{'margin'}; |
104 |
|
|
&add_query('margin', $margin); |
105 |
|
|
} |
106 |
|
|
|
107 |
|
|
$cookie_name = 'board'; |
108 |
|
|
$title = '�֥롼��������Ǽ���'; |
109 |
|
|
$backurl = '../top'; |
110 |
|
|
$back_name = '�ܼ�'; |
111 |
|
|
$html_info = ''; |
112 |
|
|
$link_element = ''; |
113 |
|
|
## Administrator |
114 |
|
|
$address_element = "<address><a href=\"mailto:blue-oceans\@suika.fam.cx\">�֥롼���������</a></address>"; |
115 |
|
|
|
116 |
|
|
|
117 |
|
|
$defhead = <<"EOH"; |
118 |
|
|
|
119 |
wakaba |
1.2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
120 |
wakaba |
1.1 |
<html lang="ja"> |
121 |
|
|
<head> |
122 |
|
|
<title>$title</title> |
123 |
wakaba |
1.2 |
<link rel="stylesheet" href="/s/simpledoc"> |
124 |
|
|
<link rel="stylesheet" href="../bo-style"> |
125 |
wakaba |
1.1 |
<link rel="index" href="../top" /> |
126 |
|
|
</head> |
127 |
|
|
<body> |
128 |
|
|
<h1>$title</h1> |
129 |
|
|
EOH |
130 |
|
|
$def_header_http = <<EOH; |
131 |
|
|
Content-Type: text/html; charset=euc-jisx0213 |
132 |
|
|
Content-Language: ja |
133 |
|
|
Content-Style-Type: text/css |
134 |
|
|
Content-Script-Type: text/javascript |
135 |
|
|
|
136 |
|
|
EOH |
137 |
|
|
|
138 |
|
|
$deffoot = <<"EOH"; |
139 |
|
|
$address_element |
140 |
|
|
$about_perl |
141 |
|
|
</body></html> |
142 |
|
|
EOH |
143 |
|
|
|
144 |
|
|
$navi_usage = '<div class="navi"><p>['; |
145 |
|
|
$navi_ichiran = "<a href=\"$this_name?$uri_query\">����ɽ��</a>"; |
146 |
|
|
$navi_num = " / <a href=\"$this_name?$uri_query;md=num\">�ǿ�����</a>"; |
147 |
|
|
$navi_new = " / <a href=\"$this_name?$uri_query;md=new\">�������</a>"; |
148 |
|
|
$navi_back = " / <a href=\"$backurl\">$back_name</a> ]</p></div>"; |
149 |
|
|
$html_navi = "<p class=\"navi\">$navi_usage$navi_ichiran$navi_num$navi_new$navi_back</p>"; |
150 |
|
|
|
151 |
|
|
|
152 |
|
|
## |
153 |
|
|
|
154 |
|
|
&get_cookie; |
155 |
|
|
if ($nazo eq 'only') {&nazo_only; } |
156 |
|
|
elsif ($OPT{'md'} eq 'reg') {®ist; } |
157 |
|
|
elsif ($OPT{'md'} eq 'del') {&delete; } |
158 |
|
|
elsif ($OPT{'md'} eq 'viw') {&view; } |
159 |
|
|
elsif ($OPT{'md'} eq 'new') { |
160 |
|
|
$html_navi = "<p class=\"navi\">$navi_usage$navi_ichiran$navi_num$navi_back"; |
161 |
|
|
&html_form('root'); |
162 |
|
|
} |
163 |
|
|
elsif ($OPT{'md'} eq 'set') { &set; } |
164 |
|
|
elsif ($OPT{'md'} eq 'num') { |
165 |
|
|
$html_navi = "<p class=\"navi\">$navi_usage$navi_ichiran$navi_new$navi_back"; |
166 |
|
|
&number; |
167 |
|
|
} |
168 |
|
|
else { |
169 |
|
|
$html_navi = "<p class=\"navi\">$navi_usage$navi_num$navi_new$navi_back"; |
170 |
|
|
&ichiran; |
171 |
|
|
} |
172 |
|
|
&html_footer; |
173 |
|
|
exit 0; |
174 |
|
|
|
175 |
|
|
# [ �إå�����ʬɽ�� ] |
176 |
|
|
# |
177 |
|
|
|
178 |
|
|
sub html_header { |
179 |
|
|
my($sub_title) = @_; |
180 |
|
|
my $s; |
181 |
|
|
if ($sub_title) { |
182 |
|
|
$s = <<"_EOF_"; |
183 |
|
|
Content-Type: text/html; charset=euc-jisx0213 |
184 |
|
|
Content-Language: ja |
185 |
|
|
Content-Style-Type: text/css |
186 |
|
|
Content-Script-Type: text/javascript |
187 |
|
|
|
188 |
wakaba |
1.2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"> |
189 |
wakaba |
1.1 |
<html lang="ja"> |
190 |
|
|
<head> |
191 |
wakaba |
1.2 |
<link rel="stylesheet" href="/s/simpledoc"> |
192 |
|
|
<link rel="stylesheet" href="../bo-style"> |
193 |
wakaba |
1.1 |
$link_element |
194 |
|
|
<title>$title ($sub_title)</title> |
195 |
|
|
_EOF_ |
196 |
|
|
|
197 |
|
|
if($indent eq 'css'){ |
198 |
|
|
my($i, $tmp_margin); |
199 |
wakaba |
1.2 |
$s .= '<style type="text/css">'; |
200 |
wakaba |
1.1 |
for( $i = 1; $i <= $max_depth; $i++ ){ |
201 |
|
|
$tmp_margin = $margin * $i; |
202 |
|
|
print ".lv$i\{margin-left:$tmp_margin\%\}"; |
203 |
|
|
} |
204 |
wakaba |
1.2 |
$s .= '</style>'; |
205 |
wakaba |
1.1 |
} |
206 |
|
|
$s .= <<"_EOF_"; |
207 |
|
|
</head> |
208 |
|
|
<body> |
209 |
|
|
<h1><a name="top">$title</a></h1> |
210 |
|
|
$html_navi |
211 |
|
|
<h2>$sub_title</h2> |
212 |
|
|
_EOF_ |
213 |
|
|
return $s; |
214 |
|
|
} |
215 |
|
|
print $s; |
216 |
|
|
} |
217 |
|
|
|
218 |
|
|
sub html_footer { |
219 |
|
|
print<<"_EOF_"; |
220 |
|
|
$deffoot |
221 |
|
|
_EOF_ |
222 |
|
|
} |
223 |
|
|
|
224 |
|
|
# [ ����ɽ�� ] |
225 |
|
|
# |
226 |
|
|
|
227 |
|
|
sub ichiran { |
228 |
|
|
&set_cookie; |
229 |
wakaba |
1.2 |
local($s) = &html_header('��������'); |
230 |
wakaba |
1.1 |
|
231 |
|
|
#�����ɤ߽Ф� |
232 |
wakaba |
1.3 |
open(LOG, $logfile) or die qq(open: $logfile: $!); #&Suika::CGI::Error::die('open', file => $logfile); |
233 |
wakaba |
1.1 |
print $s; |
234 |
|
|
my($count, $last_nj); |
235 |
|
|
$count = <LOG>;chop($count); |
236 |
|
|
$last_nj = <LOG>;chop($last_nj); |
237 |
|
|
|
238 |
|
|
if( $indent eq 'css' || $indent eq 'ul' ){ |
239 |
|
|
$prt_elm = 'ul'; |
240 |
|
|
$cld_elm = 'li'; |
241 |
|
|
}else{ |
242 |
|
|
$prt_elm = 'div'; |
243 |
|
|
$cld_elm = 'p'; |
244 |
|
|
} |
245 |
|
|
|
246 |
|
|
print $html_info; |
247 |
wakaba |
1.2 |
print '<div class="set">'; |
248 |
wakaba |
1.1 |
print "<p><em class=\"note\">([��]������ȴ�Ϣ������ޤ�ư��ɽ���Ǥ��ޤ���)</em></p>\n"; |
249 |
|
|
$tree = int($tree/$max_tree) * $max_tree; |
250 |
|
|
$end_tree = $tree + $max_tree; |
251 |
|
|
my($tree_count) = 0; |
252 |
|
|
while (<LOG>) { |
253 |
|
|
my($last_lx) = -1; |
254 |
|
|
$tree_count++; |
255 |
|
|
next if $tree_count <= $tree; |
256 |
|
|
next if $tree_count > $end_tree; |
257 |
|
|
print "\n<hr>\n<$prt_elm class=\"tree\">"; |
258 |
|
|
@datas = ÷_log($_); |
259 |
|
|
foreach (@datas) { |
260 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act) = ÷_data($_); |
261 |
|
|
if ( $indent eq 'ul' && $last_lx > -1 ){ |
262 |
|
|
my($l_diff) = $last_lx - $lx; |
263 |
|
|
if( $l_diff < 0 ){ |
264 |
|
|
print "<$prt_elm>"; |
265 |
|
|
}elsif( $l_diff > 0){ |
266 |
|
|
my($i); |
267 |
|
|
print "</$cld_elm>"; |
268 |
|
|
for($i = 1; $i <= $l_diff; $i++){ |
269 |
|
|
print "</$prt_elm></$cld_elm>"; |
270 |
|
|
} |
271 |
|
|
}else{ |
272 |
|
|
print "</$cld_elm>"; |
273 |
|
|
} |
274 |
|
|
} |
275 |
|
|
if($indent eq 'css'){ |
276 |
|
|
print "<$cld_elm class=\"lv$lx\">"; |
277 |
|
|
}else{ |
278 |
|
|
print "<$cld_elm>"; |
279 |
|
|
} |
280 |
|
|
if ($res eq 'root') { |
281 |
|
|
print "[<a href=\"$this_name?$uri_query;md=set;tn=$tn\">��</a>]"; |
282 |
|
|
} elsif ($indent eq 'space') { |
283 |
|
|
my($space_width) = $lx * 2 + 2; |
284 |
wakaba |
1.2 |
print ' ' x $space_width; |
285 |
wakaba |
1.1 |
} |
286 |
|
|
print "<a href=\"$this_name?$uri_query;md=viw;no=$no;tn=$tn\">"; |
287 |
|
|
if ($no > $count - $new_kiji) { |
288 |
|
|
print "[��]"; |
289 |
|
|
} else { |
290 |
|
|
print "[��]"; |
291 |
|
|
} |
292 |
|
|
print " $title</a> : "; |
293 |
|
|
if ($COOKIE{'name'} eq $name) { |
294 |
|
|
print "<strong>$name</strong>"; #��ʬ�ε�����Ĵɽ�� |
295 |
|
|
} else { |
296 |
|
|
print $name; |
297 |
|
|
} |
298 |
|
|
print " <span class=\"date\">($date)</span>"; |
299 |
|
|
$last_lx = $lx; |
300 |
|
|
} |
301 |
|
|
if ( $indent eq 'ul' ){ |
302 |
|
|
# print "<!--$last_lx-->"; |
303 |
|
|
my($i); |
304 |
|
|
for($i = 1; $i <= $last_lx; $i++){ |
305 |
|
|
print "</$cld_elm></$prt_elm>"; |
306 |
|
|
} |
307 |
|
|
} |
308 |
|
|
print "</$cld_elm></$prt_elm>"; |
309 |
|
|
} |
310 |
|
|
close(LOG); |
311 |
|
|
print"</div>\n"; |
312 |
|
|
|
313 |
|
|
&navi_form($tree_count); |
314 |
|
|
} |
315 |
|
|
|
316 |
|
|
# [ ���̤ǵ��������Ƥ�ɽ������ ] |
317 |
|
|
# |
318 |
|
|
|
319 |
|
|
sub view { |
320 |
|
|
local($s) = $def_header_http.$defhead.$html_navi."<h2>����$OPT{'no'}</h2>"; |
321 |
|
|
my(@kiji_datas) = ÷_log(&search_tree); |
322 |
|
|
my($kiji_data) = &search_data(@kiji_datas); |
323 |
|
|
|
324 |
|
|
$s .= &kiji_view($kiji_data); |
325 |
|
|
$s .= "<div class=\"comment-navi\">"; |
326 |
|
|
my($no,$rq_res,$lx,$tn,$title,$name,$email,$date,$rq_act,$file_pwd,$rhost,$ipad,$comment) = ÷_data($kiji_data); |
327 |
|
|
foreach (@kiji_datas) { |
328 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$pwd,$rhost,$ipad,$comment) = ÷_data($_); |
329 |
|
|
if ($rq_res == $no) { |
330 |
|
|
$parent = "���ε����ϡ�<a href=\"$this_name?$uri_query;md=viw;no=$no;tn=$OPT{'tn'}\">$title</a>�פؤΥ����ȤǤ���"; |
331 |
|
|
} |
332 |
|
|
if (($res == $OPT{'no'}) && ($res ne 'root')) { |
333 |
|
|
$children .= "<li>��<a href=\"$this_name?$uri_query;md=viw;no=$no;tn=$OPT{'tn'}\">$title</a>��$name<span class=\"date\">($date)</span></li>"; |
334 |
|
|
} |
335 |
|
|
} |
336 |
|
|
if ($rq_res eq 'root') { $parent = '�롼�ȵ����Ǥ���'; } |
337 |
|
|
elsif (!$parent) { $parent = '���ˤʤä������ϤߤĤ���ޤ���Ǥ�����'; } |
338 |
|
|
if (!$children) { $children = '�����Ȥ���Ƥ���Ƥ��ޤ���</p>'; } |
339 |
|
|
else{$children = "�ʲ��Υ����Ȥ���Ƥ���Ƥ��ޤ���</p>\n<ul class=\"comment\">$children</ul>";} |
340 |
|
|
$s .= <<"_EOF_"; |
341 |
wakaba |
1.2 |
<hr> |
342 |
wakaba |
1.1 |
<p>$parent |
343 |
|
|
$children |
344 |
|
|
<hr></div> |
345 |
|
|
_EOF_ |
346 |
|
|
if ($rq_act > 6) { |
347 |
|
|
$s .= '<p>���ε������Ф��ƥ����Ȥ���Ƥ��뤳�ȤϽ���ޤ���</p>'; |
348 |
|
|
return 0; |
349 |
|
|
}elsif( $nazo eq 'no' ){ |
350 |
|
|
$s .= '<!--�楹������⡼�ɤǤϥ����Ȥ���ƤϽ���ޤ���-->'; |
351 |
|
|
return 0; |
352 |
|
|
} |
353 |
|
|
if ($title =~ /^[Rr][Ee]\^\d+\:(.*)/) {$title = "Re: $1";} |
354 |
|
|
elsif ($title =~ /^[Rr][Ee]\[\d+\]\:(.*)/) {$title = "Re: $1";} |
355 |
|
|
elsif ($title =~ /^[Rr][Ee]\:(.*)/) {$title = "Re: $1";} |
356 |
|
|
else {$title = "Re: $title"; } |
357 |
|
|
$comment = "<br>$comment"; |
358 |
|
|
$comment =~ s/<br>((>)+)/\n$1>/ig; |
359 |
|
|
$comment =~ s/<br>/\n> /ig; |
360 |
|
|
$comment =~ s/\n//; |
361 |
|
|
$s .= '<p>���ε����˴ؤ��륳���Ȥ���Ƥ�����ϰʲ��������˽���Dz�������</p>'; |
362 |
|
|
$s .= &html_form($OPT{'no'},$title,$comment,$OPT{'tn'},$lx,1); |
363 |
|
|
|
364 |
|
|
#��ƼԺ�� |
365 |
|
|
if (crypt($COOKIE{'pwd'},$file_pwd) eq $file_pwd) { |
366 |
|
|
$s .= <<"_EOF_"; |
367 |
|
|
<hr> |
368 |
|
|
<form action="./$this_name" method="post"> |
369 |
|
|
<p> |
370 |
|
|
$form_query |
371 |
|
|
<input type="hidden" name="md" value="del"> |
372 |
|
|
<input type="hidden" name="code" value="$OPT{'code'}"> |
373 |
|
|
<input type="hidden" name="tn" value="$OPT{'tn'}"> |
374 |
|
|
<input type="hidden" name="no" value="$OPT{'no'}"> |
375 |
|
|
<input type="hidden" name="pwd" value="$COOKIE{'bbs_pwd'}"> |
376 |
|
|
<input type="submit" value="���ε��������Ƥ�������"> |
377 |
|
|
<em class="note">(�����˺������ʤ����⤢��ޤ���)</em></p> |
378 |
|
|
</form> |
379 |
|
|
_EOF_ |
380 |
|
|
} |
381 |
|
|
|
382 |
|
|
print ($s.$deffoot); |
383 |
|
|
exit; |
384 |
|
|
} |
385 |
|
|
|
386 |
|
|
# [ ���å�ɽ�� ] |
387 |
|
|
# |
388 |
|
|
|
389 |
|
|
sub set { |
390 |
|
|
my($last_lx) = -1; |
391 |
|
|
print &html_header('���å�ɽ��'); |
392 |
|
|
|
393 |
|
|
if( $indent eq 'css' || $indent eq 'ul' ){ |
394 |
|
|
$prt_elm = 'ul'; |
395 |
|
|
$cld_elm = 'li'; |
396 |
|
|
}else{ |
397 |
|
|
$prt_elm = 'div'; |
398 |
|
|
$cld_elm = 'p'; |
399 |
|
|
} |
400 |
|
|
|
401 |
|
|
print<<"_EOF_"; |
402 |
|
|
<div class=\"set\"> |
403 |
|
|
<h3><a name="list">��������</a></h3> |
404 |
|
|
<$prt_elm class="tree"> |
405 |
|
|
_EOF_ |
406 |
|
|
@kiji_datas = ÷_log(&search_tree); |
407 |
|
|
foreach (@kiji_datas) { |
408 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act) = ÷_data($_); |
409 |
|
|
my($num_no) = int($no); |
410 |
|
|
$reply[$res] .= "$num_no-"; |
411 |
|
|
if ( $indent eq 'ul' && $last_lx > -1 ){ |
412 |
|
|
my($l_diff) = $last_lx - $lx; |
413 |
|
|
if( $l_diff < 0 ){ |
414 |
|
|
print "<$prt_elm>"; |
415 |
|
|
}elsif( $l_diff > 0){ |
416 |
|
|
my($i); |
417 |
|
|
print "</$cld_elm>"; |
418 |
|
|
for($i = 1; $i <= $l_diff; $i++){ |
419 |
|
|
print "</$prt_elm></$cld_elm>"; |
420 |
|
|
} |
421 |
|
|
}else{ |
422 |
|
|
print "</$cld_elm>"; |
423 |
|
|
} |
424 |
|
|
} |
425 |
|
|
if($indent eq 'css'){ |
426 |
|
|
print "<$cld_elm class=\"lv$lx\">"; |
427 |
|
|
}else{ |
428 |
|
|
print "<$cld_elm>"; |
429 |
|
|
} |
430 |
|
|
$last_lx = $lx; |
431 |
|
|
if ($res ne 'root' && $indent eq 'space') { |
432 |
|
|
my($space_width) = $lx * 2 + 2; |
433 |
|
|
print '��' x $space_width; |
434 |
|
|
} |
435 |
|
|
print "<a href=\"#c$num_no\">�� $title</a> : $name <span class=\"date\">($date)</span>"; |
436 |
|
|
print "</$cld_elm>\n" unless ($indent eq 'ul'); |
437 |
|
|
} |
438 |
|
|
if ( $indent eq 'ul' ){ |
439 |
|
|
# print "<!--$last_lx-->"; |
440 |
|
|
my($i); |
441 |
|
|
for($i = 1; $i <= $last_lx; $i++){ |
442 |
|
|
print "</$cld_elm></$prt_elm>"; |
443 |
|
|
} |
444 |
|
|
}else{ |
445 |
|
|
print "</$prt_elm>"; |
446 |
|
|
} |
447 |
|
|
|
448 |
|
|
print"</$cld_elm></$prt_elm></div>\n"; |
449 |
|
|
|
450 |
|
|
foreach $data (@kiji_datas) { |
451 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$pwd,$rhost,$ipad,$comment) = ÷_data($data); |
452 |
|
|
my($num_no) = int($no); |
453 |
|
|
|
454 |
|
|
print "<p>No.<a name=\"c$num_no\">$num_no</a>"; |
455 |
|
|
if ($res eq 'root') { |
456 |
|
|
print '<em class="note">(�Ƶ���)</em>'; |
457 |
|
|
} else { |
458 |
|
|
$res = int($res); |
459 |
|
|
print "<a href=\"#c$res\">��<em>[$res]</em></a>"; |
460 |
|
|
} |
461 |
|
|
if (!$reply[$no]) { |
462 |
|
|
print ' / <em class="note">(����ʤ�)</em>'; |
463 |
|
|
} else { |
464 |
|
|
chop($reply[$no]); |
465 |
|
|
my(@replys) = split(/-/,$reply[$no]); |
466 |
|
|
foreach (@replys) { |
467 |
|
|
print " / <a href=\"#c$_\">��<em>[$_]</em></a>"; |
468 |
|
|
} |
469 |
|
|
} |
470 |
|
|
print "</p>\n"; |
471 |
|
|
|
472 |
|
|
print &kiji_view($data); |
473 |
|
|
if( $nazo eq 'no' ){ |
474 |
|
|
print '<!--�楹������⡼�ɤǤϥ����Ȥ���ƤϽ���ޤ���-->'; |
475 |
|
|
}else{ |
476 |
|
|
print "<p><a href=\"$this_name?$uri_query;md=viw;no=$no;tn=$OPT{'tn'}\">�����Ȥ����</a> / "; |
477 |
|
|
} |
478 |
|
|
print "<a href=\"#list\">��������</a></p><hr>"; |
479 |
|
|
} |
480 |
|
|
} |
481 |
|
|
|
482 |
|
|
# [ �ǿ�������絡ǽ ] |
483 |
|
|
|
484 |
|
|
sub number { |
485 |
|
|
print &html_header("�ǿ�����"); |
486 |
|
|
print "<p>�Ƕ�ε��� $new_kiji ���ɽ�����Ƥ��ޤ���</p>"; |
487 |
|
|
print '<p>['; |
488 |
|
|
my($i,$j,$tmp); |
489 |
|
|
for ( $i = 1; $i <= 10; $i++ ){ |
490 |
|
|
$j = $i * 10; |
491 |
|
|
unless ($new_kiji == $j){ |
492 |
|
|
if($tmp){ |
493 |
|
|
print ' / ' ; |
494 |
|
|
}else{ |
495 |
|
|
$tmp = 1; |
496 |
|
|
} |
497 |
|
|
print "<a href=\"$this_name?$uri_query;md=num;tmp_new_kiji=$j\">$j ��</a>"; |
498 |
|
|
} |
499 |
|
|
} |
500 |
|
|
print ' ]</p>'; |
501 |
|
|
open(LOG,$logfile) or &error('�ɤ߹��ߥ��顼','�������ɤ߹��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
502 |
|
|
my($count, $last_nj); |
503 |
|
|
$count = <LOG>;chop($count); |
504 |
|
|
$last_nj = <LOG>;chop($last_nj); |
505 |
|
|
while (<LOG>) { |
506 |
|
|
@datas = ÷_log($_); |
507 |
|
|
foreach $data (@datas) { |
508 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act) = ÷_data($data); |
509 |
|
|
if ($no > $count - $new_kiji) { |
510 |
|
|
push(@nums,$data); |
511 |
|
|
} |
512 |
|
|
} |
513 |
|
|
last if @nums >= $new_kiji; |
514 |
|
|
} |
515 |
|
|
close(LOG); |
516 |
|
|
|
517 |
|
|
@nums = reverse(sort(@nums)); |
518 |
|
|
print '<ul class="new">'; |
519 |
|
|
my($list_order); |
520 |
|
|
foreach $data (@nums) { |
521 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$pwd,$rhost,$ipad,$comment) = ÷_data($data); |
522 |
|
|
$list_order++; |
523 |
|
|
print "<li><p>$list_order: ����No.$no</p>\n"; |
524 |
|
|
print &kiji_view($data); |
525 |
|
|
print<<"_EOF_"; |
526 |
|
|
<p><a href="$this_name?$uri_query;md=viw;no=$no;tn=$tn">�����Ȥ����</a> / <a href="$this_name?$uri_query;md=set;tn=$tn">���åȤ�ɽ��</a></p><hr></li> |
527 |
|
|
_EOF_ |
528 |
|
|
} |
529 |
|
|
print '</ul>'; |
530 |
|
|
} |
531 |
|
|
|
532 |
|
|
# [ ��ƥե������ɽ�� ] |
533 |
|
|
# |
534 |
|
|
|
535 |
|
|
sub html_form { |
536 |
|
|
my($no,$title,$comment,$tn,$lx,$c) = (@_); |
537 |
|
|
local($s); $s = $def_header_http.$defhead if $c != 1; |
538 |
|
|
$s .= '<h2>���������</h2>'; |
539 |
|
|
|
540 |
|
|
if ($no eq '') { $no = 'root'; } |
541 |
|
|
$title = "($default_title)" unless $title; |
542 |
|
|
$comment = "($default_comment)" unless $comment; |
543 |
|
|
if($COOKIE{'name'}){ |
544 |
|
|
$my_name = $COOKIE{'name'}; |
545 |
|
|
}else{ |
546 |
|
|
$my_name = "($default_name)"; |
547 |
|
|
} |
548 |
|
|
if($COOKIE{'email'}){ |
549 |
|
|
$my_email = $COOKIE{'email'}; |
550 |
|
|
}else{ |
551 |
|
|
$my_email = "($default_email)"; |
552 |
|
|
} |
553 |
|
|
|
554 |
|
|
$nj = time() . '-' . &random_string(8); |
555 |
|
|
|
556 |
|
|
$s .= <<"_EOF_"; |
557 |
|
|
<script type="text/javascript" defer="defer"><!-- |
558 |
|
|
function check(myform){ |
559 |
|
|
if(!myform.name.value ){ |
560 |
|
|
alert("��Ƽ�̾�������Ƥ���������"); |
561 |
|
|
myform.name.focus(); |
562 |
|
|
return false; |
563 |
|
|
} else if(!myform.title.value ){ |
564 |
|
|
alert("��̾�������Ƥ���������"); |
565 |
|
|
myform.title.focus(); |
566 |
|
|
return false; |
567 |
|
|
} else if(!myform.comment.value ){ |
568 |
|
|
alert("��ʸ�������Ƥ���������"); |
569 |
|
|
myform.comment.focus(); |
570 |
|
|
return false; |
571 |
|
|
} else { |
572 |
|
|
return true; |
573 |
|
|
} |
574 |
|
|
} |
575 |
|
|
//--></script> |
576 |
|
|
<form action="./$this_name" method="post" onsubmit="return check(this);"> |
577 |
|
|
<p><label accesskey="S" for="title">��̾(<span class="key">S</span>):</label> |
578 |
|
|
<input type="text" name="title" id="title" size="40" maxlength="80" value="$title"></p> |
579 |
|
|
<p><label accesskey="N" for="name">̾��(<span class="key">N</span>):</label> |
580 |
|
|
<input type="text" name="name" id="name" size="40" maxlength="42" value="$my_name"></p> |
581 |
|
|
<p><label accesskey="E" for="email">�ᥤ��(<span class="key">M</span>):</label> |
582 |
|
|
<input type="text" name="email" id="email" size="60" maxlength="120" value="$my_email"></p> |
583 |
|
|
<p><label accesskey="B" for="comment">��ʸ(<span class="key">B</span>):</label> |
584 |
|
|
<br><textarea name="comment" id="comment" rows="10" cols="70">$comment</textarea></label></p> |
585 |
|
|
<p><input type="submit" value="����"> |
586 |
|
|
$form_query |
587 |
|
|
<input type="hidden" name="md" value="reg"><input type="hidden" name="no" value="$no"><input type="hidden" name="tn" value="$tn"><input type="hidden" name="lx" value="$lx"><input type="hidden" name="pwd" value="$COOKIE{'pwd'}"><input type="hidden" name="nj" value="$nj"><input type="hidden" name="code" value="$OPT{'code'}"></p> |
588 |
|
|
</form> |
589 |
|
|
_EOF_ |
590 |
|
|
if ($c == 1) { |
591 |
|
|
$s; |
592 |
|
|
} else { |
593 |
|
|
print ($s); |
594 |
|
|
} |
595 |
|
|
} |
596 |
|
|
|
597 |
|
|
# [ �������Ƥ�ɽ�� ] |
598 |
|
|
|
599 |
|
|
sub kiji_view { |
600 |
|
|
my($data) = @_; |
601 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$tm_pwd,$rhost,$ipad,$comment) = ÷_data($data); |
602 |
|
|
# &jcode'convert(*comment,'euc'); |
603 |
|
|
$comment = &squelch($comment) if $nazo; |
604 |
|
|
$comment =~ s/(<br>|\s|��)+$//g; |
605 |
|
|
$comment =~ s/^(>|>)([^<]*)/<q class=\"responce\">>$2<\/q>/g; |
606 |
|
|
$comment =~ s/<br>(>|>)([^<]*)/<br><q class=\"responce\">>$2<\/q>/g; |
607 |
|
|
|
608 |
|
|
#URL �˥��������ꤹ�� |
609 |
|
|
if( $uri_mode eq 'uri' || $uri_mode eq 'all' ){ |
610 |
|
|
$comment =~ s/(https?|ftp|gopher|telnet|nntp|news)\:([\w|\:\!\#\$\%\=\&\-\^\`\\\|\@\~\[\{\]\}\;\+\*\,\.\?\/]+)/<a href=\"$1\:$2\">$1\:$2<\/a>/ig; |
611 |
|
|
} |
612 |
|
|
if( $uri_mode eq 'rfc' || $uri_mode eq 'all' ){ |
613 |
|
|
$comment =~ s/(\W)([Rr][Ff][Cc]\s?)([1-9]\d*)(\W)/$1<a href=\"$rfc_base_uri\/rfc$3.txt\">$2$3<\/a>$4/g; |
614 |
|
|
} |
615 |
|
|
# &jcode'convert(*comment,$mojicode); |
616 |
|
|
if ($email) { $name = "<a href=\"mailto:$email\">$name</a>"; } |
617 |
|
|
local($s) = <<"_EOF_"; |
618 |
|
|
<!-- message start --> |
619 |
|
|
<div class="message"><h3 class="subject">$title</h3> |
620 |
|
|
<div class="message-header"><p><cite class="from">$name</cite> |
621 |
|
|
<span class="date">($date)</span><!--$rhost($ipad)--></p></div> |
622 |
|
|
<div class="message-body"> |
623 |
|
|
<p>$comment</p></div></div> |
624 |
|
|
<!-- message end --> |
625 |
|
|
_EOF_ |
626 |
|
|
$s; |
627 |
|
|
} |
628 |
|
|
|
629 |
|
|
# [ ������Ͽ���� ] |
630 |
|
|
|
631 |
|
|
sub regist { |
632 |
|
|
my($title,$name,$email,$comment,$lx,$tn,$pwd,$ref_url) = ($OPT{'title'},$OPT{'name'},$OPT{'email'},$OPT{'comment'},$OPT{'lx'},$OPT{'tn'},$OPT{'pwd'},$ENV{'HTTP_REFERER'}); |
633 |
|
|
$title =~ s/^\($default_title\)//; |
634 |
|
|
$title =~ s/\r\n//g; |
635 |
|
|
$title =~ s/[\r\n]//g; |
636 |
|
|
$name =~ s/^\($default_name\)//; |
637 |
|
|
$name =~ s/\r\n//g; |
638 |
|
|
$name =~ s/[\r\n]//g; |
639 |
|
|
$email =~ s/^\($default_email\)//; |
640 |
|
|
$email =~ s/\r\n//g; |
641 |
|
|
$email =~ s/[\r\n]//g; |
642 |
|
|
$comment =~ s/^\($default_comment\)//; |
643 |
|
|
$comment =~ s/^\s+//g; |
644 |
|
|
$comment =~ s/(\s|��)+$//g; |
645 |
|
|
$comment =~ s/\r\n/<br>/g; |
646 |
|
|
$comment =~ s/[\r\n]/<br>/g; |
647 |
|
|
$lx++; |
648 |
|
|
$pwd =~ s/\r\n//g; |
649 |
|
|
$pwd =~ s/\r|\n//g; |
650 |
|
|
$ref_url =~ s/\?(.|\n)*//g; |
651 |
|
|
s/\%7E/\~/g; |
652 |
|
|
|
653 |
|
|
#��ƥ����å� |
654 |
|
|
if($ENV{'REQUEST_METHOD'} ne "POST"){ |
655 |
|
|
&method_error(); |
656 |
|
|
# }elsif($base_url && ($ref_url !~ $base_url)){ |
657 |
|
|
# &error('�������','���������ϼ���������ޤ���Ǥ����������������������Ƥ��Ԥ�줿��ǽ��������ޤ�����������ƤǤ⤳�Υ��顼���Ф���ϡ��֥饦���� Referer �����Ф�������ˤʤäƤ��뤫��ǧ���Ƥ���������'); |
658 |
|
|
}elsif (length($title) > 80) { |
659 |
|
|
$_ = length($title) - 80; |
660 |
|
|
&error('��̾���ϥ��顼',"��̾��Ĺ�����ޤ���$_ �Х��Ⱥ︺���Ƥ���������"); |
661 |
|
|
}elsif (!$title) { |
662 |
|
|
&error('��̾���ϥ��顼','��̾�����Ϥ���Ƥ��ޤ���'); |
663 |
|
|
}elsif (!$name) { |
664 |
|
|
&error('��Ƽ�̾���ϥ��顼','��Ƽ�̾�����Ϥ���Ƥ��ޤ���'); |
665 |
|
|
}elsif (length($name) > 42) { |
666 |
|
|
$_ = length($name) - 42; |
667 |
|
|
&error('��Ƽ�̾���ϥ��顼',"��Ƽ�̾��Ĺ�����ޤ���$_ �Х��Ⱥ︺���Ƥ���������"); |
668 |
|
|
}elsif ($email && $email !~ /\w[\w\.\-]*\@\w[\w\.\-]*\.\w+/){ |
669 |
|
|
&error('��륢�ɥ쥹���ϥ��顼','��륢�ɥ쥹�ν������Ǥ�������ʸ����ȤäƤ��ʤ����������ޤ�Ƥ��ʤ�����ǧ���Ƥ���������'); |
670 |
|
|
}elsif (length($email) > 120) { |
671 |
|
|
$_ = length($email) - 120; |
672 |
|
|
&error('��륢�ɥ쥹���ϥ��顼',"��륢�ɥ쥹��Ĺ�����ޤ���$_ �Х��Ⱥ︺���Ƥ���������"); |
673 |
|
|
}elsif (!$comment) { |
674 |
|
|
&error('��ʸ���ϥ��顼','��ʸ�����Ϥ���Ƥ��ޤ�����Τߤ���ƤϽ���ޤ���'); |
675 |
|
|
}elsif (length($comment) > $max_msg) { |
676 |
|
|
$_ = length($comment) - $max_msg; |
677 |
|
|
&error('��ʸ���ϥ��顼',"��ʸ��Ĺ�����ޤ���$_ �Х��Ⱥ︺���Ƥ���������"); |
678 |
|
|
}elsif ((!$pwd) || (length($pwd) > 8)) { $pwd = &random_string(8); } |
679 |
|
|
my($salt) = &random_string(2); |
680 |
|
|
$file_pwd = crypt($pwd,$salt); |
681 |
|
|
&get_date; |
682 |
|
|
|
683 |
|
|
open(LOG,$logfile) or &error('�ɤ߹��ߥ��顼','�������ɤ߹��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
684 |
|
|
my($count, $last_nj); |
685 |
|
|
$count = <LOG>;chop($count); |
686 |
|
|
$last_nj = <LOG>;chop($last_nj); |
687 |
|
|
my(@all_log) = <LOG>; |
688 |
|
|
close(LOG); |
689 |
|
|
|
690 |
|
|
$this_nj = $OPT{'nj'}; |
691 |
|
|
|
692 |
|
|
if (++$count > 9999) { |
693 |
|
|
&error('���������Υ����С��ե���','��Ͽ�������� 10,000 ��ã�������ᡢ��Ƥ�����դ��뤳�Ȥ�����ޤ�����Ƥ�����դ���ˤϡ���¸�ε�������������ƷǼ��Ĥκ�Ŭ����Ԥ�ɬ�פ�����ޤ��������Ԥ�Ϣ�����Ƥ���������'); |
694 |
|
|
# }elsif ($this_nj eq $last_nj){ |
695 |
|
|
# &error('������','�����ƤǤ�����ƥܥ���Ϣ�Ǥ���Ƥ��ޤä���ǽ��������ޤ�������ɽ���������ɤ��Ƶ�������Ƥ��줿����ǧ���Ƥ�������������Ƥκݤϡ���ƥե�����������ɤ�����Ƥ���ľ���Ƥ���������'); |
696 |
|
|
} |
697 |
|
|
|
698 |
|
|
my($kiji_no) = substr("0000",length($count)).$count; |
699 |
|
|
|
700 |
|
|
$rhost = $ENV{'REMOTE_HOST'}; |
701 |
|
|
$ipad = $ENV{'REMOTE_ADDR'}; |
702 |
|
|
|
703 |
|
|
if ($OPT{'no'} eq 'root') { |
704 |
|
|
$kiji_data = "$kiji_no<>root<>0<>$kiji_no<>$title<>$name<>$email<>$date_now<>0<>$file_pwd<>$rhost<>$ipad<>$comment\n"; |
705 |
|
|
unshift(@all_log,$kiji_data); |
706 |
|
|
} else { |
707 |
|
|
foreach $tree (@all_log) { |
708 |
|
|
if ($tn == (split(/<>/,$tree))[0]) { |
709 |
|
|
@datas = ÷_log($tree); |
710 |
|
|
$flag1 = 0; $flag2 = 0; |
711 |
|
|
$kiji_data = "$kiji_no<>$OPT{'no'}<>$lx<>$tn<>$title<>$name<>$email<>$date_now<>0<>$file_pwd<>$rhost<>$ipad<>$comment"; |
712 |
|
|
foreach $data (@datas) { |
713 |
|
|
if (($flag2 == 1) && ($temp_lx >= (split(/<>/,$data))[2])){ |
714 |
|
|
$tree_data = "$tree_data<#>$kiji_data"; |
715 |
|
|
$flag2 = 2; |
716 |
|
|
} |
717 |
|
|
if ($flag1) { $tree_data = "$tree_data<#>$data"; } |
718 |
|
|
else { $tree_data = $data; $flag1 = 1; } |
719 |
|
|
if (($OPT{'no'} == (split(/<>/,$data))[0]) && (!$flag2)) { |
720 |
|
|
$flag2 = 1; $temp_lx = (split(/<>/,$data))[2]; |
721 |
|
|
} |
722 |
|
|
} |
723 |
|
|
if ($flag2 == 1){ $tree_data = "$tree_data<#>$kiji_data"; } |
724 |
|
|
unshift (@new,"$tree_data\n"); |
725 |
|
|
} |
726 |
|
|
else { push (@new,$tree); } |
727 |
|
|
} |
728 |
|
|
@all_log = @new; |
729 |
|
|
} |
730 |
|
|
|
731 |
|
|
#���̥����С������������� |
732 |
|
|
if ($max_size < 1500) { $max_size = 1500; } |
733 |
|
|
$size = -s $logfile; |
734 |
|
|
while ($size > $max_size){ |
735 |
|
|
my($delete) = pop(@all_log); |
736 |
|
|
$size -= length($delete); |
737 |
|
|
&delete_log($delete); |
738 |
|
|
} |
739 |
|
|
&write_file($count, $this_nj, @all_log); |
740 |
|
|
|
741 |
|
|
$COOKIE{'name'} = $name; |
742 |
|
|
$COOKIE{'email'} = $email; |
743 |
|
|
$COOKIE{'pwd'} = $pwd; |
744 |
|
|
&set_cookie; |
745 |
|
|
local($s) = $def_header_http.$defhead.$html_navi.'<h2>��Ƥμ���</h2>'; |
746 |
|
|
$s .= <<"_EOF_"; |
747 |
|
|
<p>�����ͭ�������ޤ����ʲ������Ƥ�������ޤ�����</p> |
748 |
|
|
_EOF_ |
749 |
|
|
$s .= &kiji_view($kiji_data); |
750 |
|
|
print ($s.$deffoot); |
751 |
|
|
exit; |
752 |
|
|
} |
753 |
|
|
|
754 |
|
|
# [ ��ƼԺ������ ] |
755 |
|
|
|
756 |
|
|
sub delete { |
757 |
|
|
my(@kiji_datas) = ÷_log(&search_tree); |
758 |
|
|
my($kiji_data) = &search_data(@kiji_datas); |
759 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$file_pwd,$rhost,$ipad,$comment) = ÷_data($kiji_data); |
760 |
|
|
if (crypt($COOKIE{'pwd'},$file_pwd) ne $file_pwd) { |
761 |
|
|
&error('������顼','���ꤷ�������κ���ϤǤ��ޤ����˺������Ƥ��ʤ�����ǧ���Ƥ����������ɤ����Ƥ������������ϴ����Ԥ�Ϣ�����Ƥ���������'); |
762 |
|
|
} |
763 |
|
|
&get_date; |
764 |
|
|
|
765 |
|
|
#�ڵ��Ĥ��Ƥ����� |
766 |
|
|
&delete_log($kiji_data); |
767 |
|
|
|
768 |
|
|
open(LOG,$logfile) or &error('�ɤ߹��ߥ��顼','�������ɤ߹��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
769 |
|
|
my($count, $last_nj); |
770 |
|
|
$count = <LOG>;chop($count); |
771 |
|
|
$last_nj = <LOG>;chop($last_nj); |
772 |
|
|
my($delete_notice); |
773 |
|
|
if (@kiji_datas == 1) { |
774 |
|
|
while (<LOG>) { |
775 |
|
|
unless (/^$OPT{'no'}/) { push(@new,$_); } |
776 |
|
|
} |
777 |
|
|
$delete_notice = '<p>�����ϥĥ�������Ƥ��ʤ��ä����ᡢ�����˾��Ǥ��Ƥ��ޤ���</p>'; |
778 |
|
|
} else { |
779 |
|
|
my($kiji_data) = "$no<>$res<>$lx<>$tn<><del datetime=\"$datetime\">$title</del><em>(��ƼԺ��)</em><>$name<><>$date<>8<>Null<>$rhost<>$ipad<>��ƼԤˤ�äƺ������ޤ�����(���: $date_now)"; |
780 |
|
|
my($flag) = 0; |
781 |
|
|
my($tree_data); |
782 |
|
|
foreach (@kiji_datas) { |
783 |
|
|
if ($flag) { $tree_data .= "<#>"; } else { $flag = 1; } |
784 |
|
|
if (/^$OPT{'no'}/) { $tree_data .= $kiji_data; } |
785 |
|
|
else { $tree_data .= $_; } |
786 |
|
|
} |
787 |
|
|
$tree_data =~ s/\n//; |
788 |
|
|
while (<LOG>) { |
789 |
|
|
if (!/^$OPT{'tn'}/) { push(@new,$_); } |
790 |
|
|
else { push(@new,"$tree_data\n"); } |
791 |
|
|
} |
792 |
|
|
$delete_notice = '<p>�����ϥĥ�ΰ����������Ƥ������ᡢ(��ƼԺ��) �Ȥ��������˺����ؤ����Ƥ��ޤ���</p>'; |
793 |
|
|
} |
794 |
|
|
close(LOG); |
795 |
|
|
&write_file($count, $this_nj, @new); |
796 |
|
|
print &html_header("��ƼԺ��"); |
797 |
|
|
print<<"_EOF_"; |
798 |
|
|
<hr> |
799 |
|
|
<p>���� No.$OPT{'tn'}��$title�פ������ޤ�����</p> |
800 |
|
|
$delete_notice |
801 |
|
|
<p><a href="$this_name?$uri_query">����ɽ��</a>�������ɤ��ơ�������������줿���Ȥ��ǧ���Ƥ���������</p> |
802 |
|
|
<hr> |
803 |
|
|
_EOF_ |
804 |
|
|
} |
805 |
|
|
|
806 |
|
|
# [ �ǡ���������Ϣ���ѥ��� ] |
807 |
|
|
|
808 |
|
|
sub divide_log { |
809 |
|
|
my($data) = @_; |
810 |
|
|
chop($data); |
811 |
|
|
return split(/<#>/,$data); |
812 |
|
|
} |
813 |
|
|
sub divide_data { |
814 |
|
|
my $data = @_; |
815 |
|
|
return split(/<>/,$_[0]); |
816 |
|
|
} |
817 |
|
|
|
818 |
|
|
sub search_data { |
819 |
|
|
my(@kiji_datas) = @_; |
820 |
|
|
my($search_data_no) = $OPT{'no'}; |
821 |
|
|
my($hit_data); |
822 |
|
|
foreach(@kiji_datas){ |
823 |
|
|
if ( /^$search_data_no/ ) { |
824 |
|
|
$hit_data = $_; |
825 |
|
|
last; |
826 |
|
|
} |
827 |
|
|
} |
828 |
|
|
return $hit_data; |
829 |
|
|
} |
830 |
|
|
|
831 |
|
|
sub search_tree { |
832 |
|
|
my($search_tree_no) = $OPT{'tn'}; |
833 |
|
|
my($hit_data); |
834 |
|
|
open(LOG,$logfile) or &error('�ɤ߹��ߥ��顼','�������ɤ߹��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
835 |
|
|
my($count, $last_nj); |
836 |
|
|
$count = <LOG>;chop($count); |
837 |
|
|
$last_nj = <LOG>;chop($last_nj); |
838 |
|
|
while (<LOG>) { |
839 |
|
|
if ( /^$search_tree_no/ ){ |
840 |
|
|
$hit_data = $_; |
841 |
|
|
last; |
842 |
|
|
} |
843 |
|
|
} |
844 |
|
|
close(LOG); |
845 |
|
|
return $hit_data; |
846 |
|
|
} |
847 |
|
|
|
848 |
|
|
# [ �ե����फ��ǡ������� ] |
849 |
|
|
|
850 |
|
|
sub read_form { |
851 |
wakaba |
1.3 |
# %OPT = %Suika::CGI::param; |
852 |
|
|
# return; |
853 |
wakaba |
1.1 |
my($pair,$buffer); |
854 |
|
|
if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); |
855 |
|
|
} else { $buffer = $ENV{'QUERY_STRING'}; } |
856 |
|
|
my(@pairs) = split(/[&;]/,$buffer); #�ѥ������ڤ�� ; ��Ȥ���褦�˲�¤�� |
857 |
|
|
foreach $pair (@pairs) { |
858 |
|
|
my($name,$value) = split(/=/,$pair); |
859 |
|
|
$value =~ tr/+/ /; |
860 |
|
|
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; |
861 |
|
|
$OPT{$name} = &change_code($value); |
862 |
|
|
} |
863 |
|
|
} |
864 |
|
|
|
865 |
|
|
# [ ��������� ] |
866 |
|
|
|
867 |
|
|
sub get_cookie { |
868 |
|
|
my($pair,%DUMMY); |
869 |
|
|
my($cookies) = $ENV{'HTTP_COOKIE'}; |
870 |
|
|
my(@pairs) = split(/;/,$cookies); |
871 |
|
|
foreach $pair (@pairs) { |
872 |
|
|
my($name,$value) = split(/=/,$pair); |
873 |
|
|
$name =~ s/ //g; |
874 |
|
|
$value =~ s/%([0-9A-Fa-f][0-9A-Fa-f])/pack("C", hex($1))/eg; |
875 |
|
|
$DUMMY{$name} = $value; |
876 |
|
|
} |
877 |
|
|
@pairs = split(/,/,$DUMMY{$cookie_name}); |
878 |
|
|
foreach $pair (@pairs) { |
879 |
|
|
my($name,$value) = split(/:/,$pair); |
880 |
|
|
$COOKIE{$name} = &change_code($value); |
881 |
|
|
} |
882 |
|
|
} |
883 |
|
|
sub set_cookie { |
884 |
|
|
my($sec,$min,$hour,$mday,$mon,$year,$wday) = gmtime(time + 30*24*60*60); |
885 |
|
|
$year += 100 if $year < 99; |
886 |
|
|
$year += 1900; |
887 |
|
|
$sec = "0$sec" if $sec < 10; |
888 |
|
|
$min = "0$min" if $min < 10; |
889 |
|
|
$hour = "0$hour" if $hour < 10; |
890 |
|
|
$mday = "0$mday" if $mday < 10; |
891 |
|
|
$mon = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec')[$mon]; |
892 |
|
|
$youbi = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday')[$wday]; |
893 |
|
|
$date_gmt = "$youbi, $mday\-$mon\-$year $hour:$min:$sec GMT"; |
894 |
|
|
my($cook); |
895 |
|
|
foreach $valname ('name','email','pwd'){ |
896 |
|
|
my($tmp) = $COOKIE{$valname}; |
897 |
|
|
$tmp =~ s/(\W)/sprintf("%%%02X", unpack("C", $1))/eg; |
898 |
|
|
$cook .= "$valname:$tmp,"; |
899 |
|
|
} |
900 |
|
|
print "Set-Cookie: $cookie_name=$cook; expires=$date_gmt\n"; |
901 |
|
|
} |
902 |
|
|
|
903 |
|
|
# [ ʸ�������ɴ�Ϣ ] |
904 |
|
|
|
905 |
|
|
sub change_code { |
906 |
|
|
my($text)=$_[0]; |
907 |
|
|
&jcode'convert(*text,$mojicode); |
908 |
|
|
$text =~ s/&/&/g; |
909 |
|
|
$text =~ s/</</g; |
910 |
|
|
$text =~ s/>/>/g; |
911 |
|
|
return $text; |
912 |
|
|
} |
913 |
|
|
|
914 |
|
|
# [ ���ռ��� ] |
915 |
|
|
|
916 |
|
|
sub get_date { |
917 |
|
|
$ENV{'TZ'} = "JST-9"; # TimeZone (���ܻ��� = ���ɸ���(JST) - 9����) |
918 |
|
|
my($sec,$min,$hour,$day,$mon,$year) = localtime(); |
919 |
|
|
if ($year < 99) { $year += 100; } |
920 |
|
|
$year += 1900; |
921 |
|
|
$mon++; |
922 |
|
|
$sec = "0$sec" if $sec < 10; |
923 |
|
|
$min = "0$min" if $min < 10; |
924 |
|
|
$hour = "0$hour" if $hour < 10; |
925 |
|
|
$mon = "0$mon" if $mon < 10; |
926 |
|
|
$day = "0$day" if $day < 10; |
927 |
|
|
$date_now = "$year/$mon/$day $hour:$min:$sec"; |
928 |
|
|
$datetime = "$year-$mon-${day}T$hour:$min:$sec+09:00"; |
929 |
|
|
} |
930 |
|
|
|
931 |
|
|
# [ ��Ͽ�ե�����ν��� ] |
932 |
|
|
|
933 |
|
|
sub write_file { |
934 |
|
|
my($count,$this_nj,@lines) = @_; |
935 |
|
|
|
936 |
|
|
#�ץ�����ID ����ƥ�ݥ��ե�����̾������ |
937 |
|
|
$pros = $$; |
938 |
|
|
$pros = time unless $pros; |
939 |
|
|
$tmp_file = "$ID$pros.tmp"; |
940 |
|
|
|
941 |
|
|
#¾�Υƥ�ݥ��ե������ |
942 |
|
|
opendir(DIR,$log_dir) or &error('�����ƥ२�顼','��ȥǥ��쥯�ȥ�Υ����ץ�˼��Ԥ��ޤ����������Ԥ�������˺��Ƥ����ǽ��������ޤ���'); |
943 |
|
|
@list = readdir(DIR); |
944 |
|
|
closedir(DIR); |
945 |
|
|
unless (@list) { &error('�����ƥ२�顼','��ȥǥ��쥯�ȥ꤬�����˶��Ǥ���'); } |
946 |
|
|
@lists = grep(/$ID.*\.tmp/,@list); |
947 |
|
|
|
948 |
|
|
#�ƥ�ݥ��ե����뤬������ |
949 |
|
|
my($retry_counter) = $retry; |
950 |
|
|
while (@lists) { |
951 |
|
|
if (--$retry_counter <= 0) { |
952 |
|
|
#���Ӥ���ڤ餷�� |
953 |
|
|
foreach (@lists) { |
954 |
|
|
#�ƥ�ݥ��ե���������� |
955 |
|
|
unlink("$log_dir$_") if (-e "$log_dir$_"); |
956 |
|
|
} |
957 |
|
|
&error('�ӥ���','�������������Ƥ��ޤ������֤��ƺ��ټ¹Ԥ��Ƥ���������'); |
958 |
|
|
} |
959 |
|
|
sleep(1); |
960 |
|
|
opendir(DIR,"$log_dir"); |
961 |
|
|
@list = readdir(DIR); |
962 |
|
|
closedir(DIR); |
963 |
|
|
@lists = grep(/$ID.*\.tmp/,@list); |
964 |
|
|
} |
965 |
|
|
|
966 |
|
|
#�ƥ�ݥ��ե�����˽��� |
967 |
|
|
open(WRITE,">$log_dir$tmp_file") or &error('���ߥ��顼','��Ͽ�ե�����ν��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
968 |
|
|
print WRITE "$count\n"; |
969 |
|
|
print WRITE "$this_nj\n"; |
970 |
|
|
print WRITE @lines; |
971 |
|
|
close(WRITE); |
972 |
|
|
|
973 |
|
|
#�⤦����¾�Υƥ�ݥ��ե������ |
974 |
|
|
opendir(DIR,$log_dir); |
975 |
|
|
@list = readdir(DIR); |
976 |
|
|
closedir(DIR); |
977 |
|
|
@lists = grep(/$ID.*\.tmp/,@list); |
978 |
|
|
@lists = grep(!/$tmp_file/,@lists);#��ʬ���ȤϽ��� |
979 |
|
|
if (@lists) {#¾�ǽ�����Ǥ���н��ߤ���ߤ��ƽ�λ |
980 |
|
|
unlink("$log_dir$tmp_file") if (-e "$log_dir$tmp_file"); |
981 |
|
|
&error('���ߤζ���','�̤ν��ߤν�����Ǥ������������֤��Ƥ��顢���٤����Ѳ�������'); |
982 |
|
|
} |
983 |
|
|
rename("$log_dir$tmp_file",$logfile) or &error('���ߤζ���','���ߤ˼��Ԥ��ޤ��������ټ¹Ԥ��Ƥ���������'); |
984 |
|
|
chmod 0666, $logfile; |
985 |
|
|
} |
986 |
|
|
|
987 |
|
|
sub delete_log{ |
988 |
|
|
my($delete) = @_; |
989 |
|
|
open(WRITE,">> $arc_dir${ID}.txt") or &error('���顼','��������Υ����ƥ२�顼�Ǥ��������Ԥ�Ϣ�����Ƥ���������'); |
990 |
|
|
@datas = ÷_log($delete); |
991 |
|
|
@datas = sort(@datas); |
992 |
|
|
foreach $data (@datas) { |
993 |
|
|
my($no,$res,$lx,$tn,$title,$name,$email,$date,$act,$pwd,$rhost,$ipad,$comment) = ÷_data($data); |
994 |
|
|
print WRITE "No:$no $title\n"; |
995 |
|
|
print WRITE "$date"; |
996 |
|
|
print WRITE "$res �ؤΥ�����" unless ($res eq 'root'); |
997 |
|
|
print WRITE "\n"; |
998 |
|
|
$comment =~ s/<br>/\n/g; |
999 |
|
|
$comment =~ s/>/>/g; |
1000 |
|
|
$comment =~ s/</</g; |
1001 |
|
|
$comment =~ s/&/&/g; |
1002 |
|
|
print WRITE "$comment\n\n"; |
1003 |
|
|
} |
1004 |
|
|
close(WRITE); |
1005 |
|
|
} |
1006 |
|
|
|
1007 |
|
|
sub random_string{ |
1008 |
|
|
my($str_length) = @_; |
1009 |
|
|
my($str,$i); |
1010 |
|
|
srand(); |
1011 |
|
|
for ($i=0; $i<$str_length; $i++){ |
1012 |
|
|
$str .= substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./', int(rand(64)),1); |
1013 |
|
|
} |
1014 |
|
|
return $str; |
1015 |
|
|
} |
1016 |
|
|
|
1017 |
|
|
# [ ���顼���� ] |
1018 |
|
|
|
1019 |
|
|
sub error { |
1020 |
|
|
my($err_msg,$err_description) = @_; |
1021 |
|
|
print<<"_EOF_"; |
1022 |
|
|
Content-type: text/html; $charset_code |
1023 |
|
|
Content-Language: ja |
1024 |
|
|
|
1025 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
1026 |
|
|
"http://www.w3.org/TR/html4/strict.dtd"> |
1027 |
|
|
<html lang="ja"> |
1028 |
|
|
<head> |
1029 |
|
|
$link_element |
1030 |
wakaba |
1.2 |
<link rel="stylesheet" href="/s/simpledoc"> |
1031 |
|
|
<link rel="stylesheet" href="../bo-style"> |
1032 |
wakaba |
1.1 |
<title>(���顼���)</title> |
1033 |
|
|
</head> |
1034 |
|
|
<body> |
1035 |
|
|
<h1><a name="top">���顼</a></h1> |
1036 |
|
|
<h2>$err_msg</h2> |
1037 |
|
|
<p>$err_description</p> |
1038 |
|
|
_EOF_ |
1039 |
|
|
&html_footer; |
1040 |
|
|
exit; |
1041 |
|
|
} |
1042 |
|
|
|
1043 |
|
|
sub method_error{ |
1044 |
|
|
print<<"_EOF_"; |
1045 |
|
|
Status: 405 Method Not Allowed |
1046 |
|
|
Allow: POST |
1047 |
|
|
Content-type: text/html; $charset_code |
1048 |
|
|
Content-Language: ja |
1049 |
|
|
|
1050 |
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
1051 |
|
|
"http://www.w3.org/TR/html4/strict.dtd"> |
1052 |
|
|
<html lang="ja"> |
1053 |
|
|
<head> |
1054 |
wakaba |
1.2 |
<link rel="stylesheet" href="/s/simpledoc"> |
1055 |
|
|
<link rel="stylesheet" href="../bo-style"> |
1056 |
wakaba |
1.1 |
<title>(���顼���)</title> |
1057 |
|
|
</head> |
1058 |
|
|
<body> |
1059 |
|
|
<h1><a name="top">���顼</a></h1> |
1060 |
|
|
<h2>�������</h2> |
1061 |
|
|
<p>���������ϼ���������ޤ���Ǥ����������������������Ƥ��Ԥ�줿��ǽ��������ޤ���</p> |
1062 |
|
|
_EOF_ |
1063 |
|
|
&html_footer; |
1064 |
|
|
exit; |
1065 |
|
|
} |
1066 |
|
|
|
1067 |
|
|
sub navi_form{ |
1068 |
|
|
my($tree_count) = @_; |
1069 |
|
|
my($this_page,$page_navi); |
1070 |
|
|
my($tmp_query) = $uri_query; |
1071 |
|
|
$tmp_query =~ s/;tree=\d+//; |
1072 |
|
|
if($tree_count){ |
1073 |
|
|
for ($i = 0; $i < $tree_count; $i += $max_tree) { |
1074 |
|
|
$j = $i / $max_tree + 1; |
1075 |
|
|
if ($tree == $i) { |
1076 |
|
|
$this_page = $j; |
1077 |
|
|
} else { |
1078 |
|
|
$page_navi .= "/ <a href=\"$this_name?$tmp_query;tree=$i\">$j�ڡ���</a>\n" |
1079 |
|
|
} |
1080 |
|
|
} |
1081 |
|
|
} |
1082 |
|
|
$page_navi .= "( $this_page / $j �ڡ��� )" if $j > 1; |
1083 |
|
|
print<<"_EOF_"; |
1084 |
|
|
<div class="pagenavi"><hr> |
1085 |
|
|
<p><a href="$this_name?$uri_query;md=new">�������</a> |
1086 |
|
|
$page_navi</p> |
1087 |
|
|
<hr></div> |
1088 |
|
|
_EOF_ |
1089 |
|
|
} |
1090 |
|
|
|
1091 |
|
|
sub nazo_only{ |
1092 |
|
|
my(%nazo); |
1093 |
|
|
my(@env); |
1094 |
|
|
my($name, $value); |
1095 |
|
|
open(LOG, $logfile) or &error('�ɤ߹��ߥ��顼','�������ɤ߹��ߤ�����ޤ������Ԥ�Ϣ�����Ƥ���������'); |
1096 |
|
|
while(<LOG>){ |
1097 |
|
|
while( m|(��.+?��)|g ){ |
1098 |
|
|
$nazo{"$1"} ++; |
1099 |
|
|
} |
1100 |
|
|
} |
1101 |
|
|
close(LOG); |
1102 |
|
|
print &html_header("��������"); |
1103 |
|
|
if(%nazo){ |
1104 |
|
|
print '<ul>'; |
1105 |
|
|
while (($name, $value) = each(%nazo)){ |
1106 |
|
|
push(@env, "$name = $value"); |
1107 |
|
|
} |
1108 |
|
|
foreach (sort(@env)){ |
1109 |
|
|
print "<li><p>$_</p></li>"; |
1110 |
|
|
} |
1111 |
|
|
print '</ul>'; |
1112 |
|
|
}else{ |
1113 |
|
|
print '<p>Not Found.</p>'; |
1114 |
|
|
} |
1115 |
|
|
&html_footer; |
1116 |
|
|
exit; |
1117 |
|
|
} |
1118 |
|
|
|
1119 |
|
|
sub location{ |
1120 |
|
|
my($location) = @_; |
1121 |
|
|
print <<"_EndOfText_"; |
1122 |
|
|
Status: 302 Found |
1123 |
|
|
Location: $location |
1124 |
|
|
Content-Type: text/html; charset=EUC-JP |
1125 |
|
|
Content-Language: ja |
1126 |
|
|
|
1127 |
|
|
_EndOfText_ |
1128 |
|
|
print &html_header("$location"); |
1129 |
|
|
print "<p><a href=\"$location\">$location</a> �Ȥ��Ƥ���������</p>"; |
1130 |
|
|
&html_footer; |
1131 |
|
|
exit; |
1132 |
|
|
} |
1133 |
|
|
|
1134 |
|
|
sub add_query{ |
1135 |
|
|
my($name, $value) = @_; |
1136 |
|
|
$uri_query .= ";$name=$value"; |
1137 |
|
|
$form_query .= "<input type=\"hidden\" name=\"$name\" value=\"$value\">"; |
1138 |
|
|
} |
1139 |
|
|
|
1140 |
|
|
sub squelch{ |
1141 |
|
|
my($data) = @_; |
1142 |
|
|
#���������� |
1143 |
|
|
if( $nazo eq 'no' ){ |
1144 |
|
|
$data =~ s/(��[^<]+?��)/<del class="nazo">$1<\/del>/g; |
1145 |
|
|
} |
1146 |
|
|
return $data; |
1147 |
|
|
} |