#!/usr/local/bin/perl # 過去ログ変換スクリプト (YY-BORD / プチ☆ボード) # past_conv.cgi v1.0 (2001/01/27) # Copyright(C) Kent Web 2001 # webmaster@kent-web.com # http://www.kent-web.com/ # # 1. YY-BORD v3.x 以前の過去ログを v4.xx 形式に変換します。 # 又は、プチ☆ボード v4.x の過去ログを v5.xx 形式に変換します。 # 2. 変換後の過去ログの拡張子は、「.dat」となります。 # 3. 過去ログのあるディレクトリのパーミッションは原則として「777」 # として下さい。 # 4. このスクリプト処理に関する質問は受け付けておりません。 # #【実行例】 # # public_html (ホームページディレクトリ) # | # +-- yybbs [777] / 1.html, 2.html, .... (既存の過去ログ) # pastno.dat (既存のNOファイル) # past_conv.cgi [755] #============# # 設定項目 # #============# # 過去ログNOファイル $nofile = './pastno.dat'; # 過去ログのディレクトリ $pastdir = '.'; #============# # 設定完了 # #============# print "Content-type: text/html\n\n"; print "過去ログ変換スクリプト\n"; open(IN,"$nofile") || &error("Open Error: $nofile"); $data = ; close(IN); foreach (1 .. $data) { # 対象ファイルを定義 $target1 = "$pastdir/$_\.html"; $target2 = "$pastdir/$_\.dat"; if (-e $target1) { @new=(); open(IN,"$target1") || print "Open Error: $target1
\n"; while () { if ($_ !~ /^\[(\d+)/) { next; } $_ =~ s/
//g; push(@new,"
$_"); } close(IN); open(OUT,">$target2") || print "Write Error: $target2
\n"; print OUT @new; close(OUT); chmod (0666, $target2); } else { print "存在しません:$target1
\n"; } } print "

処理完了

\n"; print "\n"; exit; #--------------# # エラー処理 # #--------------# sub error { print <<"EOM";

ERROR

$_[0]
EOM exit; }