Develop and Download Open Source Software

Browse CVS Repository

Contents of /gikonavigoeson/gikonavi/GikoSystem.pas

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


Revision 1.155 - (show annotations) (download) (as text)
Sun Aug 8 05:26:35 2004 UTC (19 years, 8 months ago) by q9_
Branch: MAIN
CVS Tags: b48, v1_48_0_530, v1_48_0_535, v1_48_0_539, v1_48_0_538, v1_48_0_533, v1_48_0_537, v1_48_0_536
Changes since 1.154: +10 -1 lines
File MIME type: text/x-pascal
Folder.idxハンツクチー、ヒ・ケ・?ヨケ讀ヌ・ス。シ・ネ

1 unit GikoSystem;
2
3 interface
4
5 uses
6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
8 {$IF Defined(DELPRO) }
9 SHDocVw,
10 MSHTML,
11 {$ELSE}
12 SHDocVw_TLB,
13 MSHTML_TLB,
14 {$IFEND}
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
18 Sort;
19
20 type
21 //BBS繧ソ繧、繝?/span>
22 TGikoBBSType = (gbt2ch);
23 //繝ュ繧ー繧ソ繧、繝?/span>
24 TGikoLogType = (glt2chNew, glt2chOld);
25 //繝。繝?そ繝シ繧ク繧「繧、繧ウ繝ウ
26 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
27 //URL繧ェ繝シ繝励Φ繝悶Λ繧ヲ繧カ繧ソ繧、繝?/span>
28 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
29
30
31 TStrTokSeparator = set of Char;
32 TStrTokRec = record
33 Str: string;
34 Pos: Integer;
35 end;
36
37 //繧、繝ウ繝?ャ繧ッ繧ケ繝輔ぃ繧、繝ォ繝ャ繧ウ繝シ繝?/span>
38 TIndexRec = record
39 FNo: Integer;
40 FFileName: string;
41 FTitle: string;
42 FCount: Integer;
43 FSize: Integer;
44 // FRoundNo: Integer;
45 FRoundDate: TDateTime;
46 FLastModified: TDateTime;
47 FKokomade: Integer;
48 FNewReceive: Integer;
49 FMishiyou: Boolean; //譛ェ菴ソ逕ィ
50 FUnRead: Boolean;
51 FScrollTop: Integer;
52 //Index Ver 1.01
53 FAllResCount: Integer;
54 FNewResCount: Integer;
55 FAgeSage: TGikoAgeSage;
56 end;
57
58 //繧オ繝悶ず繧ァ繧ッ繝医Ξ繧ウ繝シ繝?/span>
59 TSubjectRec = record
60 FFileName: string;
61 FTitle: string;
62 FCount: Integer;
63 end;
64
65 //繝ャ繧ケ繝ャ繧ウ繝シ繝?/span>
66 TResRec = record
67 FTitle: string;
68 FMailTo: string;
69 FName: string;
70 FDateTime: string;
71 FBody: string;
72 FType: TGikoLogType;
73 end;
74
75 //URLPath繝ャ繧ウ繝シ繝?/span>
76 TPathRec = record
77 FBBS: string; //BBSID
78 FKey: string; //ThreadID
79 FSt: Int64; //髢句ァ九Ξ繧ケ逡ェ
80 FTo: Int64; //邨ゆコ?Ξ繧ケ逡ェ
81 FFirst: Boolean; //>>1縺ョ陦ィ遉コ
82 FStBegin: Boolean; //1縲懆。ィ遉コ
83 FToEnd: Boolean; //縲懈怙蠕後∪縺ァ陦ィ遉コ
84 FDone: Boolean; //謌仙粥
85 FNoParam: Boolean; //繝ャ繧ケ逡ェ繝代Λ繝。繝シ繧ソ縺ェ縺?/span>
86 end;
87
88 TGikoSys = class(TObject)
89 private
90 { Private 螳」險? }
91 FSetting: TSetting;
92 FDolib: TDolib;
93 FAWKStr: TAWKStr;
94 FResRange : Longint;
95
96 // FExitWrite: TStringList;
97 // function StrToFloatDef(s: string; Default: Double): Double;
98 public
99 { Public 螳」險? }
100 FAbon : TAbon;
101 FSelectResFilter : TAbon;
102 constructor Create;
103
104 destructor Destroy; override;
105 property ResRange : Longint read FResRange write FResRange;
106 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
107 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
108 function IsNumeric(s: string): boolean;
109 function IsFloat(s: string): boolean;
110 function DirectoryExistsEx(const Name: string): Boolean;
111 function ForceDirectoriesEx(Dir: string): Boolean;
112 // function GetVersion: string;
113
114 function GetBoardFileName: string;
115 function GetCustomBoardFileName: string;
116 function GetHtmlTempFileName: string;
117 function GetAppDir: string;
118 function GetTempFolder: string;
119 function GetSentFileName: string;
120 function GetConfigDir: string;
121 function GetSkinDir: string;
122 function GetSkinHeaderFileName: string;
123 function GetSkinFooterFileName: string;
124 function GetSkinResFileName: string;
125 function GetSkinNewResFileName: string;
126 function GetSkinBookmarkFileName: string;
127 function GetSkinNewmarkFileName: string;
128 function GetStyleSheetDir: string;
129 function GetOutBoxFileName: string;
130 function GetUserAgent: string;
131 function GetSambaFileName : string;
132
133 procedure ReadSubjectFile(Board: TBoard);
134 procedure CreateThreadDat(Board: TBoard);
135 procedure WriteThreadDat(Board: TBoard);
136 function ParseIndexLine(Line: string): TIndexRec;
137 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
138 procedure GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean); overload;//繧オ繝悶ヵ繧ゥ繝ォ繝?縺ッ讀懃エ「縺励↑縺?/span>
139 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
140
141 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
142 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
143 function AddAnchorTag(s: string): string;
144
145 function DivideSubject(Line: string): TSubjectRec;
146 function DivideStrLine(Line: string): TResRec;
147
148 property Setting: TSetting read FSetting write FSetting;
149 property Dolib: TDolib read FDolib write FDolib;
150
151 function UrlToID(url: string): string;
152 function UrlToServer(url: string): string;
153
154 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
155 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
156
157 function GetFileSize(FileName : string) : longint;
158 function GetFileLineCount(FileName : string): longint;
159 function Get2chDate(aDate: TDateTime): string;
160 function IntToDateTime(val: Int64): TDateTime;
161 function DateTimeToInt(ADate: TDateTime): Int64;
162
163 function ReadThreadFile(FileName: string; Line: Integer): string;
164
165 procedure MenuFont(Font: TFont);
166
167 function RemoveToken(var s:string; const delimiter:string):string;
168 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
169 function DeleteLink(const s: string): string;
170
171 function GetShortName(const LongName: string; ALength: integer): string;
172 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
173 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
174 function ConvertResAnchor(res: string): string;
175 function BoolToInt(b: Boolean): Integer;
176 function IntToBool(i: Integer): Boolean;
177 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
178 procedure LoadKeySetting(ActionList: TActionList);
179 procedure SaveKeySetting(ActionList: TActionList);
180 procedure LoadEditorKeySetting(ActionList: TActionList);
181 procedure SaveEditorKeySetting(ActionList: TActionList);
182
183 procedure CreateProcess(const AppPath: string; const Param: string);
184 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
185 function HTMLDecode(const AStr: String): String;
186 function GetHRefText(s: string): string;
187 function Is2chHost(Host: string): Boolean;
188 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
189 function Parse2chURL2(URL: string): TPathRec;
190 procedure ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
191 function GetVersionBuild: Integer;
192 function GetBrowsableThreadURL( inURL : string ) : string;
193 function GetThreadURL2BoardURL( inURL : string ) : string;
194 function Get2chThreadURL2BoardURL( inURL : string ) : string;
195 function Get2chBrowsableThreadURL( inURL : string ) : string;
196 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
197 procedure ListBoardFile;
198 procedure ReadBoardFile( bbs : TBBS );
199
200 function GetUnknownCategory : TCategory;
201 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
202
203 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
204
205 // 繧ケ繧ュ繝ウ繧定ェュ縺ソ霎シ縺ソ縲∝?、繧堤スョ謠帙☆繧?/span>
206 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
207 // 繝ャ繧ケ縺ョ蛟、繧堤スョ謠帙☆繧?/span>
208 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
209
210 //Samba24縺ョ繝輔ぃ繧、繝ォ縺悟ュ伜惠縺吶k縺九?ょュ伜惠縺励↑縺??エ蜷医?‥efault繝輔ぃ繧、繝ォ繧池ename縺吶k
211 procedure SambaFileExists();
212 end;
213
214 var
215 GikoSys: TGikoSys;
216 const
217 //LENGTH_RESTITLE = 40;
218 ZERO_DATE: Integer = 25569;
219 BETA_VERSION_NAME_E = 'beta';
220 BETA_VERSION_NAME_J = '?奇セ橸セ?';
221 BETA_VERSION = 48;
222 BETA_VERSION_BUILD = ''; //debug迚医↑縺ゥ
223 APP_NAME = 'gikoNavi';
224
225 implementation
226
227 uses
228 Giko, RoundData, Favorite;
229
230 const
231 FOLDER_INDEX_VERSION = '1.01';
232 USER_AGENT = 'Monazilla';
233 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
234 NGWORDs_DIR_NAME : String = 'NGwords';
235
236 READ_PATH: string = '/test/read.cgi/';
237 OLD_READ_PATH: string = '/test/read.cgi?';
238 KAKO_PATH: string = '/kako/';
239
240 (*************************************************************************
241 *GikoSys繧ウ繝ウ繧ケ繝医Λ繧ッ繧ソ
242 *************************************************************************)
243 constructor TGikoSys.Create;
244 begin
245 FSetting := TSetting.Create;
246 FDolib := TDolib.Create;
247 FAWKStr := TAWKStr.Create(nil);
248 if DirectoryExists(GetConfigDir) = false then begin
249 CreateDir(GetConfigDir);
250 end;
251 FAbon := TAbon.Create;
252 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
253 FAbon.GoHome;
254 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
255 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
256 FAbon.DeleteSyria := FSetting.DeleteSyria;
257 FAbon.Deleterlo := FSetting.AbonDeleterlo;
258 FAbon.Replaceul := FSetting.AbonReplaceul;
259 FAbon.AbonPopupRes := FSetting.PopUpAbon;
260
261 FSelectResFilter := TAbon.Create;
262 // 邨槭j霎シ繧?縺ィ縺阪?讌オ蜉帑ク?隕ァ縺瑚ヲ九i繧後k縺サ縺?′縺?>縺ョ縺ァ莉悶?螳悟?縺ォ蜑企勁
263 FSelectResFilter.AbonString := '';
264 //
265 ResRange := FSetting.ResRange;
266 end;
267
268 (*************************************************************************
269 *GikoSys繝?せ繝医Λ繧ッ繧ソ
270 *************************************************************************)
271 destructor TGikoSys.Destroy;
272 var
273 i: Integer;
274 FileList: TStringList;
275 begin
276 //繧ケ繝ャ繝?ラ繝??繧ソ繝輔ぃ繧、繝ォ繧呈峩譁ー
277 // FlashExitWrite;
278
279 // FExitWrite.Free;
280 FAWKStr.Free;
281 FSetting.Free;
282 FDolib.Free;
283 FAbon.Free;
284 FSelectResFilter.Free;
285 //繝?Φ繝昴Λ繝ェHTML繧貞炎髯、
286 FileList := TStringList.Create;
287 try
288 GetFileList(GetTempFolder, '*.html', FileList, False, True);
289 for i := 0 to FileList.Count - 1 do begin
290 DeleteFile(FileList[i]);
291 end;
292 finally
293 FileList.Free;
294 end;
295 inherited;
296 end;
297
298 (*************************************************************************
299 *譁?ュ怜?謨ー蟄励メ繧ァ繝?け
300 *************************************************************************)
301 {$HINTS OFF}
302 function TGikoSys.IsNumeric(s: string): boolean;
303 var
304 e: integer;
305 v: integer;
306 begin
307 Val(s, v, e);
308 Result := e = 0;
309 end;
310 {$HINTS ON}
311
312 (*************************************************************************
313 *譁?ュ怜?豬ョ蜍募ー乗焚轤ケ謨ー蟄励メ繧ァ繝?け
314 *************************************************************************)
315 function TGikoSys.IsFloat(s: string): boolean;
316 var
317 v: Extended;
318 begin
319 Result := TextToFloat(PChar(s), v, fvExtended);
320 end;
321
322 (*************************************************************************
323 *繝懊?繝峨ヵ繧。繧、繝ォ蜷榊叙蠕暦シ医ヱ繧ケ?九ヵ繧。繧、繝ォ蜷搾シ?/span>
324 *************************************************************************)
325 function TGikoSys.GetBoardFileName: string;
326 begin
327 Result := Setting.GetBoardFileName;
328 end;
329
330 (*************************************************************************
331 *繝懊?繝峨ヵ繧。繧、繝ォ蜷榊叙蠕暦シ医ヱ繧ケ?九ヵ繧。繧、繝ォ蜷搾シ?/span>
332 *************************************************************************)
333 function TGikoSys.GetCustomBoardFileName: string;
334 begin
335 Result := Setting.GetCustomBoardFileName;
336 end;
337
338 (*************************************************************************
339 *繝?Φ繝昴Λ繝ェ繝輔か繝ォ繝?繝シ蜷榊叙蠕?/span>
340 *************************************************************************)
341 function TGikoSys.GetHtmlTempFileName: string;
342 begin
343 Result := Setting.GetHtmlTempFileName;
344 end;
345
346
347 (*************************************************************************
348 *螳溯。後ヵ繧。繧、繝ォ繝輔か繝ォ繝?蜿門セ?/span>
349 *************************************************************************)
350 function TGikoSys.GetAppDir: string;
351 begin
352 Result := Setting.GetAppDir;
353 end;
354
355 (*************************************************************************
356 *TempHtml繝輔ぃ繧、繝ォ蜷榊叙蠕暦シ医ヱ繧ケ?九ヵ繧。繧、繝ォ蜷搾シ?/span>
357 *************************************************************************)
358 function TGikoSys.GetTempFolder: string;
359 begin
360 Result := Setting.GetTempFolder;
361 end;
362
363 (*************************************************************************
364 *sent.ini繝輔ぃ繧、繝ォ蜷榊叙蠕暦シ医ヱ繧ケ?九ヵ繧。繧、繝ォ蜷搾シ?/span>
365 *************************************************************************)
366 function TGikoSys.GetSentFileName: string;
367 begin
368 Result := Setting.GetSentFileName;
369 end;
370
371 (*************************************************************************
372 *outbox.ini繝輔ぃ繧、繝ォ蜷榊叙蠕暦シ医ヱ繧ケ?九ヵ繧。繧、繝ォ蜷搾シ?/span>
373 *************************************************************************)
374 function TGikoSys.GetOutBoxFileName: string;
375 begin
376 Result := Setting.GetOutBoxFileName;
377 end;
378
379 (*************************************************************************
380 *Config繝輔か繝ォ繝?蜿門セ?/span>
381 *************************************************************************)
382 function TGikoSys.GetConfigDir: string;
383 begin
384 Result := Setting.GetConfigDir;
385 end;
386
387 function TGikoSys.GetStyleSheetDir: string;
388 begin
389 Result := Setting.GetStyleSheetDir;
390 end;
391
392 function TGikoSys.GetSkinDir: string;
393 begin
394 Result := Setting.GetSkinDir;
395 end;
396
397 function TGikoSys.GetSkinHeaderFileName: string;
398 begin
399 Result := Setting.GetSkinHeaderFileName;
400 end;
401
402 function TGikoSys.GetSkinFooterFileName: string;
403 begin
404 Result := Setting.GetSkinFooterFileName;
405 end;
406
407 function TGikoSys.GetSkinNewResFileName: string;
408 begin
409 Result := Setting.GetSkinNewResFileName;
410 end;
411
412 function TGikoSys.GetSkinResFileName: string;
413 begin
414 Result := Setting.GetSkinResFileName;
415 end;
416
417 function TGikoSys.GetSkinBookmarkFileName: string;
418 begin
419 Result := Setting.GetSkinBookmarkFileName;
420 end;
421
422 function TGikoSys.GetSkinNewmarkFileName: string;
423 begin
424 Result := Setting.GetSkinNewmarkFileName;
425 end;
426
427 // UserAgent蜿門セ?/span>
428 function TGikoSys.GetUserAgent: string;
429 begin
430 if Dolib.Connected then begin
431 Result := Format('%s %s/%s%d%s', [
432 Dolib.UserAgent,
433 APP_NAME,
434 //MAJOR_VERSION,
435 //MINOR_VERSION,
436 BETA_VERSION_NAME_E,
437 BETA_VERSION,
438 BETA_VERSION_BUILD]);
439 end else begin
440 Result := Format('%s/%s %s/%s%d%s', [
441 USER_AGENT,
442 Dolib.Version,
443 APP_NAME,
444 //MAJOR_VERSION,
445 //MINOR_VERSION,
446 BETA_VERSION_NAME_E,
447 BETA_VERSION,
448 BETA_VERSION_BUILD]);
449 end;
450 end;
451
452 (*************************************************************************
453 *?偵■繧?s縺ュ繧区婿蠑乗凾蛻サ蜿門セ?/span>
454 *************************************************************************)
455 function TGikoSys.Get2chDate(aDate: TDateTime): string;
456 var
457 d1: TDateTime;
458 d2: TDateTime;
459 begin
460 d1 := EncodeDate(1970, 1, 1);
461 d2 := aDate - EncodeTime(9, 0, 0, 0);
462 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
463 Result := FloatToStr(Trunc((d2 - d1) * 86400));
464 end;
465
466
467 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
468 var
469 d1: tdatetime;
470 d2: tdatetime;
471 begin
472 d1 := EncodeDate(1970, 1, 1);
473 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
474 Result := d1 + d2;
475 end;
476
477 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
478 var
479 d: TDateTime;
480 c: Currency;
481 begin
482 d := EncodeDate(1970, 1, 1);
483 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
484 Result := Trunc(c);
485 end;
486
487
488 (*************************************************************************
489 *Subject繝輔ぃ繧、繝ォRead
490 *************************************************************************)
491 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
492 var
493 ThreadItem: TThreadItem;
494 FileName: string;
495 FileList: TStringList;
496 TmpFileList: TStringList;
497 Index: Integer;
498 sl: TStringList;
499 i: Integer;
500 Rec: TIndexRec;
501 UnRead: Integer;
502 ini: TMemIniFile;
503 ResRec: TResRec;
504 RoundItem: TRoundItem;
505 idx: Integer;
506 usePlugIn : Boolean;
507 tmpStr: string;
508 {*
509 FavoThreadItem : TFavoriteThreadItem;
510 Node: TTreeNode;
511 *}
512 begin
513 if Board.IsThreadDatRead then
514 Exit;
515 Board.Clear;
516 UnRead := 0;
517
518 usePlugIn := Board.IsBoardPlugInAvailable;
519
520 FileName := Board.GetFolderIndexFileName;
521
522 FileList := TStringList.Create;
523 FileList.Sorted := True;
524 TmpFileList := TStringList.Create;
525 TmpFileList.Sorted := True;
526
527 //IsLogFile逕ィDAT繝輔ぃ繧、繝ォ繝ェ繧ケ繝?/span>
528 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
529 //蜑榊屓逡ー蟶ク邨ゆコ?凾逕ィTmp繝輔ぃ繧、繝ォ繝ェ繧ケ繝?/span>
530 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
531
532 // 驥崎、?r髦イ縺?/span>
533 Board.BeginUpdate;
534 Board.Sorted := True;
535
536 sl := TStringList.Create;
537 try
538 if FileExists(FileName) then begin
539 sl.LoadFromFile(FileName);
540
541 //?定。檎岼縺九i?茨シ題。檎岼縺ッ繝舌?繧ク繝ァ繝ウ??/span>
542 for i := sl.Count - 1 downto 1 do begin
543 Rec := ParseIndexLine(sl[i]);
544 if usePlugIn then
545 ThreadItem := TThreadItem.Create(
546 Board.BoardPlugIn,
547 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
548 else
549 ThreadItem := TThreadItem.Create(
550 nil,
551 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
552
553 if FileList.Count <> 0 then
554 if FileList.Find( ThreadItem.FileName, Index ) then
555 FileList.Delete( Index );
556
557 ThreadItem.BeginUpdate;
558 ThreadItem.No := Rec.FNo;
559 ThreadItem.FileName := Rec.FFileName;
560 ThreadItem.Title := Rec.FTitle;
561 ThreadItem.Count := Rec.FCount;
562 ThreadItem.Size := Rec.FSize;
563 // ThreadItem.RoundNo := Rec.FRoundNo;
564 ThreadItem.RoundDate := Rec.FRoundDate;
565 ThreadItem.LastModified := Rec.FLastModified;
566 ThreadItem.Kokomade := Rec.FKokomade;
567 ThreadItem.NewReceive := Rec.FNewReceive;
568 // ThreadItem.Round := Rec.FRound;
569 ThreadItem.UnRead := Rec.FUnRead;
570 ThreadItem.ScrollTop := Rec.FScrollTop;
571 ThreadItem.AllResCount := Rec.FAllResCount;
572 ThreadItem.NewResCount := Rec.FNewResCount;
573 ThreadItem.AgeSage := Rec.FAgeSage;
574 ThreadItem.ParentBoard := Board;
575 {* 縺頑ー励↓蜈・繧雁、ァ驥冗函謌舌さ繝シ繝 *}
576 {*
577 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
578 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
579 *}
580
581 //蟾。蝗槭Μ繧ケ繝医↓蟄伜惠縺励◆繧牙キ。蝗槭ヵ繝ゥ繧ー繧サ繝?ヨ
582 if ThreadItem.IsLogFile then begin
583 idx := RoundList.Find(ThreadItem);
584 if idx <> -1 then begin
585 RoundItem := RoundList.Items[idx, grtItem];
586 ThreadItem.RoundName := RoundItem.RoundName;
587 ThreadItem.Round := True;
588 end;
589 end;
590
591 //蜑榊屓逡ー蟶ク邨ゆコ?凾繝√ぉ繝?け
592 if TmpFileList.Count <> 0 then begin
593 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
594 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
595 try
596 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
597 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
598
599 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
600 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
601 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
602 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
603
604 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
605 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
606 try
607 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
608 except
609 end;
610 end;
611
612
613 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
614 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
615 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
616 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
617 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
618 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
619 finally
620 ini.Free;
621 end;
622 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
623 TmpFileList.Delete(Index);
624 end;
625 end;
626
627 ThreadItem.EndUpdate;
628 Board.Add(ThreadItem);
629
630 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
631 Inc(UnRead);
632 end;
633 end;
634
635 if UnRead <> Board.UnRead then
636 Board.UnRead := UnRead;
637
638 //繧、繝ウ繝?ャ繧ッ繧ケ縺ォ辟。縺九▲縺溘Ο繧ー繧定ソス蜉??郁?繧後う繝ウ繝?ャ繧ッ繧ケ蟇セ蠢懶シ?/span>
639 for i := 0 to FileList.Count - 1 do begin
640 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
641
642 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
643 if usePlugIn then begin
644 ThreadItem := TThreadItem.Create(
645 Board.BoardPlugIn,
646 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
647 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
648 end else begin
649 ThreadItem := TThreadItem.Create(
650 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
651 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
652 end;
653
654 ThreadItem.BeginUpdate;
655 ThreadItem.FilePath := FileName;
656 ThreadItem.No := Board.Count + 1;
657 ThreadItem.FileName := FileList[i];
658 ThreadItem.Title := ResRec.FTitle;
659 ThreadItem.Count := GetFileLineCount(FileName);
660 ThreadItem.AllResCount := ThreadItem.Count;
661 ThreadItem.NewResCount := ThreadItem.Count;
662 ThreadItem.Size := GetFileSize(FileName) - ThreadItem.Count;//1byte縺壹l繧九→縺阪′縺ゅk縺代←縺昴l縺ッ縺ゅ″繧峨a繧?/span>
663 ThreadItem.RoundDate := ZERO_DATE;
664 ThreadItem.LastModified := ZERO_DATE;
665 ThreadItem.Kokomade := -1;
666 ThreadItem.NewReceive := ThreadItem.Count;
667 ThreadItem.ParentBoard := Board;
668 ThreadItem.IsLogFile := True;
669 ThreadItem.Round := False;
670 ThreadItem.UnRead := False;
671 ThreadItem.ScrollTop := 0;
672 ThreadItem.AgeSage := gasNone;
673 ThreadItem.EndUpdate;
674 Board.Add(ThreadItem);
675 end;
676 Board.EndUpdate;
677 finally
678 sl.Free;
679 FileList.Free;
680 TmpFileList.Free;
681 Board.Sorted := False;
682 end;
683 Board.IsThreadDatRead := True;
684 end;
685
686 (*************************************************************************
687 *繧ケ繝ャ繝?ラ繧、繝ウ繝?ャ繧ッ繧ケ繝輔ぃ繧、繝ォ(Folder.idx)菴懈?
688 *************************************************************************)
689 procedure TGikoSys.CreateThreadDat(Board: TBoard);
690 var
691 i: integer;
692 s: string;
693 SubjectList: TStringList;
694 sl: TStringList;
695 Rec: TSubjectRec;
696 FileName: string;
697 cnt: Integer;
698 begin
699 if not FileExists(Board.GetSubjectFileName) then Exit;
700 FileName := Board.GetFolderIndexFileName;
701
702 SubjectList := TStringList.Create;
703 try
704 SubjectList.LoadFromFile(Board.GetSubjectFileName);
705 sl := TStringList.Create;
706 try
707 cnt := 1;
708 sl.Add(FOLDER_INDEX_VERSION);
709 for i := 0 to SubjectList.Count - 1 do begin
710 Rec := DivideSubject(SubjectList[i]);
711
712 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
713 Continue;
714
715 s := Format('%x', [cnt]) + #1 //逡ェ蜿キ
716 + Rec.FFileName + #1 //繝輔ぃ繧、繝ォ蜷?/span>
717 + Rec.FTitle + #1 //繧ソ繧、繝医Ν
718 + Format('%x', [Rec.FCount]) + #1 //繧ォ繧ヲ繝ウ繝?/span>
719 + Format('%x', [0]) + #1 //size
720 + Format('%x', [0]) + #1 //RoundDate
721 + Format('%x', [0]) + #1 //LastModified
722 + Format('%x', [0]) + #1 //Kokomade
723 + Format('%x', [0]) + #1 //NewReceive
724 + '0' + #1 //譛ェ菴ソ逕ィ
725 + Format('%x', [0]) + #1 //UnRead
726 + Format('%x', [0]) + #1 //ScrollTop
727 + Format('%x', [Rec.FCount]) + #1 //AllResCount
728 + Format('%x', [0]) + #1 //NewResCount
729 + Format('%x', [0]); //AgeSage
730
731 sl.Add(s);
732 inc(cnt);
733 end;
734 sl.SaveToFile(FileName);
735 finally
736 sl.Free;
737 end;
738 finally
739 SubjectList.Free;
740 end;
741 end;
742
743 (*************************************************************************
744 *繧ケ繝ャ繝?ラ繧、繝ウ繝?ャ繧ッ繧ケ(Thread.dat)譖ク縺崎セシ縺ソ
745 *Public
746 *************************************************************************)
747 procedure TGikoSys.WriteThreadDat(Board: TBoard);
748 //const
749 // Values: array[Boolean] of string = ('0', '1');
750 var
751 i: integer;
752 FileName: string;
753 sl: TStringList;
754 s: string;
755 TmpFileList: TStringList;
756 begin
757 if not Board.IsThreadDatRead then
758 Exit;
759 FileName := Board.GetFolderIndexFileName;
760 ForceDirectoriesEx( ExtractFilePath( FileName ) );
761
762 sl := TStringList.Create;
763 TmpFileList := TStringList.Create;
764 TmpFileList.Sorted := true;
765 try
766 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
767 sl.BeginUpdate;
768 sl.Add(FOLDER_INDEX_VERSION);
769
770 // 繧ケ繝ャ逡ェ蜿キ菫晏ュ倥?縺溘a繧ス繝シ繝?/span>
771 Sort.SortNoFlag := true;
772 Sort.SortOrder := true;
773 Sort.SortIndex := 0;
774 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
775 Board.CustomSort(ThreadItemSortProc);
776
777 for i := 0 to Board.Count - 1 do begin
778 Board.Items[i].No := i + 1;
779 s := Format('%x', [Board.Items[i].No]) + #1
780 + Board.Items[i].FileName + #1
781 + Board.Items[i].Title + #1
782 + Format('%x', [Board.Items[i].Count]) + #1
783 + Format('%x', [Board.Items[i].Size]) + #1
784 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
785 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
786 + Format('%x', [Board.Items[i].Kokomade]) + #1
787 + Format('%x', [Board.Items[i].NewReceive]) + #1
788 + '0' + #1 //譛ェ菴ソ逕ィ
789 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
790 + Format('%x', [Board.Items[i].ScrollTop]) + #1
791 + Format('%x', [Board.Items[i].AllResCount]) + #1
792 + Format('%x', [Board.Items[i].NewResCount]) + #1
793 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
794
795 sl.Add(s);
796 end;
797 sl.EndUpdate;
798 sl.SaveToFile(FileName);
799
800 for i := 0 to TmpFileList.Count - 1 do begin
801 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
802 end;
803
804 finally
805 TmpFileList.Free;
806 sl.Free;
807 end;
808 end;
809
810 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
811 begin
812 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
813 Result.FFileName := RemoveToken(Line, #1);
814 Result.FTitle := RemoveToken(Line, #1);
815 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
816 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
817 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
818 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
819 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
820 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
821 RemoveToken(Line, #1);//9: ; //譛ェ菴ソ逕ィ
822 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
823 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
824 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
825 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
826 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
827
828 end;
829
830 //謖?ョ壹ヵ繧ゥ繝ォ繝?蜀??謖?ョ壹ヵ繧。繧、繝ォ荳?隕ァ繧貞叙蠕励☆繧?/span>
831 // ListFiles('c:\', '*.txt', list, True);
832 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
833 var
834 rc: Integer;
835 SearchRec : TSearchRec;
836 s: string;
837 maskExt: string;
838 begin
839 maskExt := Copy(Mask, 1, Length(Mask) - 1);
840
841 Path := IncludeTrailingPathDelimiter(Path);
842 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
843 try
844 while rc = 0 do begin
845 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
846 s := Path + SearchRec.Name;
847 //if (SearchRec.Attr and faDirectory > 0) then
848 // s := IncludeTrailingPathDelimiter(s)
849
850 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
851 if IsPathAdd then
852 List.Add(s)
853 else
854 List.Add(SearchRec.Name);
855 if SubDir and (SearchRec.Attr and faDirectory > 0) then
856 GetFileList(s, Mask, List, True, IsPathAdd);
857 end;
858 rc := FindNext(SearchRec);
859 end;
860 finally
861 SysUtils.FindClose(SearchRec);
862 end;
863 List.Sort;
864 end;
865 //謖?ョ壹ヵ繧ゥ繝ォ繝?蜀??謖?ョ壹ヵ繧。繧、繝ォ荳?隕ァ繧貞叙蠕励☆繧?/span>
866 //繧オ繝悶ヵ繧ゥ繝ォ繝?縺ッ讀懃エ「縺励↑縺?/span>
867 // ListFiles('c:\', '*.txt', list, True);
868 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
869 var
870 rc: Integer;
871 SearchRec : TSearchRec;
872 s: string;
873 begin
874 Path := IncludeTrailingPathDelimiter(Path);
875 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
876 try
877 while rc = 0 do begin
878 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
879 s := Path + SearchRec.Name;
880
881 if (SearchRec.Attr and faDirectory = 0) then
882 if IsPathAdd then
883 List.Add(s)
884 else
885 List.Add(SearchRec.Name);
886 end;
887 rc := FindNext(SearchRec);
888 end;
889 finally
890 SysUtils.FindClose(SearchRec);
891 end;
892 List.Sort;
893 end;
894 //謖?ョ壹ヵ繧ゥ繝ォ繝?蜀??繝?ぅ繝ャ繧ッ繝医Μ荳?隕ァ繧貞叙蠕励☆繧?/span>
895 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
896 var
897 rc: Integer;
898 SearchRec : TSearchRec;
899 s: string;
900 begin
901 Path := IncludeTrailingPathDelimiter(Path);
902 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
903 try
904 while rc = 0 do begin
905 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
906 s := Path + SearchRec.Name;
907 //if (SearchRec.Attr and faDirectory > 0) then
908 // s := IncludeTrailingPathDelimiter(s)
909
910 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
911 List.Add( IncludeTrailingPathDelimiter( s ) );
912 if SubDir and (SearchRec.Attr and faDirectory > 0) then
913 GetDirectoryList(s, Mask, List, True);
914 end;
915 rc := FindNext(SearchRec);
916 end;
917 finally
918 SysUtils.FindClose(SearchRec);
919 end;
920 end;
921
922 // 繧ケ繧ュ繝ウ繧定ェュ縺ソ霎シ縺ソ縲∝?、繧堤スョ謠帙☆繧?/span>
923 function TGikoSys.LoadFromSkin(
924 fileName: string;
925 ThreadItem: TThreadItem;
926 SizeByte: Integer
927 ): string;
928 var
929 Skin: TStringList;
930 begin
931
932 Skin := TStringList.Create;
933 try
934 if FileExists( fileName ) then begin
935 Skin.LoadFromFile( fileName );
936
937 // 繧?j縺九◆縺瑚協縺励>縺代←縲√が繝励す繝ァ繝ウ繝?繧、繧「繝ュ繧ー縺ョ繝励Ξ繝薙Η繝シ逕ィ try
938 try
939 if ThreadItem.ParentBoard <> nil then
940 if ThreadItem.ParentBoard.ParentCategory <> nil then
941 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
942 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
943 except end;
944 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
945 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
946 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
947 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
948 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
949 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
950 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
951
952 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
953 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
954 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
955
956 //----- 縺ィ繧翫≠縺医★縺九■繧??懊@繧?コ呈鋤逕ィ縲ゅさ繝。繝ウ繝医い繧ヲ繝医@縺ヲ繧ゅh縺?/span>
957 // 繧?j縺九◆縺瑚協縺励>縺代←縲√が繝励す繝ァ繝ウ繝?繧、繧「繝ュ繧ー縺ョ繝励Ξ繝薙Η繝シ逕ィ try
958 try
959 if ThreadItem.ParentBoard <> nil then
960 if ThreadItem.ParentBoard.ParentCategory <> nil then
961 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
962 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
963 except end;
964 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
965 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
966 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
967 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
968 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
969 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
970 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
971
972 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
973 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
974 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
975 //----- 縺薙%縺セ縺ァ
976 end;
977 Result := Skin.Text;
978 finally
979 Skin.Free;
980 end;
981 end;
982
983 // 繝ャ繧ケ縺ョ蛟、繧堤スョ謠帙☆繧?/span>
984 function TGikoSys.SkinedRes(
985 skin: string;
986 Res: TResRec;
987 No: string
988 ): string;
989 begin
990
991 try
992 Skin := CustomStringReplace( Skin, '<NUMBER/>',
993 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
994 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
995 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
996 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
997 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
998 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
999 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1000 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1001
1002 //----- 縺九■繧??懊@繧?コ呈鋤逕ィ縲ゅさ繝。繝ウ繝医い繧ヲ繝医@縺ヲ繧ゅh縺?/span>
1003 Skin := CustomStringReplace( Skin, '&NUMBER',
1004 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1005 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1006 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1007 Skin := CustomStringReplace( Skin, '&MAILNAME',
1008 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1009 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1010 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1011 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1012 //----- 縺薙%縺セ縺ァ
1013
1014 Result := Skin;
1015 finally
1016 end;
1017
1018 end;
1019
1020 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1021 var
1022 i: integer;
1023 No: string;
1024 //bufList : TStringList;
1025 ReadList: TStringList;
1026 SaveList: TStringList;
1027 CSSFileName: string;
1028 BBSID: string;
1029 FileName: string;
1030 NewReceiveNo: Integer;
1031 Res: TResRec;
1032 boardPlugIn : TBoardPlugIn;
1033
1034 UserOptionalStyle: string;
1035 SkinHeader: string;
1036 SkinNewRes: string;
1037 SkinRes: string;
1038
1039 function LoadSkin( fileName: string ): string;
1040 begin
1041 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1042 end;
1043 function ReplaceRes( skin: string ): string;
1044 begin
1045 Result := SkinedRes( skin, Res, No );
1046 end;
1047 begin
1048 if ThreadItem <> nil then begin
1049 if ThreadItem.IsBoardPlugInAvailable then begin
1050 //===== 繝励Λ繧ー繧、繝ウ縺ォ繧医k陦ィ遉コ
1051 boardPlugIn := ThreadItem.BoardPlugIn;
1052 NewReceiveNo := ThreadItem.NewReceive;
1053 // 繝輔か繝ウ繝医d繧オ繧、繧コ縺ョ險ュ螳?/span>
1054 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1055 UserOptionalStyle := UserOptionalStyle +
1056 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1057 if GikoSys.Setting.BrowserFontSize <> 0 then
1058 UserOptionalStyle := UserOptionalStyle +
1059 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1060 if GikoSys.Setting.BrowserFontColor <> -1 then
1061 UserOptionalStyle := UserOptionalStyle +
1062 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1063 if GikoSys.Setting.BrowserBackColor <> -1 then
1064 UserOptionalStyle := UserOptionalStyle +
1065 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1066 case GikoSys.Setting.BrowserFontBold of
1067 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1068 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1069 end;
1070 case GikoSys.Setting.BrowserFontItalic of
1071 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1072 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1073 end;
1074
1075 SaveList := TStringList.Create;
1076 try
1077 doc.open;
1078 // 譁?ュ励さ繝シ繝峨?繝励Λ繧ー繧、繝ウ縺ォ莉サ縺帙k
1079 // doc.charset := 'Shift_JIS';
1080
1081 // 繝倥ャ繝?
1082 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1083 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1084
1085 for i := 0 to threadItem.Count - 1 do begin
1086 // 1 縺ッ蠢?★陦ィ遉コ
1087 if i <> 0 then begin
1088 // 陦ィ遉コ遽?峇繧帝剞螳?/span>
1089 case ResRange of
1090 Ord( grrKoko ):
1091 if ThreadItem.Kokomade > (i + 1) then
1092 Continue;
1093 Ord( grrNew ):
1094 if NewReceiveNo > (i + 1) then
1095 Continue;
1096 10..65535:
1097 if (threadItem.Count - i) > ResRange then
1098 Continue;
1099 end;
1100 end;
1101
1102 // 譁ー逹?繝槭?繧ッ
1103 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1104 try
1105 if GikoSys.Setting.UseSkin then begin
1106 if FileExists( GetSkinNewmarkFileName ) then
1107 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1108 else
1109 SaveList.Add( '<a name="new"></a>' );
1110 end else if GikoSys.Setting.UseCSS then begin
1111 SaveList.Add('<a name="new"></a><div class="new">譁ー逹?繝ャ繧ケ <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1112 end else begin
1113 SaveList.Add('</dl>');
1114 SaveList.Add('<a name="new"></a>');
1115 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>譁ー逹?繝ャ繧ケ ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1116 SaveList.Add('<dl>');
1117 end;
1118 except
1119 SaveList.Add( '<a name="new"></a>' );
1120 end;
1121 end;
1122
1123 // 繝ャ繧ケ
1124 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1125
1126 if ThreadItem.Kokomade = (i + 1) then begin
1127 // 縺薙%縺セ縺ァ隱ュ繧薙□
1128 try
1129 if GikoSys.Setting.UseSkin then begin
1130 if FileExists( GetSkinBookmarkFileName ) then
1131 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1132 else
1133 SaveList.Add( '<a name="koko"></a>' );
1134 end else if GikoSys.Setting.UseCSS then begin
1135 SaveList.Add('<a name="koko"></a><div class="koko">繧ウ繧ウ縺セ縺ァ隱ュ繧薙□</div>');
1136 end else begin
1137 SaveList.Add('</dl>');
1138 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>繧ウ繧ウ縺セ縺ァ隱ュ繧薙□</b></font></td></tr></table>');
1139 SaveList.Add('<dl>');
1140 end;
1141 except
1142 SaveList.Add( '<a name="koko"></a>' );
1143 end;
1144 end;
1145
1146 doc.Write(SaveList.Text);
1147 SaveList.Clear;
1148 end;
1149
1150
1151 // 繧ケ繧ュ繝ウ(繝輔ャ繧ソ)
1152 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1153
1154 doc.Write(SaveList.Text);
1155 finally
1156 SaveList.Free;
1157 doc.Close;
1158 end;
1159
1160 Exit;
1161 end;
1162 end;
1163 ShortDayNames[1] := '譌・'; ShortDayNames[2] := '譛?#39;;
1164 ShortDayNames[3] := '轣ォ'; ShortDayNames[4] := '豌エ';
1165 ShortDayNames[5] := '譛ィ'; ShortDayNames[6] := '驥?#39;;
1166 ShortDayNames[7] := '蝨?#39;;
1167 BBSID := ThreadItem.ParentBoard.BBSID;
1168 NewReceiveNo := ThreadItem.NewReceive;
1169 ReadList := TStringList.Create;
1170 try
1171 if ThreadItem.IsLogFile then begin
1172 FileName := ThreadItem.GetThreadFileName;
1173 ReadList.LoadFromFile(FileName);
1174 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1175 FAbon.Execute(ReadList); // 縺ゅ⊂縲懊s縺励※
1176 FSelectResFilter.ExecuteEx(ReadList); //繝ャ繧ケ縺ョ繝輔ぅ繝ォ繧ソ繝ェ繝ウ繧ー繧偵☆繧?/span>
1177 Res := DivideStrLine(ReadList[0]);
1178 Res.FTitle := CustomStringReplace(Res.FTitle, '????', ',');
1179 sTitle := Res.FTitle;
1180 end else begin
1181 sTitle := CustomStringReplace(ThreadItem.Title, '????', ',');
1182 end;
1183 SaveList := TStringList.Create;
1184 try
1185 doc.open;
1186 doc.charset := 'Shift_JIS';
1187
1188 // 繝輔か繝ウ繝医d繧オ繧、繧コ縺ョ險ュ螳?/span>
1189 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1190 UserOptionalStyle := UserOptionalStyle +
1191 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1192 if GikoSys.Setting.BrowserFontSize <> 0 then
1193 UserOptionalStyle := UserOptionalStyle +
1194 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1195 if GikoSys.Setting.BrowserFontColor <> -1 then
1196 UserOptionalStyle := UserOptionalStyle +
1197 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1198 if GikoSys.Setting.BrowserBackColor <> -1 then
1199 UserOptionalStyle := UserOptionalStyle +
1200 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1201 case GikoSys.Setting.BrowserFontBold of
1202 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1203 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1204 end;
1205 case GikoSys.Setting.BrowserFontItalic of
1206 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1207 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1208 end;
1209
1210 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1211 if GikoSys.Setting.UseSkin then begin
1212 // 繧ケ繧ュ繝ウ菴ソ逕ィ
1213 // 繧ケ繧ュ繝ウ縺ョ險ュ螳?/span>
1214 try
1215 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1216 if Length( UserOptionalStyle ) > 0 then
1217 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1218 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1219 SaveList.Add( SkinHeader );
1220 except
1221 end;
1222 try
1223 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1224 except
1225 end;
1226 try
1227 SkinRes := LoadSkin( GetSkinResFileName );
1228 except
1229 end;
1230
1231 SaveList.Add('<a name="top"></a>');
1232
1233 for i := 0 to ReadList.Count - 1 do begin
1234 // 1 縺ッ蠢?★陦ィ遉コ
1235 if i <> 0 then begin
1236 // 陦ィ遉コ遽?峇繧帝剞螳?/span>
1237 case ResRange of
1238 Ord( grrKoko ):
1239 if ThreadItem.Kokomade > (i + 1) then
1240 Continue;
1241 Ord( grrNew ):
1242 if NewReceiveNo > (i + 1) then
1243 Continue;
1244 10..65535:
1245 if (threadItem.Count - i) > ResRange then
1246 Continue;
1247 end;
1248 end;
1249
1250 // 譁ー逹?繝槭?繧ッ
1251 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1252 try
1253 if FileExists( GetSkinNewmarkFileName ) then
1254 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1255 else
1256 SaveList.Add( '<a name="new"></a>' );
1257 except
1258 SaveList.Add( '<a name="new"></a>' );
1259 end;
1260 end;
1261 if (Trim(ReadList[i]) <> '') then begin
1262 No := IntToStr(i + 1);
1263
1264 Res := DivideStrLine(ReadList[i]);
1265 if Res.FType = glt2chOld then begin
1266 Res.FMailTo := CustomStringReplace(Res.FMailTo, '????', ',');
1267 Res.FName := CustomStringReplace(Res.FName, '????', ',');
1268 Res.FBody := CustomStringReplace(Res.FBody, '????', ',');
1269 end;
1270
1271 Res.FBody := AddAnchorTag(Res.FBody);
1272 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1273
1274 try
1275 if NewReceiveNo <= (i + 1) then
1276 // 譁ー逹?繝ャ繧ケ
1277 SaveList.Add( ReplaceRes( SkinNewRes ) )
1278 else
1279 // 騾壼クク縺ョ繝ャ繧ケ
1280 SaveList.Add( ReplaceRes( SkinRes ) );
1281 except
1282 end;
1283 end;
1284
1285 if ThreadItem.Kokomade = (i + 1) then begin
1286 // 縺薙%縺セ縺ァ隱ュ繧薙□
1287 try
1288 if FileExists( GetSkinBookmarkFileName ) then
1289 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1290 else
1291 SaveList.Add( '<a name="koko"></a>' );
1292 except
1293 SaveList.Add( '<a name="koko"></a>' );
1294 end;
1295 end;
1296 doc.Write(SaveList.Text);
1297 SaveList.Clear;
1298 end;
1299 SaveList.Add('<a name="bottom"></a>');
1300 // 繧ケ繧ュ繝ウ(繝輔ャ繧ソ)
1301 try
1302 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1303 except
1304 end;
1305 doc.Write(SaveList.Text);
1306
1307 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1308 //CSS菴ソ逕ィ
1309 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1310 // SaveList.Add('<html lang="ja"><head>');
1311 SaveList.Add('<html><head>');
1312 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1313 SaveList.Add('<title>' + sTitle + '</title>');
1314 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1315 if Length( UserOptionalStyle ) > 0 then
1316 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1317 SaveList.Add('</head>');
1318 SaveList.Add('<body>');
1319 SaveList.Add('<a name="top"></a>');
1320 SaveList.Add('<div class="title">' + sTitle + '</div>');
1321 doc.Write(SaveList.Text);
1322 SaveList.Clear;
1323 //Application.ProcessMessages;
1324 for i := 0 to ReadList.Count - 1 do begin
1325 // 1 縺ッ蠢?★陦ィ遉コ
1326 if i <> 0 then begin
1327 // 陦ィ遉コ遽?峇繧帝剞螳?/span>
1328 case ResRange of
1329 Ord( grrKoko ):
1330 if ThreadItem.Kokomade > (i + 1) then
1331 Continue;
1332 Ord( grrNew ):
1333 if NewReceiveNo > (i + 1) then
1334 Continue;
1335 10..65535:
1336 if (threadItem.Count - i) > ResRange then
1337 Continue;
1338 end;
1339 end;
1340
1341 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1342 SaveList.Add('<a name="new"></a><div class="new">譁ー逹?繝ャ繧ケ <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1343 end;
1344 if (Trim(ReadList[i]) <> '') then begin
1345 No := IntToStr(i + 1);
1346 Res := DivideStrLine(ReadList[i]);
1347 Res.FBody := AddAnchorTag(Res.FBody);
1348 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1349 if Res.FMailTo = '' then
1350 SaveList.Add('<a name="' + No + '"></a>'
1351 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1352 + '<span class="name_label">蜷榊燕??lt;/span> '
1353 + '<span class="name"><b>' + Res.FName + '</b></span> '
1354 + '<span class="date_label">謚慕ィソ譌・??lt;/span> '
1355 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1356 + '<div class="mes">' + Res.FBody + ' </div>')
1357 else if GikoSys.Setting.ShowMail then
1358 SaveList.Add('<a name="' + No + '"></a>'
1359 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1360 + '<span class="name_label"> 蜷榊燕? </span>'
1361 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1362 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1363 + '<span class="date_label"> 謚慕ィソ譌・??lt;/span>'
1364 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1365 + '<div class="mes">' + Res.FBody + ' </div>')
1366 else
1367 SaveList.Add('<a name="' + No + '"></a>'
1368 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1369 + '<span class="name_label"> 蜷榊燕? </span>'
1370 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1371 + '<b>' + Res.FName + '</b></a>'
1372 + '<span class="date_label"> 謚慕ィソ譌・??lt;/span>'
1373 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1374 + '<div class="mes">' + Res.FBody + ' </div>');
1375 end;
1376 if ThreadItem.Kokomade = (i + 1) then begin
1377 SaveList.Add('<a name="koko"></a><div class="koko">繧ウ繧ウ縺セ縺ァ隱ュ繧薙□</div>');
1378 end;
1379
1380 doc.Write(SaveList.Text);
1381 SaveList.Clear;
1382 end;
1383 SaveList.Add('<a name="bottom"></a>');
1384 SaveList.Add('</body></html>');
1385 SaveList.Add('<a name="last"></a>');
1386 SaveList.Add('</body></html>');
1387
1388 doc.Write(SaveList.Text);
1389 end else begin
1390 //CSS髱樔スソ逕ィ
1391 // SaveList.Add('<html lang="ja"><head>');
1392 SaveList.Add('<html><head>');
1393 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1394 SaveList.Add('<title>' + sTitle + '</title></head>');
1395 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1396 SaveList.Add('<a name="top"></a>');
1397 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1398 SaveList.Add('<dl>');
1399 doc.Write(SaveList.Text);
1400 SaveList.Clear;
1401 //Application.ProcessMessages;
1402 for i := 0 to ReadList.Count - 1 do begin
1403 // 1 縺ッ蠢?★陦ィ遉コ
1404 if i <> 0 then begin
1405 // 陦ィ遉コ遽?峇繧帝剞螳?/span>
1406 case ResRange of
1407 Ord( grrKoko ):
1408 if ThreadItem.Kokomade > (i + 1) then
1409 Continue;
1410 Ord( grrNew ):
1411 if NewReceiveNo > (i + 1) then
1412 Continue;
1413 10..65535:
1414 if (threadItem.Count - i) > ResRange then
1415 Continue;
1416 end;
1417 end;
1418
1419 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1420 SaveList.Add('</dl>');
1421 SaveList.Add('<a name="new"></a>');
1422 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>譁ー逹?繝ャ繧ケ ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1423 SaveList.Add('<dl>');
1424 end;
1425 if (Trim(ReadList[i]) <> '') then begin
1426 No := IntToStr(i + 1);
1427 Res := DivideStrLine(ReadList[i]);
1428 if Res.FType = glt2chOld then begin
1429 Res.FMailTo := CustomStringReplace(Res.FMailTo, '????', ',');
1430 Res.FName := CustomStringReplace(Res.FName, '????', ',');
1431 Res.FBody := CustomStringReplace(Res.FBody, '????', ',');
1432 end;
1433 Res.FBody := AddAnchorTag(Res.FBody);
1434 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1435 if Res.FMailTo = '' then
1436 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;font color="forestgreen"><b> ' + Res.FName + ' </b></font> 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1437 else if GikoSys.Setting.ShowMail then
1438 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1439 else
1440 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1441 end;
1442 if ThreadItem.Kokomade = (i + 1) then begin
1443 SaveList.Add('</dl>');
1444 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>繧ウ繧ウ縺セ縺ァ隱ュ繧薙□</b></font></td></tr></table>');
1445 SaveList.Add('<dl>');
1446 end;
1447 doc.Write(SaveList.Text);
1448 SaveList.Clear;
1449 end;
1450 SaveList.Add('</dl>');
1451 SaveList.Add('<a name="bottom"></a>');
1452 SaveList.Add('</body></html>');
1453 doc.Write(SaveList.Text);
1454 end;
1455 finally
1456 SaveList.Free;
1457 doc.Close;
1458 end;
1459 finally
1460 ReadList.Free;
1461 end;
1462 end;
1463 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1464 var
1465 i: integer;
1466 No: string;
1467 //bufList : TStringList;
1468 ReadList: TStringList;
1469 // SaveList: TStringList;
1470 CSSFileName: string;
1471 BBSID: string;
1472 FileName: string;
1473 Res: TResRec;
1474 boardPlugIn : TBoardPlugIn;
1475
1476 UserOptionalStyle: string;
1477 SkinHeader: string;
1478 SkinRes: string;
1479 tmp, tmp1: string;
1480 function LoadSkin( fileName: string ): string;
1481 begin
1482 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1483 end;
1484 function ReplaceRes( skin: string ): string;
1485 begin
1486 Result := SkinedRes( skin, Res, No );
1487 end;
1488
1489 begin
1490 if ThreadItem <> nil then begin
1491 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1492 html.Clear;
1493 html.BeginUpdate;
1494 if ThreadItem.IsBoardPlugInAvailable then begin
1495 //===== 繝励Λ繧ー繧、繝ウ縺ォ繧医k陦ィ遉コ
1496 boardPlugIn := ThreadItem.BoardPlugIn;
1497 // 繝輔か繝ウ繝医d繧オ繧、繧コ縺ョ險ュ螳?/span>
1498 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1499 UserOptionalStyle := UserOptionalStyle +
1500 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1501 if GikoSys.Setting.BrowserFontSize <> 0 then
1502 UserOptionalStyle := UserOptionalStyle +
1503 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1504 if GikoSys.Setting.BrowserFontColor <> -1 then
1505 UserOptionalStyle := UserOptionalStyle +
1506 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1507 if GikoSys.Setting.BrowserBackColor <> -1 then
1508 UserOptionalStyle := UserOptionalStyle +
1509 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1510 case GikoSys.Setting.BrowserFontBold of
1511 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1512 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1513 end;
1514 case GikoSys.Setting.BrowserFontItalic of
1515 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1516 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1517 end;
1518
1519 try
1520 // 譁?ュ励さ繝シ繝峨?繝励Λ繧ー繧、繝ウ縺ォ莉サ縺帙k
1521 // 繝倥ャ繝?
1522 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1523 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1524 //邨カ蟇セ蜿ら?縺九i逶ク蟇セ蜿ら?縺ク
1525 if Setting.UseSkin then begin
1526 tmp1 := './' +Setting.CSSFileName;
1527 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1528 tmp1 := CustomStringReplace(tmp1, '\', '/');
1529 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1530 end else if Setting.UseCSS then begin
1531 tmp1 := './' + CSSFileName;
1532 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1533 tmp1 := CustomStringReplace(tmp1, '\', '/');
1534 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1535 end;
1536 html.Append( tmp );
1537
1538 for i := 0 to threadItem.Count - 1 do begin
1539
1540 // 繝ャ繧ケ
1541 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1542
1543 end;
1544 // 繧ケ繧ュ繝ウ(繝輔ャ繧ソ)
1545 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1546 finally
1547 end;
1548 html.EndUpdate;
1549 Exit;
1550 end;
1551 end;
1552 ShortDayNames[1] := '譌・'; ShortDayNames[2] := '譛?#39;;
1553 ShortDayNames[3] := '轣ォ'; ShortDayNames[4] := '豌エ';
1554 ShortDayNames[5] := '譛ィ'; ShortDayNames[6] := '驥?#39;;
1555 ShortDayNames[7] := '蝨?#39;;
1556 BBSID := ThreadItem.ParentBoard.BBSID;
1557 ReadList := TStringList.Create;
1558 try
1559 if ThreadItem.IsLogFile then begin
1560 FileName := ThreadItem.GetThreadFileName;
1561 ReadList.LoadFromFile(FileName);
1562 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1563 FAbon.Execute(ReadList); // 縺ゅ⊂縲懊s縺励※
1564 FSelectResFilter.ExecuteEx(ReadList); //繝ャ繧ケ縺ョ繝輔ぅ繝ォ繧ソ繝ェ繝ウ繧ー繧偵☆繧?/span>
1565 Res := DivideStrLine(ReadList[0]);
1566 Res.FTitle := CustomStringReplace(Res.FTitle, '????', ',');
1567 sTitle := Res.FTitle;
1568 end else begin
1569 sTitle := CustomStringReplace(ThreadItem.Title, '????', ',');
1570 end;
1571 try
1572 // 繝輔か繝ウ繝医d繧オ繧、繧コ縺ョ險ュ螳?/span>
1573 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1574 UserOptionalStyle := UserOptionalStyle +
1575 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1576 if GikoSys.Setting.BrowserFontSize <> 0 then
1577 UserOptionalStyle := UserOptionalStyle +
1578 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1579 if GikoSys.Setting.BrowserFontColor <> -1 then
1580 UserOptionalStyle := UserOptionalStyle +
1581 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1582 if GikoSys.Setting.BrowserBackColor <> -1 then
1583 UserOptionalStyle := UserOptionalStyle +
1584 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1585 case GikoSys.Setting.BrowserFontBold of
1586 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1587 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1588 end;
1589 case GikoSys.Setting.BrowserFontItalic of
1590 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1591 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1592 end;
1593
1594
1595 if GikoSys.Setting.UseSkin then begin
1596 // 繧ケ繧ュ繝ウ菴ソ逕ィ
1597 // 繧ケ繧ュ繝ウ縺ョ險ュ螳?/span>
1598 try
1599 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1600 if Length( UserOptionalStyle ) > 0 then
1601 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1602 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1603 //邨カ蟇セ蜿ら?縺九i逶ク蟇セ蜿ら?縺ク
1604 tmp1 := './' +Setting.CSSFileName;
1605 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1606 tmp1 := CustomStringReplace(tmp1, '\', '/');
1607 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1608 html.Append( SkinHeader );
1609 except
1610 end;
1611 try
1612 SkinRes := LoadSkin( GetSkinResFileName );
1613 except
1614 end;
1615 html.Append('<a name="top"></a>');
1616 for i := 0 to ReadList.Count - 1 do begin
1617 if (Trim(ReadList[i]) <> '') then begin
1618 No := IntToStr(i + 1);
1619
1620 Res := DivideStrLine(ReadList[i]);
1621 if Res.FType = glt2chOld then begin
1622 Res.FMailTo := CustomStringReplace(Res.FMailTo, '????', ',');
1623 Res.FName := CustomStringReplace(Res.FName, '????', ',');
1624 Res.FBody := CustomStringReplace(Res.FBody, '????', ',');
1625 end;
1626
1627 Res.FBody := AddAnchorTag(Res.FBody);
1628 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1629
1630 try
1631 html.Append( ReplaceRes( SkinRes ) );
1632 except
1633 end;
1634 end;
1635
1636 end;
1637 html.Append('<a name="bottom"></a>');
1638 // 繧ケ繧ュ繝ウ(繝輔ャ繧ソ)
1639 try
1640 html.Append( LoadSkin( GetSkinFooterFileName ) );
1641 except
1642 end;
1643 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1644 //CSS菴ソ逕ィ
1645 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1646 html.Append('<html><head>');
1647 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1648 html.Append('<title>' + sTitle + '</title>');
1649 //邨カ蟇セ蜿ら?縺九i逶ク蟇セ蜿ら?縺ク
1650 tmp1 := './' + CSSFileName;
1651 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1652 tmp1 := CustomStringReplace(tmp1, '\', '/');
1653
1654 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1655 if Length( UserOptionalStyle ) > 0 then
1656 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1657 html.Append('</head>');
1658 html.Append('<body>');
1659 html.Append('<a name="top"></a>');
1660 html.Append('<div class="title">' + sTitle + '</div>');
1661 for i := 0 to ReadList.Count - 1 do begin
1662 if (Trim(ReadList[i]) <> '') then begin
1663 No := IntToStr(i + 1);
1664 Res := DivideStrLine(ReadList[i]);
1665 Res.FBody := AddAnchorTag(Res.FBody);
1666 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1667 if Res.FMailTo = '' then
1668 html.Append('<a name="' + No + '"></a>'
1669 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1670 + '<span class="name_label">蜷榊燕??lt;/span> '
1671 + '<span class="name"><b>' + Res.FName + '</b></span> '
1672 + '<span class="date_label">謚慕ィソ譌・??lt;/span> '
1673 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1674 + '<div class="mes">' + Res.FBody + ' </div>')
1675 else if GikoSys.Setting.ShowMail then
1676 html.Append('<a name="' + No + '"></a>'
1677 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1678 + '<span class="name_label"> 蜷榊燕? </span>'
1679 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1680 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1681 + '<span class="date_label"> 謚慕ィソ譌・??lt;/span>'
1682 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1683 + '<div class="mes">' + Res.FBody + ' </div>')
1684 else
1685 html.Append('<a name="' + No + '"></a>'
1686 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1687 + '<span class="name_label"> 蜷榊燕? </span>'
1688 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1689 + '<b>' + Res.FName + '</b></a>'
1690 + '<span class="date_label"> 謚慕ィソ譌・??lt;/span>'
1691 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1692 + '<div class="mes">' + Res.FBody + ' </div>');
1693 end;
1694 end;
1695 html.Append('<a name="bottom"></a>');
1696 html.Append('</body></html>');
1697 html.Append('<a name="last"></a>');
1698 html.Append('</body></html>');
1699 end else begin
1700 //CSS髱樔スソ逕ィ
1701 html.Append('<html><head>');
1702 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1703 html.Append('<title>' + sTitle + '</title></head>');
1704 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1705 html.Append('<a name="top"></a>');
1706 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1707 html.Append('<dl>');
1708 for i := 0 to ReadList.Count - 1 do begin
1709 if (Trim(ReadList[i]) <> '') then begin
1710 No := IntToStr(i + 1);
1711 Res := DivideStrLine(ReadList[i]);
1712 if Res.FType = glt2chOld then begin
1713 Res.FMailTo := CustomStringReplace(Res.FMailTo, '????', ',');
1714 Res.FName := CustomStringReplace(Res.FName, '????', ',');
1715 Res.FBody := CustomStringReplace(Res.FBody, '????', ',');
1716 end;
1717 Res.FBody := AddAnchorTag(Res.FBody);
1718 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1719 if Res.FMailTo = '' then
1720 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;font color="forestgreen"><b> ' + Res.FName + ' </b></font> 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1721 else if GikoSys.Setting.ShowMail then
1722 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1723 else
1724 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> 蜷榊燕??lt;a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> 謚慕ィソ譌・? ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1725 end;
1726 end;
1727 html.Append('</dl>');
1728 html.Append('<a name="bottom"></a>');
1729 html.Append('</body></html>');
1730 end;
1731 finally
1732 html.EndUpdate;
1733 end;
1734 finally
1735 ReadList.Free;
1736 end;
1737 end;
1738 function TGikoSys.ConvertResAnchor(res: string): string;
1739 const
1740 _HEAD : string = '<a href="../';
1741 _TAIL : string = ' target="_blank">';
1742 _ST: string = '&st=';
1743 _TO: string = '&to=';
1744 _STA: string = '&START=';
1745 _END: string = '&END=';
1746 var
1747 i, j, k: Integer;
1748 tmp: string;
1749 begin
1750 Result := '';
1751 i := AnsiPos(_HEAD, res);
1752 while i <> 0 do begin
1753 Result := Result + Copy(res, 1, i -1);
1754 Delete(res, 1, i - 1);
1755 j := AnsiPos(_TAIL, res);
1756 if j = 0 then begin
1757 Result := Result + res;
1758 Exit;
1759 end;
1760 tmp := Copy(res, 1, j - 1);
1761 Delete(res, 1, j + 16);
1762 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1763 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1764 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1765 Result := Result + '<a href="#' + tmp + '">';
1766 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1767 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1768 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1769 Result := Result + '<a href="#' + tmp + '">';
1770 end else begin
1771 k := LastDelimiter('/', tmp);
1772 Delete(tmp, 1, k);
1773 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1774 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1775 else
1776 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1777
1778 Result := Result + '<a href="#' + tmp + '">';
1779 end;
1780 i := AnsiPos(_HEAD, res);
1781 end;
1782 Result := Result + res;
1783
1784 end;
1785
1786 (*************************************************************************
1787 *http://縺ョ譁?ュ怜?繧誕nchor繧ソ繧ー莉倥″縺ォ縺吶k縲?/span>
1788 *************************************************************************)
1789 function TGikoSys.AddAnchorTag(s: string): string;
1790 const
1791 URL_CHAR: string = '0123456789'
1792 + 'abcdefghijklmnopqrstuvwxyz'
1793 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1794 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1795 ANCHOR_REF = 'href=';
1796 RES_REF = '&gt;&gt;';
1797 var
1798 wkIdx: array[0..9] of Integer;
1799 url: string;
1800 href: string;
1801 i, b: Integer;
1802 idx: Integer;
1803 anchorLen : Integer;
1804 begin
1805 Result := '';
1806 // + 3 縺ッ 'href="' ('"'縺、縺?縺ェ縺ゥ縺ョ繝舌Μ繧ィ繝シ繧キ繝ァ繝ウ縺ォ菴呵」輔r謖√◆縺帙k縺溘a
1807 anchorLen := Length( ANCHOR_REF ) + 3;
1808
1809 while True do begin
1810 wkIdx[0] := AnsiPos('http://', s);
1811 wkIdx[1] := AnsiPos('ttp://', s);
1812 wkIdx[2] := AnsiPos('tp://', s);
1813 wkIdx[3] := AnsiPos('ms-help://', s);
1814 wkIdx[4] := AnsiPos('p://', s);
1815 wkIdx[5] := AnsiPos('https://', s);
1816 wkIdx[6] := AnsiPos('www.', s);
1817 wkIdx[7] := AnsiPos('ftp://', s);
1818 wkIdx[8] := AnsiPos('news://', s);
1819 wkIdx[9] := AnsiPos('rtsp://', s);
1820
1821 idx := MaxInt;
1822 for i := 0 to 9 do
1823 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1824
1825 if idx = MaxInt then begin
1826 //繝ェ繝ウ繧ッ縺檎┌縺?h縲?/span>
1827 Result := Result + s;
1828 Break;
1829 end;
1830
1831 if (idx > 1) and
1832 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1833 //譌「縺ォ繝ェ繝ウ繧ッ繧ソ繧ー縺後▽縺?※縺?k縺」縺ス縺?→縺阪?繝?繧キ
1834 href := Copy( s, idx, Length( s ) );
1835 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1836 s := href;
1837 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1838
1839 Continue;
1840 end;
1841
1842 Result := Result + Copy(s, 0, idx - 1);
1843
1844 s := Copy(s, idx, length(s));
1845
1846 b := Length( s ) + 1;
1847 for i := 1 to b do begin
1848 if i = b then
1849 idx := 0
1850 else
1851 idx := AnsiPos(s[i], URL_CHAR);
1852 if idx = 0 then begin
1853 //URL縺倥c縺ェ縺?枚蟄礼匱隕具シ√→縺九?∵枚蟄励′縺ェ縺上↑縺」縺溘??/span>
1854 url := Copy(s, 0, i - 1);
1855
1856 if AnsiPos('ttp://', url) = 1 then
1857 href := 'h' + url
1858 else if AnsiPos('tp://', url) = 1 then
1859 href := 'ht' + url
1860 else if AnsiPos('p://', url) = 1 then
1861 href := 'htt' + url
1862 else if AnsiPos('www.', url) = 1 then
1863 href := 'http://' + url
1864 else
1865 href := url;
1866 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1867 s := Copy(s, i, MaxInt);
1868 Break;
1869 end;
1870 end;
1871 end;
1872 end;
1873
1874 (*************************************************************************
1875 *繧オ繝悶ず繧ァ繧ッ繝井ク?陦後r蛻?牡
1876 *************************************************************************)
1877 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1878 var
1879 i: integer;
1880 ws: WideString;
1881 Delim: string;
1882 LeftK: string;
1883 RightK: string;
1884 begin
1885 Result.FCount := 0;
1886
1887 if AnsiPos('<>', Line) = 0 then
1888 Delim := ','
1889 else
1890 Delim := '<>';
1891 Result.FFileName := RemoveToken(Line, Delim);
1892 Result.FTitle := RemoveToken(Line, Delim);
1893
1894 ws := Trim(Result.FTitle);
1895
1896 if Copy(ws, Length(ws), 1) = ')' then begin
1897 LeftK := '(';
1898 RightK := ')';
1899 end else if Copy(ws, Length(ws), 1) = '??#39; then begin
1900 LeftK := '??#39;;
1901 RightK := '??#39;;
1902 end else if Copy(ws, Length(ws), 1) = '<' then begin
1903 LeftK := '<';
1904 RightK := '>';
1905 end;
1906
1907 for i := Length(ws) - 1 downto 1 do begin
1908 if ws[i] = LeftK then begin
1909 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1910 if IsNumeric(ws) then
1911 Result.FCount := StrToInt(ws);
1912 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1913 break;
1914 end;
1915 end;
1916 end;
1917
1918 (*************************************************************************
1919 * dat繝輔ぃ繧、繝ォ縺ョ荳?繝ゥ繧、繝ウ繧貞?隗」
1920 *************************************************************************)
1921 function TGikoSys.DivideStrLine(Line: string): TResRec;
1922 var
1923 Delim: string;
1924 bufbody : String;
1925 begin
1926 if AnsiPos('<>', Line) = 0 then begin
1927 Delim := ',';
1928 Result.FType := glt2chOld;
1929 end else begin
1930 Delim := '<>';
1931 Result.FType := glt2chNew;
1932 end;
1933 Result.FName := Trim(RemoveToken(Line, Delim));
1934 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1935 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1936 bufBody := Trim(RemoveToken(Line, Delim));
1937
1938 if bufbody = '' then begin
1939 Insert('&nbsp;',bufbody, 1);
1940 end;
1941 Result.FBody := bufBody;
1942 Result.FTitle := Trim(RemoveToken(Line, Delim));
1943
1944 end;
1945
1946 (*************************************************************************
1947 * URL縺九iBBSID繧貞叙蠕?/span>
1948 *************************************************************************)
1949 function TGikoSys.UrlToID(url: string): string;
1950 var
1951 i: integer;
1952 begin
1953 Result := '';
1954 url := Trim(url);
1955
1956 if url = '' then Exit;
1957
1958 url := Copy(url, 0, Length(url) - 1);
1959 for i := Length(url) downto 0 do begin
1960 if url[i] = '/' then begin
1961 Result := Copy(url, i + 1, Length(url));
1962 Break;
1963 end;
1964 end;
1965 end;
1966
1967 (*************************************************************************
1968 *URL縺九iBBSID莉・螟悶?驛ィ蛻?http://teri.2ch.net/)繧貞叙蠕?/span>
1969 *************************************************************************)
1970 function TGikoSys.UrlToServer(url: string): string;
1971 var
1972 i: integer;
1973 wsURL: WideString;
1974 begin
1975 Result := '';
1976 wsURL := url;
1977 wsURL := Trim(wsURL);
1978
1979 if wsURL = '' then exit;
1980
1981 if Copy(wsURL, Length(wsURL), 1) = '/' then
1982 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1983
1984 for i := Length(wsURL) downto 0 do begin
1985 if wsURL[i] = '/' then begin
1986 Result := Copy(wsURL, 0, i);
1987 break;
1988 end;
1989 end;
1990 end;
1991
1992 (*************************************************************************
1993 *繝?ぅ繝ャ繧ッ繝医Μ縺悟ュ伜惠縺吶k縺九メ繧ァ繝?け
1994 *************************************************************************)
1995 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1996 var
1997 Code: Integer;
1998 begin
1999 Code := GetFileAttributes(PChar(Name));
2000 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2001 end;
2002
2003 (*************************************************************************
2004 *繝?ぅ繝ャ繧ッ繝医Μ菴懈??郁、?焚髫主ア、蟇セ蠢懶シ?/span>
2005 *************************************************************************)
2006 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2007 begin
2008 Result := True;
2009 if Length(Dir) = 0 then
2010 raise Exception.Create('繝輔か繝ォ繝?縺御ス懈?蜃コ譚・縺セ縺帙s');
2011 Dir := ExcludeTrailingPathDelimiter(Dir);
2012 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2013 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2014 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2015 end;
2016
2017 (*************************************************************************
2018 *譁?ュ怜?縺九i繝医?繧ッ繝ウ縺ョ蛻?j蜃コ縺暦シ亥?譛溷?逅?シ?/span>
2019 *FDelphi縺九i縺ョ繝代け繝ェ
2020 *************************************************************************)
2021 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2022 begin
2023 Rec.Str := s;
2024 Rec.Pos := 1;
2025 Result := StrTokNext(sep, Rec);
2026 end;
2027
2028 (*************************************************************************
2029 *譁?ュ怜?縺九i繝医?繧ッ繝ウ縺ョ蛻?j蜃コ縺?/span>
2030 *FDelphi縺九i縺ョ繝代け繝ェ
2031 *************************************************************************)
2032 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2033 var
2034 Len, I: Integer;
2035 begin
2036 with Rec do begin
2037 Len := Length(Str);
2038 Result := '';
2039 if Len >= Pos then begin
2040 while (Pos <= Len) and (Str[Pos] in sep) do begin
2041 Inc(Pos);
2042 end;
2043 I := Pos;
2044 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2045 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2046 Inc(Pos);
2047 end;
2048 Inc(Pos);
2049 end;
2050 Result := Copy(Str, I, Pos - I);
2051 while (Pos <= Len) and (Str[Pos] in sep) do begin// 縺薙l縺ッ縺雁・ス縺ソ
2052 Inc(Pos);
2053 end;
2054 end;
2055 end;
2056 end;
2057
2058 (*************************************************************************
2059 *繝輔ぃ繧、繝ォ繧オ繧、繧コ蜿門セ?/span>
2060 *************************************************************************)
2061 function TGikoSys.GetFileSize(FileName : string): longint;
2062 var
2063 F : File;
2064 begin
2065 try
2066 if not FileExists(FileName) then begin
2067 Result := 0;
2068 Exit;
2069 end;
2070 Assign(F, FileName);
2071 Reset(F, 1);
2072 Result := FileSize(F);
2073 CloseFile(F);
2074 except
2075 Result := 0;
2076 end;
2077 end;
2078
2079 (*************************************************************************
2080 *繝輔ぃ繧、繝ォ陦梧焚蜿門セ?/span>
2081 *************************************************************************)
2082 function TGikoSys.GetFileLineCount(FileName : string): longint;
2083 var
2084 sl: TStringList;
2085 begin
2086 sl := TStringList.Create;
2087 try
2088 try
2089 sl.LoadFromFile(FileName);
2090 Result := sl.Count;
2091 except
2092 Result := 0;
2093 end;
2094 finally
2095 sl.Free;
2096 end;
2097
2098 end;
2099
2100 (*************************************************************************
2101 *繧ケ繝ャ繝?ラ繝輔ぃ繧、繝ォ縺九i謖?ョ夊。後r蜿門セ?/span>
2102 *************************************************************************)
2103 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2104 var
2105 fileTmp : TStringList;
2106 begin
2107 Result := '';
2108 if FileExists(FileName) then begin
2109 fileTmp := TStringList.Create;
2110 try
2111 try
2112 fileTmp.LoadFromFile( FileName );
2113 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2114 Result := fileTmp.Strings[ Line-1 ];
2115 end;
2116 except
2117 //on EFOpenError do Result := '';
2118 end;
2119 finally
2120 fileTmp.Free;
2121 end;
2122 end;
2123 end;
2124
2125 (*************************************************************************
2126 *繧キ繧ケ繝?Β繝。繝九Η繝シ繝輔か繝ウ繝医?螻樊?ァ繧貞叙蠕?/span>
2127 *************************************************************************)
2128 procedure TGikoSys.MenuFont(Font: TFont);
2129 var
2130 lf: LOGFONT;
2131 nm: NONCLIENTMETRICS;
2132 begin
2133 nm.cbSize := sizeof(NONCLIENTMETRICS);
2134
2135 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2136 lf := nm.lfMenuFont;
2137
2138 Font.Name := lf.lfFaceName;
2139 Font.Height := lf.lfHeight;
2140 Font.Style := [];
2141 if lf.lfWeight >= 700 then
2142 Font.Style := Font.Style + [fsBold];
2143 if lf.lfItalic = 1 then
2144 Font.Style := Font.Style + [fsItalic];
2145 end;
2146
2147 (*************************************************************************
2148 *
2149 *縺ゥ縺薙°縺ョ繧オ繧、繝医°繧峨?繝代け繝ェ
2150 *************************************************************************)
2151 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2152 var
2153 p: Integer;
2154 begin
2155 p := AnsiPos(delimiter, s);
2156 if p = 0 then
2157 Result := s
2158 else
2159 Result := Copy(s, 1, p - 1);
2160 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2161 end;
2162
2163 (*************************************************************************
2164 *
2165 *縺ゥ縺薙°縺ョ繧オ繧、繝医°繧峨?繝代け繝ェ
2166 *************************************************************************)
2167 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2168 var
2169 i: Integer;
2170 begin
2171 Result := '';
2172 for i := 0 to index do
2173 Result := RemoveToken(s, delimiter);
2174 end;
2175
2176 (*************************************************************************
2177 *
2178 *************************************************************************)
2179 function TGikoSys.DeleteLink(const s: string): string;
2180 var
2181 s1: string;
2182 s2: string;
2183 idx: Integer;
2184 i: Integer;
2185 begin
2186 i := 0;
2187 Result := '';
2188 while True do begin
2189 s1 := GetTokenIndex(s, '<a href="', i);
2190 s2 := GetTokenIndex(s, '<a href="', i + 1);
2191
2192 idx := Pos('">', s1);
2193 if idx <> 0 then
2194 Delete(s1, 1, idx + 1);
2195 idx := Pos('">', s2);
2196 if idx <> 0 then
2197 Delete(s2, 1, idx + 1);
2198
2199 Result := Result + s1 + s2;
2200
2201 if s2 = '' then
2202 Break;
2203
2204 inc(i, 2);
2205 end;
2206 end;
2207
2208 //繧、繝ウ繝?ャ繧ッ繧ケ譛ェ譖エ譁ー繝舌ャ繝輔ぃ繧偵ヵ繝ゥ繝?す繝・??/span>
2209 {procedure TGikoSys.FlashExitWrite;
2210 var
2211 i: Integer;
2212 begin
2213 //繧ケ繝ャ繝?ラ繝??繧ソ繝輔ぃ繧、繝ォ繧呈峩譁ー
2214 for i := 0 to FExitWrite.Count - 1 do
2215 WriteThreadDat(FExitWrite[i]);
2216 FExitWrite.Clear;
2217 end;}
2218
2219 (*************************************************************************
2220 *繧ケ繝ャ蜷阪↑縺ゥ繧堤洒縺?錐蜑阪↓螟画鋤縺吶k
2221 *from HotZonu
2222 *************************************************************************)
2223 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2224 const
2225 ERASECHAR : array [1..39] of string =
2226 ('笘?#39;,'笘?#39;,'笆?','笆。','笳?#39;,'笳?#39;,'?ソ','??#39;,'笆イ','笆シ',
2227 '笆ウ','笆ス','笳?#39;,'笳?#39;,'笳?#39;,'縲?#39;,'縲?#39;,'笙ェ','縲?#39;,'縲?#39;,
2228 '窶?#39;,'窶?#39;,'縲?#39;,'縲?#39;,'窶?#39;,'窶?#39;,'??#39;,'??#39;,'竕ェ','竕ォ',
2229 '??#39;,'??#39;,'縲?#39;,'縲?#39;,'縲?#39;,'縲?#39;,'縲?#39;,'窶ヲ', '縲?');
2230 var
2231 Chr : array [0..255] of char;
2232 S : string;
2233 i : integer;
2234 begin
2235 s := Trim(LongName);
2236 if (Length(s) <= ALength) then begin
2237 Result := s;
2238 end else begin
2239 S := s;
2240 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2241 S := CustomStringReplace(S, ERASECHAR[i], '');
2242 end;
2243 if (Length(S) <= ALength) then begin
2244 Result := S;
2245 end else begin
2246 Windows.LCMapString(
2247 GetUserDefaultLCID(),
2248 LCMAP_HALFWIDTH,
2249 PChar(S),
2250 Length(S) + 1,
2251 chr,
2252 Sizeof(chr)
2253 );
2254 S := Chr;
2255 S := Copy(S,1,ALength);
2256 while true do begin
2257 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2258 S := Copy(S, 1, Length(S) - 1);
2259 end else begin
2260 Break;
2261 end;
2262 end;
2263 Result := S;
2264 end;
2265 end;
2266 end;
2267
2268 (*************************************************************************
2269 *
2270 * from HotZonu
2271 *************************************************************************)
2272 function TGikoSys.ConvRes(const Body, Bbs, Key,
2273 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2274 DatToHTML: boolean = false): string;
2275 type
2276 PIndex = ^TIndex;
2277 TIndex = record
2278 FIndexFrom : integer;
2279 FIndexTo : integer;
2280 FNo : string;
2281 end;
2282 const
2283 GT = '&gt;';
2284 SN = '0123456789-';
2285 ZN = '?撰シ托シ抵シ難シ費シ包シ厄シ暦シ假シ吮?';
2286 var
2287 i : integer;
2288 s,r : string;
2289 b : TMbcsByteType;
2290 sw: boolean;
2291 sp: integer;
2292 No: string;
2293 sx: string;
2294 List: TList;
2295 oc : string;
2296 st, et: string;
2297 chk : boolean;
2298 al : boolean;
2299 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2300 var
2301 FIndex : PIndex;
2302 begin
2303 New(FIndex);
2304 FIndex.FIndexFrom := IndexFrom;
2305 FIndex.FIndexTo := IndexTo;
2306 FIndex.FNo := No;
2307 List.Add(FIndex);
2308 end;
2309 function ChooseString(const Text, Separator: string; Index: integer): string;
2310 var
2311 S : string;
2312 i, p : integer;
2313 begin
2314 S := Text;
2315 for i := 0 to Index - 1 do begin
2316 if (AnsiPos(Separator, S) = 0) then S := ''
2317 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2318 end;
2319 p := AnsiPos(Separator, S);
2320 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2321 end;
2322 begin
2323 { v1.0 b2 - 03 }
2324 s := Body;
2325 r := Body;
2326 i := 1;
2327 sw := False;
2328 No := '';
2329 List:= TList.Create;
2330 oc := '';
2331 sp := 0;
2332 chk := False;
2333 al := False;
2334 while true do begin
2335 b := ByteType(s, i);
2336 case b of
2337 mbSingleByte : begin
2338 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2339 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2340 sw := True;
2341 sp := i;
2342 i := i + 7;
2343 oc:='';
2344 chk := True;
2345 end;
2346 end else
2347 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2348 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2349 i := i + 7;
2350 oc:='';
2351 chk := True;
2352 end;
2353 end else
2354 if (not sw) and (Copy(s,i,4) = GT) then begin
2355 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2356 sw := True;
2357 sp := i;
2358 i := i + 3;
2359 oc:='';
2360 chk := True;
2361 end;
2362 end else
2363 if ((not sw) and (Copy(s,i,1) = ',')) or
2364 ((not sw) and (Copy(s,i,1) = '=')) then begin
2365 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2366 ((Chk) and (oc = '')) or
2367 ((not Chk) and (al)) then
2368 begin
2369 sw := True;
2370 sp := i;
2371 //i := i + 1;
2372 oc:='';
2373 end;
2374 end else
2375 if (sw) then begin
2376 sx := Copy(s,i,1);
2377 if (AnsiPos(sx, SN) > 0) then begin
2378 No := No + sx;
2379 end else begin
2380 if (No <> '') and (No <> '-') then begin
2381 Add(sp, i, No);
2382 al := True;
2383 end;
2384 sw := False;
2385 //
2386 i := i - 1;
2387 //
2388 No := '';
2389 oc:='';
2390 //chk := False;
2391 end;
2392 end else begin
2393 if Copy(s,i,1) = '<' then oc := '';
2394 oc := oc + Copy(s,i,1);
2395 chk := False;
2396 al := False;
2397 end;
2398 end;
2399 mbLeadByte : begin
2400 if (not sw) and (Copy(s,i,4) = '?橸シ?#39;) then begin
2401 sw := True;
2402 sp := i;
2403 i := i + 3;
2404 chk := True;
2405 end else
2406 if (not sw) and (Copy(s,i,2) = '??#39;) then begin
2407 sw := True;
2408 sp := i;
2409 i := i + 1;
2410 chk := True;
2411 end else
2412 if (sw) then begin
2413 sx := Copy(s,i,2);
2414 if (AnsiPos(sx, ZN) > 0) then begin
2415 No := No + ZenToHan(sx);
2416 end else begin
2417 if (No <> '') and (No <> '-') and (No <> '竏?#39;) then begin
2418 Add(sp, i, No);
2419 end;
2420 sw := False;
2421 i := i - 1;
2422 No := '';
2423 end;
2424 end else begin
2425 oc := '';
2426 chk := False;
2427 end;
2428 al := False;
2429 end;
2430 end;
2431 inc(i);
2432 if (i > Length(Body)) then begin
2433 if (sw) then begin
2434 if (No <> '') then Add(sp, i, No);
2435 end;
2436 Break;
2437 end;
2438 end;
2439 for i := List.Count - 1 downto 0 do begin
2440 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2441 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2442 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2443 end else begin
2444 st := PIndex(List[i]).FNo;
2445 et := PIndex(List[i]).FNo;
2446 end;
2447 if not DatToHTML then
2448 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2449 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2450 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2451 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2452 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2453 else
2454 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2455 Format('<a href="#%s">', [st]) +
2456 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2457 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2458
2459 Dispose(PIndex(List[i]));
2460 end;
2461 List.Free;
2462 Result := r;
2463 end;
2464
2465 function TGikoSys.ConvRes(
2466 const Body, Bbs, Key, ParamBBS, ParamKey,
2467 ParamStart, ParamTo, ParamNoFirst,
2468 ParamTrue, FullURL : string
2469 ): string;
2470 type
2471 PIndex = ^TIndex;
2472 TIndex = record
2473 FIndexFrom : integer;
2474 FIndexTo : integer;
2475 FNo : string;
2476 end;
2477 const
2478 GT = '&gt;';
2479 SN = '0123456789-';
2480 ZN = '?撰シ托シ抵シ難シ費シ包シ厄シ暦シ假シ吮?';
2481 var
2482 i : integer;
2483 s,r : string;
2484 b : TMbcsByteType;
2485 sw: boolean;
2486 sp: integer;
2487 No: string;
2488 sx: string;
2489 List: TList;
2490 oc : string;
2491 st, et: string;
2492 chk : boolean;
2493 al : boolean;
2494 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2495 var
2496 FIndex : PIndex;
2497 begin
2498 New(FIndex);
2499 FIndex.FIndexFrom := IndexFrom;
2500 FIndex.FIndexTo := IndexTo;
2501 FIndex.FNo := No;
2502 List.Add(FIndex);
2503 end;
2504 function ChooseString(const Text, Separator: string; Index: integer): string;
2505 var
2506 S : string;
2507 i, p : integer;
2508 begin
2509 S := Text;
2510 for i := 0 to Index - 1 do begin
2511 if (AnsiPos(Separator, S) = 0) then S := ''
2512 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2513 end;
2514 p := AnsiPos(Separator, S);
2515 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2516 end;
2517 begin
2518 { v1.0 b2 - 03 }
2519 s := Body;
2520 r := Body;
2521 i := 1;
2522 sw := False;
2523 No := '';
2524 List:= TList.Create;
2525 oc := '';
2526 sp := 0;
2527 chk := False;
2528 al := False;
2529 while true do begin
2530 b := ByteType(s, i);
2531 case b of
2532 mbSingleByte : begin
2533 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2534 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2535 sw := True;
2536 sp := i;
2537 i := i + 7;
2538 oc:='';
2539 chk := True;
2540 end;
2541 end else
2542 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2543 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2544 i := i + 7;
2545 oc:='';
2546 chk := True;
2547 end;
2548 end else
2549 if (not sw) and (Copy(s,i,4) = GT) then begin
2550 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2551 sw := True;
2552 sp := i;
2553 i := i + 3;
2554 oc:='';
2555 chk := True;
2556 end;
2557 end else
2558 if ((not sw) and (Copy(s,i,1) = ',')) or
2559 ((not sw) and (Copy(s,i,1) = '=')) then begin
2560 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2561 ((Chk) and (oc = '')) or
2562 ((not Chk) and (al)) then
2563 begin
2564 sw := True;
2565 sp := i;
2566 //i := i + 1;
2567 oc:='';
2568 end;
2569 end else
2570 if (sw) then begin
2571 sx := Copy(s,i,1);
2572 if (AnsiPos(sx, SN) > 0) then begin
2573 No := No + sx;
2574 end else begin
2575 if (No <> '') and (No <> '-') then begin
2576 Add(sp, i, No);
2577 al := True;
2578 end;
2579 sw := False;
2580 //
2581 i := i - 1;
2582 //
2583 No := '';
2584 oc:='';
2585 //chk := False;
2586 end;
2587 end else begin
2588 if Copy(s,i,1) = '<' then oc := '';
2589 oc := oc + Copy(s,i,1);
2590 chk := False;
2591 al := False;
2592 end;
2593 end;
2594 mbLeadByte : begin
2595 if (not sw) and (Copy(s,i,4) = '?橸シ?#39;) then begin
2596 sw := True;
2597 sp := i;
2598 i := i + 3;
2599 chk := True;
2600 end else
2601 if (not sw) and (Copy(s,i,2) = '??#39;) then begin
2602 sw := True;
2603 sp := i;
2604 i := i + 1;
2605 chk := True;
2606 end else
2607 if (sw) then begin
2608 sx := Copy(s,i,2);
2609 if (AnsiPos(sx, ZN) > 0) then begin
2610 No := No + ZenToHan(sx);
2611 end else begin
2612 if (No <> '') and (No <> '-') and (No <> '竏?#39;) then begin
2613 Add(sp, i, No);
2614 end;
2615 sw := False;
2616 i := i - 1;
2617 No := '';
2618 end;
2619 end else begin
2620 oc := '';
2621 chk := False;
2622 end;
2623 al := False;
2624 end;
2625 end;
2626 inc(i);
2627 if (i > Length(Body)) then begin
2628 if (sw) then begin
2629 if (No <> '') then Add(sp, i, No);
2630 end;
2631 Break;
2632 end;
2633 end;
2634 for i := List.Count - 1 downto 0 do begin
2635 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2636 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2637 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2638 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2639 end else begin
2640 st := PIndex(List[i]).FNo;
2641 et := PIndex(List[i]).FNo;
2642 end;
2643 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2644 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2645 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2646 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2647 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2648 Dispose(PIndex(List[i]));
2649 end;
2650 List.Free;
2651 Result := r;
2652 end;
2653
2654
2655 function TGikoSys.BoolToInt(b: Boolean): Integer;
2656 begin
2657 Result := IfThen(b, 1, 0);
2658 end;
2659
2660 function TGikoSys.IntToBool(i: Integer): Boolean;
2661 begin
2662 Result := i = 1;
2663 end;
2664
2665 //gzip縺ァ蝨ァ邵ョ縺輔l縺溘?繧呈綾縺?/span>
2666 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2667 const
2668 BUF_SIZE = 4096;
2669 var
2670 GZipStream: TGzipDecompressStream;
2671 TextStream: TStringStream;
2672 buf: array[0..BUF_SIZE - 1] of Byte;
2673 cnt: Integer;
2674 s: string;
2675 i: Integer;
2676 begin
2677 Result := '';
2678 TextStream := TStringStream.Create('');
2679 try
2680 //繝弱?繝医Φ繧ヲ繝ウ繝√え繧」繝ォ繧ケ2003蟇セ遲?x-gzip縺ィ縺九↓縺ェ繧九∩縺溘>)
2681 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2682 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2683 ResStream.Position := 0;
2684 GZipStream := TGzipDecompressStream.Create(TextStream);
2685 try
2686 repeat
2687 FillChar(buf, BUF_SIZE,