#!/usr/bin/perl
##=======================================================================##
## AD-EDIT PAGE-EDIT2 v4.0.5
## (c)2008-2011 NorenzPRO Ltd. TakafumiArai 2011/12/29
##=======================================================================##
use CGI::Carp qw(fatalsToBrowser);
##=======================================================================##
## 設定項目
##=======================================================================##
##★ライブラリ
use Encode;
require './mimew.pl';
require '../admin/emoji.pl';
require '../admin/aelib.cgi';
##★このスクリプトの名前
$cginame = 'index.cgi';
##★データファイルのパス
$datafile = './data.dat';
##★レスファイルのパス
$resfile = './res.dat';
##★カテゴリファイルのパス
$ctgfile = './ctg.dat';
##★アップロード画像格納ディレクトリ(相対・絶対パス)
$img_dir = './file/';
##★アップロード画像公開ディレクトリ(相対・絶対パス)
$img_path = './file/';
##=====================================================================================##
##メインルーチン
##=====================================================================================##
##キャリア転送
$ua = $ENV{"HTTP_USER_AGENT"};
if ($ua =~ /DoCoMo\/1\.0/i) { $xCR='mobi'; }
elsif ($ua =~ /Mozilla/i) { $xCR='pc'; }
elsif ($ua =~ /(DoCoMo\/2\.0|FOMA)/i) { $xCR='mobi'; }
elsif ($ua =~ /^(SoftBank|Vodafone|J\-PHONE|MOT\-[CV])/i) { $xCR='mobi'; }
elsif ($ua =~ /^UP\.Browser/i) { $xCR='mobi'; }
elsif ($ua =~ /^(KDDI\-|OPWV|MMP)/i) { $xCR='mobi'; }
else { $xCR='pc'; }
##システム設定ファイル読込
$servconf = '../admin/conf.dat';
if (-e $servconf) {
open(SVCFGRD,"$servconf");
@SVCONF = ;
close(SVCFGRD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($servconf);
if ($contCC eq 'shiftjis') {
foreach (@SVCFGRD) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
$DirMode =$SVCONF[0];
$DirMode =~ s/\r//g; $DirMode =~ s/\n//g;
$ExecMode =$SVCONF[1];
$ExecMode =~ s/\r//g; $ExecMode =~ s/\n//g;
$WRMode =$SVCONF[2];
$WRMode =~ s/\r//g; $WRMode =~ s/\n//g;
$Domain =$SVCONF[3];
$Domain =~ s/\r//g; $Domain =~ s/\n//g;
$PerlPath =$SVCONF[4];
$PerlPath =~ s/\r//g; $PerlPath =~ s/\n//g;
$EditType =$SVCONF[5];
$EditType =~ s/\r//g; $EditType =~ s/\n//g;
$EditName =$SVCONF[6];
$EditName =~ s/\r//g; $EditName =~ s/\n//g;
$SendmailPath =$SVCONF[7];
$SendmailPath =~ s/\r//g; $SendmailPath =~ s/\n//g;
$GmapAPIkey =$SVCONF[8];
$GmapAPIkey =~ s/\r//g; $GmapAPIkey =~ s/\n//g;
$SysVersion =$SVCONF[9];
$SysVersion =~ s/\r//g; $SysVersion =~ s/\n//g;
$RootPath =$SVCONF[10];
$RootPath =~ s/\r//g; $RootPath =~ s/\n//g;
$LogoutTime =$SVCONF[11];
$LogoutTime =~ s/\r//g; $LogoutTime =~ s/\n//g;
$PathConvert =$SVCONF[12];
$PathConvert =~ s/\r//g; $PathConvert =~ s/\n//g;
$pcoutCode =$SVCONF[22];
$pcoutCode =~ s/\r//g; $pcoutCode =~ s/\n//g;
}
if ($PathConvert eq '') { $PathConvert ='/usr/local/bin/convert'; }
if ($LogoutTime eq '') { $LogoutTime='259200'; }
if ($DirMode eq '') { $DirMode ='0755'; }
if ($ExecMode eq '') { $ExecMode ='0755'; }
if ($WRMode eq '') { $WRMode ='0666'; }
if ($PerlPath eq '') { $PerlPath ='#!/usr/local/bin/perl'; }
if ($pcoutCode eq '') { $pcoutCode='sjis'; }
##設定ファイル読込
$conffile='./conf.dat';
open(CONFRD,"$conffile");
@CONF = ;
close(CONFRD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($conffile);
if ($contCC eq 'shiftjis') {
foreach (@CONF) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
$AdmiTitle =$CONF[0];
$AdmiTitle =~ s/\r//g;$AdmiTitle =~ s/\n//g;
$PageTitle =$CONF[3];
$PageTitle =~ s/\r//g;$PageTitle =~ s/\n//g;
$pageview =$CONF[4];
$pageview =~ s/\r//g;$pageview =~ s/\n//g;
$SkinFile =$CONF[5];
$SkinFile =~ s/\r//g;$SkinFile =~ s/\n//g;
$SkinFile ='..'.$SkinFile;
$FileTypeLine =$CONF[12];
$FileTypeLine =~ s/\r//g;$FileTypeLine =~ s/\n//g;
@FileType=split(/:/,$FileTypeLine);
$TimeStamp =$CONF[13];
$TimeStamp =~ s/\r//g;$TimeStamp =~ s/\n//g;
$DirName =$CONF[14];
$DirName =~ s/\r//g;$DirName =~ s/\n//g;
$ViewMode =$CONF[20];
$ViewMode =~ s/\r//g;$ViewMode =~ s/\n//g;
$SideTitle =$CONF[21];
$SideTitle =~ s/\r//g;$SideTitle =~ s/\n//g;
$ResMode =$CONF[22];
$ResMode =~ s/\r//g;$ResMode =~ s/\n//g;
$NoticeTo =$CONF[23];
$NoticeTo =~ s/\r//g;$NoticeTo =~ s/\n//g;
$PageHeadMsg =$CONF[24];
$PageHeadMsg =~ s/\r//g;$PageHeadMsg =~ s/\n//g;
$PageHeadMsg=&tag_change($PageHeadMsg);
$PageHeadMsg=&EmojiTagToGif($PageHeadMsg);
$PageHeadMsg =~ s/
/
\&\#32\;/g;
$PageHeadMsg = &cgi_include($PageHeadMsg);
$PageHeadMsg = &url_import($PageHeadMsg);
$NaviBack =$CONF[26];
$NaviBack =~ s/\r//g;$NaviBack =~ s/\n//g;
$NaviNext =$CONF[27];
$NaviNext =~ s/\r//g;$NaviNext =~ s/\n//g;
$ListBack =$CONF[28];
$ListBack =~ s/\r//g;$ListBack =~ s/\n//g;
$ListNext =$CONF[29];
$ListNext =~ s/\r//g;$ListNext =~ s/\n//g;
$ToListView =$CONF[33];
$ToListView =~ s/\r//g;$ToListView =~ s/\n//g;
$ToDetail =$CONF[35];
$ToDetail =~ s/\r//g;$ToDetail =~ s/\n//g;
$ResShow =$CONF[41];
$ResShow =~ s/\r//g;$ResShow =~ s/\n//g;
$HtmlHeader =$CONF[43];
$HtmlHeader =~ s/\r//g;$HtmlHeader =~ s/\n//g;
$HtmlHeader =~ s/
/\n/g;
$GreyBox =$CONF[44];
$GreyBox =~ s/\r//g;$GreyBox =~ s/\n//g;
$NaviComment =$CONF[45];
$NaviComment =~ s/\r//g;$NaviComment =~ s/\n//g;
$NaviToukou =$CONF[46];
$NaviToukou =~ s/\r//g;$NaviToukou =~ s/\n//g;
$NaviSyusei =$CONF[47];
$NaviSyusei =~ s/\r//g;$NaviSyusei =~ s/\n//g;
$NaviKakunin =$CONF[51];
$NaviKakunin =~ s/\r//g;$NaviKakunin =~ s/\n//g;
$PgTitleClass =$CONF[52];
$PgTitleClass =~ s/\r//g;$PgTitleClass =~ s/\n//g;
$ListTitleClass =$CONF[54];
$ListTitleClass =~ s/\r//g;$ListTitleClass =~ s/\n//g;
$pgHdMsgDtl =$CONF[61];
$pgHdMsgDtl =~ s/\r//g;$pgHdMsgDtl =~ s/\n//g;
$OutPutHTML =$CONF[63];
$OutPutHTML =~ s/\r//g;$OutPutHTML =~ s/\n//g;
$ListHeadMsg =$CONF[64];
$ListHeadMsg =~ s/\r//g;$ListHeadMsg =~ s/\n//g;
$ListHeadMsg = &inline_link($ListHeadMsg);
$ListHeadMsg = &tag_change($ListHeadMsg);
$ListHeadMsg = &EmojiTagToGif($ListHeadMsg);
$ListHeadMsg =~ s/
/
\&\#32\;/g;
$ListHeadMsg = &cgi_include($ListHeadMsg);
$ListHeadMsg = &url_import($ListHeadMsg);
$ListFootMsg =$CONF[65];
$ListFootMsg =~ s/\r//g;$ListFootMsg =~ s/\n//g;
$ListFootMsg = &inline_link($ListFootMsg);
$ListFootMsg = &tag_change($ListFootMsg);
$ListFootMsg = &EmojiTagToGif($ListFootMsg);
$ListFootMsg =~ s/
/
\&\#32\;/g;
$ListFootMsg = &cgi_include($ListFootMsg);
$ListFootMsg = &url_import($ListFootMsg);
$pgListCols =$CONF[66];
$pgListCols =~ s/\r//g;$pgListCols =~ s/\n//g;
$viewCategory =$CONF[69];
$viewCategory =~ s/\r//g;$viewCategory =~ s/\n//g;
$ctgName =$CONF[70];
$ctgName =~ s/\r//g;$ctgName =~ s/\n//g;
$ctgCSS =$CONF[71];
$ctgCSS =~ s/\r//g;$ctgCSS =~ s/\n//g;
$ctgNumview =$CONF[75];
$ctgNumview =~ s/\r//g;$ctgNumview =~ s/\n//g;
$resNumview =$CONF[76];
$resNumview =~ s/\r//g;$resNumview =~ s/\n//g;
$NoticeFrom =$CONF[77];
$NoticeFrom =~ s/\r//g;$NoticeFrom =~ s/\n//g;
$NoticeBodyMail =$CONF[78];
$NoticeBodyMail =~ s/\r//g;$NoticeBodyMail =~ s/\n//g;
$hdPageTitle =$CONF[86];
$hdPageTitle =~ s/\r//g;$hdPageTitle =~ s/\n//g;
$fmtDate =$CONF[88];
$fmtDate =~ s/\r//g;$fmtDate =~ s/\n//g;
$fmtPgTitle =$CONF[89];
$fmtPgTitle =~ s/\r//g;$fmtPgTitle =~ s/\n//g;
$fmtLsTitle =$CONF[90];
$fmtLsTitle =~ s/\r//g;$fmtLsTitle =~ s/\n//g;
$MsgAnchor =$CONF[103];
$MsgAnchor =~ s/\r//g;$MsgAnchor =~ s/\n//g;
if ($ResShow eq '') { $ResShow='ResShow'; }
if ($NaviBack eq '') { $NaviBack='[<<BACK]'; }
if ($NaviNext eq '') { $NaviNext='[NEXT>>]'; }
if ($ListBack eq '') { $ListBack='[≪戻る]'; }
if ($ListNext eq '') { $ListNext='[次へ≫]'; }
if ($ToListView eq '') { $ToListView='[リストへ戻る]'; }
if ($ToDetail eq '') { $ToDetail='[詳細記事≫]'; }
if ($NaviComment eq '') { $NaviComment='[コメントする]'; }
if ($NaviToukou eq '') { $NaviToukou='投稿する'; }
if ($NaviSyusei eq '') { $NaviSyusei='修正する'; }
if ($NaviKakunin eq '') { $NaviKakunin='投稿確認ページへ'; }
if ($pgListCols eq '') { $pgListCols='1'; }
if ($hdPageTitle eq '') { $hdPageTitle=$PageTitle; }
if ($fmtDate eq '') { $fmtDate='[dYYYY]/[dM]/[dD]([dYoubi])'; }
if ($fmtPgTitle eq '') { $fmtPgTitle='[TITLE] [SUB] [DATE]'; }
if ($fmtLsTitle eq '') { $fmtLsTitle='[TITLE][SUB] [DATEs] [RESn]'; }
if ($MsgAnchor eq '') { $MsgAnchor='MsgAnchorON'; }
$pgListRows=$pageview;
$pageview=$pgListRows*$pgListCols;
##AGENTの取得
$hostaddr = &domain_name;
$agent = $ENV{'HTTP_USER_AGENT'};
$agent =~ s/\,/\./g;
$ref = $ENV{'HTTP_REFERER'};
##日付・時刻情報の取得
$ENV{'TZ'} = "JST-9";
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time);
$year += 1900;
$yr2d = $year-2000;
$month = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec') [$mon];
$mon++;
$mon2d=sprintf("%02d",$mon);
$mday2d=sprintf("%02d",$mday);
$youbi = ('日','月','火','水','木','金','土') [$wday];
$week = ('Sun','Mon','Tue','Wed','Thu','Fri','Sat') [$wday];
$xmon=sprintf("%02d",$mon);
$xmday=sprintf("%02d",$mday);
$xhour=sprintf("%02d",$hour);
$xmin=sprintf("%02d",$min);
$DATE = $fmtDate;
$DATE =~ s/\[dYYYY\]/$year/g;
$DATE =~ s/\[dYY\]/$yr2d/g;
$DATE =~ s/\[dMM\]/$mon2d/g;
$DATE =~ s/\[dM\]/$mon/g;
$DATE =~ s/\[dME\]/$month/g;
$DATE =~ s/\[dDD\]/$mday/g;
$DATE =~ s/\[dD\]/$mday2d/g;
$DATE =~ s/\[dYoubi\]/$youbi/g;
$DATE =~ s/\[dWeek\]/$week/g;
$DATE =~ s/\d\d\d\d\///g;
$DATE =~ s/\d\d\d\d\-//g;
$DATE =~ s/\d\d\d\d\.//g;
$DATE =~ s/\/\d\d\d\d//g;
$DATE =~ s/-\d\d\d\d//g;
$DATE =~ s/\.\d\d\d\d//g;
$DATE2 = $year.'/'.$mon.'/'.$mday;
$DATE3 = $year.$xmon.$xmday.$xhour.$xmin.'';
$DATE4 = $year.'/'.$xmon.'/'.$xmday.' '.$xhour.':'.$xmin;
##乱数処理(セキュリティ用)
$RandNum=int(rand(100000));
$RandNum = sprintf("%05d",$RandNum);
##フォームの取得
if ($ENV{'REQUEST_METHOD'} eq "POST") {
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/,$buffer);
for $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/</g;
$value =~ s/>/>/g;
$value =~ s/<br>/
/g;
$value =~ s/=/\|eq\|/g;
$value =~ s/\"/\|quot\|/g;
$value =~ s/\'/\|apos\|/g;
$value =~ s/"/\|quot\|/g;
$value =~ s/'/\|apos\|/g;
$value =~ s/\r\n/
/g;
$value =~ s/\n/
/g;
$value =~ s/\r/
/g;
if ($pcoutCode eq 'sjis') { Encode::from_to($value, 'shiftjis', 'utf8'); }
$value =~ s/\xEF\xBD\x9E/\xE3\x80\x9C/g;
$value =~ s/\xEF\xBC\x8D/\xE2\x88\x92/g;
$in{$name} = $value;
}
} else {
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/,$buffer);
for $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/</g;
$value =~ s/>/>/g;
$value =~ s/=/\|eq\|/g;
$value =~ s/\r\n/
/g;
$value =~ s/\n/
/g;
$value =~ s/\r/
/g;
if ($pcoutCode eq 'sjis') { Encode::from_to($value, 'shiftjis', 'utf8'); }
$value =~ s/\xEF\xBD\x9E/\xE3\x80\x9C/g;
$value =~ s/\xEF\xBC\x8D/\xE2\x88\x92/g;
$in{$name} = $value;
}
}
##携帯アクセス転送
if ($xCR eq 'mobi') {
if ($in{'pg'} ne '') {
print 'Location:mobi.cgi?pg='.$in{'pg'}."\n\n";
exit;
} else {
print 'Location:mobi.cgi'."\n\n";
exit;
}
}
##==============メインアクション==============
if ($in{'resdel'} eq '1') { $in{'mode'}='delete'; }
if ($in{'pg'} ne '') { $in{'mode'}='detail'; $in{'code'}=$in{'pg'}; }
if ($in{'mode'} eq 'detail') { &detail; }
elsif ($in{'mode'} eq 'input') { &detail; }
elsif ($in{'mode'} eq 'check') { &detail; }
elsif ($in{'mode'} eq 'regist') { ®ist; }
elsif ($in{'mode'} eq 'edit') { &detail; }
elsif ($in{'mode'} eq 'delete') { &delete; }
elsif ($in{'mode'} eq 'preview2') { &detail; }
elsif ($in{'mode'} eq 'result') { &detail; }
else { &list; }
exit;
##=====================================================================================##
##サブルーチン
##=====================================================================================##
sub html_head {
if ($GreyBox==1) {
if ($RootPath ne '') {$GBpath=$Domain.'/'.$RootPath; } else { $GBpath=$Domain; }
$gbJS = <<"gbJS";
gbJS
} else { $gbJS=''; }
if ($RootPath ne '') {
$RssURL='http://'.$Domain.'/'.$RootPath.'/'.$DirName.'/rdfout.cgi';
} else {
$RssURL='http://'.$Domain.'/'.$DirName.'/rdfout.cgi';
}
$RdfTag='';
#スキンページ読込
&page_read;
print "Content-type: text/html\n\n";
$phi=0;
foreach (@PHEAD) {
$PHEAD[$phi]=~ s/<\/head>/$HtmlHeader$gbJS\n$RdfTag\n<\/head>/g;
if ($pcoutCode eq 'sjis') { Encode::from_to($PHEAD[$phi], 'utf8', 'shiftjis'); }
print $PHEAD[$phi];
$phi++;
}
}
##=======================================================================================
sub html_foot {
#スキンページ読込
&page_read;
$pfi=0;
foreach (@PFOOT) {
if ($pcoutCode eq 'sjis') { Encode::from_to($PFOOT[$pfi], 'utf8', 'shiftjis'); }
print $PFOOT[$pfi];
$pfi++;
}
}
##=======================================================================================
sub list {
##★フォーム取得
if ($in{'pline'} eq '') { $pline = 0; } else { $pline = $in{'pline'}; }
if ($in{'lline'} eq '') { $lline = 0; } else { $lline = $in{'lline'}; }
$vCTGname=$in{'ctg'};
$vCTGname =~ s/ctg//g;
$vCTGname =~ s/\|eq\|/=/g;
$vCTGname =~ s/\|quot\|/\"/g;
$vCTGname =~ s/\|apos\|/\'/g;
&html_head;
if ($PgTitleClass ne '') { $addTitleClass=' class="'.$PgTitleClass.'"'; }
if ($pcoutCode eq 'sjis') { Encode::from_to($vCTGname, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageTitle, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageHeadMsg, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($ListHeadMsg, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($ListFootMsg, 'utf8', 'shiftjis'); }
if (($ViewMode eq '0')&&($viewCategory eq '')) {
if ($PageTitle ne '') {
print ''.$PageTitle.' '.$vCTGname.'
';
}
if ($PageHeadMsg ne '') {
print ''.$PageHeadMsg.'
'."\n";
}
&html_list;
} else {
print "";
if ($PageTitle ne '') {
print '
'.$PageTitle.' '.$vCTGname.'
';
}
if ($PageHeadMsg ne '') {
print '
'.$PageHeadMsg.'
'."\n";
}
&html_list;
print "
";
if ($ListHeadMsg ne '') { print $ListHeadMsg; }
&html_right;
if ($ListFootMsg ne '') { print $ListFootMsg; }
print "
";
}
&html_foot;
exit;
}
##=======================================================================================
sub html_list {
##メイン記事の読込み
&data_read;
if ($in{'mode'} eq 'preview1') {
@NEW = grep(/code=$in{'prevcode'}\t/,@DATA);
} else {
@TRUE = grep(/code=/,@DATA);
##公開指定のみ@DATAへ
$i=0;
foreach(@TRUE) {
$FILE{'vSt'}='200001010000';$FILE{'vFn'}='299912310000';
@termLine=split(/\t/,$TRUE[$i]);
foreach (@termLine) {
($key, $value) = split(/=/,$_);
$FILE{$key} = $value;
}
if (($DATE3 > $FILE{'vSt'})&&($DATE3 <= $FILE{'vFn'})) { push(@TERM,$TRUE[$i]); }
$i++;
}
@PRE = grep(/\tshow=on\t/,@TERM);
$di=0; $tflag=0; $dLot=@PRE-1;
for (0..$dLot) {
if ($PRE[$di] !~ /\ttitle=\t/i) { $tflag=1; }
if ($tflag==0) { push(@NEW,$PRE[$di]); }
if (($tflag==1)&&($PRE[$di] !~ /\ttitle=\t/i)) { push(@NEW,$PRE[$di]); }
$di++;
}
}
##カテゴリ表示
if ($in{'ctg'} ne '') {
$targctg=$in{'ctg'};
@CTGNEW = grep(/$targctg /,@NEW);
push(@CTGNEW,grep(/$targctg\t/,@NEW));
@NEW=();
push(@NEW,@CTGNEW);
$nctg = $in{'ctg'};
if ($pcoutCode eq 'sjis') { Encode::from_to($nctg, 'utf8', 'shiftjis'); }
$nctg =~ s/([^\w ])/'%'.unpack('H2', $1)/eg;
$nctg =~ tr/ /+/;
$addCtgNavi='&ctg='.$nctg;
}
##レス記事読込み
if ($ResMode eq 'ResMode') {
&res_read;
@RESTRUE = grep(/code=/,@RES);
}
##開始記事($TopData)-終了記事($EndData)の取得
$TopData = $pline;
$dLot=@NEW-1;
$EndData=$TopData+$pageview-1;
if ($dLot<=$pageview) { $EndData=$TopData+$dLot; }
if ($EndData >= $dLot) { $EndData=$dLot; }
#テーブル表示
if ($pgListCols > 1) {
print '';
$cellwidth=int(100/$pgListCols);
$tdi=1;
}
##記事出力
foreach ($TopData..$EndData) {
$FILE{'dhide'}='';
$FILE{'title'}='';
$FILE{'sub'}='';
$f1_code=''; $f0_imgtag='';
$f1_sub=''; $f1_title='';
@LINE = split(/\t/,$NEW[$_]);
foreach (@LINE) {
($key, $value) = split(/=/,$_);
$value =~ s/\|eq\|/=/g;
$value =~ s/\|quot\|/\"/g;
$value =~ s/\|apos\|/\'/g;
$FILE{$key} = $value;
}
$f1_code = $FILE{'code'};
$f1_show = $FILE{'show'};
$f1_tshow = $FILE{'tshow'};
$f1_align = $FILE{'align'};
$f1_date = $FILE{'date'};
$f1_title = $FILE{'title'};
$f1_title = &tag_change($f1_title);
$f1_title = &EmojiTagToGif($f1_title);
$f1_sub = $FILE{'sub'};
$f1_sub = &tag_change($f1_sub);
$f1_sub = &EmojiTagToGif($f1_sub);
$f1_summary = $FILE{'summary'};
$f1_summary = &inline_link($f1_summary);
$f1_summary = &tag_change($f1_summary);
$f1_summary = &EmojiTagToGif($f1_summary);
$f1_summary =~ s/\|br\|/\n/g;
$f1_summary =~ s/
/
\&\#32\;/g;
$f1_summary =~ s/
/
\&\#32\;/g;
$f1_summary = &cgi_include($f1_summary);
$f1_summary = &url_import($f1_summary);
##★リスト用画像があれば表示
$FtLot=@FileType-1;$i=0;
for (0..$FtLot) {
$f0_filepath = $img_dir.$f1_code.'9.'.$FileType[$i];
$h0_filepath = $img_path.$f1_code.'9.'.$FileType[$i];
if ($FileType[$i] eq 'jpg') { $FtypeName='[JPG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'gif') { $FtypeName='[GIF画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'png') { $FtypeName='[PNG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'doc') { $FtypeName='[WORD書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'docx') { $FtypeName='[WORD2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xls') { $FtypeName='[EXCEL書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xlsx') { $FtypeName='[EXCEL2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'ppt') { $FtypeName='[PPT書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pptx') { $FtypeName='[PPT2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'jtd') { $FtypeName='[一太郎書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'txt') { $FtypeName='[テキスト書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pdf') { $FtypeName='[PDF書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp3') { $FtypeName='[MP3音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wma') { $FtypeName='[WMA音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mmf') { $FtypeName='[MMF音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mld') { $FtypeName='[MLD音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wmv') { $FtypeName='[WMV動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp4') { $FtypeName='[MPEG4動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3gp') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3g2') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'zip') { $FtypeName='[ZIPファイル]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'lzh') { $FtypeName='[LZHファイル]'; $FtypeImg=0; }
if ((-e $f0_filepath)&&($FtypeImg==1)) {
$f0_imgtag = "";
$f0_filetag='';
$f1_clear='
';
last;
} elsif ((-e $f0_filepath)&&($FtypeImg==0)) {
$f0_imgtag = '';
$f0_filetag = ''.$FtypeName.'';
last;
} else { $f0_imgtag = ''; $f0_filetag='' }
$i++;
}
##★レスモード時の出力処理
$ResView='';
if ($ResMode eq 'ResMode') {
@RESSHOW = grep(/\tresto=$f1_code\t/,@RESTRUE);
@RESLINES = grep(/\trshow=on\t/,@RESSHOW);
##レス記事出力
$ResLot=@RESLINES;
$ResView='[コメント'.$ResLot.'件] ';
}
##記事アンカー
if ($MsgAnchor eq 'MsgAnchorON') {
$htMsgAnchor=' ';
} else { $htMsgAnchor=''; }
##★リスト画面の変更はここを訂正
if (($TimeStamp eq '1')&&($f1_date ne '')) { $TTtag=$f1_date; } else { $TTtag=''; }
if ($FILE{'dhide'} eq '') {
$DetailTag=''.$ResView
.' '
.$ToDetail.'
';
} else {
$DetailTag='';
}
if ($f1_title ne "") {
if ($f1_sub ne '') { $fv_sub=$f1_sub; } else { $fv_sub=''; }
$fmvPgTitle = $fmtPgTitle;
$fmvPgTitle =~ s/\[TITLE\]/$f1_title/g;
$fmvPgTitle =~ s/\[SUB\]/$fv_sub/g;
$fmvPgTitle =~ s/\[DATE\]/$TTtag/g;
if ($PgTitleClass ne '') { $TitleCssID=' id="'.$PgTitleClass.$f1_code.'"'; } else { $TitleCssID=''; }
$htmlc_list = <<"LISTC";
$htMsgAnchor
<$f1_tshow$TitleCssID>$fmvPgTitle$f1_tshow>
$f0_imgtag $f1_imgtag $f1_summary $f0_filetag $f1_filetag $f1_clear
$DetailTag
LISTC
} else {
$htmlc_list = <<"LISTC";
$htMsgAnchor
$f0_imgtag $f1_summary $f0_filetag $f1_clear
LISTC
}
#テーブル表示
if ($pgListCols>1) {
if ($tdi==1) { print ''."\n"; }
print '';
}
#記事表示
if ($pcoutCode eq 'sjis') { Encode::from_to($htmlc_list, 'utf8', 'shiftjis'); }
print $htmlc_list;
#テーブル表示
if ($pgListCols>1) {
print ' | '."\n";
if ($_==$EndData) {
$tdnum=$pgListCols-$tdi;
if ($tdnum>0) {
for(1..$tdnum) { print ' | '."\n"; }
print '
'."\n";
}
}
if ($tdi==$pgListCols) { print ''."\n"; $tdi=0;}
$tdi++;
}
}
#テーブル表示
if ($pgListCols > 1) {
print '
'."\n";
}
##★ページ移動ナビ
if ($in{'resto'} eq '') {
$next_line = $pline + $pageview;
$back_line = $pline - $pageview;
if ($back_line < 0) { $back_line =0; }
print "\n";
if ($TopData != 0) {
$BackURL=$cginame.'?mode=list&pline='.$back_line.'&lline='.$lline.$addCtgNavi;
$tagNavigator= "$NaviBack\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
$tLot=@NEW;
$pLotN=int($tLot/$pageview);
$pLotG=$tLot/$pageview;
if ($pLotG > $pLotN) { $pLotN++; }
if ($pLotN >= 3) {
print ' [';
$pNum=int($pline/$pageview)+1;
if ($pNum >= 4) { $startNum=$pNum-3; } else { $startNum=1; }
for (1..7) {
$pnLine=($startNum-1)*$pageview;
if ($startNum <= $pLotN) {
if ($pnLine ne $pline) {
$pNumURL=$cginame.'?mode=list&pline='.$pnLine.'&lline='.$lline.$addCtgNavi;
print " $startNum \n";
} else {
print " $startNum \n";
}
}
$startNum++;
}
print '] ';
} else { print " "; }
if ($EndData != $dLot) {
$BackURL=$cginame.'?mode=list&pline='.$next_line.'&lline='.$lline.$addCtgNavi;
$tagNavigator= "$NaviNext\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
print "
\n";
}
}
##=======================================================================================
sub detail {
##★フォーム取得
if ($in{'pline'} eq '') { $pline = 0; } else { $pline = $in{'pline'}; }
if ($in{'lline'} eq '') { $lline = 0; } else { $lline = $in{'lline'}; }
$vCTGname=$in{'ctg'};
$vCTGname =~ s/ctg//g;
$vCTGname =~ s/\|eq\|/=/g;
$vCTGname =~ s/\|quot\|/\"/g;
$vCTGname =~ s/\|apos\|/\'/g;
&html_head;
if ($PgTitleClass ne '') { $addTitleClass=' class="'.$PgTitleClass.'"'; }
if ($pcoutCode eq 'sjis') { Encode::from_to($vCTGname, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageTitle, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageHeadMsg, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($ListHeadMsg, 'utf8', 'shiftjis'); }
if ($pcoutCode eq 'sjis') { Encode::from_to($ListFootMsg, 'utf8', 'shiftjis'); }
if (($ViewMode eq '0')&&($viewCategory eq '')) {
if ($PageTitle ne '') {
print ''.$PageTitle.' '.$vCTGname.'
';
}
if (($PageHeadMsg ne '')&&($pgHdMsgDtl ne '')) {
print ''."\n";
}
&html_detail;
} else {
print "";
if ($PageTitle ne '') {
print '
'.$PageTitle.' '.$vCTGname.'
';
}
if (($PageHeadMsg ne '')&&($pgHdMsgDtl ne '')) {
print '
'."\n";
}
&html_detail;
print "
";
if ($ListHeadMsg ne '') { print $ListHeadMsg; }
&html_right;
if ($ListFootMsg ne '') { print $ListFootMsg; }
print "
";
}
&html_foot;
exit;
}
##=======================================================================================
sub html_detail {
##レスモード処理
if ($ResMode eq 'ResMode') {
&res_read;
@RESTRUE = grep(/code=/,@RES);
##レスモード $in{'mode'}=inputのときの処理
if ($in{'mode'} eq 'input') { $pageview=1; }
##レスモード $in{'mode'}=editのときの処理
if ($in{'mode'} eq 'edit') { $pageview=1; }
##レスモード $in{'mode'}=checkのときの処理
if ($in{'mode'} eq 'check') {
$pageview=1;
if ($in{'restitle'} eq '') { &errorout('タイトルが記入されていません'); }
if ($in{'resname'} eq '') { &errorout('おなまえが記入されていません'); }
if ($in{'resmsg'} eq '') { &errorout('本文が記入されていません'); }
##編集認証
if ($in{'corcode'} ne '') {
@RESOWNER = grep(/code=$in{'corcode'}\t/,@RES);
$rcpw =crypt($in{'respw'},'ae');
if ($RESOWNER[0] !~ /\trespw=$rcpw\t/) {
&errorout('投稿パスワードが違います');
}
}
}
}
##メイン記事の読込み
&data_read;
if ($in{'mode'} eq 'preview2') {
@NEW = grep(/code=$in{'prevcode'}\t/,@DATA);
push(@TTLINE,@NEW);
} else {
@TRUE = grep(/code=/,@DATA);
##公開指定のみ@DATAへ
$i=0;
foreach(@TRUE) {
$FILE{'vSt'}='200001010000';$FILE{'vFn'}='299912310000';
@termLine=split(/\t/,$TRUE[$i]);
foreach (@termLine) {
($key, $value) = split(/=/,$_);
$FILE{$key} = $value;
}
if (($DATE3 > $FILE{'vSt'})&&($DATE3 <= $FILE{'vFn'})) { push(@TERM,$TRUE[$i]); }
$i++;
}
@NEW = grep(/\tshow=on\t/,@TERM);
@TTLINE = grep(!/\ttitle=\t/,@NEW);
}
##カテゴリ表示
if ($in{'ctg'} ne '') {
$targctg=$in{'ctg'};
@CTGNEW = grep(/$targctg /,@NEW);
push(@CTGNEW,grep(/$targctg\t/,@NEW));
@NEW=();
push(@NEW,@CTGNEW);
@TTLINE=();
@TTLINE = grep(!/\ttitle=\t/,@NEW);
$nctg = $in{'ctg'};
if ($pcoutCode eq 'sjis') { Encode::from_to($nctg, 'utf8', 'shiftjis'); }
$nctg =~ s/([^\w ])/'%'.unpack('H2', $1)/eg;
$nctg =~ tr/ /+/;
$addCtgNavi='&ctg='.$nctg;
}
##開始記事($TopData)の取得
$i=0;
foreach (@NEW) {
if ($NEW[$i] =~ /code=$in{'code'}\t/) {
$TopData=$i;
last;
}
$i++;
}
##終了記事($EndData)の取得
$i=0;
foreach (@TTLINE) {
if ($TTLINE[$i] =~ /code=$in{'code'}\t/) { $endFlag=1; }
$i++;
if ($endFlag==1) {
@EndLine=split(/\t/,$TTLINE[$i]);
($x,$EndCode)=split(/=/,$EndLine[0]);
last;
}
}
$i=0;
foreach (@NEW) {
if ($NEW[$i] =~ /code=$EndCode\t/) {
$EndData=$i-1;
last;
}
$i++;
}
$EndNEWnum=@NEW-1;
if ($EndData eq '') {$EndData=$EndNEWnum; }
##記事出力
$resline=0;
foreach ($TopData..$EndData) {
$f1_code=''; $f0_imgtag='';
@LINE = split(/\t/,$NEW[$_]);
foreach (@LINE) {
($key, $value) = split(/=/,$_);
$value =~ s/\|eq\|/=/g;
$value =~ s/\|quot\|/\"/g;
$value =~ s/\|apos\|/\'/g;
$FILE{$key} = $value;
}
$f1_code = $FILE{'code'};
$f1_show = $FILE{'show'};
$f1_tshow = $FILE{'tshow'};
$f1_align = $FILE{'align'};
$f1_date = $FILE{'date'};
$f1_title = $FILE{'title'};
$fr_title = $f1_title;
$fm_title = $f1_title;
$f1_title = &tag_change($f1_title);
$f1_title = &EmojiTagToGif($f1_title);
$f1_sub = $FILE{'sub'};
$fm_sub = $f1_sub;
$f1_sub = &tag_change($f1_sub);
$f1_sub = &EmojiTagToGif($f1_sub);
$f1_message = $FILE{'message'};
$f1_message = &inline_link($f1_message);
$f1_message = &tag_change($f1_message);
$f1_message = &EmojiTagToGif($f1_message);
$f1_message =~ s/\|br\|/\n/g;
$f1_message=~ s/
/
\&\#32\;/g;
$f1_message =~ s/
/
\&\#32\;/g;
$f1_message = &cgi_include($f1_message);
$f1_message = &url_import($f1_message);
##★レスモード時の出力処理
$ResView='';$ResTag='';
if ($ResMode eq 'ResMode') {
##レス分岐処理(レスブロックの表示/非表示)
$nxline=$_+1;
if ($NEW[$nxline] =~ /\ttitle=\t/) { $resline=0; } else { $resline=1; }
##レス記事コード取得
if ($f1_title ne "") { $resto=$f1_code; $fr_title='re:'.$fr_title;}
##レス記事出力
@RESLINEPRE = grep(/\tresto=$resto\t/,@RESTRUE);
@RESLINES = grep(!/\trshow=off\t/,@RESLINEPRE);
$ResLot=@RESLINES-1;
if (($resline==1)&&($ResLot >= 0)) {
$ri=$ResLot;
for (0..$ResLot) {
@RESELEMENT = split(/\t/,$RESLINES[$ri]);
foreach (@RESELEMENT) {
($key, $value) = split(/=/,$_);
$value =~ s/\|eq\|/=/g;
$value =~ s/\|quot\|/\"/g;
$value =~ s/\|apos\|/\'/g;
$RES{$key} = $value;
}
$RES{'resmsg'} =~ s/
/
\&\#32\;/g;
$RES{'resmsg'} =~ s/
/
\&\#32\;/g;
$RES{'restitle'} = &EmojiTagToGif($RES{'restitle'});
$RES{'resname'} = &EmojiTagToGif($RES{'resname'});
$RES{'resmsg'} = &EmojiTagToGif($RES{'resmsg'});
$ResView=$ResView.'
'.$RES{'restitle'}.''
.' '.$RES{'resname'}.'さん '.$RES{'date'}.' '
.' [編集]'
.'
'
.$RES{'resmsg'}.'
'."\n";
$ri--;
}
} else { $ResView=''; }
##入力画面出力
if ($resline==1) {
if ($in{'mode'} eq 'input') {
$fr_title =~ s/\|eq\|/=/g;
$fr_title =~ s/\|quot\|/"/g;
$fr_title =~ s/\|apos\|/'/g;
$fr_title =~ s/\"/"/g;
$fr_title =~ s/\'/'/g;
$ResTag='
'
.'
'."\n";
} elsif ($in{'mode'} eq 'edit') {
@RESCORR = grep(/code=$in{'corcode'}\t/,@RESTRUE);
@CORLINES=split(/\t/,$RESCORR[0]);
foreach (@CORLINES) {
($key, $value) = split(/=/,$_);
$value =~ s/
/\n/g;
$value =~ s/\|eq\|/=/g;
$value =~ s/\|quot\|/"/g;
$value =~ s/\|apos\|/'/g;
$cor{$key} = $value;
}
$ResTag='
'
.'
'."\n";
} elsif ($in{'mode'} eq 'check') {
$vresname=$in{'resname'};
$vresname =~ s/\|eq\|/=/g; $vresname =~ s/\|quot\|/\"/g; $vresname =~ s/\|apos\|/\'/g;
$vrestitle=$in{'restitle'};
$vrestitle =~ s/\|eq\|/=/g; $vrestitle =~ s/\|quot\|/\"/g; $vrestitle =~ s/\|apos\|/\'/g;
$vresmsg=$in{'resmsg'};
$vresmsg =~ s/\|eq\|/=/g; $vresmsg =~ s/\|quot\|/\"/g; $vresmsg =~ s/\|apos\|/\'/g;
$CheckNum=($RandNum+$mon+$mday)*7;
if ($ResShow eq 'ResHide') {
$ResShowTag='
この文章はサイト運営者の確認後に公開されます';
$ResShowInput='';
} else {
$ResShowTag='';
$ResShowInput='';
}
$vrestitle = &EmojiTagToGif($vrestitle);
$vresname = &EmojiTagToGif($vresname);
$vresmsg = &EmojiTagToGif($vresmsg);
$ResTag='
'
.'以下の内容で投稿します。よろしいですか?'.$ResShowTag.'
'
.'おなまえ '.$vresname.'
'
.'タイトル '.$vrestitle.'
'.$vresmsg
.'
'
.'送信の際にコード[ '.$RandNum.' ]を入力してください (有効期限:'.$DATE2.')
'."\n"
.''."\n";
} else {
$ResTag='
'.$NaviComment.'
'."\n";
}
} else { $ResTag=''; }
$ResTag=$ResView.$ResTag."\n";
}
##★添付ファイル1があれば表示
$FtLot=@FileType-1;$i=0;
for (0..$FtLot) {
$f0_filepath = $img_dir.$f1_code.'0.'.$FileType[$i];
$h0_filepath = $img_path.$f1_code.'0.'.$FileType[$i];
$gb_filepath = $img_path.$f1_code.'0b.'.$FileType[$i];
if ($FileType[$i] eq 'jpg') { $FtypeName='[JPG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'gif') { $FtypeName='[GIF画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'png') { $FtypeName='[PNG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'doc') { $FtypeName='[WORD書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'docx') { $FtypeName='[WORD2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xls') { $FtypeName='[EXCEL書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xlsx') { $FtypeName='[EXCEL2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'ppt') { $FtypeName='[PPT書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pptx') { $FtypeName='[PPT2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'jtd') { $FtypeName='[一太郎書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'txt') { $FtypeName='[テキスト書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pdf') { $FtypeName='[PDF書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp3') { $FtypeName='[MP3音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wma') { $FtypeName='[WMA音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mmf') { $FtypeName='[MMF音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mld') { $FtypeName='[MLD音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wmv') { $FtypeName='[WMV動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp4') { $FtypeName='[MPEG4動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3gp') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3g2') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'zip') { $FtypeName='[ZIPファイル]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'lzh') { $FtypeName='[LZHファイル]'; $FtypeImg=0; }
if ((-e $f0_filepath)&&($FtypeImg==1)) {
if ($GreyBox==1) {
if (-e $gb_filepath) {
$gb1=''; $gb2='';
} else {
$gb1=''; $gb2='';
}
} else { $gb1=''; $gb2=''; }
if ($f1_align eq "none") {
$f0_imgtag = "$gb1$gb2
";
$f0_filetag='';
$f1_clear='';
} elsif ($f1_align eq "bottom") {
$f0_imgtag = '';
$f0_filetag="
$gb1$gb2";
$f1_clear='';
} elsif ($f1_align eq "pane") {
$f0_imgtag = "$gb1$gb2";
$f0_filetag='';
$f1_clear='';
} elsif ($f1_align eq "left") {
$f0_imgtag = "$gb1$gb2";
$f0_filetag='';
$f1_clear='
';
} elsif ($f1_align eq "right") {
$f0_imgtag = "$gb1$gb2";
$f0_filetag='';
$f1_clear='
';
}
last;
} elsif ((-e $f0_filepath)&&($FtypeImg==0)) {
$f0_imgtag = '';
$f0_filetag = ''.$FtypeName.'';
last;
} else { $f0_imgtag = ''; $f0_filetag='' }
$i++;
}
##★添付ファイル2があれば表示
$FtLot=@FileType-1;$i=0;
for (0..$FtLot) {
$f0_filepath = $img_dir.$f1_code.'1.'.$FileType[$i];
$h0_filepath = $img_path.$f1_code.'1.'.$FileType[$i];
$gb_filepath = $img_path.$f1_code.'1b.'.$FileType[$i];
if ($FileType[$i] eq 'jpg') { $FtypeName='[JPG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'gif') { $FtypeName='[GIF画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'png') { $FtypeName='[PNG画像]'; $FtypeImg=1; }
elsif ($FileType[$i] eq 'doc') { $FtypeName='[WORD書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'docx') { $FtypeName='[WORD2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xls') { $FtypeName='[EXCEL書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'xlsx') { $FtypeName='[EXCEL2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'ppt') { $FtypeName='[PPT書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pptx') { $FtypeName='[PPT2007書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'jtd') { $FtypeName='[一太郎書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'txt') { $FtypeName='[テキスト書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'pdf') { $FtypeName='[PDF書類]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp3') { $FtypeName='[MP3音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wma') { $FtypeName='[WMA音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mmf') { $FtypeName='[MMF音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mld') { $FtypeName='[MLD音声]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'wmv') { $FtypeName='[WMV動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'mp4') { $FtypeName='[MPEG4動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3gp') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq '3g2') { $FtypeName='[QuickTime動画]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'zip') { $FtypeName='[ZIPファイル]'; $FtypeImg=0; }
elsif ($FileType[$i] eq 'lzh') { $FtypeName='[LZHファイル]'; $FtypeImg=0; }
if ((-e $f0_filepath)&&($FtypeImg==1)) {
if ($GreyBox==1) {
if (-e $gb_filepath) {
$gb1=''; $gb2='';
} else {
$gb1=''; $gb2='';
}
} else { $gb1=''; $gb2=''; }
if ($f1_align eq "none") {
$f1_imgtag = "$gb1$gb2
";
$f1_filetag='';
$f1_clear='';
} elsif ($f1_align eq "bottom") {
$f1_imgtag = '';
$f1_filetag= "
$gb1$gb2";
$f1_clear='';
} elsif ($f1_align eq "pane") {
$f1_imgtag = "$gb1$gb2
";
$f1_filetag='';
$f1_clear='';
} elsif ($f1_align eq "left") {
$f1_imgtag = "$gb1$gb2";
$f1_filetag='';
$f1_clear='
';
} elsif ($f1_align eq "right") {
$f1_imgtag = "$gb1$gb2";
$f1_filetag='';
$f1_clear='
';
}
last;
} elsif ((-e $f0_filepath)&&($FtypeImg==0)) {
$f1_imgtag = '';
$f1_filetag = ''.$FtypeName.'';
last;
} else { $f1_imgtag = ''; $f1_filetag='' }
$i++;
}
##記事アンカー
if ($MsgAnchor eq 'MsgAnchorON') {
$htMsgAnchor=' ';
} else { $htMsgAnchor=''; }
##★リスト画面の変更はここを訂正
if (($TimeStamp eq '1')&&($f1_date ne '')) { $TTtag=$f1_date; } else { $TTtag=''; }
if ($f1_sub ne '') { $fv_sub=$f1_sub; }
if ($PgTitleClass ne '') { $TitleCssID=' id="'.$PgTitleClass.$f1_code.'"'; } else { $TitleCssID=''; }
if ($f1_title ne "") {
$fmvPgTitle = $fmtPgTitle;
$fmvPgTitle =~ s/\[TITLE\]/$f1_title/g;
$fmvPgTitle =~ s/\[SUB\]/$fv_sub/g;
$fmvPgTitle =~ s/\[DATE\]/$TTtag/g;
$htmlc_list = <<"LISTC";
$htMsgAnchor
<$f1_tshow$TitleCssID>$fmvPgTitle$f1_tshow>
$f0_imgtag $f1_imgtag $f1_message $f0_filetag $f1_filetag $f1_clear
LISTC
if ($pcoutCode eq 'sjis') { Encode::from_to($htmlc_list, 'utf8', 'shiftjis'); }
print $htmlc_list;
} else {
$htmlc_list = <<"LISTC";
$htMsgAnchor
$f0_imgtag $f1_imgtag $f1_message $f0_filetag $f1_filetag $f1_clear
LISTC
if ($pcoutCode eq 'sjis') { Encode::from_to($htmlc_list, 'utf8', 'shiftjis'); }
print $htmlc_list;
}
if ($ResTag ne '') {
if ($pcoutCode eq 'sjis') { Encode::from_to($ResTag, 'utf8', 'shiftjis'); }
print ''.$ResTag.'
'."\n";
}
}
##★ページ移動ナビ
if (($in{'resto'} eq '')||($in{'mode'} eq 'regist')) {
$i=0; $LotTTLINE=@TTLINE-1;
$BackHide=0; $NextHide=0;
foreach (@TTLINE) {
if ($TTLINE[$i] =~ /code=$in{'code'}\t/) {
if ($i==0) {
$BackHide=1;
$BackLine=$i;
$NextLine=$i+1;
last;
} elsif ($i==$LotTTLINE) {
$NextHide=1;
$BackLine=$i-1;
$NextLine=$i;
last;
} else {
$BackHide=0; $NextHide=0;
$BackLine=$i-1;
$NextLine=$i+1;
last;
}
}
$i++;
}
@Next=split(/\t/,$TTLINE[$NextLine]);
($x,$NextCode)=split(/=/,$Next[0]);
@Back=split(/\t/,$TTLINE[$BackLine]);
($x,$BackCode)=split(/=/,$Back[0]);
print "\n";
if ($BackHide==0) {
$BackURL=$cginame.'?pg='.$BackCode.'&pline='.$pline.'&lline='.$lline.$addCtgNavi;
$tagNavigator= "$NaviBack\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
print " ";
$BackURL=$cginame.'?mode=list&pline='.$pline.'&lline='.$lline.$addCtgNavi;
$tagNavigator= "$ToListView\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
print " ";
if ($NextHide==0) {
$BackURL=$cginame.'?pg='.$NextCode.'&pline='.$pline.'&lline='.$lline.$addCtgNavi;
$tagNavigator= "$NaviNext\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
print "
\n";
}
}
##=======================================================================================
sub html_right {
if ($in{'mode'} eq '') { $mode='list'; }
elsif ($in{'mode'} eq 'list') { $mode='list'; }
else { $mode='detail'; }
$lcode=$in{'code'};
##新着情報一覧
&data_read;
@TRUE = grep(/code=/,@DATA);
if ($resNumview ne '') {
&res_read;
@RESTRUE = grep(/code=/,@RES);
}
##公開指定のみ@DATAへ
$i=0;@TERM=();@PRE=();
foreach(@TRUE) {
$FILE{'vSt'}='200001010000';$FILE{'vFn'}='299912310000';
@termLine=split(/\t/,$TRUE[$i]);
foreach (@termLine) {
($key, $value) = split(/=/,$_);
$FILE{$key} = $value;
}
if (($DATE3 > $FILE{'vSt'})&&($DATE3 <= $FILE{'vFn'})) { push(@TERM,$TRUE[$i]); }
$i++;
}
@PRE = grep(/\tshow=on\t/,@TERM);
@TitleList = grep(!/\ttitle=\t/,@PRE);
##カテゴリ一覧
if (-e $ctgfile) {
&ctg_read;
if ($ctgName ne '') {
if ($ctgCSS ne '') { $ctgclass=' class="'.$ctgCSS.'"'; }
$tagCtgList=''.$ctgName.'
';
}
$LotCTG=@CTG;
if ($LotCTG > 0) {
$tagCtgList=$tagCtgList.'';
foreach (@CTG) {
$vctg = $_;
$vctg =~ s/\r//g; $vctg =~ s/\n//g;
#カテゴリ該当記事数取得
if ($ctgNumview ne '') {
@CtgHit=();@CtgHit1=();@CtgHit2=();$nCtgHit=0;$tagCtgHit='';
@CtgHit1=grep(/ctg$vctg\t/,@TitleList); push(@CtgHit,@CtgHit1);
@CtgHit2=grep(/ctg$vctg /,@TitleList); push(@CtgHit,@CtgHit2);
$nCtgHit=@CtgHit;
if ($nCtgHit >0) { $tagCtgHit=' ['.$nCtgHit.']'; }
}
$uctg='ctg'.$_;
$uctg =~ s/\r//g; $uctg =~ s/\n//g;
$uctg =~ s/=/\|eq\|/g;
$uctg =~ s/\"/\|quot\|/g;
$uctg =~ s/\'/\|apos\|/g;
if ($pcoutCode eq 'sjis') { Encode::from_to($uctg, 'utf8', 'shiftjis'); }
$uctg =~ s/([^\w ])/'%'.unpack('H2', $1)/eg;
$uctg =~ tr/ /+/;
$tagCtgList=$tagCtgList.'- '.$vctg.$tagCtgHit.'
';
}
$tagCtgList=$tagCtgList.'
';
}
}
if ($pcoutCode eq 'sjis') { Encode::from_to($tagCtgList, 'utf8', 'shiftjis'); }
$listLot=@TitleList;
$listMax=$listLot-1;
$ListTop=$lline;
$ListEnd=$ListTop+$ViewMode-1;
if ($ListTop+$ViewMode > $listMax) {
$ListEnd=$listMax;
}
if ($viewCategory eq 'upperctg') { print $tagCtgList; }
if ($ViewMode ne '0') {
if ($ListTitleClass ne '') { $addSideClass=' class="'.$ListTitleClass.'"'; }
if ($pcoutCode eq 'sjis') { Encode::from_to($SideTitle, 'utf8', 'shiftjis'); }
print ''.$SideTitle.'
';
print "";
$li=$ListTop;
foreach ($ListTop..$ListEnd) {
$f1_code='';
$FILE{'dhide'}='';
@LINE = split(/\t/,$TitleList[$li]);
foreach (@LINE) {
($key, $value) = split(/=/,$_);
$value =~ s/\|eq\|/=/g;
$value =~ s/\|quot\|/\"/g;
$value =~ s/\|apos\|/\'/g;
$FILE{$key} = $value;
}
$f1_code = $FILE{'code'};
$f1_show = $FILE{'show'};
$f1_tshow = $FILE{'tshow'};
$f1_align = $FILE{'align'};
$f1_date = $FILE{'date'};
$fs_date = $f1_date;
$fs_date =~ s/\d\d\d\d\///g;
$fs_date =~ s/\d\d\d\d\-//g;
$fs_date =~ s/\d\d\d\d\.//g;
$fs_date =~ s/\/\d\d\d\d//g;
$fs_date =~ s/-\d\d\d\d//g;
$fs_date =~ s/.\d\d\d\d//g;
$f1_title = $FILE{'title'};
$f1_title = &tag_change($f1_title);
$f1_title = &EmojiTagToGif($f1_title);
$f1_sub = $FILE{'sub'};
$f1_sub = &tag_change($f1_sub);
$f1_sub = &EmojiTagToGif($f1_sub);
$fv_sub=$f1_sub;
#コメント数取得
if ($resNumview ne '') {
@ResHit=();$nResHit=0;$tagResHit='';
@ResHit=grep(/\tresto=$f1_code\t/,@RESTRUE);
$nResHit=@ResHit;
if ($nResHit >0) { $tagResHit=' ['.$nResHit.']'; }
}
##★管理画面リストの変更はここを訂正
if (($TimeStamp eq '1')&&($f1_date ne '')) { $TTtag=$f1_date; $TStag=$fs_date; } else { $TTtag=''; $TStag=''; }
$TargetURL=$cginame.'?pg='.$f1_code.'&pline='.$pline.'&lline='.$lline;
if ($FILE{'dhide'} ne '1') {
$fmvLsTitle=$fmtLsTitle;
$fmvLsTitle =~ s/\[TITLE\]/$f1_title/g;
$fmvLsTitle =~ s/\[SUB\]/$f1_sub/g;
$fmvLsTitle =~ s/\[DATE\]/$TTtag/g;
$fmvLsTitle =~ s/\[DATEs\]/$TStag/g;
$fmvLsTitle =~ s/\[RESn\]/$tagResHit/g;
$tagSideList= "- ".$fmvLsTitle."
\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagSideList, 'utf8', 'shiftjis'); }
print $tagSideList;
}
$li++;
}
print "
";
##★リスト移動ナビ
$next_lline = $lline + $ViewMode;
$back_lline = $lline - $ViewMode;
print "\n";
if ($back_lline < 0) { $back_lline =0; }
if ($ListTop > 0) {
$ListURL=$cginame.'?mode='.$mode.'&code='.$lcode.'&pline='.$pline.'&lline='.$back_lline;
$tagNavigator= "$ListBack\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
if ($ListEnd != $listMax) {
$ListURL=$cginame.'?mode='.$mode.'&code='.$lcode.'&pline='.$pline.'&lline='.$next_lline;
$tagNavigator= " $ListNext\n";
if ($pcoutCode eq 'sjis') { Encode::from_to($tagNavigator, 'utf8', 'shiftjis'); }
print $tagNavigator;
}
print '
'."\n";
}
if ($viewCategory eq 'bottomctg') { print $tagCtgList; }
}
##=======================================================================================
sub regist {
&res_read;
@RESTRUE = grep(/code=/,@RES);
##rescodeコード取得
$resend=@RESTRUE-1;
@ResEndElem = split(/\t/,$RESTRUE[$resend]);
$ResEndElem[0] =~ s/code=//g;
$ResNewCode=$ResEndElem[0]+1;
if ($ResNewCode eq '') { $ResNewCode=1; }
##投稿認証
$CheckA=$in{'CheckNum'};
$CheckB=($in{'RandNum'}+$mon+$mday)*7;
if ($CheckA != $CheckB) {
&html_head;
if ($PgTitleClass ne '') { $addTitleClass=' class="'.$PgTitleClass.'"'; }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageTitle, 'utf8', 'shiftjis'); }
if ($PageTitle ne '') { print ''.$PageTitle.'
'; }
&errorout('コードエラーです');
}
##編集認証
if ($in{'corcode'} ne '') {
for (@RESTRUE) {
if ($_ !~ /code=$in{'corcode'}\t/) { push(@WRRES,$_); }
}
@RESTRUE=();
}
##投稿データ取得
if ($in{'respw'} eq '') { $in{'respw'}='x00x00'; }
$db_rescode = $ResNewCode;
$db_resto = $in{'resto'};
$db_rshow = $in{'rshow'};
$db_respw = $in{'respw'};
$db_respw =crypt($db_respw,'ae');
$db_restitle = $in{'restitle'};
$db_resdate = $DATE;
$db_resname = $in{'resname'};
$db_resmsg = $in{'resmsg'};
$db_resppline = $pline;
$db_resplline = $lline;
$db_resptitle = $in{'ptitle'};
$db_respdate = $in{'pdate'};
##データフォーマット
$resformat = join("\t",
"code=$db_rescode",
"resto=$db_resto",
"rshow=$db_rshow",
"respw=$db_respw",
"restitle=$db_restitle",
"date=$DATE",
"resname=$db_resname",
"resmsg=$db_resmsg",
"\n"
);
push (@WRRES,@RESTRUE);
push (@WRRES,$resformat);
&res_save;
¬ice;
@RESTRUE=();
push(@RESTRUE,@WRRES);
##処理画面出力
&html_head;
$jumpurl = $cginame.'?mode=list&pline='.$in{'pline'}.'&lline='.$in{'lline'};
$htJUMP = <<"htJUMP";
投稿記事を登録しました。
htJUMP
if ($pcoutCode eq 'sjis') { Encode::from_to($htJUMP, 'utf8', 'shiftjis'); }
print $htJUMP;
&html_foot;
exit;
}
##=======================================================================================
sub delete {
&res_read;
@RESTRUE = grep(/code=/,@RES);
##rescodeコード取得
$resend=@RESTRUE-1;
@ResEndElem = split(/\t/,$RESTRUE[$resend]);
$ResEndElem[0] =~ s/code=//g;
$ResNewCode=$ResEndElem[0]+1;
if ($ResNewCode eq '') { $ResNewCode=1; }
##編集認証
if ($in{'corcode'} ne '') {
@RESOWNER = grep(/code=$in{'corcode'}\t/,@RES);
$rcpw =crypt($in{'respw'},'ae');
if ($RESOWNER[0] !~ /\trespw=$rcpw\t/) {
&html_head;
if ($PgTitleClass ne '') { $addTitleClass=' class="'.$PgTitleClass.'"'; }
if ($pcoutCode eq 'sjis') { Encode::from_to($PageTitle, 'utf8', 'shiftjis'); }
if ($PageTitle ne '') { print ''.$PageTitle.'
'; }
&errorout('投稿パスワードが違います');
}
for (@RESTRUE) {
if ($_ !~ /code=$in{'corcode'}\t/) { push(@WRRES,$_); }
}
@RESTRUE=();
}
push (@WRRES,@RESTRUE);
&res_save;
@RESTRUE=();
push(@RESTRUE,@WRRES);
##処理画面出力
&html_head;
$jumpurl = $cginame.'?mode=list&pline='.$in{'pline'}.'&lline='.$in{'lline'};
$htJUMP = <<"htJUMP";
投稿記事を削除しました。
htJUMP
if ($pcoutCode eq 'sjis') { Encode::from_to($htJUMP, 'utf8', 'shiftjis'); }
print $htJUMP;
&html_foot;
exit;
}
##=======================================================================================
sub notice {
if ($NoticeTo ne '') {
if ($NoticeFrom ne '') { $admail="$NoticeFrom"; }
else { $admail = "$NoticeTo"; }
&jis('[お知らせ] コメント投稿');
$subject = $msg;
$subject = &mimeencode($subject);
if ($RootPath eq '') { $EmlURL='http://'.$Domain.'/'.$DirName; }
else { $EmlURL='http://'.$Domain.'/'.$RootPath.'/'.$DirName; }
$ml_resmsg=$db_resmsg;
$ml_resmsg=~ s/
/\n/g;
$ml_resmsg=~ s/
/\n/g;
$ml_resmsg=~ s/\|eq\|/=/g;
$ml_resmsg=~ s/\|quot\|/\"/g;
$ml_resmsg=~ s/\|apos\|/\'/g;
$ml_restitle=$db_restitle;
$ml_restitle=~ s/
/\n/g;
$ml_restitle=~ s/
/\n/g;
$ml_restitle=~ s/\|eq\|/=/g;
$ml_restitle=~ s/\|quot\|/\"/g;
$ml_restitle=~ s/\|apos\|/\'/g;
$ml_resname=$db_resname;
$ml_resname=~ s/
/\n/g;
$ml_resname=~ s/
/\n/g;
$ml_resname=~ s/\|eq\|/=/g;
$ml_resname=~ s/\|quot\|/\"/g;
$ml_resname=~ s/\|apos\|/\'/g;
$ml_resptitle=$db_resptitle;
$ml_resptitle=~ s/
/\n/g;
$ml_resptitle=~ s/
/\n/g;
$ml_resptitle=~ s/\|eq\|/=/g;
$ml_resptitle=~ s/\|quot\|/\"/g;
$ml_resptitle=~ s/\|apos\|/\'/g;
if ($AdmiTitle ne '') { $vAdmiTitle='「'.$AdmiTitle.'」にて'."\n"; } else { $vAdmiTitle=""; }
open(MAIL,"|$SendmailPath -t");
print MAIL "X-Mailer: NorenzMailForm ver1.0\n";
print MAIL "X-HTTP_REFERER: $ref\n";
print MAIL "To: $NoticeTo\n";
print MAIL "From: $admail\n";
print MAIL "Errors-To: $admail\n";
print MAIL "Subject: $subject\n";
print MAIL "Mime-version: 1.0\n";
print MAIL "Content-Transfer-Encoding: 7bit\n";
print MAIL "Content-Type: text/plain\; charset=\"ISO-2022-JP\"\n\n";
if ($NoticeBodyMail ne '') {
$MailBody = <<"MailBody";
$ml_restitle
$ml_resname さん
$ml_resmsg
MailBody
} else {
$MailBody = <<"MailBody";
$vAdmiTitle $ml_resptitle $db_respdate の記事にコメント\投\稿\がありましたので通知します。
=====================================================
タイトル = $ml_restitle
おなまえ = $ml_resname
本文 = $ml_resmsg
【PC】 $EmlURL/index.cgi?mode=input&resto=$db_resto&code=$db_resto&pline=$db_resppline&lline=$db_resplline
【携帯】 $EmlURL/mobi.cgi?mode=input&resto=$db_resto&dline=$db_resto
=====================================================
$DATE4
REMOTE ADDR [ $hostaddr ]
AGENT [ $agent ]
=====================================================
MailBody
}
&jis($MailBody);
print MAIL "$msg\n";
print MAIL "\n.";
close(MAIL);
}
}
##=======================================================================================
sub jis { $msg = $_[0]; Encode::from_to($msg, 'utf8', 'jis'); }
##=======================================================================================
sub data_read {
if (open(DBREAD,"$datafile")) {
@DATA = ;
close(DBREAD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($datafile);
if ($contCC eq 'shiftjis') {
foreach (@DATA) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
} else { &errorout('DBファイルの読込に失敗しました。'); }
}
##=======================================================================================
sub ctg_read {
if (open(CTGREAD,"$ctgfile")) {
@CTG = ;
close(CTGREAD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($ctgfile);
if ($contCC eq 'shiftjis') {
foreach (@CTG) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
} else { &errorout('カテゴリファイルの読込に失敗しました。'); }
}
##=======================================================================================
sub res_read {
if (-e $resfile) {
open(RESRD,"$resfile");
@RES = ;
close(RESRD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($resfile);
if ($contCC eq 'shiftjis') {
foreach (@RES) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
}
}
##=======================================================================================
sub res_save {
$tmpfile = "$$\.tmp";
if (!open(TMP,">$tmpfile")) { &errorout('パーミッションエラー'); }
print TMP @WRRES;
close(TMP);
chmod(oct($WRMode),$tmpfile);
rename($tmpfile,$resfile);
##★index.html更新
&MakeIndexFile;
}
##=======================================================================================
sub page_read {
$Domain =$SVCONF[3];
$Domain =~ s/\r//g; $Domain =~ s/\n//g;
if ($RootPath ne '') { $BaseRoot='/'.$RootPath; } else { $BaseRoot=''; }
$QRCodeS='';
$QRCodeM='';
$QRCodeL='';
if (open(PAGEREAD,"$SkinFile")) {
@PAGE = ;
close(PAGEREAD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($SkinFile);
if ($contCC eq 'shiftjis') {
foreach (@PAGE) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
} else {
$alSkinFile=$SkinFile; $alSkinFile=~ s/\.\.//i;
$PAGE[0] =''."\n";
$PAGE[1] =''."\n";
$PAGE[2] ='[設定]にて指定したスキンファイル ['.$alSkinFile.'] が存在しません
'."\n";
$PAGE[3] ='[設定]にて正しいスキンファイルを指定するか、[スキン編集]にて作成する必要があります'."\n";
$PAGE[4] =''."\n";
$PAGE[5] =''."\n";
}
#AD-EDITでメニューデータがあれば表示
$MenuFile=''; $mzi=1;
for (0..20) {
@MenuZone=();
$MenuHTML[$mzi]='';
$MenuFile='../commons/menu'.$mzi.'.inc';
if (-e $MenuFile) {
open(MENURD,"$MenuFile");
@MenuZone = ;
close(MENURD);
##文字コード判定→UTF8変換
my $contCC=&checkCharCode($MenuFile);
if ($contCC eq 'shiftjis') {
foreach (@MenuZone) { Encode::from_to($_, 'shiftjis', 'utf8'); }
}
$LotMenuLine=@MenuZone;
$mzline=0;
for (0..$LotMenuLine) { $MenuHTML[$mzi]=$MenuHTML[$mzi].$MenuZone[$mzline].''; $mzline++; }
} else { last; }
$mzi++;
}
$mzi=$mzi-1;
$pageflag = 0;
@PHEAD = (); @PFOOT = (); $pi = 0;
foreach (@PAGE) {
if ($PAGE[$pi] =~ /MainZone/i) {
$PAGE[$pi]=~ s/<\!-- MainZone -->/<\!--MainZone-->/g;
($SkinBefore,$SkinAfter)=split(/<\!--MainZone-->/,$PAGE[$pi]);
$PAGE[$pi]=$SkinBefore;
push(@PFOOT,$SkinAfter);
$pageflag = 1;
}
$mzj=1;
for (0..$mzi) {
$PAGE[$pi]=~ s//$MenuHTML[$mzj]/g;
$mzj++;
}
$PAGE[$pi]=~ s//$QRCodeS/g;
$PAGE[$pi]=~ s//$QRCodeM/g;
$PAGE[$pi]=~ s//$QRCodeL/g;
$PAGE[$pi]=~ s/<\/title>/ - $hdPageTitle<\/title>/i;
$PAGE[$pi]=~ s/<\/h1>/ - $hdPageTitle<\/h1>/i;
$PAGE[$pi] = &cgi_include($PAGE[$pi]);
$PAGE[$pi] = &url_import($PAGE[$pi]);
if ($pageflag==0) { push(@PHEAD,$PAGE[$pi]); }
if ($pageflag==1) { push(@PFOOT,$PAGE[$pi]); }
$pi++;
}
}
##=======================================================================================
sub tag_change {
## $var = &tag_change($var); で変換する
if ($RootPath ne '') { $TcRootPath='/'.$RootPath; } else { $TcRootPath=''; }
local($_) = $_[0];
1 while s/\[new\]//g;
1 while s/\[red\]//g;
1 while s/\[\/red\]/<\/span>/g;
1 while s/\[blue\]//g;
1 while s/\[\/blue\]/<\/span>/g;
1 while s/\[green\]//g;
1 while s/\[\/green\]/<\/span>/g;
1 while s/AeDirTop/index.cgi/g;
$_;
}
##=======================================================================================
sub MakeIndexFile {
if ($OutPutHTML ne '') {
#URL取得
use LWP::Simple;
our $geturl;
if ($RootPath eq '') {
$geturl = 'http://'.$Domain.'/'.$DirName.'/index.cgi';
} else {
$geturl = 'http://'.$Domain.'/'.$RootPath.'/'.$DirName.'/index.cgi';
}
#古いindex.htmlを削除
unlink ('index.html');
#index.htmlを書き出し
getstore($geturl, 'index.html');
chmod(oct($WRMode),'index.html');
} else {
if (-e 'index.html') { unlink('index.html'); }
}
}
##=======================================================================================
sub errorout {
$error = $_[0];
$ReturnLink='[先程のページへ戻る]';
##★エラーメッセージの変更はここを訂正
$errHTML = <<"ERRORMESS";
ERROR
$error
$ReturnLink
ERRORMESS
if ($pcoutCode eq 'sjis') { Encode::from_to($errHTML, 'utf8', 'shiftjis'); }
print $errHTML;
if (($ViewMode ne '0')&&($in{'mode'} ne 'regist')&&($in{'mode'} ne 'delete')) { print ''; }
&html_foot;
exit;
}
##=======================================================================================