-// \83X\83L\83\93\82ð\93Ç\82Ý\8d\9e\82Ý\81A\92l\82ð\92u\8a·\82·\82é
-function TGikoSys.LoadFromSkin(
- fileName: string;
- ThreadItem: TThreadItem;
- SizeByte: Integer
-): string;
-var
- Skin: TStringList;
-begin
-
- Skin := TStringList.Create;
- try
- if FileExists( fileName ) then begin
- Skin.LoadFromFile( fileName );
-
- // \82â\82è\82©\82½\82ª\8bê\82µ\82¢\82¯\82Ç\81A\83I\83v\83V\83\87\83\93\83_\83C\83A\83\8d\83O\82Ì\83v\83\8c\83r\83\85\81[\97p try
- try
- if ThreadItem.ParentBoard <> nil then
- if ThreadItem.ParentBoard.ParentCategory <> nil then
- CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
- CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
- except end;
- CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
- CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
- CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
- CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
- CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
-
- CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
- CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
- CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
-
- //----- \82Æ\82è\82 \82¦\82¸\82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
- // \82â\82è\82©\82½\82ª\8bê\82µ\82¢\82¯\82Ç\81A\83I\83v\83V\83\87\83\93\83_\83C\83A\83\8d\83O\82Ì\83v\83\8c\83r\83\85\81[\97p try
- try
- if ThreadItem.ParentBoard <> nil then
- if ThreadItem.ParentBoard.ParentCategory <> nil then
- CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
- CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
- except end;
- CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
- CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
- CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
- CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
- CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
- CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
-
- CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
- CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
- CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
- //----- \82±\82±\82Ü\82Å
- end;
- Result := Skin.Text;
- finally
- Skin.Free;
- end;
-end;
-
-// \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
-function TGikoSys.SkinedRes(
- skin: string;
- Res: TResRec;
- No: string
-): string;
-var
- spamminess : Extended;
- wordCount : TWordCount;
-begin
-
- wordCount := TWordCount.Create;
- try
- spamminess := Floor( SpamParse(
- Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
-
- Skin := CustomStringReplace( Skin, '<NUMBER/>',
- '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
- Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
- Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
- Skin := CustomStringReplace( Skin, '<MAILNAME/>',
- '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
- Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
- Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
- Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
- Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
- Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
-
- //----- \82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
- Skin := CustomStringReplace( Skin, '&NUMBER',
- '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
- Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
- Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
- Skin := CustomStringReplace( Skin, '&MAILNAME',
- '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
- Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
- Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
- Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
- Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
- Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
- //----- \82±\82±\82Ü\82Å
-
- Result := Skin;
- finally
- wordCount.Free;
- end;
-
-end;
-
-procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
-var
- i: integer;
- No: string;
- //bufList : TStringList;
- ReadList: TStringList;
- SaveList: TStringList;
- CSSFileName: string;
- BBSID: string;
- FileName: string;
- NewReceiveNo: Integer;
- Res: TResRec;
- boardPlugIn : TBoardPlugIn;
-
- UserOptionalStyle: string;
- SkinHeader: string;
- SkinNewRes: string;
- SkinRes: string;
-
- strTmp : string;
-
- function LoadSkin( fileName: string ): string;
- begin
- Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
- end;
- function ReplaceRes( skin: string ): string;
- begin
- Result := SkinedRes( skin, Res, No );
- end;
-begin
- if ThreadItem <> nil then begin
- if ThreadItem.IsBoardPlugInAvailable then begin
- //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
- NewReceiveNo := ThreadItem.NewReceive;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- UserOptionalStyle := SetUserOptionalStyle;
- SaveList := TStringList.Create;
- try
- doc.open;
- // \95¶\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
- // doc.charset := 'Shift_JIS';
-
- // \83w\83b\83_
- SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
- '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
-
- SaveList.Add('<p id="idSearch"></p>');
- for i := 0 to threadItem.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GetSkinNewmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
- else
- SaveList.Add( '<a name="new"></a>' );
- end else if GikoSys.Setting.UseCSS then begin
- SaveList.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end else begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="new"></a>');
- SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- except
- SaveList.Add( '<a name="new"></a>' );
- end;
- end;
-
- // \83\8c\83X
- SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
-
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GetSkinBookmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
- else
- SaveList.Add( '<a name="koko"></a>' );
- end else if GikoSys.Setting.UseCSS then begin
- SaveList.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end else begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- except
- SaveList.Add( '<a name="koko"></a>' );
- end;
- end;
-
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
-
-
- // \83X\83L\83\93(\83t\83b\83^)
- SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
- doc.Write(SaveList.Text);
- finally
- SaveList.Free;
- doc.Close;
- end;
-
- // Exit;
- //end;
- end else begin
- ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
- ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
- ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
- ShortDayNames[7] := '\93y';
- BBSID := ThreadItem.ParentBoard.BBSID;
- NewReceiveNo := ThreadItem.NewReceive;
- ReadList := TStringList.Create;
- try
- if ThreadItem.IsLogFile then begin
- FileName := ThreadItem.GetThreadFileName;
- ReadList.LoadFromFile(FileName);
- FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
- FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
- FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- if ThreadItem.Title = '' then begin
- Res := DivideStrLine(ReadList[0]);
- sTitle := Res.FTitle;
- end else
- sTitle := ThreadItem.Title;
- end else begin
- sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
- end;
- SaveList := TStringList.Create;
- try
- doc.open;
- doc.charset := 'Shift_JIS';
-
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- UserOptionalStyle := SetUserOptionalStyle;
- CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
- if GikoSys.Setting.UseSkin then begin
- // \83X\83L\83\93\8eg\97p
- // \83X\83L\83\93\82Ì\90Ý\92è
- try
- SkinHeader := LoadSkin( GetSkinHeaderFileName );
- if Length( UserOptionalStyle ) > 0 then
- SkinHeader := CustomStringReplace( SkinHeader, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
- SaveList.Add( SkinHeader );
- except
- end;
- try
- SkinNewRes := LoadSkin( GetSkinNewResFileName );
- except
- end;
- try
- SkinRes := LoadSkin( GetSkinResFileName );
- except
- end;
- SaveList.Add('<p id="idSearch"></p>');
- SaveList.Add('<a name="top"></a>');
-
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if FileExists( GetSkinNewmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
- else
- SaveList.Add( '<a name="new"></a>' );
- except
- SaveList.Add( '<a name="new"></a>' );
- end;
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
-
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- try
- if NewReceiveNo <= (i + 1) then
- // \90V\92\85\83\8c\83X
- strTmp := ReplaceRes( SkinNewRes )
- else
- // \92Ê\8fí\82Ì\83\8c\83X
- strTmp := ReplaceRes( SkinRes );
-
- SaveList.Add( strTmp );
- except
- end;
- end;
-
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if FileExists( GetSkinBookmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
- else
- SaveList.Add( '<a name="koko"></a>' );
- except
- SaveList.Add( '<a name="koko"></a>' );
- end;
- end;
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('<a name="bottom"></a>');
- // \83X\83L\83\93(\83t\83b\83^)
- try
- SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
- except
- end;
- doc.Write(SaveList.Text);
- end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- //CSS\8eg\97p
- //CSSFileName := GetAppDir + CSS_FILE_NAME;
- // SaveList.Add('<html lang="ja"><head>');
- SaveList.Add('<html><head>');
- SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- SaveList.Add('<title>' + sTitle + '</title>');
- SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
- if Length( UserOptionalStyle ) > 0 then
- SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
- SaveList.Add('</head>');
- SaveList.Add('<body>');
- SaveList.Add('<a name="top"></a>');
- SaveList.Add('<p id="idSearch"></p>');
- SaveList.Add('<div class="title">' + sTitle + '</div>');
- doc.Write(SaveList.Text);
- SaveList.Clear;
- //Application.ProcessMessages;
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- SaveList.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- if Res.FMailTo = '' then
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
- + '<span class="name_label">\96¼\91O\81F</span> '
- + '<span class="name"><b>' + Res.FName + '</b></span> '
- + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
- + '<span class="date">' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else if GikoSys.Setting.ShowMail then
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>');
- end;
- if ThreadItem.Kokomade = (i + 1) then begin
- SaveList.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end;
-
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('<a name="bottom"></a>');
- //SaveList.Add('</body></html>');
- SaveList.Add('<a name="last"></a>');
- SaveList.Add('</body></html>');
- doc.Write(SaveList.Text);
- end else begin
- //CSS\94ñ\8eg\97p
- // SaveList.Add('<html lang="ja"><head>');
- SaveList.Add('<html><head>');
- SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- SaveList.Add('<title>' + sTitle + '</title></head>');
- SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
- SaveList.Add('<a name="top"></a>');
- SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
- SaveList.Add('<dl>');
- SaveList.Add('<p id="idSearch"></p>');
- doc.Write(SaveList.Text);
- SaveList.Clear;
- //Application.ProcessMessages;
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="new"></a>');
- SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- if Res.FMailTo = '' then
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
- else if GikoSys.Setting.ShowMail then
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
- else
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
- end;
- if ThreadItem.Kokomade = (i + 1) then begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('</dl>');
- SaveList.Add('<a name="bottom"></a>');
- SaveList.Add('</body></html>');
- doc.Write(SaveList.Text);
- end;
- finally
- SaveList.Free;
- doc.Close;
- end;
- finally
- ReadList.Free;
- end;
- end;
- end;
-end;
-procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
-var
- i: integer;
- No: string;
- //bufList : TStringList;
- ReadList: TStringList;
-// SaveList: TStringList;
- CSSFileName: string;
- BBSID: string;
- FileName: string;
- Res: TResRec;
- boardPlugIn : TBoardPlugIn;
-
- UserOptionalStyle: string;
- SkinHeader: string;
- SkinRes: string;
- tmp, tmp1: string;
- function LoadSkin( fileName: string ): string;
- begin
- Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
- end;
- function ReplaceRes( skin: string ): string;
- begin
- Result := SkinedRes( skin, Res, No );
- end;
-
-begin
- if ThreadItem <> nil then begin
- CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
- html.Clear;
- html.BeginUpdate;
- if ThreadItem.IsBoardPlugInAvailable then begin
- //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- UserOptionalStyle := SetUserOptionalStyle;
- try
- // \95¶\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
- // \83w\83b\83_
- tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
- '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- if Setting.UseSkin then begin
- tmp1 := './' +Setting.CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
- end else if Setting.UseCSS then begin
- tmp1 := './' + CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
- end;
- html.Append( tmp );
-
- for i := 0 to threadItem.Count - 1 do begin
-
- // \83\8c\83X
- html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
-
- end;
- // \83X\83L\83\93(\83t\83b\83^)
- html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
- finally
- end;
- html.EndUpdate;
- //Exit;
- end else begin
- ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
- ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
- ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
- ShortDayNames[7] := '\93y';
- BBSID := ThreadItem.ParentBoard.BBSID;
- ReadList := TStringList.Create;
- try
- if ThreadItem.IsLogFile then begin
- FileName := ThreadItem.GetThreadFileName;
- ReadList.LoadFromFile(FileName);
- FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
- FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
- FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- Res := DivideStrLine(ReadList[0]);
- //Res.FTitle := CustomStringReplace(Res.FTitle, '\81\97\81M', ',');
- sTitle := Res.FTitle;
- end else begin
- sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
- end;
- try
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- UserOptionalStyle := SetUserOptionalStyle;
-
- if GikoSys.Setting.UseSkin then begin
- // \83X\83L\83\93\8eg\97p
- // \83X\83L\83\93\82Ì\90Ý\92è
- try
- SkinHeader := LoadSkin( GetSkinHeaderFileName );
- if Length( UserOptionalStyle ) > 0 then
- SkinHeader := CustomStringReplace( SkinHeader, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- tmp1 := './' +Setting.CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
- html.Append( SkinHeader );
- except
- end;
- try
- SkinRes := LoadSkin( GetSkinResFileName );
- except
- end;
- html.Append('<a name="top"></a>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
-
- Res := DivideStrLine(ReadList[i]);
- {if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
- }
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
-
- try
- html.Append( ReplaceRes( SkinRes ) );
- except
- end;
- end;
-
- end;
- html.Append('<a name="bottom"></a>');
- // \83X\83L\83\93(\83t\83b\83^)
- try
- html.Append( LoadSkin( GetSkinFooterFileName ) );
- except
- end;
- end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- //CSS\8eg\97p
- //CSSFileName := GetAppDir + CSS_FILE_NAME;
- html.Append('<html><head>');
- html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- html.Append('<title>' + sTitle + '</title>');
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- tmp1 := './' + CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
-
- html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
- if Length( UserOptionalStyle ) > 0 then
- html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
- html.Append('</head>');
- html.Append('<body>');
- html.Append('<a name="top"></a>');
- html.Append('<div class="title">' + sTitle + '</div>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- {if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
- }
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
- if Res.FMailTo = '' then
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
- + '<span class="name_label">\96¼\91O\81F</span> '
- + '<span class="name"><b>' + Res.FName + '</b></span> '
- + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
- + '<span class="date">' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else if GikoSys.Setting.ShowMail then
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>');
- end;
- end;
- html.Append('<a name="bottom"></a>');
- //html.Append('</body></html>');
- html.Append('<a name="last"></a>');
- html.Append('</body></html>');
- end else begin
- //CSS\94ñ\8eg\97p
- html.Append('<html><head>');
- html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- html.Append('<title>' + sTitle + '</title></head>');
- html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
- html.Append('<a name="top"></a>');
- html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
- html.Append('<dl>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- {if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
- }
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
- if Res.FMailTo = '' then
- html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
- else if GikoSys.Setting.ShowMail then
- html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
- else
- html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> \93\8a\8de\93ú\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
- end;
- end;
- html.Append('</dl>');
- html.Append('<a name="bottom"></a>');
- html.Append('</body></html>');
- end;
- finally
- html.EndUpdate;
- end;
- finally
- ReadList.Free;
- end;
- end;
- end;
-end;
-function TGikoSys.ConvertResAnchor(res: string): string;
-const
- _HEAD : string = '<a href="../';
- _TAIL : string = ' target="_blank">';
- _ST: string = '&st=';
- _TO: string = '&to=';
- _STA: string = '&START=';
- _END: string = '&END=';
-var
- i, j, k: Integer;
- tmp: string;
-begin
- Result := '';
- i := AnsiPos(_HEAD, res);
- while i <> 0 do begin
- Result := Result + Copy(res, 1, i -1);
- Delete(res, 1, i - 1);
- j := AnsiPos(_TAIL, res);
- if j = 0 then begin
- Result := Result + res;
- Exit;
- end;
- tmp := Copy(res, 1, j - 1);
- Delete(res, 1, j + 16);
- if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
- Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
- Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
- end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
- Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
- Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
- end else begin
- k := LastDelimiter('/', tmp);
- Delete(tmp, 1, k);
- if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
- Delete(tmp, AnsiPos('-', tmp), Length(tmp))
- else
- Delete(tmp, AnsiPos('"', tmp), Length(tmp));
-
- Result := Result + '<a href="#' + tmp + '">';
- end;
- i := AnsiPos(_HEAD, res);
- end;
- Result := Result + res;
-
-end;
-
-(*************************************************************************
- *http://\82Ì\95¶\8e\9a\97ñ\82ðanchor\83^\83O\95t\82«\82É\82·\82é\81B
- *************************************************************************)
-function TGikoSys.AddAnchorTag(s: string): string;
-const
- URL_CHAR: string = '0123456789'
- + 'abcdefghijklmnopqrstuvwxyz'
- + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
- ANCHOR_REF = 'href=';
- RES_REF = '>>';
-var
- wkIdx: array[0..9] of Integer;
- url: string;
- href: string;
- i, b: Integer;
- idx: Integer;
- anchorLen : Integer;
-begin
- Result := '';
- // + 3 \82Í 'href="' ('"'\82Â\82«)\82È\82Ç\82Ì\83o\83\8a\83G\81[\83V\83\87\83\93\82É\97]\97T\82ð\8e\9d\82½\82¹\82é\82½\82ß
- anchorLen := Length( ANCHOR_REF ) + 3;
-
- while True do begin
- wkIdx[0] := AnsiPos('http://', s);
- wkIdx[1] := AnsiPos('ttp://', s);
- wkIdx[2] := AnsiPos('tp://', s);
- wkIdx[3] := AnsiPos('ms-help://', s);
- wkIdx[4] := AnsiPos('p://', s);
- wkIdx[5] := AnsiPos('https://', s);
- wkIdx[6] := AnsiPos('www.', s);
- wkIdx[7] := AnsiPos('ftp://', s);
- wkIdx[8] := AnsiPos('news://', s);
- wkIdx[9] := AnsiPos('rtsp://', s);
-
- idx := MaxInt;
- for i := 0 to 9 do
- if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
-
- if idx = MaxInt then begin
- //\83\8a\83\93\83N\82ª\96³\82¢\82æ\81B
- Result := Result + s;
- Break;
- end;
-
- if (idx > 1) and
- (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
- //\8aù\82É\83\8a\83\93\83N\83^\83O\82ª\82Â\82¢\82Ä\82¢\82é\82Á\82Û\82¢\82Æ\82«\82Í\83\80\83V
- href := Copy( s, idx, Length( s ) );
- Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
- s := href;
- s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
-
- Continue;
- end;
-
- Result := Result + Copy(s, 0, idx - 1);
-
- s := Copy(s, idx, length(s));
-
- b := Length( s ) + 1;
- for i := 1 to b do begin
- if i = b then
- idx := 0
- else
- idx := AnsiPos(s[i], URL_CHAR);
- if idx = 0 then begin
- //URL\82¶\82á\82È\82¢\95¶\8e\9a\94\8c©\81I\82Æ\82©\81A\95¶\8e\9a\82ª\82È\82\82È\82Á\82½\81B
- url := Copy(s, 0, i - 1);
-
- if AnsiPos('ttp://', url) = 1 then
- href := 'h' + url
- else if AnsiPos('tp://', url) = 1 then
- href := 'ht' + url
- else if AnsiPos('p://', url) = 1 then
- href := 'htt' + url
- else if AnsiPos('www.', url) = 1 then
- href := 'http://' + url
- else
- href := url;
- Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
- s := Copy(s, i, MaxInt);
- Break;
- end;
- end;
- end;
-end;