Develop and Download Open Source Software

Browse CVS Repository

Annotation of /gikonavigoeson/gikonavi/HTMLCreate.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4.2.6 - (hide annotations) (download) (as text)
Tue Nov 1 17:05:35 2005 UTC (18 years, 5 months ago) by h677
Branch: Bdraw
Changes since 1.4.2.5: +4 -3 lines
File MIME type: text/x-pascal
結果を途中でクリアしてる部分があったので修正

1 h677 1.1 unit HTMLCreate;
2    
3     interface
4    
5     uses
6     Windows, Messages, SysUtils, Classes, {Graphics,} Controls, {Forms,}
7 h677 1.4.2.1 ComCtrls, IniFiles, ShellAPI, Math, GikoSystem, ActiveX,
8 h677 1.1 {$IF Defined(DELPRO) }
9     SHDocVw,
10     MSHTML,
11     {$ELSE}
12     SHDocVw_TLB,
13     MSHTML_TLB,
14     {$IFEND}
15     {HttpApp,} YofUtils, {URLMon,} BoardGroup, {gzip,} {Dolib,}
16     {bmRegExp,} AbonUnit, MojuUtils, Setting,
17     ExternalBoardManager, ExternalBoardPlugInMain{,}
18     {Sort,} ,GikoBayesian;
19    
20     type
21     THTMLCreate = class(TObject)
22     private
23     { Private ?辿?転 }
24 h677 1.4 anchorLen : Integer;
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;
31     constructor Create;
32    
33 h677 1.1 function AddBeProfileLink(AID : string; ANum: Integer):string ;
34 h677 1.4.2.1 procedure CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
35     procedure CreateUseSKINHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
36     procedure CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
37     procedure CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
38 h677 1.2 function ConvertResAnchor(res: string): string;
39 h677 1.4.2.5 procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
40 h677 1.1 public
41     { Public ?辿?転 }
42 h677 1.4 function AddAnchorTag(s: string): string;
43 h677 1.2 function LoadFromSkin(fileName: string; ThreadItem: TThreadItem; SizeByte: Integer): string;
44     function SkinedRes(skin: string; Res: TResRec; No: string): string;
45     function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
46     function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
47 h677 1.4.2.1 procedure CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
48 h677 1.2 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
49 h677 1.1 end;
50    
51     var
52     HTMLCreater: THTMLCreate;
53    
54     implementation
55    
56 h677 1.4 const
57     URL_CHAR: string = '0123456789'
58     + 'abcdefghijklmnopqrstuvwxyz'
59     + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
60     + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
61     ANCHOR_REF = 'href=';
62     CLOSE_TAGAL = '</a>';
63     CLOSE_TAGAU = '</A>';
64     RES_REF = '&gt;&gt;';
65     REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
66     'ms-help://','p://', 'https://',
67     'www.', 'ftp://','news://','rtsp://');
68    
69     constructor THTMLCreate.Create;
70     var
71     j : Integer;
72     begin
73     // + 3 ?? 'href="' ('"'???鼎)???????o???G?[?V???????]?T???????邸?辿????
74     anchorLen := Length( ANCHOR_REF ) + 3;
75     pANCHORs := PChar(ANCHOR_REF);
76     pANCHORe := pANCHORs + Length(ANCHOR_REF);
77     pURLCHARs := PChar(URL_CHAR);
78     pURLCHARe := pURLCHARs + Length(URL_CHAR);
79     pCTAGLs := PChar(CLOSE_TAGAL);
80     pCTAGLe := pCTAGLs + 4;
81     pCTAGUs := PChar(CLOSE_TAGAU);
82     pCTAGUe := pCTAGUs + 4;
83     for j := 0 to 9 do begin
84     pREF_MARKSs[j] := PChar(REF_MARK[j]);
85     pREF_MARKSe[j] := pREF_MARKSs[j] + Length(REF_MARK[j]);
86     end;
87     end;
88 h677 1.1 // ?X?L?????????????A?l???u?????辿
89     function THTMLCreate.LoadFromSkin(
90     fileName: string;
91     ThreadItem: TThreadItem;
92     SizeByte: Integer
93     ): string;
94     var
95     Skin: TStringList;
96     begin
97    
98     Skin := TStringList.Create;
99     try
100     if FileExists( fileName ) then begin
101     Skin.LoadFromFile( fileName );
102    
103     // ?但???????????直???纏???A?I?v?V?????_?C?A???O???v???r???[?p try
104     try
105     if ThreadItem.ParentBoard <> nil then
106     if ThreadItem.ParentBoard.ParentCategory <> nil then
107     CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
108     CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
109     except end;
110     CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
111     CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
112     CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
113     CustomStringReplace( Skin, '<SKINPATH/>', GikoSys.Setting.CSSFileName);
114     CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
115     CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
116     CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
117    
118     CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
119     CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
120     CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
121    
122 h677 1.4.2.1
123 h677 1.1 //----- ?????????存???甜???`?直?叩?????p?B?R?????g?A?E?g?直???????直
124 h677 1.4.2.1 if GikoSys.Setting.UseKatjushaType then begin
125     // ?但???????????直???纏???A?I?v?V?????_?C?A???O???v???r???[?p try
126     try
127     if ThreadItem.ParentBoard <> nil then
128     if ThreadItem.ParentBoard.ParentCategory <> nil then
129     CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
130     CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
131     except end;
132     CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
133     CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
134     CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
135     CustomStringReplace( Skin, '&SKINPATH', GikoSys.Setting.CSSFileName);
136     CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
137     CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
138     CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
139    
140     CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
141     CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
142     CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
143     //----- ???????長
144     end;
145 h677 1.1 end;
146     Result := Skin.Text;
147     finally
148     Skin.Free;
149     end;
150     end;
151    
152     // ???X???l???u?????辿
153     function THTMLCreate.SkinedRes(
154     skin: string;
155     Res: TResRec;
156     No: string
157     ): string;
158     var
159     spamminess : Extended;
160     wordCount : TWordCount;
161     begin
162    
163     wordCount := TWordCount.Create;
164     try
165     spamminess := Floor( GikoSys.SpamParse(
166     Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
167    
168     Skin := CustomStringReplace( Skin, '<NUMBER/>',
169     '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
170     Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
171     Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
172     Skin := CustomStringReplace( Skin, '<MAILNAME/>',
173     '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
174     Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
175     Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
176     Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
177     Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
178     Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
179    
180     //----- ???甜???`?直?叩?????p?B?R?????g?A?E?g?直???????直
181 h677 1.4.2.1 if GikoSys.Setting.UseKatjushaType then begin
182     Skin := CustomStringReplace( Skin, '&NUMBER',
183     '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
184     Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
185     Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
186     Skin := CustomStringReplace( Skin, '&MAILNAME',
187     '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
188     Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
189     Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
190     Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
191     Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
192     Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
193     end;
194 h677 1.1 //----- ???????長
195    
196     Result := Skin;
197     finally
198     wordCount.Free;
199     end;
200    
201     end;
202     (*************************************************************************
203     *http://??????????anchor?^?O?t?鼎?????辿?B
204     *************************************************************************)
205     function THTMLCreate.AddAnchorTag(s: string): string;
206     var
207     url: string;
208     href: string;
209     i, j, b: Integer;
210     tmp: Integer;
211     idx, idx2: Integer;
212 h677 1.4 pos : PChar;
213 h677 1.1 pp, pe : PChar;
214     begin
215     Result := '';
216 h677 1.4
217 h677 1.1 while True do begin
218     idx := MaxInt;
219     idx2 := MaxInt;
220 h677 1.4 pp := PChar(s);
221     pe := pp + Length(s);
222    
223 h677 1.1 for j := 0 to 9 do begin
224 h677 1.4 pos := AnsiStrPosEx(pp, pe, pREF_MARKSs[j], pREF_MARKSe[j]);
225     if pos <> nil then begin
226     tmp := pos - pp + 1;
227     idx := Min(tmp, idx);
228     if idx = tmp then idx2 := j; //?????}?[?N?長?????????????????徹??
229     end;
230 h677 1.1 end;
231 h677 1.4
232 h677 1.1 if idx = MaxInt then begin
233     //?????N?????????B
234     Result := Result + s;
235     Break;
236     end;
237    
238 h677 1.4 if (idx > 1) and (idx > anchorLen) and
239     (AnsiStrPosEx(pp + idx - 1 - anchorLen, pp + idx, pANCHORs, pANCHORe) <> nil) then begin
240 h677 1.1 //?哲???????N?^?O???????????辿???徹?????鼎?????V
241 h677 1.4 //</a></A>???T???A?店?????長???????巽???纏?????頂?????長????
242     pos := AnsiStrPosEx(pp + idx, pe, pCTAGLs, pCTAGLe);
243     if pos = nil then
244     pos := AnsiStrPosEx(pp + idx, pe, pCTAGUs, pCTAGUe);
245     if pos = nil then
246     b := Length(REF_MARK[idx2])
247     else
248     b := pos - pp + 1;
249 h677 1.1
250 h677 1.4 Result := Result + Copy(s, 1, idx + b);
251     Delete(s, 1, idx + b);
252 h677 1.1 Continue;
253     end;
254    
255     Result := Result + Copy(s, 1, idx - 1);
256     Delete(s, 1, idx - 1);
257     b := Length( s ) + 1;
258     pp := PChar(s);
259     for i := 1 to b do begin
260     pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
261    
262     if pe = nil then begin
263     //URL???叩?????????足???I?????A?????????足???????B
264     url := Copy(s, 1, i - 1);
265     case idx2 of
266     1 : href := 'h' + url;
267     2 : href := 'ht' + url;
268     4 : href := 'htt' + url;
269     6 : href := 'http://' + url;
270     else
271     href := url;
272     end;
273    
274     Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
275     Delete(s, 1, i - 1);
276     Break;
277     end;
278     //???????i???辿?B
279     Inc(pp);
280     end;
281     end;
282     end;
283    
284     //?????AAID?F???徹?????辿?炭?tID???????AANum:???X?? AURL?F?泥???X???b?h??URL
285     function THTMLCreate.AddBeProfileLink(AID : string; ANum: Integer):string ;
286     var
287     p : integer;
288     BNum, BMark : string;
289     begin
290     p := AnsiPos('BE:', AnsiUpperCase(AID));
291     if p > 0 then begin
292     BNum := Copy(AID, p, Length(AID));
293     AID := Copy(AID, 1, p - 1);
294     p := AnsiPos('-', BNum);
295     if p > 0 then begin
296     BMark := '?' + Trim(Copy(BNum, p + 1, Length(BNum)));
297     BNum := Copy(BNum, 1, p - 1);
298     end;
299     BNum := Trim(BNum);
300     Result := AID + ' <a href="' + BNum + '/' + IntToStr(ANum)
301     + '" target=_blank>' + BMark + '</a>';
302     end else
303     Result := AID;
304     end;
305 h677 1.4.2.5 procedure THTMLCreate.separateNumber(var st: String; var et: String; const Text, Separator: String);
306     var
307     p : Integer;
308     begin
309     p := Pos(Separator,Text);
310     if (p > 0 ) then begin
311     st := Copy(Text, 1, p - 1);
312     et := Copy(Text, p + Length(Separator), Length(Text));
313     end else begin
314     st := Text;
315     et := Text;
316     end;
317     end;
318    
319 h677 1.1 (*************************************************************************
320     *
321     * from HotZonu
322     *************************************************************************)
323     function THTMLCreate.ConvRes(const Body, Bbs, Key,
324     ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
325     DatToHTML: boolean = false): string;
326 h677 1.4.2.5 const
327     GT = '&gt;';
328     SN = '0123456789';
329     ZN = '?O?P?Q?R?S?T?U?V?W?X';
330     FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
331     var
332     i : integer;
333     s : string;
334     sw: boolean;
335 h677 1.4.2.6 cm: boolean;
336 h677 1.4.2.5 No: string;
337     oc : string;
338     st, et: string;
339     pos, pmin : integer;
340     j : integer;
341     token : array[0..5] of string;
342     ch : string;
343     db : boolean;
344    
345     begin
346     //s ???{?????S???端???辿
347     s := Body;
348     //???????N???A
349     Result := '';
350     //???????徹?????????S
351     token[0] := GT + GT;
352     token[1] := GT;
353     token[2] := '????';
354     token[3] := '??';
355     token[4] := '<a ';
356     token[5] := '<A ';
357    
358     //
359     while Length(s) > 0 do begin
360     pmin := Length(s) + 1;
361     i := length(token);
362     for j := 0 to length(token) - 1 do begin
363     pos := AnsiPos(token[j], s);
364     if pos <> 0 then begin
365     if pos < pmin then begin
366     //?????長?q?b?g?直?????徹??
367     i := j;
368     //?長?店?l???X?V
369     pmin := pos;
370     end;
371     end;
372     end;
373    
374     //?q?b?g?直?????????????????O???長???????R?s?[
375     Result := Result + Copy(s, 1, pmin - 1);
376     Delete(s, 1, pmin - 1);
377    
378     if i = length(token) then begin
379     //?q?b?g???直
380     end else if (i = 4) or (i = 5) then begin
381     //'<a ' or '<A' ?長?q?b?g '</a>' or '</A>' ???長?R?s?[
382     pmin := AnsiPos('</a>' , s);
383     pos := AnsiPos('</A>' , s);
384     if (pmin <> 0) and (pos <> 0) then begin
385     if (pmin > pos) then begin
386     pmin := pos;
387     end;
388     end else if (pos <> 0) then begin
389     pmin := pos;
390     end;
391     Result := Result + Copy(s, 1, pmin + 3);
392     Delete(s, 1, pmin + 3);
393     end else begin
394     //?????直?巽???????????p?^?[??
395     j := Length(token[i]) + 1;
396     oc := '';
397     No := '';
398     sw := false;
399 h677 1.4.2.6 db := false;
400 h677 1.4.2.5 while j <= Length(s) do begin
401     if (ByteType(s, j) = mbSingleByte) then begin
402     //1byte????
403     ch := s[j];
404     Inc(j);
405     db := false;
406     end else begin
407     //2byte????
408     ch := ZenToHan(Copy(s, j, 2));
409     Inc(j, 2);
410     db := true;
411     end;
412    
413     if AnsiPos(ch, SN) > 0 then begin
414     No := No + ch;
415     end else if (ch = '-') then begin
416     if sw then break;
417     if No = '' then break;
418     sw := true;
419     end else begin
420     break;
421     end;
422     end;
423     //?I?[???長?s???????I?邸???`?F?b?N
424     if j <= Length(s) then begin
425     if db then j := j - 2
426     else j := j - 1;
427     end;
428     //?????????????????巽???????鼎
429     if No = '' then begin
430     Result := Result + Copy(s, 1, j - 1);
431     end else begin
432     separateNumber(st, et, No, '-');
433    
434     if not DatToHTML then begin
435 h677 1.4.2.6 Result := Result + Format(FORMAT_LINK,
436 h677 1.4.2.5 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue])
437     + Copy(s, 1, j - 1) + '</a>';
438     end else begin
439 h677 1.4.2.6 Result := Result + Format('<a href="#%s">', [st])
440 h677 1.4.2.5 + Copy(s, 1, j - 1) + '</a>';
441     end;
442     end;
443     Delete(s, 1, j - 1);
444     end;
445     end;
446     end;
447     {
448     function THTMLCreate.ConvRes(const Body, Bbs, Key,
449     ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
450     DatToHTML: boolean = false): string;
451 h677 1.1 type
452     PIndex = ^TIndex;
453     TIndex = record
454     FIndexFrom : integer;
455     FIndexTo : integer;
456     FNo : string;
457     end;
458     const
459     GT = '&gt;';
460     SN = '0123456789-';
461     ZN = '?O?P?Q?R?S?T?U?V?W?X?|';
462 h677 1.4.2.3 FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
463 h677 1.1 var
464     i : integer;
465 h677 1.4.2.5 s : string;
466 h677 1.1 b : TMbcsByteType;
467     sw: boolean;
468     sp: integer;
469     No: string;
470     sx: string;
471     List: TList;
472     oc : string;
473     st, et: string;
474     chk : boolean;
475     al : boolean;
476     procedure Add(IndexFrom, IndexTo: integer; const No: string);
477     var
478     FIndex : PIndex;
479     begin
480     New(FIndex);
481     FIndex.FIndexFrom := IndexFrom;
482     FIndex.FIndexTo := IndexTo;
483     FIndex.FNo := No;
484     List.Add(FIndex);
485     end;
486 h677 1.4.2.3 procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
487 h677 1.1 var
488 h677 1.4.2.3 p : Integer;
489 h677 1.1 begin
490 h677 1.4.2.3 p := Pos(Separator, Text);
491     if (p > 0 ) then begin
492     st := Copy(Text, 1, p - 1);
493     et := Copy(Text, p + Length(Separator), Length(Text));
494     end else begin
495     st := Text;
496     et := Text;
497 h677 1.1 end;
498     end;
499     begin
500     s := Body;
501 h677 1.4.2.4 Result := Body;
502 h677 1.1 i := 1;
503     sw := False;
504     No := '';
505     List:= TList.Create;
506     oc := '';
507     sp := 0;
508     chk := False;
509     al := False;
510     while true do begin
511     b := ByteType(s, i);
512     case b of
513     mbSingleByte : begin
514     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
515 h677 1.4.2.3 if (Pos('<A HREF', oc) = 0) then begin
516 h677 1.1 sw := True;
517     sp := i;
518     i := i + 7;
519     oc:='';
520     chk := True;
521     end;
522     end else
523     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
524 h677 1.4.2.3 if (Pos('<A HREF', oc) = 1) then begin
525 h677 1.1 i := i + 7;
526     oc:='';
527     chk := True;
528     end;
529     end else
530     if (not sw) and (Copy(s,i,4) = GT) then begin
531 h677 1.4.2.3 if (Pos('<A HREF', oc) = 0) then begin
532 h677 1.1 sw := True;
533     sp := i;
534     i := i + 3;
535     oc:='';
536     chk := True;
537     end;
538     end else
539     if ((not sw) and (Copy(s,i,1) = ',')) or
540     ((not sw) and (Copy(s,i,1) = '=')) then begin
541 h677 1.4.2.3 if ((not Chk) and (oc = '</A>')) or
542 h677 1.1 ((Chk) and (oc = '')) or
543     ((not Chk) and (al)) then
544     begin
545     sw := True;
546     sp := i;
547     oc:='';
548     end;
549     end else
550     if (sw) then begin
551     sx := Copy(s,i,1);
552     if (AnsiPos(sx, SN) > 0) then begin
553     No := No + sx;
554     end else begin
555     if (No <> '') and (No <> '-') then begin
556     Add(sp, i, No);
557     al := True;
558     end;
559     sw := False;
560 h677 1.4.2.4 Dec(i);
561 h677 1.1 No := '';
562     oc:='';
563     end;
564     end else begin
565 h677 1.4.2.3 if Copy(s,i,1) = '<' then begin
566     oc := '<';
567     end else begin
568     oc := oc + AnsiUpperCase(Copy(s,i,1));
569     end;
570 h677 1.1 chk := False;
571     al := False;
572     end;
573     end;
574     mbLeadByte : begin
575     if (not sw) and (Copy(s,i,4) = '????') then begin
576     sw := True;
577     sp := i;
578     i := i + 3;
579     chk := True;
580     end else
581     if (not sw) and (Copy(s,i,2) = '??') then begin
582     sw := True;
583     sp := i;
584 h677 1.4.2.5 Inc(i);
585 h677 1.1 chk := True;
586     end else
587     if (sw) then begin
588     sx := Copy(s,i,2);
589     if (AnsiPos(sx, ZN) > 0) then begin
590     No := No + ZenToHan(sx);
591     end else begin
592     if (No <> '') and (No <> '-') and (No <> '?|') then begin
593     Add(sp, i, No);
594     end;
595     sw := False;
596 h677 1.4.2.5 Dec(i);
597 h677 1.1 No := '';
598     end;
599     end else begin
600     oc := '';
601     chk := False;
602     end;
603     al := False;
604     end;
605     end;
606     inc(i);
607     if (i > Length(Body)) then begin
608     if (sw) then begin
609     if (No <> '') then Add(sp, i, No);
610     end;
611     Break;
612     end;
613     end;
614     for i := List.Count - 1 downto 0 do begin
615 h677 1.4.2.3 separateNumber(st, et, PIndex(List[i]).FNo, '-');
616 h677 1.1 if not DatToHTML then
617 h677 1.4.2.5 Result := Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
618 h677 1.4.2.3 Format(FORMAT_LINK, [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
619 h677 1.4.2.4 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
620     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result))
621 h677 1.1 else
622 h677 1.4.2.5 Result := Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
623 h677 1.1 Format('<a href="#%s">', [st]) +
624 h677 1.4.2.4 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
625     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
626 h677 1.1
627     Dispose(PIndex(List[i]));
628     end;
629     List.Free;
630     end;
631 h677 1.4.2.5 }
632 h677 1.1 function THTMLCreate.ConvRes(
633     const Body, Bbs, Key, ParamBBS, ParamKey,
634     ParamStart, ParamTo, ParamNoFirst,
635     ParamTrue, FullURL : string
636     ): string;
637     type
638     PIndex = ^TIndex;
639     TIndex = record
640     FIndexFrom : integer;
641     FIndexTo : integer;
642     FNo : string;
643     end;
644     const
645     GT = '&gt;';
646     SN = '0123456789-';
647     ZN = '?O?P?Q?R?S?T?U?V?W?X?|';
648     var
649     i : integer;
650 h677 1.4.2.2 s : string;
651 h677 1.1 b : TMbcsByteType;
652     sw: boolean;
653     sp: integer;
654     No: string;
655     sx: string;
656     List: TList;
657     oc : string;
658     st, et: string;
659     chk : boolean;
660     al : boolean;
661     procedure Add(IndexFrom, IndexTo: integer; const No: string);
662     var
663     FIndex : PIndex;
664     begin
665     New(FIndex);
666     FIndex.FIndexFrom := IndexFrom;
667     FIndex.FIndexTo := IndexTo;
668     FIndex.FNo := No;
669     List.Add(FIndex);
670     end;
671     function ChooseString(const Text, Separator: string; Index: integer): string;
672     var
673     S : string;
674     i, p : integer;
675     begin
676     S := Text;
677     for i := 0 to Index - 1 do begin
678     if (AnsiPos(Separator, S) = 0) then S := ''
679     else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
680     end;
681     p := AnsiPos(Separator, S);
682     if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
683     end;
684     begin
685     { v1.0 b2 - 03 }
686     s := Body;
687 h677 1.4.2.2 Result := Body;
688 h677 1.1 i := 1;
689     sw := False;
690     No := '';
691     List:= TList.Create;
692     oc := '';
693     sp := 0;
694     chk := False;
695     al := False;
696     while true do begin
697     b := ByteType(s, i);
698 h677 1.4.2.2 case b of
699 h677 1.1 mbSingleByte : begin
700     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
701 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
702 h677 1.1 sw := True;
703     sp := i;
704     i := i + 7;
705     oc:='';
706     chk := True;
707     end;
708     end else
709     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
710 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
711 h677 1.1 i := i + 7;
712     oc:='';
713     chk := True;
714     end;
715     end else
716     if (not sw) and (Copy(s,i,4) = GT) then begin
717 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
718 h677 1.1 sw := True;
719     sp := i;
720     i := i + 3;
721     oc:='';
722     chk := True;
723     end;
724     end else
725     if ((not sw) and (Copy(s,i,1) = ',')) or
726     ((not sw) and (Copy(s,i,1) = '=')) then begin
727     if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
728     ((Chk) and (oc = '')) or
729     ((not Chk) and (al)) then
730     begin
731     sw := True;
732     sp := i;
733     //i := i + 1;
734     oc:='';
735     end;
736     end else
737     if (sw) then begin
738     sx := Copy(s,i,1);
739 h677 1.4.2.2 if (Pos(sx, SN) > 0) then begin
740 h677 1.1 No := No + sx;
741     end else begin
742     if (No <> '') and (No <> '-') then begin
743     Add(sp, i, No);
744     al := True;
745     end;
746     sw := False;
747     //
748     i := i - 1;
749     //
750     No := '';
751     oc:='';
752     //chk := False;
753     end;
754     end else begin
755     if Copy(s,i,1) = '<' then oc := '';
756     oc := oc + Copy(s,i,1);
757     chk := False;
758     al := False;
759     end;
760     end;
761     mbLeadByte : begin
762     if (not sw) and (Copy(s,i,4) = '????') then begin
763     sw := True;
764     sp := i;
765     i := i + 3;
766     chk := True;
767     end else
768     if (not sw) and (Copy(s,i,2) = '??') then begin
769     sw := True;
770     sp := i;
771     i := i + 1;
772     chk := True;
773     end else
774     if (sw) then begin
775     sx := Copy(s,i,2);
776     if (AnsiPos(sx, ZN) > 0) then begin
777     No := No + ZenToHan(sx);
778     end else begin
779     if (No <> '') and (No <> '-') and (No <> '?|') then begin
780     Add(sp, i, No);
781     end;
782     sw := False;
783     i := i - 1;
784     No := '';
785     end;
786     end else begin
787     oc := '';
788     chk := False;
789     end;
790     al := False;
791     end;
792     end;
793     inc(i);
794     if (i > Length(Body)) then begin
795     if (sw) then begin
796     if (No <> '') then Add(sp, i, No);
797     end;
798     Break;
799     end;
800     end;
801     for i := List.Count - 1 downto 0 do begin
802     if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
803     st := ChooseString(PIndex(List[i]).FNo, '-', 0);
804     et := ChooseString(PIndex(List[i]).FNo, '-', 1);
805     end else begin
806     st := PIndex(List[i]).FNo;
807     et := PIndex(List[i]).FNo;
808     end;
809 h677 1.4.2.2 Result := Copy(Result,0, PIndex(List[i]).FIndexFrom - 1) +
810 h677 1.1 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
811     [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
812 h677 1.4.2.2 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
813     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
814 h677 1.1 Dispose(PIndex(List[i]));
815     end;
816     List.Free;
817     end;
818    
819 h677 1.2 function THTMLCreate.ConvertResAnchor(res: string): string;
820     const
821     _HEAD : string = '<a href="../';
822     _TAIL : string = ' target="_blank">';
823     _ST: string = '&st=';
824     _TO: string = '&to=';
825     _STA: string = '&START=';
826     _END: string = '&END=';
827     var
828     i, j, k: Integer;
829     tmp: string;
830     begin
831     Result := '';
832     i := AnsiPos(_HEAD, res);
833     while i <> 0 do begin
834     Result := Result + Copy(res, 1, i -1);
835     Delete(res, 1, i - 1);
836     j := AnsiPos(_TAIL, res);
837     if j = 0 then begin
838     Result := Result + res;
839     Exit;
840     end;
841     tmp := Copy(res, 1, j - 1);
842     Delete(res, 1, j + 16);
843     if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
844     Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
845     Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
846     Result := Result + '<a href="#' + tmp + '">';
847     end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
848     Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
849     Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
850     Result := Result + '<a href="#' + tmp + '">';
851     end else begin
852     k := LastDelimiter('/', tmp);
853     Delete(tmp, 1, k);
854     if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
855     Delete(tmp, AnsiPos('-', tmp), Length(tmp))
856     else
857     Delete(tmp, AnsiPos('"', tmp), Length(tmp));
858    
859     Result := Result + '<a href="#' + tmp + '">';
860     end;
861     i := AnsiPos(_HEAD, res);
862     end;
863     Result := Result + res;
864    
865     end;
866    
867 h677 1.1 //Plugin?????p???辿Board???X???b?h??HTML?????店?直??doc?????鼎???鄭
868 h677 1.4.2.1 procedure THTMLCreate.CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
869 h677 1.1 var
870     i: integer;
871     NewReceiveNo: Integer;
872     boardPlugIn : TBoardPlugIn;
873     UserOptionalStyle: string;
874     begin
875     if ThreadItem <> nil then begin
876     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
877     //===== ?v???O?C???????辿?\??
878     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
879     NewReceiveNo := ThreadItem.NewReceive;
880     // ?t?H???g?但?T?C?Y??????
881     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
882 h677 1.4.2.1 html.BeginUpdate;
883 h677 1.1 try
884 h677 1.4.2.1 //doc.open;
885 h677 1.1 // ?w?b?_
886 h677 1.4.2.1 //doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
887     html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
888     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
889     // '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );
890     //doc.Write('<p id="idSearch"></p>' + #13#10 );
891     html.Add('<p id="idSearch"></p>');
892 h677 1.1 for i := 0 to threadItem.Count - 1 do begin
893     // 1 ???K?存?\??
894     if i <> 0 then begin
895     // ?\????????????
896     case GikoSys.ResRange of
897     Ord( grrKoko ):
898     if ThreadItem.Kokomade > (i + 1) then
899     Continue;
900     Ord( grrNew ):
901     if NewReceiveNo > (i + 1) then
902     Continue;
903     10..65535:
904     if (threadItem.Count - i) > GikoSys.ResRange then
905     Continue;
906     end;
907     end;
908    
909     // ?V???}?[?N
910     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
911     try
912     if GikoSys.Setting.UseSkin then begin
913     if FileExists( GikoSys.GetSkinNewmarkFileName ) then
914 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
915     html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
916 h677 1.1 else
917 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
918     html.Append( '<a name="new"></a>' );
919 h677 1.1 end else if GikoSys.Setting.UseCSS then begin
920 h677 1.4.2.1 //doc.Write('<a name="new"></a><div class="new">?V?????X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>' + #13#10);
921     html.Append('<a name="new"></a><div class="new">?V?????X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
922 h677 1.1 end else begin
923 h677 1.4.2.1 //doc.Write('</dl>');
924     html.Append('</dl>');
925     //doc.Write('<a name="new"></a>');
926     html.Append('<a name="new"></a>');
927     //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>?V?????X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
928     html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>?V?????X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
929     //doc.Write('<dl> + #13#10');
930     html.Append('<dl>');
931 h677 1.1 end;
932     except
933 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10);
934     html.Append( '<a name="new"></a>');
935 h677 1.1 end;
936     end;
937    
938     // ???X
939 h677 1.4.2.1 //doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );
940     html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
941 h677 1.1
942     if ThreadItem.Kokomade = (i + 1) then begin
943     // ???????長?????転
944     try
945     if GikoSys.Setting.UseSkin then begin
946     if FileExists( GikoSys.GetSkinBookmarkFileName ) then
947 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
948     html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
949 h677 1.1 else
950 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
951     html.Append( '<a name="koko"></a>' );
952 h677 1.1 end else if GikoSys.Setting.UseCSS then begin
953 h677 1.4.2.1 //doc.Write('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' + #13#10 );
954     html.Append('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' );
955 h677 1.1 end else begin
956 h677 1.4.2.1 //doc.Write('</dl>');
957     html.Append('</dl>');
958     //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>?R?R???長?????転</b></font></td></tr></table>');
959     html.Append('<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>?R?R???長?????転</b></font></td></tr></table>');
960     //doc.Write('<dl>' + #13#10 );
961     html.Append('<dl>' );
962 h677 1.1 end;
963     except
964 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
965     html.Append( '<a name="koko"></a>' );
966 h677 1.1 end;
967     end;
968     end;
969    
970    
971     // ?X?L??(?t?b?^)
972 h677 1.4.2.1 //doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );
973     html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
974 h677 1.1 finally
975 h677 1.4.2.1 //doc.Close;
976     html.EndUpdate;
977 h677 1.1 end;
978    
979     end;
980     end;
981     end;
982    
983    
984 h677 1.4.2.1 procedure THTMLCreate.CreateUseSKINHTML(html : TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
985 h677 1.1 var
986     i: integer;
987     No: string;
988     CSSFileName: string;
989     NewReceiveNo: Integer;
990     Res: TResRec;
991     UserOptionalStyle: string;
992     SkinHeader: string;
993     SkinNewRes: string;
994     SkinRes: string;
995     strTmp : string;
996     function ReplaceRes( skin: string ): string;
997     begin
998     Result := SkinedRes( skin, Res, No );
999     end;
1000     begin
1001     if ThreadItem <> nil then begin
1002     // ?X?L???g?p
1003     if GikoSys.Setting.UseSkin then begin
1004     NewReceiveNo := ThreadItem.NewReceive;
1005     // ?t?H???g?但?T?C?Y??????
1006     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1007     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1008 h677 1.4.2.1 //doc.open;
1009     html.BeginUpdate;
1010 h677 1.1 try
1011 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1012 h677 1.1
1013     // ?X?L????????
1014     try
1015     SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
1016     if Length( UserOptionalStyle ) > 0 then
1017     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1018     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1019 h677 1.4.2.1 //doc.Write( SkinHeader + #13#10);
1020     html.Append( SkinHeader);
1021 h677 1.1 except
1022     end;
1023    
1024     try
1025     SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
1026     except
1027     end;
1028    
1029     try
1030     SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
1031     except
1032     end;
1033    
1034 h677 1.4.2.1 //doc.Write('<p id="idSearch"></p>' + #13#10);
1035     html.Append('<p id="idSearch"></p>');
1036     //doc.Write('<a name="top"></a>' + #13#10);
1037     html.Append('<a name="top"></a>');
1038 h677 1.1
1039     for i := 0 to ReadList.Count - 1 do begin
1040     // 1 ???K?存?\??
1041     if i <> 0 then begin
1042     // ?\????????????
1043     case GikoSys.ResRange of
1044     Ord( grrKoko ):
1045     if ThreadItem.Kokomade > (i + 1) then
1046     Continue;
1047     Ord( grrNew ):
1048     if NewReceiveNo > (i + 1) then
1049     Continue;
1050     10..65535:
1051     if (threadItem.Count - i) > GikoSys.ResRange then
1052     Continue;
1053     end;
1054     end;
1055    
1056     // ?V???}?[?N
1057     if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1058     try
1059     if FileExists( GikoSys.GetSkinNewmarkFileName ) then
1060 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10)
1061     html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
1062 h677 1.1 else
1063 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
1064     html.Append( '<a name="new"></a>' );
1065 h677 1.1 except
1066 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
1067     html.Append( '<a name="new"></a>' );
1068 h677 1.1 end;
1069     end;
1070    
1071     if (Trim(ReadList[i]) <> '') then begin
1072     No := IntToStr(i + 1);
1073    
1074 h677 1.3 Res := DivideStrLine(ReadList[i]);
1075 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1076     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1077    
1078     try
1079     if NewReceiveNo <= (i + 1) then
1080     // ?V?????X
1081     strTmp := ReplaceRes( SkinNewRes )
1082     else
1083     // ???鱈?????X
1084     strTmp := ReplaceRes( SkinRes );
1085    
1086 h677 1.4.2.1 //doc.Write( strTmp + #13#10 );
1087     html.Append( strTmp );
1088 h677 1.1 except
1089     end;
1090     end;
1091    
1092     if ThreadItem.Kokomade = (i + 1) then begin
1093     // ???????長?????転
1094     try
1095     if FileExists( GikoSys.GetSkinBookmarkFileName ) then
1096 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
1097     html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
1098 h677 1.1 else
1099 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
1100     html.Append( '<a name="koko"></a>' );
1101 h677 1.1 except
1102 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
1103     html.Append( '<a name="koko"></a>' );
1104 h677 1.1 end;
1105     end;
1106     end;
1107    
1108 h677 1.4.2.1 //doc.Write('<a name="bottom"></a>' + #13#10);
1109     html.Append('<a name="bottom"></a>' );
1110 h677 1.1 // ?X?L??(?t?b?^)
1111     try
1112 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );
1113     html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
1114 h677 1.1 except
1115     end;
1116     finally
1117 h677 1.4.2.1 //doc.close;
1118     html.EndUpdate;
1119 h677 1.1 end;
1120     end;
1121     end;
1122     end;
1123    
1124 h677 1.4.2.1 procedure THTMLCreate.CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1125 h677 1.1 var
1126     i: integer;
1127     No: string;
1128     CSSFileName: string;
1129     NewReceiveNo: Integer;
1130     Res: TResRec;
1131     UserOptionalStyle: string;
1132     begin
1133     if ThreadItem <> nil then begin
1134 h677 1.4.2.1 //doc.open;
1135     html.BeginUpdate;
1136 h677 1.1 try
1137 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1138 h677 1.1 NewReceiveNo := ThreadItem.NewReceive;
1139     // ?t?H???g?但?T?C?Y??????
1140     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1141     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1142     if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1143     //CSS?g?p
1144 h677 1.4.2.1 html.Append('<html><head>');
1145     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1146     html.Append('<title>' + sTitle + '</title>');
1147     html.Append('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1148 h677 1.1 if Length( UserOptionalStyle ) > 0 then
1149 h677 1.4.2.1 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1150     html.Append('</head>');
1151     html.Append('<body>');
1152     html.Append('<a name="top"></a>');
1153     html.Append('<p id="idSearch"></p>');
1154     html.Append('<div class="title">' + sTitle + '</div>');
1155 h677 1.1 for i := 0 to ReadList.Count - 1 do begin
1156     // 1 ???K?存?\??
1157     if i <> 0 then begin
1158     // ?\????????????
1159     case GikoSys.ResRange of
1160     Ord( grrKoko ):
1161     if ThreadItem.Kokomade > (i + 1) then
1162     Continue;
1163     Ord( grrNew ):
1164     if NewReceiveNo > (i + 1) then
1165     Continue;
1166     10..65535:
1167     if (threadItem.Count - i) > GikoSys.ResRange then
1168     Continue;
1169     end;
1170     end;
1171    
1172     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1173 h677 1.4.2.1 html.Append('<a name="new"></a><div class="new">?V?????X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1174 h677 1.1 end;
1175    
1176     if (Trim(ReadList[i]) <> '') then begin
1177     No := IntToStr(i + 1);
1178 h677 1.3 Res := DivideStrLine(ReadList[i]);
1179 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1180     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1181     if Res.FMailTo = '' then
1182 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1183 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1184     + '<span class="name_label">?添?O?F</span> '
1185     + '<span class="name"><b>' + Res.FName + '</b></span> '
1186     + '<span class="date_label">???e?炭?F</span> '
1187     + '<span class="date">' + Res.FDateTime+ '</span></div>'
1188 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>')
1189 h677 1.1 else if GikoSys.Setting.ShowMail then
1190 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1191 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1192     + '<span class="name_label"> ?添?O?F </span>'
1193     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1194     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1195     + '<span class="date_label"> ???e?炭?F</span>'
1196     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1197 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>')
1198 h677 1.1 else
1199 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1200 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1201     + '<span class="name_label"> ?添?O?F </span>'
1202     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1203     + '<b>' + Res.FName + '</b></a>'
1204     + '<span class="date_label"> ???e?炭?F</span>'
1205     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1206 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>');
1207 h677 1.1 end;
1208    
1209     if ThreadItem.Kokomade = (i + 1) then begin
1210 h677 1.4.2.1 html.Append('<a name="koko"></a><div class="koko">?R?R???長?????転</div>');
1211 h677 1.1 end;
1212    
1213     end;
1214    
1215 h677 1.4.2.1 html.Append('<a name="bottom"></a>');
1216     html.Append('<a name="last"></a>');
1217     html.Append('</body></html>');
1218 h677 1.1 end;
1219     finally
1220 h677 1.4.2.1 html.EndUpdate;
1221     //doc.Close;
1222 h677 1.1 end;
1223     end;
1224     end;
1225    
1226 h677 1.4.2.1 procedure THTMLCreate.CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1227 h677 1.1 var
1228     i: integer;
1229     No: string;
1230     NewReceiveNo: Integer;
1231     Res: TResRec;
1232     begin
1233     if ThreadItem <> nil then begin
1234 h677 1.4.2.1 //doc.open;
1235     html.BeginUpdate;
1236 h677 1.1 try
1237 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1238 h677 1.1 NewReceiveNo := ThreadItem.NewReceive;
1239 h677 1.4.2.1 html.Append('<html><head>');
1240     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1241     html.Append('<title>' + sTitle + '</title></head>');
1242     html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1243     html.Append('<a name="top"></a>');
1244     html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1245     html.Append('<dl>');
1246     html.Append('<p id="idSearch"></p>');
1247 h677 1.1 for i := 0 to ReadList.Count - 1 do begin
1248     // 1 ???K?存?\??
1249     if i <> 0 then begin
1250     // ?\????????????
1251     case GikoSys.ResRange of
1252     Ord( grrKoko ):
1253     if ThreadItem.Kokomade > (i + 1) then
1254     Continue;
1255     Ord( grrNew ):
1256     if NewReceiveNo > (i + 1) then
1257     Continue;
1258     10..65535:
1259     if (threadItem.Count - i) > GikoSys.ResRange then
1260     Continue;
1261     end;
1262     end;
1263    
1264     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1265 h677 1.4.2.1 html.Append('</dl>');
1266     html.Append('<a name="new"></a>');
1267     html.Append('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>?V?????X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1268     html.Append('<dl>');
1269 h677 1.1 end;
1270    
1271     if (Trim(ReadList[i]) <> '') then begin
1272     No := IntToStr(i + 1);
1273 h677 1.3 Res := DivideStrLine(ReadList[i]);
1274 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1275     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1276     if Res.FMailTo = '' then
1277 h677 1.4.2.1 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1278 h677 1.1 else if GikoSys.Setting.ShowMail then
1279 h677 1.4.2.1 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1280 h677 1.1 else
1281 h677 1.4.2.1 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> ???e?炭?F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
1282 h677 1.1 end;
1283     if ThreadItem.Kokomade = (i + 1) then begin
1284 h677 1.4.2.1 html.Append('</dl>');
1285     html.Append('<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>?R?R???長?????転</b></font></td></tr></table>');
1286     html.Append('<dl>');
1287 h677 1.1 end;
1288     end;
1289 h677 1.4.2.1 html.Append('</dl>');
1290     html.Append('<a name="bottom"></a>');
1291     html.Append('</body></html>');
1292 h677 1.1 finally
1293 h677 1.4.2.1 //doc.Close;
1294     html.EndUpdate;
1295 h677 1.1 end;
1296     end;
1297     end;
1298    
1299 h677 1.4.2.1 procedure THTMLCreate.CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
1300 h677 1.1 var
1301     ReadList: TStringList;
1302     CSSFileName: string;
1303     FileName: string;
1304     Res: TResRec;
1305 h677 1.4.2.1 html: TStringList;
1306     mStream : TMemoryStream;
1307 h677 1.4 {$IFDEF DEBUG}
1308     st, rt: Cardinal;
1309     {$ENDIF}
1310 h677 1.1 begin
1311 h677 1.4 {$IFDEF DEBUG}
1312     Writeln('Create HTML');
1313     st := GetTickCount;
1314     {$ENDIF}
1315 h677 1.1 if ThreadItem <> nil then begin
1316 h677 1.4.2.1 html := TStringList.Create;
1317     try
1318     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1319     CreateUsePluginHTML(html, ThreadItem, sTitle);
1320     end else begin
1321     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
1322     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
1323     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
1324     ShortDayNames[7] := '?y';
1325 h677 1.1
1326 h677 1.4.2.1 ReadList := TStringList.Create;
1327     try
1328     if ThreadItem.IsLogFile then begin
1329     FileName := ThreadItem.GetThreadFileName;
1330     ReadList.LoadFromFile(FileName);
1331     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1332     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
1333     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
1334     if ThreadItem.Title = '' then begin
1335     Res := DivideStrLine(ReadList[0]);
1336     sTitle := Res.FTitle;
1337     end else
1338     sTitle := ThreadItem.Title
1339     end else begin
1340     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
1341     end;
1342 h677 1.1
1343 h677 1.4.2.1 // ?t?H???g?但?T?C?Y??????
1344     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1345     if GikoSys.Setting.UseSkin then begin
1346     CreateUseSKINHTML(html, ThreadItem, ReadList);
1347     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1348     CreateUseCSSHTML(html, ThreadItem, ReadList, sTitle);
1349     end else begin
1350     CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
1351     end;
1352     finally
1353     ReadList.Free;
1354 h677 1.1 end;
1355 h677 1.4.2.1 end;
1356     //WebBrowser?????鼎????
1357     mStream := TMemoryStream.Create;
1358     try
1359     html.SaveToStream(mStream);
1360     mStream.Seek(soFromBeginning, 0);
1361     (doc as IPersistStreamInit).Load(TStreamAdapter.Create(mStream));
1362 h677 1.1 finally
1363 h677 1.4.2.1 mStream.Free;
1364 h677 1.1 end;
1365 h677 1.4.2.1 finally
1366     html.Free;
1367 h677 1.1 end;
1368     end;
1369 h677 1.4 {$IFDEF DEBUG}
1370     rt := GetTickCount - st;
1371     Writeln('Done.');
1372     Writeln(IntToStr(rt) + ' ms');
1373     {$ENDIF}
1374 h677 1.1 end;
1375    
1376 h677 1.2 procedure THTMLCreate.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1377     var
1378     i: integer;
1379     No: string;
1380     //bufList : TStringList;
1381     ReadList: TStringList;
1382     // SaveList: TStringList;
1383     CSSFileName: string;
1384     BBSID: string;
1385     FileName: string;
1386     Res: TResRec;
1387     boardPlugIn : TBoardPlugIn;
1388    
1389     UserOptionalStyle: string;
1390     SkinHeader: string;
1391     SkinRes: string;
1392     tmp, tmp1: string;
1393     function LoadSkin( fileName: string ): string;
1394     begin
1395     Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1396     end;
1397     function ReplaceRes( skin: string ): string;
1398     begin
1399     Result := SkinedRes( skin, Res, No );
1400     end;
1401    
1402     begin
1403     if ThreadItem <> nil then begin
1404     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1405     html.Clear;
1406     html.BeginUpdate;
1407     //if ThreadItem.IsBoardPlugInAvailable then begin
1408     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1409     //===== ?v???O?C???????辿?\??
1410     //boardPlugIn := ThreadItem.BoardPlugIn;
1411     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1412     // ?t?H???g?但?T?C?Y??????
1413     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1414     try
1415     // ?????R?[?h???v???O?C?????C?邸?辿
1416     // ?w?b?_
1417     tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1418     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1419     //?但???Q?????巽?????Q????
1420     if GikoSys.Setting.UseSkin then begin
1421     tmp1 := './' + GikoSys.Setting.CSSFileName;
1422     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1423     tmp1 := CustomStringReplace(tmp1, '\', '/');
1424     tmp := CustomStringReplace(tmp, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1425     end else if GikoSys.Setting.UseCSS then begin
1426     tmp1 := './' + CSSFileName;
1427     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1428     tmp1 := CustomStringReplace(tmp1, '\', '/');
1429     tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1430     end;
1431     html.Append( tmp );
1432    
1433     for i := 0 to threadItem.Count - 1 do begin
1434    
1435     // ???X
1436     html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1437    
1438     end;
1439     // ?X?L??(?t?b?^)
1440     html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1441     finally
1442     end;
1443     html.EndUpdate;
1444     //Exit;
1445     end else begin
1446     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
1447     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
1448     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
1449     ShortDayNames[7] := '?y';
1450     BBSID := ThreadItem.ParentBoard.BBSID;
1451     ReadList := TStringList.Create;
1452     try
1453     if ThreadItem.IsLogFile then begin
1454     FileName := ThreadItem.GetThreadFileName;
1455     ReadList.LoadFromFile(FileName);
1456     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1457     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
1458     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
1459 h677 1.3 Res := DivideStrLine(ReadList[0]);
1460 h677 1.2 //Res.FTitle := CustomStringReplace(Res.FTitle, '???M', ',');
1461     sTitle := Res.FTitle;
1462     end else begin
1463     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
1464     end;
1465     try
1466     // ?t?H???g?但?T?C?Y??????
1467     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1468    
1469     if GikoSys.Setting.UseSkin then begin
1470     // ?X?L???g?p
1471     // ?X?L????????
1472     try
1473     SkinHeader := LoadSkin( GikoSys.GetSkinHeaderFileName );
1474     if Length( UserOptionalStyle ) > 0 then
1475     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1476     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1477     //?但???Q?????巽?????Q????
1478     tmp1 := './' + GikoSys.Setting.CSSFileName;
1479     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1480     tmp1 := CustomStringReplace(tmp1, '\', '/');
1481     SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1482     html.Append( SkinHeader );
1483     except
1484     end;
1485     try
1486     SkinRes := LoadSkin( GikoSys.GetSkinResFileName );
1487     except
1488     end;
1489     html.Append('<a name="top"></a>');
1490     for i := 0 to ReadList.Count - 1 do begin
1491     if (Trim(ReadList[i]) <> '') then begin
1492     No := IntToStr(i + 1);
1493    
1494 h677 1.3 Res := DivideStrLine(ReadList[i]);
1495 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1496     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1497    
1498     try
1499     html.Append( ReplaceRes( SkinRes ) );
1500     except
1501     end;
1502     end;
1503    
1504     end;
1505     html.Append('<a name="bottom"></a>');
1506     // ?X?L??(?t?b?^)
1507     try
1508     html.Append( LoadSkin( GikoSys.GetSkinFooterFileName ) );
1509     except
1510     end;
1511     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1512     //CSS?g?p
1513     //CSSFileName := GetAppDir + CSS_FILE_NAME;
1514     html.Append('<html><head>');
1515     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1516     html.Append('<title>' + sTitle + '</title>');
1517     //?但???Q?????巽?????Q????
1518     tmp1 := './' + CSSFileName;
1519     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1520     tmp1 := CustomStringReplace(tmp1, '\', '/');
1521    
1522     html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1523     if Length( UserOptionalStyle ) > 0 then
1524     html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1525     html.Append('</head>');
1526     html.Append('<body>');
1527     html.Append('<a name="top"></a>');
1528     html.Append('<div class="title">' + sTitle + '</div>');
1529     for i := 0 to ReadList.Count - 1 do begin
1530     if (Trim(ReadList[i]) <> '') then begin
1531     No := IntToStr(i + 1);
1532 h677 1.3 Res := DivideStrLine(ReadList[i]);
1533 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1534     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1535     if Res.FMailTo = '' then
1536     html.Append('<a name="' + No + '"></a>'
1537     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1538     + '<span class="name_label">?添?O?F</span> '
1539     + '<span class="name"><b>' + Res.FName + '</b></span> '
1540     + '<span class="date_label">???e?炭?F</span> '
1541     + '<span class="date">' + Res.FDateTime+ '</span></div>'
1542     + '<div class="mes">' + Res.FBody + ' </div>')
1543     else if GikoSys.Setting.ShowMail then
1544     html.Append('<a name="' + No + '"></a>'
1545     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1546     + '<span class="name_label"> ?添?O?F </span>'
1547     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1548     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1549     + '<span class="date_label"> ???e?炭?F</span>'
1550     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1551     + '<div class="mes">' + Res.FBody + ' </div>')
1552     else
1553     html.Append('<a name="' + No + '"></a>'
1554     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1555     + '<span class="name_label"> ?添?O?F </span>'
1556     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1557     + '<b>' + Res.FName + '</b></a>'
1558     + '<span class="date_label"> ???e?炭?F</span>'
1559     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1560     + '<div class="mes">' + Res.FBody + ' </div>');
1561     end;
1562     end;
1563     html.Append('<a name="bottom"></a>');
1564     html.Append('<a name="last"></a>');
1565     html.Append('</body></html>');
1566     end else begin
1567     //CSS???g?p
1568     html.Append('<html><head>');
1569     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1570     html.Append('<title>' + sTitle + '</title></head>');
1571     html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1572     html.Append('<a name="top"></a>');
1573     html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1574     html.Append('<dl>');
1575     for i := 0 to ReadList.Count - 1 do begin
1576     if (Trim(ReadList[i]) <> '') then begin
1577     No := IntToStr(i + 1);
1578 h677 1.3 Res := DivideStrLine(ReadList[i]);
1579 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1580     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1581     if Res.FMailTo = '' then
1582     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1583     else if GikoSys.Setting.ShowMail then
1584     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1585     else
1586     html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> ?添?O?F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> ???e?炭?F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1587     end;
1588     end;
1589     html.Append('</dl>');
1590     html.Append('<a name="bottom"></a>');
1591     html.Append('</body></html>');
1592     end;
1593     finally
1594     html.EndUpdate;
1595     end;
1596     finally
1597     ReadList.Free;
1598     end;
1599     end;
1600     end;
1601     end;
1602    
1603 h677 1.1 initialization
1604     HTMLCreater := THTMLCreate.Create;
1605    
1606     finalization
1607     if HTMLCreater <> nil then begin
1608     HTMLCreater.Free;
1609     HTMLCreater := nil;
1610     end;
1611    
1612     end.

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26