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.5 - (hide annotations) (download) (as text)
Tue Nov 1 16:28:00 2005 UTC (18 years, 5 months ago) by h677
Branch: Bdraw
Changes since 1.4.2.4: +145 -9 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     No: string;
336     oc : string;
337     st, et: string;
338     pos, pmin : integer;
339     j : integer;
340     token : array[0..5] of string;
341     ch : string;
342     db : boolean;
343    
344     begin
345     //s ???{?????S???端???辿
346     s := Body;
347     //???????N???A
348     Result := '';
349     //???????徹?????????S
350     token[0] := GT + GT;
351     token[1] := GT;
352     token[2] := '????';
353     token[3] := '??';
354     token[4] := '<a ';
355     token[5] := '<A ';
356    
357     //
358     while Length(s) > 0 do begin
359     pmin := Length(s) + 1;
360     i := length(token);
361     for j := 0 to length(token) - 1 do begin
362     pos := AnsiPos(token[j], s);
363     if pos <> 0 then begin
364     if pos < pmin then begin
365     //?????長?q?b?g?直?????徹??
366     i := j;
367     //?長?店?l???X?V
368     pmin := pos;
369     end;
370     end;
371     end;
372    
373     //?q?b?g?直?????????????????O???長???????R?s?[
374     Result := Result + Copy(s, 1, pmin - 1);
375     Delete(s, 1, pmin - 1);
376    
377     if i = length(token) then begin
378     //?q?b?g???直
379     end else if (i = 4) or (i = 5) then begin
380     //'<a ' or '<A' ?長?q?b?g '</a>' or '</A>' ???長?R?s?[
381     pmin := AnsiPos('</a>' , s);
382     pos := AnsiPos('</A>' , s);
383     if (pmin <> 0) and (pos <> 0) then begin
384     if (pmin > pos) then begin
385     pmin := pos;
386     end;
387     end else if (pos <> 0) then begin
388     pmin := pos;
389     end;
390     Result := Result + Copy(s, 1, pmin + 3);
391     Delete(s, 1, pmin + 3);
392     end else begin
393     //?????直?巽???????????p?^?[??
394     j := Length(token[i]) + 1;
395     oc := '';
396     No := '';
397     sw := false;
398     db := false;
399     while j <= Length(s) do begin
400     if (ByteType(s, j) = mbSingleByte) then begin
401     //1byte????
402     ch := s[j];
403     Inc(j);
404     db := false;
405     end else begin
406     //2byte????
407     ch := ZenToHan(Copy(s, j, 2));
408     Inc(j, 2);
409     db := true;
410     end;
411    
412     if AnsiPos(ch, SN) > 0 then begin
413     No := No + ch;
414     end else if (ch = '-') then begin
415     if sw then break;
416     if No = '' then break;
417     sw := true;
418     end else begin
419     break;
420     end;
421     end;
422     //?I?[???長?s???????I?邸???`?F?b?N
423     if j <= Length(s) then begin
424     if db then j := j - 2
425     else j := j - 1;
426     end;
427     //?????????????????巽???????鼎
428     if No = '' then begin
429     Result := Result + Copy(s, 1, j - 1);
430     end else begin
431     separateNumber(st, et, No, '-');
432    
433     if not DatToHTML then begin
434     Result := Format(FORMAT_LINK,
435     [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue])
436     + Copy(s, 1, j - 1) + '</a>';
437     end else begin
438     Result := Format('<a href="#%s">', [st])
439     + Copy(s, 1, j - 1) + '</a>';
440     end;
441     end;
442     Delete(s, 1, j - 1);
443     end;
444     end;
445     end;
446     {
447     function THTMLCreate.ConvRes(const Body, Bbs, Key,
448     ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
449     DatToHTML: boolean = false): string;
450 h677 1.1 type
451     PIndex = ^TIndex;
452     TIndex = record
453     FIndexFrom : integer;
454     FIndexTo : integer;
455     FNo : string;
456     end;
457     const
458     GT = '&gt;';
459     SN = '0123456789-';
460     ZN = '?O?P?Q?R?S?T?U?V?W?X?|';
461 h677 1.4.2.3 FORMAT_LINK = '<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">';
462 h677 1.1 var
463     i : integer;
464 h677 1.4.2.5 s : string;
465 h677 1.1 b : TMbcsByteType;
466     sw: boolean;
467     sp: integer;
468     No: string;
469     sx: string;
470     List: TList;
471     oc : string;
472     st, et: string;
473     chk : boolean;
474     al : boolean;
475     procedure Add(IndexFrom, IndexTo: integer; const No: string);
476     var
477     FIndex : PIndex;
478     begin
479     New(FIndex);
480     FIndex.FIndexFrom := IndexFrom;
481     FIndex.FIndexTo := IndexTo;
482     FIndex.FNo := No;
483     List.Add(FIndex);
484     end;
485 h677 1.4.2.3 procedure separateNumber(var st: String; var et: String; const Text, Separator: String);
486 h677 1.1 var
487 h677 1.4.2.3 p : Integer;
488 h677 1.1 begin
489 h677 1.4.2.3 p := Pos(Separator, Text);
490     if (p > 0 ) then begin
491     st := Copy(Text, 1, p - 1);
492     et := Copy(Text, p + Length(Separator), Length(Text));
493     end else begin
494     st := Text;
495     et := Text;
496 h677 1.1 end;
497     end;
498     begin
499     s := Body;
500 h677 1.4.2.4 Result := Body;
501 h677 1.1 i := 1;
502     sw := False;
503     No := '';
504     List:= TList.Create;
505     oc := '';
506     sp := 0;
507     chk := False;
508     al := False;
509     while true do begin
510     b := ByteType(s, i);
511     case b of
512     mbSingleByte : begin
513     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
514 h677 1.4.2.3 if (Pos('<A HREF', oc) = 0) then begin
515 h677 1.1 sw := True;
516     sp := i;
517     i := i + 7;
518     oc:='';
519     chk := True;
520     end;
521     end else
522     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
523 h677 1.4.2.3 if (Pos('<A HREF', oc) = 1) then begin
524 h677 1.1 i := i + 7;
525     oc:='';
526     chk := True;
527     end;
528     end else
529     if (not sw) and (Copy(s,i,4) = GT) then begin
530 h677 1.4.2.3 if (Pos('<A HREF', oc) = 0) then begin
531 h677 1.1 sw := True;
532     sp := i;
533     i := i + 3;
534     oc:='';
535     chk := True;
536     end;
537     end else
538     if ((not sw) and (Copy(s,i,1) = ',')) or
539     ((not sw) and (Copy(s,i,1) = '=')) then begin
540 h677 1.4.2.3 if ((not Chk) and (oc = '</A>')) or
541 h677 1.1 ((Chk) and (oc = '')) or
542     ((not Chk) and (al)) then
543     begin
544     sw := True;
545     sp := i;
546     oc:='';
547     end;
548     end else
549     if (sw) then begin
550     sx := Copy(s,i,1);
551     if (AnsiPos(sx, SN) > 0) then begin
552     No := No + sx;
553     end else begin
554     if (No <> '') and (No <> '-') then begin
555     Add(sp, i, No);
556     al := True;
557     end;
558     sw := False;
559 h677 1.4.2.4 Dec(i);
560 h677 1.1 No := '';
561     oc:='';
562     end;
563     end else begin
564 h677 1.4.2.3 if Copy(s,i,1) = '<' then begin
565     oc := '<';
566     end else begin
567     oc := oc + AnsiUpperCase(Copy(s,i,1));
568     end;
569 h677 1.1 chk := False;
570     al := False;
571     end;
572     end;
573     mbLeadByte : begin
574     if (not sw) and (Copy(s,i,4) = '????') then begin
575     sw := True;
576     sp := i;
577     i := i + 3;
578     chk := True;
579     end else
580     if (not sw) and (Copy(s,i,2) = '??') then begin
581     sw := True;
582     sp := i;
583 h677 1.4.2.5 Inc(i);
584 h677 1.1 chk := True;
585     end else
586     if (sw) then begin
587     sx := Copy(s,i,2);
588     if (AnsiPos(sx, ZN) > 0) then begin
589     No := No + ZenToHan(sx);
590     end else begin
591     if (No <> '') and (No <> '-') and (No <> '?|') then begin
592     Add(sp, i, No);
593     end;
594     sw := False;
595 h677 1.4.2.5 Dec(i);
596 h677 1.1 No := '';
597     end;
598     end else begin
599     oc := '';
600     chk := False;
601     end;
602     al := False;
603     end;
604     end;
605     inc(i);
606     if (i > Length(Body)) then begin
607     if (sw) then begin
608     if (No <> '') then Add(sp, i, No);
609     end;
610     Break;
611     end;
612     end;
613     for i := List.Count - 1 downto 0 do begin
614 h677 1.4.2.3 separateNumber(st, et, PIndex(List[i]).FNo, '-');
615 h677 1.1 if not DatToHTML then
616 h677 1.4.2.5 Result := Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
617 h677 1.4.2.3 Format(FORMAT_LINK, [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
618 h677 1.4.2.4 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
619     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result))
620 h677 1.1 else
621 h677 1.4.2.5 Result := Copy(Result,1, PIndex(List[i]).FIndexFrom - 1) +
622 h677 1.1 Format('<a href="#%s">', [st]) +
623 h677 1.4.2.4 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
624     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
625 h677 1.1
626     Dispose(PIndex(List[i]));
627     end;
628     List.Free;
629     end;
630 h677 1.4.2.5 }
631 h677 1.1 function THTMLCreate.ConvRes(
632     const Body, Bbs, Key, ParamBBS, ParamKey,
633     ParamStart, ParamTo, ParamNoFirst,
634     ParamTrue, FullURL : string
635     ): string;
636     type
637     PIndex = ^TIndex;
638     TIndex = record
639     FIndexFrom : integer;
640     FIndexTo : integer;
641     FNo : string;
642     end;
643     const
644     GT = '&gt;';
645     SN = '0123456789-';
646     ZN = '?O?P?Q?R?S?T?U?V?W?X?|';
647     var
648     i : integer;
649 h677 1.4.2.2 s : string;
650 h677 1.1 b : TMbcsByteType;
651     sw: boolean;
652     sp: integer;
653     No: string;
654     sx: string;
655     List: TList;
656     oc : string;
657     st, et: string;
658     chk : boolean;
659     al : boolean;
660     procedure Add(IndexFrom, IndexTo: integer; const No: string);
661     var
662     FIndex : PIndex;
663     begin
664     New(FIndex);
665     FIndex.FIndexFrom := IndexFrom;
666     FIndex.FIndexTo := IndexTo;
667     FIndex.FNo := No;
668     List.Add(FIndex);
669     end;
670     function ChooseString(const Text, Separator: string; Index: integer): string;
671     var
672     S : string;
673     i, p : integer;
674     begin
675     S := Text;
676     for i := 0 to Index - 1 do begin
677     if (AnsiPos(Separator, S) = 0) then S := ''
678     else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
679     end;
680     p := AnsiPos(Separator, S);
681     if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
682     end;
683     begin
684     { v1.0 b2 - 03 }
685     s := Body;
686 h677 1.4.2.2 Result := Body;
687 h677 1.1 i := 1;
688     sw := False;
689     No := '';
690     List:= TList.Create;
691     oc := '';
692     sp := 0;
693     chk := False;
694     al := False;
695     while true do begin
696     b := ByteType(s, i);
697 h677 1.4.2.2 case b of
698 h677 1.1 mbSingleByte : begin
699     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
700 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
701 h677 1.1 sw := True;
702     sp := i;
703     i := i + 7;
704     oc:='';
705     chk := True;
706     end;
707     end else
708     if (not sw) and (Copy(s,i,8) = GT + GT) then begin
709 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
710 h677 1.1 i := i + 7;
711     oc:='';
712     chk := True;
713     end;
714     end else
715     if (not sw) and (Copy(s,i,4) = GT) then begin
716 h677 1.4.2.2 if (Pos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
717 h677 1.1 sw := True;
718     sp := i;
719     i := i + 3;
720     oc:='';
721     chk := True;
722     end;
723     end else
724     if ((not sw) and (Copy(s,i,1) = ',')) or
725     ((not sw) and (Copy(s,i,1) = '=')) then begin
726     if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
727     ((Chk) and (oc = '')) or
728     ((not Chk) and (al)) then
729     begin
730     sw := True;
731     sp := i;
732     //i := i + 1;
733     oc:='';
734     end;
735     end else
736     if (sw) then begin
737     sx := Copy(s,i,1);
738 h677 1.4.2.2 if (Pos(sx, SN) > 0) then begin
739 h677 1.1 No := No + sx;
740     end else begin
741     if (No <> '') and (No <> '-') then begin
742     Add(sp, i, No);
743     al := True;
744     end;
745     sw := False;
746     //
747     i := i - 1;
748     //
749     No := '';
750     oc:='';
751     //chk := False;
752     end;
753     end else begin
754     if Copy(s,i,1) = '<' then oc := '';
755     oc := oc + Copy(s,i,1);
756     chk := False;
757     al := False;
758     end;
759     end;
760     mbLeadByte : begin
761     if (not sw) and (Copy(s,i,4) = '????') then begin
762     sw := True;
763     sp := i;
764     i := i + 3;
765     chk := True;
766     end else
767     if (not sw) and (Copy(s,i,2) = '??') then begin
768     sw := True;
769     sp := i;
770     i := i + 1;
771     chk := True;
772     end else
773     if (sw) then begin
774     sx := Copy(s,i,2);
775     if (AnsiPos(sx, ZN) > 0) then begin
776     No := No + ZenToHan(sx);
777     end else begin
778     if (No <> '') and (No <> '-') and (No <> '?|') then begin
779     Add(sp, i, No);
780     end;
781     sw := False;
782     i := i - 1;
783     No := '';
784     end;
785     end else begin
786     oc := '';
787     chk := False;
788     end;
789     al := False;
790     end;
791     end;
792     inc(i);
793     if (i > Length(Body)) then begin
794     if (sw) then begin
795     if (No <> '') then Add(sp, i, No);
796     end;
797     Break;
798     end;
799     end;
800     for i := List.Count - 1 downto 0 do begin
801     if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
802     st := ChooseString(PIndex(List[i]).FNo, '-', 0);
803     et := ChooseString(PIndex(List[i]).FNo, '-', 1);
804     end else begin
805     st := PIndex(List[i]).FNo;
806     et := PIndex(List[i]).FNo;
807     end;
808 h677 1.4.2.2 Result := Copy(Result,0, PIndex(List[i]).FIndexFrom - 1) +
809 h677 1.1 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
810     [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
811 h677 1.4.2.2 Copy(Result,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
812     Copy(Result,PIndex(List[i]).FIndexTo,Length(Result));
813 h677 1.1 Dispose(PIndex(List[i]));
814     end;
815     List.Free;
816     end;
817    
818 h677 1.2 function THTMLCreate.ConvertResAnchor(res: string): string;
819     const
820     _HEAD : string = '<a href="../';
821     _TAIL : string = ' target="_blank">';
822     _ST: string = '&st=';
823     _TO: string = '&to=';
824     _STA: string = '&START=';
825     _END: string = '&END=';
826     var
827     i, j, k: Integer;
828     tmp: string;
829     begin
830     Result := '';
831     i := AnsiPos(_HEAD, res);
832     while i <> 0 do begin
833     Result := Result + Copy(res, 1, i -1);
834     Delete(res, 1, i - 1);
835     j := AnsiPos(_TAIL, res);
836     if j = 0 then begin
837     Result := Result + res;
838     Exit;
839     end;
840     tmp := Copy(res, 1, j - 1);
841     Delete(res, 1, j + 16);
842     if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
843     Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
844     Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
845     Result := Result + '<a href="#' + tmp + '">';
846     end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
847     Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
848     Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
849     Result := Result + '<a href="#' + tmp + '">';
850     end else begin
851     k := LastDelimiter('/', tmp);
852     Delete(tmp, 1, k);
853     if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
854     Delete(tmp, AnsiPos('-', tmp), Length(tmp))
855     else
856     Delete(tmp, AnsiPos('"', tmp), Length(tmp));
857    
858     Result := Result + '<a href="#' + tmp + '">';
859     end;
860     i := AnsiPos(_HEAD, res);
861     end;
862     Result := Result + res;
863    
864     end;
865    
866 h677 1.1 //Plugin?????p???辿Board???X???b?h??HTML?????店?直??doc?????鼎???鄭
867 h677 1.4.2.1 procedure THTMLCreate.CreateUsePluginHTML(html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
868 h677 1.1 var
869     i: integer;
870     NewReceiveNo: Integer;
871     boardPlugIn : TBoardPlugIn;
872     UserOptionalStyle: string;
873     begin
874     if ThreadItem <> nil then begin
875     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
876     //===== ?v???O?C???????辿?\??
877     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
878     NewReceiveNo := ThreadItem.NewReceive;
879     // ?t?H???g?但?T?C?Y??????
880     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
881 h677 1.4.2.1 html.BeginUpdate;
882 h677 1.1 try
883 h677 1.4.2.1 //doc.open;
884 h677 1.1 // ?w?b?_
885 h677 1.4.2.1 //doc.Write( boardPlugIn.GetHeader( DWORD( threadItem ),
886     html.Append( boardPlugIn.GetHeader( DWORD( threadItem ),
887     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ));
888     // '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) + #13#10 );
889     //doc.Write('<p id="idSearch"></p>' + #13#10 );
890     html.Add('<p id="idSearch"></p>');
891 h677 1.1 for i := 0 to threadItem.Count - 1 do begin
892     // 1 ???K?存?\??
893     if i <> 0 then begin
894     // ?\????????????
895     case GikoSys.ResRange of
896     Ord( grrKoko ):
897     if ThreadItem.Kokomade > (i + 1) then
898     Continue;
899     Ord( grrNew ):
900     if NewReceiveNo > (i + 1) then
901     Continue;
902     10..65535:
903     if (threadItem.Count - i) > GikoSys.ResRange then
904     Continue;
905     end;
906     end;
907    
908     // ?V???}?[?N
909     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
910     try
911     if GikoSys.Setting.UseSkin then begin
912     if FileExists( GikoSys.GetSkinNewmarkFileName ) then
913 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
914     html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ))
915 h677 1.1 else
916 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
917     html.Append( '<a name="new"></a>' );
918 h677 1.1 end else if GikoSys.Setting.UseCSS then begin
919 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);
920     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>');
921 h677 1.1 end else begin
922 h677 1.4.2.1 //doc.Write('</dl>');
923     html.Append('</dl>');
924     //doc.Write('<a name="new"></a>');
925     html.Append('<a name="new"></a>');
926     //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>');
927     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>');
928     //doc.Write('<dl> + #13#10');
929     html.Append('<dl>');
930 h677 1.1 end;
931     except
932 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10);
933     html.Append( '<a name="new"></a>');
934 h677 1.1 end;
935     end;
936    
937     // ???X
938 h677 1.4.2.1 //doc.Write( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) + #13#10 );
939     html.Append( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
940 h677 1.1
941     if ThreadItem.Kokomade = (i + 1) then begin
942     // ???????長?????転
943     try
944     if GikoSys.Setting.UseSkin then begin
945     if FileExists( GikoSys.GetSkinBookmarkFileName ) then
946 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
947     html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
948 h677 1.1 else
949 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
950     html.Append( '<a name="koko"></a>' );
951 h677 1.1 end else if GikoSys.Setting.UseCSS then begin
952 h677 1.4.2.1 //doc.Write('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' + #13#10 );
953     html.Append('<a name="koko"></a><div class="koko">?R?R???長?????転</div>' );
954 h677 1.1 end else begin
955 h677 1.4.2.1 //doc.Write('</dl>');
956     html.Append('</dl>');
957     //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>');
958     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>');
959     //doc.Write('<dl>' + #13#10 );
960     html.Append('<dl>' );
961 h677 1.1 end;
962     except
963 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
964     html.Append( '<a name="koko"></a>' );
965 h677 1.1 end;
966     end;
967     end;
968    
969    
970     // ?X?L??(?t?b?^)
971 h677 1.4.2.1 //doc.Write( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) + #13#10 );
972     html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
973 h677 1.1 finally
974 h677 1.4.2.1 //doc.Close;
975     html.EndUpdate;
976 h677 1.1 end;
977    
978     end;
979     end;
980     end;
981    
982    
983 h677 1.4.2.1 procedure THTMLCreate.CreateUseSKINHTML(html : TStringList; ThreadItem: TThreadItem; ReadList: TStringList);
984 h677 1.1 var
985     i: integer;
986     No: string;
987     CSSFileName: string;
988     NewReceiveNo: Integer;
989     Res: TResRec;
990     UserOptionalStyle: string;
991     SkinHeader: string;
992     SkinNewRes: string;
993     SkinRes: string;
994     strTmp : string;
995     function ReplaceRes( skin: string ): string;
996     begin
997     Result := SkinedRes( skin, Res, No );
998     end;
999     begin
1000     if ThreadItem <> nil then begin
1001     // ?X?L???g?p
1002     if GikoSys.Setting.UseSkin then begin
1003     NewReceiveNo := ThreadItem.NewReceive;
1004     // ?t?H???g?但?T?C?Y??????
1005     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1006     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1007 h677 1.4.2.1 //doc.open;
1008     html.BeginUpdate;
1009 h677 1.1 try
1010 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1011 h677 1.1
1012     // ?X?L????????
1013     try
1014     SkinHeader := LoadFromSkin( GikoSys.GetSkinHeaderFileName, ThreadItem, ThreadItem.Size);
1015     if Length( UserOptionalStyle ) > 0 then
1016     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1017     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1018 h677 1.4.2.1 //doc.Write( SkinHeader + #13#10);
1019     html.Append( SkinHeader);
1020 h677 1.1 except
1021     end;
1022    
1023     try
1024     SkinNewRes := LoadFromSkin( GikoSys.GetSkinNewResFileName, ThreadItem, ThreadItem.Size);
1025     except
1026     end;
1027    
1028     try
1029     SkinRes := LoadFromSkin( GikoSys.GetSkinResFileName, ThreadItem, ThreadItem.Size );
1030     except
1031     end;
1032    
1033 h677 1.4.2.1 //doc.Write('<p id="idSearch"></p>' + #13#10);
1034     html.Append('<p id="idSearch"></p>');
1035     //doc.Write('<a name="top"></a>' + #13#10);
1036     html.Append('<a name="top"></a>');
1037 h677 1.1
1038     for i := 0 to ReadList.Count - 1 do begin
1039     // 1 ???K?存?\??
1040     if i <> 0 then begin
1041     // ?\????????????
1042     case GikoSys.ResRange of
1043     Ord( grrKoko ):
1044     if ThreadItem.Kokomade > (i + 1) then
1045     Continue;
1046     Ord( grrNew ):
1047     if NewReceiveNo > (i + 1) then
1048     Continue;
1049     10..65535:
1050     if (threadItem.Count - i) > GikoSys.ResRange then
1051     Continue;
1052     end;
1053     end;
1054    
1055     // ?V???}?[?N
1056     if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1057     try
1058     if FileExists( GikoSys.GetSkinNewmarkFileName ) then
1059 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10)
1060     html.Append( LoadFromSkin( GikoSys.GetSkinNewmarkFileName, ThreadItem, ThreadItem.Size ) )
1061 h677 1.1 else
1062 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
1063     html.Append( '<a name="new"></a>' );
1064 h677 1.1 except
1065 h677 1.4.2.1 //doc.Write( '<a name="new"></a>' + #13#10 );
1066     html.Append( '<a name="new"></a>' );
1067 h677 1.1 end;
1068     end;
1069    
1070     if (Trim(ReadList[i]) <> '') then begin
1071     No := IntToStr(i + 1);
1072    
1073 h677 1.3 Res := DivideStrLine(ReadList[i]);
1074 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1075     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1076    
1077     try
1078     if NewReceiveNo <= (i + 1) then
1079     // ?V?????X
1080     strTmp := ReplaceRes( SkinNewRes )
1081     else
1082     // ???鱈?????X
1083     strTmp := ReplaceRes( SkinRes );
1084    
1085 h677 1.4.2.1 //doc.Write( strTmp + #13#10 );
1086     html.Append( strTmp );
1087 h677 1.1 except
1088     end;
1089     end;
1090    
1091     if ThreadItem.Kokomade = (i + 1) then begin
1092     // ???????長?????転
1093     try
1094     if FileExists( GikoSys.GetSkinBookmarkFileName ) then
1095 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) + #13#10 )
1096     html.Append( LoadFromSkin( GikoSys.GetSkinBookmarkFileName, ThreadItem, ThreadItem.Size ) )
1097 h677 1.1 else
1098 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
1099     html.Append( '<a name="koko"></a>' );
1100 h677 1.1 except
1101 h677 1.4.2.1 //doc.Write( '<a name="koko"></a>' + #13#10 );
1102     html.Append( '<a name="koko"></a>' );
1103 h677 1.1 end;
1104     end;
1105     end;
1106    
1107 h677 1.4.2.1 //doc.Write('<a name="bottom"></a>' + #13#10);
1108     html.Append('<a name="bottom"></a>' );
1109 h677 1.1 // ?X?L??(?t?b?^)
1110     try
1111 h677 1.4.2.1 //doc.Write( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) + #13#10 );
1112     html.Append( LoadFromSkin( GikoSys.GetSkinFooterFileName, ThreadItem, ThreadItem.Size ) );
1113 h677 1.1 except
1114     end;
1115     finally
1116 h677 1.4.2.1 //doc.close;
1117     html.EndUpdate;
1118 h677 1.1 end;
1119     end;
1120     end;
1121     end;
1122    
1123 h677 1.4.2.1 procedure THTMLCreate.CreateUseCSSHTML(html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1124 h677 1.1 var
1125     i: integer;
1126     No: string;
1127     CSSFileName: string;
1128     NewReceiveNo: Integer;
1129     Res: TResRec;
1130     UserOptionalStyle: string;
1131     begin
1132     if ThreadItem <> nil then begin
1133 h677 1.4.2.1 //doc.open;
1134     html.BeginUpdate;
1135 h677 1.1 try
1136 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1137 h677 1.1 NewReceiveNo := ThreadItem.NewReceive;
1138     // ?t?H???g?但?T?C?Y??????
1139     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1140     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1141     if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1142     //CSS?g?p
1143 h677 1.4.2.1 html.Append('<html><head>');
1144     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1145     html.Append('<title>' + sTitle + '</title>');
1146     html.Append('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1147 h677 1.1 if Length( UserOptionalStyle ) > 0 then
1148 h677 1.4.2.1 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1149     html.Append('</head>');
1150     html.Append('<body>');
1151     html.Append('<a name="top"></a>');
1152     html.Append('<p id="idSearch"></p>');
1153     html.Append('<div class="title">' + sTitle + '</div>');
1154 h677 1.1 for i := 0 to ReadList.Count - 1 do begin
1155     // 1 ???K?存?\??
1156     if i <> 0 then begin
1157     // ?\????????????
1158     case GikoSys.ResRange of
1159     Ord( grrKoko ):
1160     if ThreadItem.Kokomade > (i + 1) then
1161     Continue;
1162     Ord( grrNew ):
1163     if NewReceiveNo > (i + 1) then
1164     Continue;
1165     10..65535:
1166     if (threadItem.Count - i) > GikoSys.ResRange then
1167     Continue;
1168     end;
1169     end;
1170    
1171     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1172 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>');
1173 h677 1.1 end;
1174    
1175     if (Trim(ReadList[i]) <> '') then begin
1176     No := IntToStr(i + 1);
1177 h677 1.3 Res := DivideStrLine(ReadList[i]);
1178 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1179     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1180     if Res.FMailTo = '' then
1181 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1182 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1183     + '<span class="name_label">?添?O?F</span> '
1184     + '<span class="name"><b>' + Res.FName + '</b></span> '
1185     + '<span class="date_label">???e?炭?F</span> '
1186     + '<span class="date">' + Res.FDateTime+ '</span></div>'
1187 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>')
1188 h677 1.1 else if GikoSys.Setting.ShowMail then
1189 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1190 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1191     + '<span class="name_label"> ?添?O?F </span>'
1192     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1193     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1194     + '<span class="date_label"> ???e?炭?F</span>'
1195     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1196 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>')
1197 h677 1.1 else
1198 h677 1.4.2.1 html.Append('<a name="' + No + '"></a>'
1199 h677 1.1 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1200     + '<span class="name_label"> ?添?O?F </span>'
1201     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1202     + '<b>' + Res.FName + '</b></a>'
1203     + '<span class="date_label"> ???e?炭?F</span>'
1204     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1205 h677 1.4.2.1 + '<div class="mes">' + Res.FBody + ' </div>');
1206 h677 1.1 end;
1207    
1208     if ThreadItem.Kokomade = (i + 1) then begin
1209 h677 1.4.2.1 html.Append('<a name="koko"></a><div class="koko">?R?R???長?????転</div>');
1210 h677 1.1 end;
1211    
1212     end;
1213    
1214 h677 1.4.2.1 html.Append('<a name="bottom"></a>');
1215     html.Append('<a name="last"></a>');
1216     html.Append('</body></html>');
1217 h677 1.1 end;
1218     finally
1219 h677 1.4.2.1 html.EndUpdate;
1220     //doc.Close;
1221 h677 1.1 end;
1222     end;
1223     end;
1224    
1225 h677 1.4.2.1 procedure THTMLCreate.CreateDefaultHTML (html: TStringList; ThreadItem: TThreadItem; ReadList: TStringList; sTitle: string );
1226 h677 1.1 var
1227     i: integer;
1228     No: string;
1229     NewReceiveNo: Integer;
1230     Res: TResRec;
1231     begin
1232     if ThreadItem <> nil then begin
1233 h677 1.4.2.1 //doc.open;
1234     html.BeginUpdate;
1235 h677 1.1 try
1236 h677 1.4.2.1 //doc.charset := 'Shift_JIS';
1237 h677 1.1 NewReceiveNo := ThreadItem.NewReceive;
1238 h677 1.4.2.1 html.Append('<html><head>');
1239     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1240     html.Append('<title>' + sTitle + '</title></head>');
1241     html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1242     html.Append('<a name="top"></a>');
1243     html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1244     html.Append('<dl>');
1245     html.Append('<p id="idSearch"></p>');
1246 h677 1.1 for i := 0 to ReadList.Count - 1 do begin
1247     // 1 ???K?存?\??
1248     if i <> 0 then begin
1249     // ?\????????????
1250     case GikoSys.ResRange of
1251     Ord( grrKoko ):
1252     if ThreadItem.Kokomade > (i + 1) then
1253     Continue;
1254     Ord( grrNew ):
1255     if NewReceiveNo > (i + 1) then
1256     Continue;
1257     10..65535:
1258     if (threadItem.Count - i) > GikoSys.ResRange then
1259     Continue;
1260     end;
1261     end;
1262    
1263     if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1264 h677 1.4.2.1 html.Append('</dl>');
1265     html.Append('<a name="new"></a>');
1266     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>');
1267     html.Append('<dl>');
1268 h677 1.1 end;
1269    
1270     if (Trim(ReadList[i]) <> '') then begin
1271     No := IntToStr(i + 1);
1272 h677 1.3 Res := DivideStrLine(ReadList[i]);
1273 h677 1.1 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1274     Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1275     if Res.FMailTo = '' then
1276 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>')
1277 h677 1.1 else if GikoSys.Setting.ShowMail then
1278 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>')
1279 h677 1.1 else
1280 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>');
1281 h677 1.1 end;
1282     if ThreadItem.Kokomade = (i + 1) then begin
1283 h677 1.4.2.1 html.Append('</dl>');
1284     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>');
1285     html.Append('<dl>');
1286 h677 1.1 end;
1287     end;
1288 h677 1.4.2.1 html.Append('</dl>');
1289     html.Append('<a name="bottom"></a>');
1290     html.Append('</body></html>');
1291 h677 1.1 finally
1292 h677 1.4.2.1 //doc.Close;
1293     html.EndUpdate;
1294 h677 1.1 end;
1295     end;
1296     end;
1297    
1298 h677 1.4.2.1 procedure THTMLCreate.CreateHTML2(doc: IDispatch; ThreadItem: TThreadItem; var sTitle: string);
1299 h677 1.1 var
1300     ReadList: TStringList;
1301     CSSFileName: string;
1302     FileName: string;
1303     Res: TResRec;
1304 h677 1.4.2.1 html: TStringList;
1305     mStream : TMemoryStream;
1306 h677 1.4 {$IFDEF DEBUG}
1307     st, rt: Cardinal;
1308     {$ENDIF}
1309 h677 1.1 begin
1310 h677 1.4 {$IFDEF DEBUG}
1311     Writeln('Create HTML');
1312     st := GetTickCount;
1313     {$ENDIF}
1314 h677 1.1 if ThreadItem <> nil then begin
1315 h677 1.4.2.1 html := TStringList.Create;
1316     try
1317     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1318     CreateUsePluginHTML(html, ThreadItem, sTitle);
1319     end else begin
1320     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
1321     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
1322     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
1323     ShortDayNames[7] := '?y';
1324 h677 1.1
1325 h677 1.4.2.1 ReadList := TStringList.Create;
1326     try
1327     if ThreadItem.IsLogFile then begin
1328     FileName := ThreadItem.GetThreadFileName;
1329     ReadList.LoadFromFile(FileName);
1330     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1331     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
1332     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
1333     if ThreadItem.Title = '' then begin
1334     Res := DivideStrLine(ReadList[0]);
1335     sTitle := Res.FTitle;
1336     end else
1337     sTitle := ThreadItem.Title
1338     end else begin
1339     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
1340     end;
1341 h677 1.1
1342 h677 1.4.2.1 // ?t?H???g?但?T?C?Y??????
1343     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1344     if GikoSys.Setting.UseSkin then begin
1345     CreateUseSKINHTML(html, ThreadItem, ReadList);
1346     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1347     CreateUseCSSHTML(html, ThreadItem, ReadList, sTitle);
1348     end else begin
1349     CreateDefaultHTML(html, ThreadItem, ReadList, sTitle);
1350     end;
1351     finally
1352     ReadList.Free;
1353 h677 1.1 end;
1354 h677 1.4.2.1 end;
1355     //WebBrowser?????鼎????
1356     mStream := TMemoryStream.Create;
1357     try
1358     html.SaveToStream(mStream);
1359     mStream.Seek(soFromBeginning, 0);
1360     (doc as IPersistStreamInit).Load(TStreamAdapter.Create(mStream));
1361 h677 1.1 finally
1362 h677 1.4.2.1 mStream.Free;
1363 h677 1.1 end;
1364 h677 1.4.2.1 finally
1365     html.Free;
1366 h677 1.1 end;
1367     end;
1368 h677 1.4 {$IFDEF DEBUG}
1369     rt := GetTickCount - st;
1370     Writeln('Done.');
1371     Writeln(IntToStr(rt) + ' ms');
1372     {$ENDIF}
1373 h677 1.1 end;
1374    
1375 h677 1.2 procedure THTMLCreate.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1376     var
1377     i: integer;
1378     No: string;
1379     //bufList : TStringList;
1380     ReadList: TStringList;
1381     // SaveList: TStringList;
1382     CSSFileName: string;
1383     BBSID: string;
1384     FileName: string;
1385     Res: TResRec;
1386     boardPlugIn : TBoardPlugIn;
1387    
1388     UserOptionalStyle: string;
1389     SkinHeader: string;
1390     SkinRes: string;
1391     tmp, tmp1: string;
1392     function LoadSkin( fileName: string ): string;
1393     begin
1394     Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1395     end;
1396     function ReplaceRes( skin: string ): string;
1397     begin
1398     Result := SkinedRes( skin, Res, No );
1399     end;
1400    
1401     begin
1402     if ThreadItem <> nil then begin
1403     CSSFileName := GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName;
1404     html.Clear;
1405     html.BeginUpdate;
1406     //if ThreadItem.IsBoardPlugInAvailable then begin
1407     if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1408     //===== ?v???O?C???????辿?\??
1409     //boardPlugIn := ThreadItem.BoardPlugIn;
1410     boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1411     // ?t?H???g?但?T?C?Y??????
1412     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1413     try
1414     // ?????R?[?h???v???O?C?????C?邸?辿
1415     // ?w?b?_
1416     tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1417     '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1418     //?但???Q?????巽?????Q????
1419     if GikoSys.Setting.UseSkin then begin
1420     tmp1 := './' + GikoSys.Setting.CSSFileName;
1421     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1422     tmp1 := CustomStringReplace(tmp1, '\', '/');
1423     tmp := CustomStringReplace(tmp, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1424     end else if GikoSys.Setting.UseCSS then begin
1425     tmp1 := './' + CSSFileName;
1426     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1427     tmp1 := CustomStringReplace(tmp1, '\', '/');
1428     tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1429     end;
1430     html.Append( tmp );
1431    
1432     for i := 0 to threadItem.Count - 1 do begin
1433    
1434     // ???X
1435     html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1436    
1437     end;
1438     // ?X?L??(?t?b?^)
1439     html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1440     finally
1441     end;
1442     html.EndUpdate;
1443     //Exit;
1444     end else begin
1445     ShortDayNames[1] := '?炭'; ShortDayNames[2] := '??';
1446     ShortDayNames[3] := '??'; ShortDayNames[4] := '??';
1447     ShortDayNames[5] := '??'; ShortDayNames[6] := '??';
1448     ShortDayNames[7] := '?y';
1449     BBSID := ThreadItem.ParentBoard.BBSID;
1450     ReadList := TStringList.Create;
1451     try
1452     if ThreadItem.IsLogFile then begin
1453     FileName := ThreadItem.GetThreadFileName;
1454     ReadList.LoadFromFile(FileName);
1455     GikoSys.FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1456     GikoSys.FAbon.Execute(ReadList); // ?????`???直??
1457     GikoSys.FSelectResFilter.Execute(ReadList); //???X???t?B???^?????O?????辿
1458 h677 1.3 Res := DivideStrLine(ReadList[0]);
1459 h677 1.2 //Res.FTitle := CustomStringReplace(Res.FTitle, '???M', ',');
1460     sTitle := Res.FTitle;
1461     end else begin
1462     sTitle := CustomStringReplace(ThreadItem.Title, '???M', ',');
1463     end;
1464     try
1465     // ?t?H???g?但?T?C?Y??????
1466     UserOptionalStyle := GikoSys.SetUserOptionalStyle;
1467    
1468     if GikoSys.Setting.UseSkin then begin
1469     // ?X?L???g?p
1470     // ?X?L????????
1471     try
1472     SkinHeader := LoadSkin( GikoSys.GetSkinHeaderFileName );
1473     if Length( UserOptionalStyle ) > 0 then
1474     SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1475     '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1476     //?但???Q?????巽?????Q????
1477     tmp1 := './' + GikoSys.Setting.CSSFileName;
1478     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1479     tmp1 := CustomStringReplace(tmp1, '\', '/');
1480     SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(GikoSys.Setting.CSSFileName), tmp1);
1481     html.Append( SkinHeader );
1482     except
1483     end;
1484     try
1485     SkinRes := LoadSkin( GikoSys.GetSkinResFileName );
1486     except
1487     end;
1488     html.Append('<a name="top"></a>');
1489     for i := 0 to ReadList.Count - 1 do begin
1490     if (Trim(ReadList[i]) <> '') then begin
1491     No := IntToStr(i + 1);
1492    
1493 h677 1.3 Res := DivideStrLine(ReadList[i]);
1494 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1495     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1496    
1497     try
1498     html.Append( ReplaceRes( SkinRes ) );
1499     except
1500     end;
1501     end;
1502    
1503     end;
1504     html.Append('<a name="bottom"></a>');
1505     // ?X?L??(?t?b?^)
1506     try
1507     html.Append( LoadSkin( GikoSys.GetSkinFooterFileName ) );
1508     except
1509     end;
1510     end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1511     //CSS?g?p
1512     //CSSFileName := GetAppDir + CSS_FILE_NAME;
1513     html.Append('<html><head>');
1514     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1515     html.Append('<title>' + sTitle + '</title>');
1516     //?但???Q?????巽?????Q????
1517     tmp1 := './' + CSSFileName;
1518     tmp1 := CustomStringReplace(tmp1, GikoSys.GetConfigDir, '');
1519     tmp1 := CustomStringReplace(tmp1, '\', '/');
1520    
1521     html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1522     if Length( UserOptionalStyle ) > 0 then
1523     html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1524     html.Append('</head>');
1525     html.Append('<body>');
1526     html.Append('<a name="top"></a>');
1527     html.Append('<div class="title">' + sTitle + '</div>');
1528     for i := 0 to ReadList.Count - 1 do begin
1529     if (Trim(ReadList[i]) <> '') then begin
1530     No := IntToStr(i + 1);
1531 h677 1.3 Res := DivideStrLine(ReadList[i]);
1532 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1533     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1534     if Res.FMailTo = '' then
1535     html.Append('<a name="' + No + '"></a>'
1536     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1537     + '<span class="name_label">?添?O?F</span> '
1538     + '<span class="name"><b>' + Res.FName + '</b></span> '
1539     + '<span class="date_label">???e?炭?F</span> '
1540     + '<span class="date">' + Res.FDateTime+ '</span></div>'
1541     + '<div class="mes">' + Res.FBody + ' </div>')
1542     else if GikoSys.Setting.ShowMail then
1543     html.Append('<a name="' + No + '"></a>'
1544     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1545     + '<span class="name_label"> ?添?O?F </span>'
1546     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1547     + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1548     + '<span class="date_label"> ???e?炭?F</span>'
1549     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1550     + '<div class="mes">' + Res.FBody + ' </div>')
1551     else
1552     html.Append('<a name="' + No + '"></a>'
1553     + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1554     + '<span class="name_label"> ?添?O?F </span>'
1555     + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1556     + '<b>' + Res.FName + '</b></a>'
1557     + '<span class="date_label"> ???e?炭?F</span>'
1558     + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1559     + '<div class="mes">' + Res.FBody + ' </div>');
1560     end;
1561     end;
1562     html.Append('<a name="bottom"></a>');
1563     html.Append('<a name="last"></a>');
1564     html.Append('</body></html>');
1565     end else begin
1566     //CSS???g?p
1567     html.Append('<html><head>');
1568     html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1569     html.Append('<title>' + sTitle + '</title></head>');
1570     html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1571     html.Append('<a name="top"></a>');
1572     html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1573     html.Append('<dl>');
1574     for i := 0 to ReadList.Count - 1 do begin
1575     if (Trim(ReadList[i]) <> '') then begin
1576     No := IntToStr(i + 1);
1577 h677 1.3 Res := DivideStrLine(ReadList[i]);
1578 h677 1.2 Res.FBody := AddAnchorTag(Res.FBody);
1579     Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1580     if Res.FMailTo = '' then
1581     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>')
1582     else if GikoSys.Setting.ShowMail then
1583     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>')
1584     else
1585     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>');
1586     end;
1587     end;
1588     html.Append('</dl>');
1589     html.Append('<a name="bottom"></a>');
1590     html.Append('</body></html>');
1591     end;
1592     finally
1593     html.EndUpdate;
1594     end;
1595     finally
1596     ReadList.Free;
1597     end;
1598     end;
1599     end;
1600     end;
1601    
1602 h677 1.1 initialization
1603     HTMLCreater := THTMLCreate.Create;
1604    
1605     finalization
1606     if HTMLCreater <> nil then begin
1607     HTMLCreater.Free;
1608     HTMLCreater := nil;
1609     end;
1610    
1611     end.

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