6 Windows, Messages, SysUtils, Classes, {Graphics,} Controls, {Forms,}
7 ComCtrls, IniFiles, ShellAPI, Math, GikoSystem,
15 {HttpApp,} YofUtils, {URLMon,} BoardGroup, {gzip,} {Dolib,}
16 {bmRegExp,} AbonUnit, MojuUtils, Setting,
17 ExternalBoardManager, ExternalBoardPlugInMain{,}
18 {Sort,} ,GikoBayesian, HintWindow;
21 THTMLCreate = class(TObject)
25 pURLCHARs,pURLCHARe : PChar;
26 pANCHORs, pANCHORe : PChar;
27 pCTAGLs, pCTAGLe : PChar;
28 pCTAGUs, pCTAGUe : PChar;
29 pREF_MARKSs : array[0..9] of PChar;
30 pREF_MARKSe : array[0..9] of PChar;
33 function AddBeProfileLink(AID : string; ANum: Integer):string ;
34 procedure CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
35 procedure CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
36 procedure CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
37 procedure CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
38 function ConvertResAnchor(res: string): string;
39 procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
42 function AddAnchorTag(s: string): string;
43 function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
44 function SkinedRes(const skin: string; PRes: PResRec; const No: string): string;
45 function ConvRes(const Body, Bbs, Key: string; DatToHTML: boolean = false): string; overload;
46 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
47 // function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
48 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
49 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
50 //
\83\8c\83X
\83|
\83b
\83v
\83A
\83b
\83v
\82Ì
\8dì
\90¬
51 procedure SetResPopupText(Hint :TResPopup; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
52 //
\83\8a\83\93\83N
\82Ì
\95¶
\8e\9a\97ñ
\82©
\82ç
\83\8c\83X
\83|
\83b
\83v
\83A
\83b
\83v
\97p
\82ÌURL
\82É
\95Ï
\8a·
\82·
\82é
53 class function GetRespopupURL(AText, AThreadURL : string): string;
54 //
\8ew
\92è
\82µ
\82½
\83p
\83X
\82É
\83X
\83L
\83\93\82à
\82µ
\82
\82ÍCSS
\82Ì
\83t
\83@
\83C
\83\8b\82Ì
\83R
\83s
\81[
\82ð
\8dì
\82é
55 class procedure SkinorCSSFilesCopy(path: string);
59 HTMLCreater: THTMLCreate;
64 URL_CHAR: string = '0123456789'
65 + 'abcdefghijklmnopqrstuvwxyz'
66 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
67 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
72 REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
73 'ms-help://','p://', 'https://',
74 'www.', 'ftp://','news://','rtsp://');
76 constructor THTMLCreate.Create;
80 // + 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ß
81 anchorLen := Length( ANCHOR_REF ) + 3;
82 pANCHORs := PChar(ANCHOR_REF);
83 pANCHORe := pANCHORs + Length(ANCHOR_REF);
84 pURLCHARs := PChar(URL_CHAR);
85 pURLCHARe := pURLCHARs + Length(URL_CHAR);
86 pCTAGLs := PChar(CLOSE_TAGAL);
87 pCTAGLe := pCTAGLs + 4;
88 pCTAGUs := PChar(CLOSE_TAGAU);
89 pCTAGUe := pCTAGUs + 4;
90 for j := 0 to 9 do begin
91 pREF_MARKSs[j] := PChar(REF_MARK[j]);
92 pREF_MARKSe[j] := pREF_MARKSs[j] + Length(REF_MARK[j]);
95 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
96 function THTMLCreate.LoadFromSkin(
98 ThreadItem: TThreadItem;
105 Skin := TStringList.Create;
107 if FileExists( fileName ) then begin
108 Skin.LoadFromFile( fileName );
110 //
\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
112 if ThreadItem.ParentBoard <> nil then
113 if ThreadItem.ParentBoard.ParentCategory <> nil then
114 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
115 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
117 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
118 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
119 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
120 CustomStringReplace( Skin, '<SKINPATH/>', GikoSys.Setting.CSSFileName);
121 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
122 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
123 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
125 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
126 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
127 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
129 //-----
\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µ
130 //
\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
131 if GikoSys.Setting.UseKatjushaType then begin
133 if ThreadItem.ParentBoard <> nil then
134 if ThreadItem.ParentBoard.ParentCategory <> nil then
135 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
136 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
138 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
139 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
140 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
141 CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);
142 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
143 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
144 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
146 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
147 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
148 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
150 //-----
\82±
\82±
\82Ü
\82Å
158 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
159 function THTMLCreate.SkinedRes(
165 FORMT_NAME = '<b>%s</b>';
166 FORMT_NUM = '<a href="menu:%s" name="%s">%s</a>';
167 FORMT_MAILNAME = '<a href="mailto:%s"><b>%s</b></a>';
169 spamminess : Extended;
170 {$IFDEF SPAM_FILTER_ENABLED}
171 wordCount : TWordCount;
174 {$IFDEF SPAM_FILTER_ENABLED}
175 wordCount := TWordCount.Create;
177 spamminess := Floor( GikoSys.SpamParse(
178 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
182 Result := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
183 Result := CustomStringReplace( Result, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
184 Result := CustomStringReplace( Result, '<MAIL/>', PRes^.FMailTo);
185 Result := CustomStringReplace( Result, '<DATE/>', PRes^.FDateTime);
186 Result := CustomStringReplace( Result, '<PLAINNUMBER/>', No);
187 Result := CustomStringReplace( Result, '<NAME/>',
188 Format(FORMT_NAME, [PRes^.FName]));
189 Result := CustomStringReplace( Result, '<NUMBER/>',
190 Format(FORMT_NUM, [No, No, No]));
191 Result := CustomStringReplace( Result, '<MAILNAME/>',
192 Format(FORMT_MAILNAME,[PRes^.FMailTo, PRes^.FName]));
193 Result := CustomStringReplace( Result, '<MESSAGE/>', PRes^.FBody);
194 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
195 if GikoSys.Setting.UseKatjushaType then begin
196 Result := CustomStringReplace( Result, '&NUMBER',
197 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
198 Result := CustomStringReplace( Result, '&PLAINNUMBER', No);
199 Result := CustomStringReplace( Result, '&NAME', '<b>' + PRes^.FName + '</b>');
200 Result := CustomStringReplace( Result, '&MAILNAME',
201 '<a href="mailto:' + PRes^.FMailTo + '"><b>' + PRes^.FName + '</b></a>');
202 Result := CustomStringReplace( Result, '&MAIL', PRes^.FMailTo);
203 Result := CustomStringReplace( Result, '&DATE', PRes^.FDateTime);
204 Result := CustomStringReplace( Result, '&MESSAGE', PRes^.FBody);
205 Result := CustomStringReplace( Result, '&SPAMMINESS', FloatToStr( spamminess ) );
206 Result := CustomStringReplace( Result, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
208 //-----
\82±
\82±
\82Ü
\82Å
209 {$IFDEF SPAM_FILTER_ENABLED}
216 (*************************************************************************
217 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
218 *************************************************************************)
219 function THTMLCreate.AddAnchorTag(s: string): string;
235 pe := pp + Length(s);
237 for j := 0 to 9 do begin
238 pos := AnsiStrPosEx(pp, pe, pREF_MARKSs[j], pREF_MARKSe[j]);
239 if pos <> nil then begin
241 idx := Min(tmp, idx);
242 if idx = tmp then idx2 := j; //
\82Ç
\82Ì
\83}
\81[
\83N
\82Å
\88ø
\82Á
\82©
\82©
\82Á
\82½
\82©
\82ð
\95Û
\91¶
246 if idx = MaxInt then begin
247 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
248 Result := Result + s;
252 if (idx > 1) and (idx > anchorLen) and
253 (AnsiStrPosEx(pp + idx - 1 - anchorLen, pp + idx, pANCHORs, pANCHORe) <> nil) then begin
254 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
255 //</a></A>
\82ð
\92T
\82·
\81A
\8f¬
\95¶
\8e\9a\82Å
\8c©
\82Â
\82©
\82ç
\82È
\82¯
\82ê
\82Î
\91å
\95¶
\8e\9a\82Å
\8c\9f\8dõ
256 pos := AnsiStrPosEx(pp + idx, pe, pCTAGLs, pCTAGLe);
258 pos := AnsiStrPosEx(pp + idx, pe, pCTAGUs, pCTAGUe);
260 b := Length(REF_MARK[idx2])
264 Result := Result + Copy(s, 1, idx + b);
265 Delete(s, 1, idx + b);
269 Result := Result + Copy(s, 1, idx - 1);
270 Delete(s, 1, idx - 1);
271 b := Length( s ) + 1;
273 for i := 1 to b do begin
274 pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
276 if pe = nil then begin
277 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
278 url := Copy(s, 1, i - 1);
280 1 : href := 'h' + url;
281 2 : href := 'ht' + url;
282 4 : href := 'htt' + url;
283 6 : href := 'http://' + url;
288 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
292 //
\88ê
\95¶
\8e\9a\90i
\82ß
\82é
\81B
298 //
\88ø
\90\94\81AAID
\81F
\91Î
\8fÛ
\82Æ
\82È
\82é
\93ú
\95tID
\95¶
\8e\9a\97ñ
\81AANum:
\83\8c\83X
\94Ô AURL
\81F
\82»
\82Ì
\83X
\83\8c\83b
\83h
\82ÌURL
299 function THTMLCreate.AddBeProfileLink(AID : string; ANum: Integer):string ;
302 BNum, BMark : string;
304 p := AnsiPos('BE:', AnsiUpperCase(AID));
306 BNum := Copy(AID, p, Length(AID));
307 AID := Copy(AID, 1, p - 1);
308 p := AnsiPos('-', BNum);
310 BMark := '?' + Trim(Copy(BNum, p + 1, Length(BNum)));
311 BNum := Copy(BNum, 1, p - 1);
314 Result := AID + ' <a href="' + BNum + '/' + IntToStr(ANum)
315 + '" target=_blank>' + BMark + '</a>';
319 procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
323 p := Pos(Separator,Text);
324 if (p > 0 ) then begin
325 st := Copy(Text, 1, p - 1);
326 et := Copy(Text, p + Length(Separator), Length(Text));
332 function THTMLCreate.ConvRes(const Body, Bbs, Key : string; DatToHTML: boolean = false): string;
338 ParamNoFirst = 'nofirst';
342 FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
343 //
\8c\9f\8dõ
\91Î
\8fÛ
\82Ì
\95¶
\8e\9a\97ñ
\8cS
344 TOKEN : array[0..5] of string = (GT+GT, GT, '
\81\84\81\84', '
\81\84', '<a ', '<A ');
358 function addResAnchor(const Left :string) : string;
362 //
\8fI
\92[
\82Ü
\82Å
\8ds
\82Á
\82Ä
\82Ì
\8fI
\97¹
\82©
\83`
\83F
\83b
\83N
363 if j <= len then begin
364 if db then j := j - 2
367 //
\89½
\82à
\90\94\8e\9a\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82¢
\82Æ
\82«
368 if No = '' then begin
369 Result := Left + Copy(s, 1, j - 1);
371 separateNumber(st, et, No, '-');
373 if not DatToHTML then begin
374 Result := Left + Format(FORMAT_LINK,
375 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
377 Result := Left + Format('<a href="#%s">', [st]);
379 Result := Result + Copy(s, 1, j - 1) + '</a>';
384 procedure getNumberString;
386 while (j <= len) do begin
387 if (ByteType(s, j) = mbSingleByte) then begin
394 ch := ZenToHan(Copy(s, j, 2));
399 if System.Pos(ch, SN) > 0 then begin
401 end else if (ch = '-') then begin
403 if No = '' then break;
412 function checkComma : boolean;
416 if ((len > 0) and (s[j] = ',')) or ((len > 1) and (ZenToHan(Copy(s, j ,2)) = ',')) then begin
418 if (ByteType(s, j) = mbSingleByte) then
428 //s
\82É
\96{
\95¶
\82ð
\91S
\95\94\93ü
\82ê
\82é
430 //
\8c\8b\89Ê
\82ð
\83N
\83\8a\83A
434 while Length(s) > 2 do begin
435 pmin := Length(s) + 1;
437 for j := 0 to 5 do begin
438 pos := AnsiPos(TOKEN[j], s);
439 if pos <> 0 then begin
440 if pos < pmin then begin
441 //
\82Ç
\82ê
\82Å
\83q
\83b
\83g
\82µ
\82½
\82©
\95Û
\91¶
443 //
\8dÅ
\8f¬
\92l
\82ð
\8dX
\90V
449 //
\83q
\83b
\83g
\82µ
\82½
\95¶
\8e\9a\97ñ
\82Ì
\88ê
\82Â
\8eè
\91O
\82Ü
\82Å
\8c\8b\89Ê
\82É
\83R
\83s
\81[
450 Result := Result + Copy(s, 1, pmin - 1);
451 Delete(s, 1, pmin - 1);
454 //
\83q
\83b
\83g
\82È
\82µ
455 end else if (i = 4) or (i = 5) then begin
456 //'<a ' or '<A'
\82Å
\83q
\83b
\83g '</a>' or '</A>'
\82Ü
\82Å
\83R
\83s
\81[
457 pmin := AnsiPos('</a>' , s);
458 pos := AnsiPos('</A>' , s);
459 if (pmin <> 0) and (pos <> 0) then begin
460 if (pmin > pos) then begin
463 end else if (pos <> 0) then begin
466 rink := Copy(s, 1, pmin + 3);
467 Result := Result + rink;
468 Delete(s, 1, pmin + 3);
470 pmin := Length(rink);
472 for j := 0 to 3 do begin
473 pos := AnsiPos(TOKEN[j], rink);
474 if pos <> 0 then begin
475 if pos < pmin then begin
476 //
\82Ç
\82ê
\82Å
\83q
\83b
\83g
\82µ
\82½
\82©
\95Û
\91¶
478 //
\8dÅ
\8f¬
\92l
\82ð
\8dX
\90V
483 //
\83\8c\83X
\83A
\83\93\83J
\81[
\82ª
\8aÜ
\82Ü
\82ê
\82Ä
\82¢
\82½
\82ç,
\82ª
\91±
\82
\8cÀ
\82è
\83A
\83\93\83J
\81[
\82Æ
\82µ
\82Ä
\88µ
\82¤
494 Result := addResAnchor(Result);
499 //
\89½
\82©
\82µ
\82ç
\8c©
\82Â
\82©
\82Á
\82½
\83p
\83^
\81[
\83\93
500 j := Length(TOKEN[i]) + 1;
507 Result := addResAnchor(Result);
510 Result := Result + s;
513 (*************************************************************************
516 *************************************************************************)
517 function THTMLCreate.ConvRes(const Body, Bbs, Key,
518 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
519 DatToHTML: boolean = false): string;
523 FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
524 //
\8c\9f\8dõ
\91Î
\8fÛ
\82Ì
\95¶
\8e\9a\97ñ
\8cS
525 TOKEN : array[0..5] of string = (GT+GT, GT, '
\81\84\81\84', '
\81\84', '<a ', '<A ');
539 function addResAnchor(const Left :string) : string;
543 //
\8fI
\92[
\82Ü
\82Å
\8ds
\82Á
\82Ä
\82Ì
\8fI
\97¹
\82©
\83`
\83F
\83b
\83N
544 if j <= len then begin
545 if db then j := j - 2
548 //
\89½
\82à
\90\94\8e\9a\82ª
\8c©
\82Â
\82©
\82ç
\82È
\82¢
\82Æ
\82«
549 if No = '' then begin
550 Result := Left + Copy(s, 1, j - 1);
552 separateNumber(st, et, No, '-');
554 if not DatToHTML then begin
555 Result := Left + Format(FORMAT_LINK,
556 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]);
558 Result := Left + Format('<a href="#%s">', [st]);
560 Result := Result + Copy(s, 1, j - 1) + '</a>';
565 procedure getNumberString;
567 while (j <= len) do begin
568 if (ByteType(s, j) = mbSingleByte) then begin
575 ch := ZenToHan(Copy(s, j, 2));
580 if System.Pos(ch, SN) > 0 then begin
582 end else if (ch = '-') then begin
584 if No = '' then break;
593 function checkComma : boolean;
597 if ((len > 0) and (s[j] = ',')) or ((len > 1) and (ZenToHan(Copy(s, j ,2)) = ',')) then begin
599 if (ByteType(s, j) = mbSingleByte) then
609 //s
\82É
\96{
\95¶
\82ð
\91S
\95\94\93ü
\82ê
\82é
611 //
\8c\8b\89Ê
\82ð
\83N
\83\8a\83A
615 while Length(s) > 2 do begin
616 pmin := Length(s) + 1;
618 for j := 0 to 5 do begin
619 pos := AnsiPos(TOKEN[j], s);
620 if pos <> 0 then begin
621 if pos < pmin then begin
622 //
\82Ç
\82ê
\82Å
\83q
\83b
\83g
\82µ
\82½
\82©
\95Û
\91¶
624 //
\8dÅ
\8f¬
\92l
\82ð
\8dX
\90V
630 //
\83q
\83b
\83g
\82µ
\82½
\95¶
\8e\9a\97ñ
\82Ì
\88ê
\82Â
\8eè
\91O
\82Ü
\82Å
\8c\8b\89Ê
\82É
\83R
\83s
\81[
631 Result := Result + Copy(s, 1, pmin - 1);
632 Delete(s, 1, pmin - 1);
635 //
\83q
\83b
\83g
\82È
\82µ
636 end else if (i = 4) or (i = 5) then begin
637 //'<a ' or '<A'
\82Å
\83q
\83b
\83g '</a>' or '</A>'
\82Ü
\82Å
\83R
\83s
\81[
638 pmin := AnsiPos('</a>' , s);
639 pos := AnsiPos('</A>' , s);
640 if (pmin <> 0) and (pos <> 0) then begin
641 if (pmin > pos) then begin
644 end else if (pos <> 0) then begin
647 rink := Copy(s, 1, pmin + 3);
648 Result := Result + rink;
649 Delete(s, 1, pmin + 3);
651 pmin := Length(rink);
653 for j := 0 to 3 do begin
654 pos := AnsiPos(TOKEN[j], rink);
655 if pos <> 0 then begin
656 if pos < pmin then begin
657 //
\82Ç
\82ê
\82Å
\83q
\83b
\83g
\82µ
\82½
\82©
\95Û
\91¶
659 //
\8dÅ
\8f¬
\92l
\82ð
\8dX
\90V
664 //
\83\8c\83X
\83A
\83\93\83J
\81[
\82ª
\8aÜ
\82Ü
\82ê
\82Ä
\82¢
\82½
\82ç,
\82ª
\91±
\82
\8cÀ
\82è
\83A
\83\93\83J
\81[
\82Æ
\82µ
\82Ä
\88µ
\82¤
675 Result := addResAnchor(Result);
680 //
\89½
\82©
\82µ
\82ç
\8c©
\82Â
\82©
\82Á
\82½
\83p
\83^
\81[
\83\93
681 j := Length(TOKEN[i]) + 1;
688 Result := addResAnchor(Result);
691 Result := Result + s;
694 function THTMLCreate.ConvertResAnchor(res: string): string;
696 _HEAD : string = '<a href="../';
697 _TAIL : string = ' target="_blank">';
698 _ST: string = '&st=';
699 _TO: string = '&to=';
700 _STA: string = '&START=';
701 _END: string = '&END=';
707 i := AnsiPos(_HEAD, res);
708 while i <> 0 do begin
709 Result := Result + Copy(res, 1, i -1);
710 Delete(res, 1, i - 1);
711 j := AnsiPos(_TAIL, res);
713 Result := Result + res;
716 tmp := Copy(res, 1, j - 1);
717 Delete(res, 1, j + 16);
718 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
719 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
720 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
721 Result := Result + '<a href="#' + tmp + '">';
722 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
723 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
724 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
725 Result := Result + '<a href="#' + tmp + '">';
727 k := LastDelimiter('/', tmp);
729 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
730 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
732 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
734 Result := Result + '<a href="#' + tmp + '">';
736 i := AnsiPos(_HEAD, res);
738 Result := Result + res;
742 //Plugin
\82ð
\97\98\97p
\82·
\82éBoard
\82Ì
\83X
\83\8c\83b
\83h
\82ÌHTML
\82ð
\8dì
\90¬
\82µ
\82Ädoc
\82É
\8f\91\82«
\8d\9e\82Þ
743 procedure THTMLCreate.CreateUsePluginHTML(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
746 NewReceiveNo: Integer;
747 boardPlugIn : TBoardPlugIn;
748 UserOptionalStyle: string;
750 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
751 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
752 NewReceiveNo := ThreadItem.NewReceive;
753 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
754 UserOptionalStyle := GikoSys.SetUserOptionalStyle;
758 doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
759 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
760 doc.Write('<p id="idSearch"></p>');
762 for i := 0 to threadItem.Count - 1 do begin
763 // 1
\82Í
\95K
\82¸
\95\
\8e¦
765 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
766 case GikoSys.ResRange of
768 if ThreadItem.Kokomade > (i + 1) then
771 if NewReceiveNo > (i + 1) then
774 if (threadItem.Count - i) > GikoSys.ResRange then
779 //
\90V
\92\85\83}
\81[
\83N
780 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
782 if GikoSys.Setting.UseSkin then begin
783 if FileExists( GikoSys.GetSkinNewmarkFileName ) then
784 doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
786 doc.Write( '<a name="new"></a>');
787 end else if GikoSys.Setting.UseCSS then begin
788 doc.Write('<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>');
791 doc.Write('<a name="new"></a>');
792 doc.Write('<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>');
796 doc.Write( '<a name="new"></a>');
801 doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ));
803 if ThreadItem.Kokomade = (i + 1) then begin
804 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
806 if GikoSys.Setting.UseSkin then begin
807 if FileExists( GikoSys.GetSkinBookmarkFileName ) then
808 doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
810 doc.Write( '<a name="koko"></a>');
811 end else if GikoSys.Setting.UseCSS then begin
812 doc.Write('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
815 doc.Write('<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>');
819 doc.Write( '<a name="koko"></a>');
825 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
826 doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ));
833 procedure THTMLCreate.CreateUseSKINHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList);
837 NewReceiveNo: Integer;
839 UserOptionalStyle: string;
846 NewReceiveNo := ThreadItem.NewReceive;
847 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
848 UserOptionalStyle := GikoSys.SetUserOptionalStyle;
849 ThreadName := ChangeFileExt(ThreadItem.FileName, '');
853 doc.charset := 'Shift_JIS';
855 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
857 SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
858 if Length( UserOptionalStyle ) > 0 then
859 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
860 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
861 doc.Write( SkinHeader );
866 SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
871 SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
875 doc.Write('<p id="idSearch"></p>'#13#10'<a name="top"></a>');
877 for i := 0 to ReadList.Count - 1 do begin
878 // 1
\82Í
\95K
\82¸
\95\
\8e¦
880 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
881 case GikoSys.ResRange of
883 if ThreadItem.Kokomade > (i + 1) then
886 if NewReceiveNo > (i + 1) then
889 if (threadItem.Count - i) > GikoSys.ResRange then
894 //
\90V
\92\85\83}
\81[
\83N
895 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
897 if FileExists( GikoSys.GetSkinNewmarkFileName ) then
898 doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
900 doc.Write( '<a name="new"></a>');
902 doc.Write( '<a name="new"></a>' );
906 if (Trim(ReadList[i]) <> '') then begin
907 No := IntToStr(i + 1);
909 DivideStrLine(ReadList[i], @Res);
910 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ThreadName);
911 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
914 if NewReceiveNo <= (i + 1) then
915 //
\90V
\92\85\83\8c\83X
916 strTmp := SkinedRes(SkinNewRes, @Res, No)
918 //
\92Ê
\8fí
\82Ì
\83\8c\83X
919 strTmp := SkinedRes(SkinRes, @Res, No);
926 if ThreadItem.Kokomade = (i + 1) then begin
927 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
929 if FileExists( GikoSys.GetSkinBookmarkFileName ) then
930 doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
932 doc.Write( '<a name="koko"></a>' );
934 doc.Write( '<a name="koko"></a>' );
939 doc.Write('<a name="bottom"></a>');
940 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
942 doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
950 procedure THTMLCreate.CreateUseCSSHTML(doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
952 FORMAT_NOMAIL = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
953 + '<span class="name_label">
\96¼
\91O
\81F</span> <span class="name"><b>%s</b></span>'
954 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> <span class="date">%s</span></div>'
955 + '<div class="mes">%s</div>';
957 FORMAT_SHOWMAIL = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
958 + '<span class="name_label">
\96¼
\91O
\81F </span><a class="name_mail" href="mailto:%s">'
959 + '<b>%s</b></a><span class="mail"> [%s]</span><span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
960 + '<span class="date"> %s</span></div><div class="mes">%s </div>';
962 FORMAT_NOSHOW = '<a name="%s"></a><div class="header"><span class="no"><a href="menu:%s">%s</a></span>'
963 + '<span class="name_label">
\96¼
\91O
\81F </span><a class="name_mail" href="mailto:%s">'
964 + '<b>%s</b></a><span class="date_label">
\93\8a\8de
\93ú
\81F</span><span class="date"> %s</span></div>'
965 + '<div class="mes">%s </div>';
971 NewReceiveNo: Integer;
973 UserOptionalStyle: string;
977 doc.charset := 'Shift_JIS';
978 NewReceiveNo := ThreadItem.NewReceive;
979 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
980 UserOptionalStyle := GikoSys.SetUserOptionalStyle;
981 CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
982 if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
984 doc.Write('<html><head>');
985 doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
986 doc.Write('<title>' + sTitle + '</title>');
987 doc.Write('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
988 if Length( UserOptionalStyle ) > 0 then
989 doc.Write('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
990 doc.Write('</head>'#13#10'<body>');
991 doc.Write('<a name="top"></a>'#13#10'<p id="idSearch"></p>');
992 doc.Write('<div class="title">' + sTitle + '</div>');
993 for i := 0 to ReadList.Count - 1 do begin
994 // 1
\82Í
\95K
\82¸
\95\
\8e¦
996 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
997 case GikoSys.ResRange of
999 if ThreadItem.Kokomade > (i + 1) then
1002 if NewReceiveNo > (i + 1) then
1005 if (threadItem.Count - i) > GikoSys.ResRange then
1010 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1011 doc.Write('<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>');
1014 if (Trim(ReadList[i]) <> '') then begin
1015 No := IntToStr(i + 1);
1016 DivideStrLine(ReadList[i], @Res);
1017 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''));
1018 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1019 if Res.FMailTo = '' then
1020 doc.Write(Format(FORMAT_NOMAIL, [No, No, No, Res.FName, Res.FDateTime, Res.FBody]))
1021 else if GikoSys.Setting.ShowMail then
1022 doc.Write(Format(FORMAT_SHOWMAIL, [No, No, No, Res.FMailTo, Res.FName, Res.FMailTo, Res.FDateTime, Res.FBody]))
1024 doc.Write(Format(FORMAT_NOSHOW, [No, No, No, Res.FName, Res.FDateTime, Res.FBody]));
1027 if ThreadItem.Kokomade = (i + 1) then begin
1028 doc.Write('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1033 doc.Write('<a name="bottom"></a>');
1034 doc.Write('<a name="last"></a>');
1035 doc.Write('</body></html>');
1042 procedure THTMLCreate.CreateDefaultHTML (doc: Variant; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1046 NewReceiveNo: Integer;
1051 doc.charset := 'Shift_JIS';
1052 NewReceiveNo := ThreadItem.NewReceive;
1053 doc.Write('<html><head>'#13#10);
1054 doc.Write('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">'#13#10);
1055 doc.Write('<title>' + sTitle + '</title></head>'#13#10);
1056 doc.Write('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">'#13#10);
1057 doc.Write('<a name="top"></a>'#13#10);
1058 doc.Write('<font size=+1 color="#FF0000">' + sTitle + '</font>'#13#10);
1059 doc.Write('<dl>'#13#10);
1060 doc.Write('<p id="idSearch"></p>'#13#10);
1061 for i := 0 to ReadList.Count - 1 do begin
1062 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1063 if i <> 0 then begin
1064 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1065 case GikoSys.ResRange of
1067 if ThreadItem.Kokomade > (i + 1) then
1070 if NewReceiveNo > (i + 1) then
1073 if (threadItem.Count - i) > GikoSys.ResRange then
1078 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1079 doc.Write('</dl>'#13#10);
1080 doc.Write('<a name="new"></a>'#13#10);
1081 doc.Write('<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>'#13#10);
1082 doc.Write('<dl>'#13#10);
1085 if (Trim(ReadList[i]) <> '') then begin
1086 No := IntToStr(i + 1);
1087 DivideStrLine(ReadList[i], @Res);
1088 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''));
1089 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1090 if Res.FMailTo = '' then
1091 doc.Write('<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>'#13#10)
1092 else if GikoSys.Setting.ShowMail then
1093 doc.Write('<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>'#13#10)
1095 doc.Write('<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>'#13#10);
1097 if ThreadItem.Kokomade = (i + 1) then begin
1098 doc.Write('</dl>'#13#10);
1099 doc.Write('<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>'#13#10);
1100 doc.Write('<dl>'#13#10);
1103 doc.Write('</dl>'#13#10);
1104 doc.Write('<a name="bottom"></a>'#13#10);
1105 doc.Write('</body></html>'#13#10);
1111 procedure THTMLCreate.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1113 ReadList: TStringList;
1114 CSSFileName: string;
1122 Writeln('Create HTML');
1125 if ThreadItem <> nil then begin
1126 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1127 CreateUsePluginHTML(doc, ThreadItem, sTitle);
1129 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1130 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1131 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1132 ShortDayNames[7] := '
\93y';
1134 ReadList := TStringList.Create;
1136 if ThreadItem.IsLogFile then begin
1137 ReadList.BeginUpdate;
1138 FileName := ThreadItem.GetThreadFileName;
1139 ReadList.LoadFromFile(FileName);
1141 GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1142 GikoSys.FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1143 GikoSys.FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1144 if ThreadItem.Title = '' then begin
1145 DivideStrLine(ReadList[0], @Res);
1146 sTitle := Res.FTitle;
1148 sTitle := ThreadItem.Title
1150 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1152 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1153 CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1154 if GikoSys.Setting.UseSkin then begin
1155 CreateUseSKINHTML(doc, ThreadItem, ReadList);
1156 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1157 CreateUseCSSHTML(doc, ThreadItem, ReadList, sTitle);
1159 CreateDefaultHTML(doc, ThreadItem, ReadList, sTitle);
1168 rt := GetTickCount - st;
1170 Writeln(IntToStr(rt) + ' ms');
1174 procedure THTMLCreate.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1178 //bufList : TStringList;
1179 ReadList: TStringList;
1180 // SaveList: TStringList;
1181 CSSFileName: string;
1185 boardPlugIn : TBoardPlugIn;
1187 UserOptionalStyle: string;
1191 function LoadSkin( fileName: string ): string;
1193 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1195 function ReplaceRes( skin: string ): string;
1197 Result := SkinedRes( skin, @Res, No );
1201 if ThreadItem <> nil then begin
1202 CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1205 //if ThreadItem.IsBoardPlugInAvailable then begin
1206 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1207 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1208 //boardPlugIn := ThreadItem.BoardPlugIn;
1209 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1210 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1211 UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1213 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1215 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1216 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1217 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1218 if GikoSys.Setting.UseSkin then begin
1219 tmp1 := './' + GikoSys.Setting.CSSFileName;
1220 tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1221 tmp1 := CustomStringReplace(tmp1, '\', '/');
1222 tmp := CustomStringReplace(tmp, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1223 end else if GikoSys.Setting.UseCSS then begin
1224 tmp1 := './' + CSSFileName;
1225 tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1226 tmp1 := CustomStringReplace(tmp1, '\', '/');
1227 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1231 for i := 0 to threadItem.Count - 1 do begin
1234 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1237 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1238 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1244 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1245 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1246 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1247 ShortDayNames[7] := '
\93y';
1248 BBSID := ThreadItem.ParentBoard.BBSID;
1249 ReadList := TStringList.Create;
1251 if ThreadItem.IsLogFile then begin
1252 FileName := ThreadItem.GetThreadFileName;
1253 ReadList.LoadFromFile(FileName);
1254 GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1255 GikoSys.FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1256 GikoSys.FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1257 DivideStrLine(ReadList[0], @Res);
1258 //Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1259 sTitle := Res.FTitle;
1261 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1264 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1265 UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1267 if GikoSys.Setting.UseSkin then begin
1268 //
\83X
\83L
\83\93\8eg
\97p
1269 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1271 SkinHeader := LoadSkin( GikoSys.GetSkinHeaderFileName );
1272 if Length( UserOptionalStyle ) > 0 then
1273 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1274 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1275 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1276 tmp1 := './' + GikoSys.Setting.CSSFileName;
1277 tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1278 tmp1 := CustomStringReplace(tmp1, '\', '/');
1279 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1280 html.Append( SkinHeader );
1284 SkinRes := LoadSkin( GikoSys.GetSkinResFileName );
1287 html.Append('<a name="top"></a>');
1288 for i := 0 to ReadList.Count - 1 do begin
1289 if (Trim(ReadList[i]) <> '') then begin
1290 No := IntToStr(i + 1);
1292 DivideStrLine(ReadList[i], @Res);
1293 Res.FBody := AddAnchorTag(Res.FBody);
1294 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), true));
1297 html.Append( ReplaceRes( SkinRes ) );
1303 html.Append('<a name="bottom"></a>');
1304 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1306 html.Append( LoadSkin( GikoSys.GetSkinFooterFileName ) );
1309 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1311 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1312 html.Append('<html><head>');
1313 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1314 html.Append('<title>' + sTitle + '</title>');
1315 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1316 tmp1 := './' + CSSFileName;
1317 tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1318 tmp1 := CustomStringReplace(tmp1, '\', '/');
1320 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1321 if Length( UserOptionalStyle ) > 0 then
1322 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1323 html.Append('</head>');
1324 html.Append('<body>');
1325 html.Append('<a name="top"></a>');
1326 html.Append('<div class="title">' + sTitle + '</div>');
1327 for i := 0 to ReadList.Count - 1 do begin
1328 if (Trim(ReadList[i]) <> '') then begin
1329 No := IntToStr(i + 1);
1330 DivideStrLine(ReadList[i], @Res);
1331 Res.FBody := AddAnchorTag(Res.FBody);
1332 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), true));
1333 if Res.FMailTo = '' then
1334 html.Append('<a name="' + No + '"></a>'
1335 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1336 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1337 + '<span class="name"><b>' + Res.FName + '</b></span> '
1338 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1339 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1340 + '<div class="mes">' + Res.FBody + ' </div>')
1341 else if GikoSys.Setting.ShowMail then
1342 html.Append('<a name="' + No + '"></a>'
1343 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1344 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1345 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1346 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1347 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1348 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1349 + '<div class="mes">' + Res.FBody + ' </div>')
1351 html.Append('<a name="' + No + '"></a>'
1352 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1353 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1354 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1355 + '<b>' + Res.FName + '</b></a>'
1356 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1357 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1358 + '<div class="mes">' + Res.FBody + ' </div>');
1361 html.Append('<a name="bottom"></a>');
1362 html.Append('<a name="last"></a>');
1363 html.Append('</body></html>');
1366 html.Append('<html><head>');
1367 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1368 html.Append('<title>' + sTitle + '</title></head>');
1369 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1370 html.Append('<a name="top"></a>');
1371 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1372 html.Append('<dl>');
1373 for i := 0 to ReadList.Count - 1 do begin
1374 if (Trim(ReadList[i]) <> '') then begin
1375 No := IntToStr(i + 1);
1376 DivideStrLine(ReadList[i], @Res);
1377 Res.FBody := AddAnchorTag(Res.FBody);
1378 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), true));
1379 if Res.FMailTo = '' then
1380 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>')
1381 else if GikoSys.Setting.ShowMail then
1382 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>')
1384 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>');
1387 html.Append('</dl>');
1388 html.Append('<a name="bottom"></a>');
1389 html.Append('</body></html>');
1401 procedure THTMLCreate.SetResPopupText(Hint : TResPopup; threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
1413 boardPlugIn : TBoardPlugIn;
1416 if StNum > ToNum then begin
1422 //
\8dÅ
\91å10
\83\8c\83X
\82Ü
\82Å
\95\
\8e¦
1423 if StNum + MAX_POPUP_RES < ToNum then
1424 ToNum := StNum + MAX_POPUP_RES;
1426 //
\83^
\83C
\83g
\83\8b\95\
\8e¦
1428 if ThreadItem <> nil then
1429 Hint.Title := ThreadItem.Title;
1431 if ThreadItem <> nil then begin
1432 //if ThreadItem.IsBoardPlugInAvailable then begin
1433 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1434 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1435 //boardPlugIn := ThreadItem.BoardPlugIn;
1436 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1438 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1439 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1440 for i := StNum to ToNum do begin
1442 //
\82±
\82±
\82Å
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\82Ìdat
\82Ì
\8c`
\8e®
\82Å
\82P
\8ds
\93Ç
\82Ý
\8d\9e\82ß
\82ê
\82Î¥¥¥
\81B
\81«
\93Ç
\82ß
\82é
\82æ
\82¤
\82É
\82È
\82Á
\82½
1443 tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
1444 if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
1445 DivideStrLine(tmp, @Res);
1446 if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
1447 Header := IntToStr(Line) + '
\96¼
\91O
\81F ' + Res.FName + '
\93\8a\8de
\93ú
\81F ' + Res.FDateTime
1449 Header := IntToStr(Line) + '
\96¼
\91O
\81F ' + Res.FName + ' [' + res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime;
1450 Header := DeleteFontTag(Header);
1451 Header := CustomStringReplace(Header, '<br>', '',true);
1453 Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
1454 Body := CustomStringReplace(Body, '<br>', #10,true);
1455 Body := CustomStringReplace(Body, '</a>', '',true);
1456 Body := GikoSys.DeleteLink(Body);
1457 Body := CustomStringReplace(Body, '<', '<');
1458 Body := CustomStringReplace(Body, '>', '>');
1459 Body := CustomStringReplace(Body, '"', '"');
1460 Body := CustomStringReplace(Body, '&', '&');
1461 Body := CustomStringReplace(Body, ' ', ' ');
1463 Hint.Add(Header, Body);
1467 for i := StNum to ToNum do begin
1469 FileName := ThreadItem.FilePath;
1470 tmp := GikoSys.ReadThreadFile(FileName, Line);
1471 if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
1472 DivideStrLine(tmp, @Res);
1473 if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
1474 Header := IntToStr(Line) + '
\96¼
\91O
\81F ' + Res.FName + '
\93\8a\8de
\93ú
\81F ' + Res.FDateTime
1476 Header := IntToStr(Line) + '
\96¼
\91O
\81F ' + Res.FName + ' [' + res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime;
1478 Body := DeleteFontTag(Res.FBody);
1479 Body := CustomStringReplace(Body, '<br> ', #10,true);
1480 Body := CustomStringReplace(Body, '<br>', #10,true);
1481 Body := CustomStringReplace(Body, '</a>', '',true);
1482 Body := GikoSys.DeleteLink(Body);
1483 Body := CustomStringReplace(Body, '<', '<');
1484 Body := CustomStringReplace(Body, '>', '>');
1485 Body := CustomStringReplace(Body, '"', '"');
1486 Body := CustomStringReplace(Body, '&', '&');
1487 Body := CustomStringReplace(Body, ' ', ' ');
1488 Hint.Add(Header, Body);
1497 //
\83\8a\83\93\83N
\82Ì
\95¶
\8e\9a\97ñ
\82©
\82ç
\83\8c\83X
\83|
\83b
\83v
\83A
\83b
\83v
\97p
\82ÌURL
\82É
\95Ï
\8a·
\82·
\82é
1498 class function THTMLCreate.GetRespopupURL(AText, AThreadURL : string): string;
1503 if Pos('about:blank..', AText) = 1 then begin
1504 wkInt := LastDelimiter( '/', AThreadURL );
1505 if Pos( '?', Copy( AThreadURL, wkInt, MaxInt ) ) = 0 then begin
1506 // Thread.URL
\82Í PATH_INFO
\93n
\82µ
1507 Result := Copy( AThreadURL, 1, LastDelimiter( '/', AThreadURL ) );
1508 wkInt := LastDelimiter( '/', AText );
1509 if Pos( '?', Copy( AText, wkInt, MaxInt ) ) = 0 then
1510 // Text
\82à PATH_INFO
\93n
\82µ
1511 Result := Result + Copy( AText, LastDelimiter( '/', AText ) + 1, MaxInt )
1513 // Text
\82Í QUERY_STRING
\93n
\82µ
1514 Result := Result + Copy( AText, LastDelimiter( '?', AText ) + 1, MaxInt );
1516 // Thread.URL
\82Í QUERY_STRING
\93n
\82µ
1517 Result := Copy( AThreadURL, 1, LastDelimiter( '?', AThreadURL ) );
1518 wkInt := LastDelimiter( '/', AText );
1519 if Pos( '?', Copy( AText, wkInt, MaxInt ) ) = 0 then begin
1520 // Text
\82Í PATH_INFO
\93n
\82µ
1521 // URL
\82É
\94Â
\82Æ
\83L
\81[
\82ª
\91«
\82ç
\82È
\82¢
\82Ì
\82Å Text
\82©
\82ç
\92¸
\91Õ
\82·
\82é
1522 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
1523 wkInt := LastDelimiter( '/', Copy( AText, 1, wkInt - 1 ) );
1524 Result := Copy( Result, 1, Length( Result ) - 1 ) + Copy( AText, wkInt, MaxInt );
1526 // Text
\82à QUERY_STRING
\93n
\82µ
1527 Result := Result + Copy( AText, LastDelimiter( '?', AText ) + 1, MaxInt )
1530 end else if Pos('about:blank/bbs/', AText) = 1 then begin
1531 //
\82µ
\82½
\82ç
\82ÎJBBS
\82Ì
\8ed
\95Ï
\82Ì
\8bz
\8eû
1532 AText := CustomStringReplace(AText, 'about:blank/bbs/', 'about:blank../../bbs/');
1533 Result := GetRespopupURL(AText, AThreadURL);
1539 //
\8ew
\92è
\82µ
\82½
\83p
\83X
\82É
\83X
\83L
\83\93\82à
\82µ
\82
\82ÍCSS
\82Ì
\83t
\83@
\83C
\83\8b\82Ì
\83R
\83s
\81[
\82ð
\8dì
\82é
1540 class procedure THTMLCreate.SkinorCSSFilesCopy(path: string);
1542 tmp, tmpD, tmpF: string;
1548 if GikoSys.Setting.UseSkin then begin
1549 current := ExtractFilePath(GikoSys.GetSkinDir);
1550 tmp := GikoSys.Setting.CSSFileName;
1551 end else if GikoSys.Setting.UseCSS then begin
1552 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
1553 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
1555 dirs := TStringList.Create;
1558 if tmp <> current then begin
1559 GikoSys.GetDirectoryList(current, '*.*', dirs, true);
1560 for i := 0 to dirs.Count - 1 do begin
1561 files := TStringList.Create;
1564 gikoSys.GetFileList(dirs[i], '*.*', files, true);
1566 tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
1567 if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
1568 ForceDirectories(tmpD);
1570 if(dirs[i] = tmp) and (dirs[i] <> current) then begin
1571 for j := 0 to files.Count - 1 do begin
1572 tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
1573 if not FileExists(tmpF) then begin
1574 CopyFile(PChar(files[j]), PChar(tmpF),True);
1583 tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
1584 if not DirectoryExists(tmpD) then
1585 ForceDirectories(tmpD);
1586 tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
1587 , GikoSys.GetConfigDir, path);
1588 if not FileExists(tmpF) then begin
1589 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
1590 , PChar(tmpF), True);
1601 HTMLCreater := THTMLCreate.Create;
1604 if HTMLCreater <> nil then begin