6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
22 TGikoBBSType = (gbt2ch);
23 //
\83\8d\83O
\83^
\83C
\83v
24 TGikoLogType = (glt2chNew, glt2chOld);
25 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
26 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
27 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
28 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
31 TStrTokSeparator = set of Char;
37 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
45 FRoundDate: TDateTime;
46 FLastModified: TDateTime;
49 FMishiyou: Boolean; //
\96¢
\8eg
\97p
53 FAllResCount: Integer;
54 FNewResCount: Integer;
55 FAgeSage: TGikoAgeSage;
58 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
65 //
\83\8c\83X
\83\8c\83R
\81[
\83h
75 //URLPath
\83\8c\83R
\81[
\83h
78 FKey: string; //ThreadID
79 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
80 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
81 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
82 FStBegin: Boolean; //1
\81`
\95\
\8e¦
83 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
84 FDone: Boolean; //
\90¬
\8c÷
85 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
88 TGikoSys = class(TObject)
95 FBayesian : TGikoBayesian; //!<
\83x
\83C
\83W
\83A
\83\93\83t
\83B
\83\8b\83^
97 // FExitWrite: TStringList;
98 // function StrToFloatDef(s: string; Default: Double): Double;
99 function SetUserOptionalStyle(): string;
103 FSelectResFilter : TAbon;
104 FBoardURLList: TStringList;
107 destructor Destroy; override;
108 property ResRange : Longint read FResRange write FResRange;
109 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
110 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
111 function IsNumeric(s: string): boolean;
112 function IsFloat(s: string): boolean;
113 function DirectoryExistsEx(const Name: string): Boolean;
114 function ForceDirectoriesEx(Dir: string): Boolean;
115 // function GetVersion: string;
117 function GetBoardFileName: string;
118 function GetCustomBoardFileName: string;
119 function GetHtmlTempFileName: string;
120 function GetAppDir: string;
121 function GetTempFolder: string;
122 function GetSentFileName: string;
123 function GetConfigDir: string;
124 function GetSkinDir: string;
125 function GetSkinHeaderFileName: string;
126 function GetSkinFooterFileName: string;
127 function GetSkinResFileName: string;
128 function GetSkinNewResFileName: string;
129 function GetSkinBookmarkFileName: string;
130 function GetSkinNewmarkFileName: string;
131 function GetStyleSheetDir: string;
132 function GetOutBoxFileName: string;
133 function GetUserAgent: string;
134 function GetSambaFileName : string;
136 procedure ReadSubjectFile(Board: TBoard);
137 procedure CreateThreadDat(Board: TBoard);
138 procedure WriteThreadDat(Board: TBoard);
139 function ParseIndexLine(Line: string): TIndexRec;
140 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
141 procedure GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean); overload;//
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
142 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
144 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
145 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
146 function AddAnchorTag(s: string): string;
148 function DivideSubject(Line: string): TSubjectRec;
149 function DivideStrLine(Line: string): TResRec;
151 property Setting: TSetting read FSetting write FSetting;
152 property Dolib: TDolib read FDolib write FDolib;
154 function UrlToID(url: string): string;
155 function UrlToServer(url: string): string;
157 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
158 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
160 function GetFileSize(FileName : string) : longint;
161 function GetFileLineCount(FileName : string): longint;
162 function Get2chDate(aDate: TDateTime): string;
163 function IntToDateTime(val: Int64): TDateTime;
164 function DateTimeToInt(ADate: TDateTime): Int64;
166 function ReadThreadFile(FileName: string; Line: Integer): string;
168 procedure MenuFont(Font: TFont);
170 function RemoveToken(var s:string; const delimiter:string):string;
171 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
172 function DeleteLink(const s: string): string;
174 function GetShortName(const LongName: string; ALength: integer): string;
175 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
176 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
177 function ConvertResAnchor(res: string): string;
178 function BoolToInt(b: Boolean): Integer;
179 function IntToBool(i: Integer): Boolean;
180 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
181 procedure LoadKeySetting(ActionList: TActionList);
182 procedure SaveKeySetting(ActionList: TActionList);
183 procedure LoadEditorKeySetting(ActionList: TActionList);
184 procedure SaveEditorKeySetting(ActionList: TActionList);
186 procedure CreateProcess(const AppPath: string; const Param: string);
187 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
188 function HTMLDecode(const AStr: String): String;
189 function GetHRefText(s: string): string;
190 function Is2chHost(Host: string): Boolean;
191 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
192 function Parse2chURL2(URL: string): TPathRec;
193 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
194 function GetVersionBuild: Integer;
195 function GetBrowsableThreadURL( inURL : string ) : string;
196 function GetThreadURL2BoardURL( inURL : string ) : string;
197 function Get2chThreadURL2BoardURL( inURL : string ) : string;
198 function Get2chBrowsableThreadURL( inURL : string ) : string;
199 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
200 procedure ListBoardFile;
201 procedure ReadBoardFile( bbs : TBBS );
203 function GetUnknownCategory : TCategory;
204 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
206 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
208 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
209 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
210 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
211 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
213 //Samba24
\82Ì
\83t
\83@
\83C
\83\8b\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\81B
\91¶
\8dÝ
\82µ
\82È
\82¢
\8fê
\8d\87\81Adefault
\83t
\83@
\83C
\83\8b\82ðrename
\82·
\82é
214 procedure SambaFileExists();
216 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
217 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string; overload;
218 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string; overload;
219 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
220 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
222 procedure SpamCountWord( const text : string; wordCount : TWordCount );
223 //!
\8aw
\8fK
\83N
\83\8a\83A
224 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
225 //!
\83X
\83p
\83\80\8aw
\8fK
226 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
227 //!
\83X
\83p
\83\80\93x
\90\94
228 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
229 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
230 function NotDateorTimeString(const AStr : string): boolean;
236 //LENGTH_RESTITLE = 40;
237 ZERO_DATE: Integer = 25569;
238 BETA_VERSION_NAME_E = 'beta';
239 BETA_VERSION_NAME_J = 'ÊÞÀ';
241 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
242 APP_NAME = 'gikoNavi';
247 Giko, RoundData, Favorite;
250 FOLDER_INDEX_VERSION = '1.01';
251 USER_AGENT = 'Monazilla';
252 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
253 NGWORDs_DIR_NAME : String = 'NGwords';
255 READ_PATH: string = '/test/read.cgi/';
256 OLD_READ_PATH: string = '/test/read.cgi?';
257 KAKO_PATH: string = '/kako/';
259 (*************************************************************************
260 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
261 *************************************************************************)
262 constructor TGikoSys.Create;
264 FSetting := TSetting.Create;
265 FDolib := TDolib.Create;
266 FAWKStr := TAWKStr.Create(nil);
267 if DirectoryExists(GetConfigDir) = false then begin
268 CreateDir(GetConfigDir);
270 FAbon := TAbon.Create;
271 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
273 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
274 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
275 FAbon.DeleteSyria := FSetting.DeleteSyria;
276 FAbon.Deleterlo := FSetting.AbonDeleterlo;
277 FAbon.Replaceul := FSetting.AbonReplaceul;
278 FAbon.AbonPopupRes := FSetting.PopUpAbon;
280 FSelectResFilter := TAbon.Create;
281 //
\8di
\82è
\8d\9e\82Þ
\82Æ
\82«
\82Í
\8bÉ
\97Í
\88ê
\97\97\82ª
\8c©
\82ç
\82ê
\82é
\82Ù
\82¤
\82ª
\82¢
\82¢
\82Ì
\82Å
\91¼
\82Í
\8a®
\91S
\82É
\8dí
\8f\9c
282 FSelectResFilter.AbonString := '';
284 ResRange := FSetting.ResRange;
285 FBayesian := TGikoBayesian.Create;
286 FBoardURLList := TStringList.Create;
289 (*************************************************************************
290 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
291 *************************************************************************)
292 destructor TGikoSys.Destroy;
295 FileList: TStringList;
297 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
306 FSelectResFilter.Free;
308 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
309 FileList := TStringList.Create;
311 GetFileList(GetTempFolder, '*.html', FileList, False, True);
312 for i := 0 to FileList.Count - 1 do begin
313 DeleteFile(FileList[i]);
321 (*************************************************************************
322 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
323 *************************************************************************)
325 function TGikoSys.IsNumeric(s: string): boolean;
335 (*************************************************************************
336 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
337 *************************************************************************)
338 function TGikoSys.IsFloat(s: string): boolean;
342 Result := TextToFloat(PChar(s), v, fvExtended);
345 (*************************************************************************
346 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
347 *************************************************************************)
348 function TGikoSys.GetBoardFileName: string;
350 Result := Setting.GetBoardFileName;
353 (*************************************************************************
354 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
355 *************************************************************************)
356 function TGikoSys.GetCustomBoardFileName: string;
358 Result := Setting.GetCustomBoardFileName;
361 (*************************************************************************
362 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
363 *************************************************************************)
364 function TGikoSys.GetHtmlTempFileName: string;
366 Result := Setting.GetHtmlTempFileName;
370 (*************************************************************************
371 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
372 *************************************************************************)
373 function TGikoSys.GetAppDir: string;
375 Result := Setting.GetAppDir;
378 (*************************************************************************
379 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
380 *************************************************************************)
381 function TGikoSys.GetTempFolder: string;
383 Result := Setting.GetTempFolder;
386 (*************************************************************************
387 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
388 *************************************************************************)
389 function TGikoSys.GetSentFileName: string;
391 Result := Setting.GetSentFileName;
394 (*************************************************************************
395 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
396 *************************************************************************)
397 function TGikoSys.GetOutBoxFileName: string;
399 Result := Setting.GetOutBoxFileName;
402 (*************************************************************************
403 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
404 *************************************************************************)
405 function TGikoSys.GetConfigDir: string;
407 Result := Setting.GetConfigDir;
410 function TGikoSys.GetStyleSheetDir: string;
412 Result := Setting.GetStyleSheetDir;
415 function TGikoSys.GetSkinDir: string;
417 Result := Setting.GetSkinDir;
420 function TGikoSys.GetSkinHeaderFileName: string;
422 Result := Setting.GetSkinHeaderFileName;
425 function TGikoSys.GetSkinFooterFileName: string;
427 Result := Setting.GetSkinFooterFileName;
430 function TGikoSys.GetSkinNewResFileName: string;
432 Result := Setting.GetSkinNewResFileName;
435 function TGikoSys.GetSkinResFileName: string;
437 Result := Setting.GetSkinResFileName;
440 function TGikoSys.GetSkinBookmarkFileName: string;
442 Result := Setting.GetSkinBookmarkFileName;
445 function TGikoSys.GetSkinNewmarkFileName: string;
447 Result := Setting.GetSkinNewmarkFileName;
451 function TGikoSys.GetUserAgent: string;
453 if Dolib.Connected then begin
454 Result := Format('%s %s/%s%d%s', [
461 BETA_VERSION_BUILD]);
463 Result := Format('%s/%s %s/%s%d%s', [
471 BETA_VERSION_BUILD]);
475 (*************************************************************************
476 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
477 *************************************************************************)
478 function TGikoSys.Get2chDate(aDate: TDateTime): string;
483 d1 := EncodeDate(1970, 1, 1);
484 d2 := aDate - EncodeTime(9, 0, 0, 0);
485 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
486 Result := FloatToStr(Trunc((d2 - d1) * 86400));
490 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
495 d1 := EncodeDate(1970, 1, 1);
496 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
500 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
505 d := EncodeDate(1970, 1, 1);
506 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
511 (*************************************************************************
512 *Subject
\83t
\83@
\83C
\83\8bRead
513 *************************************************************************)
514 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
516 ThreadItem: TThreadItem;
518 FileList: TStringList;
519 TmpFileList: TStringList;
527 RoundItem: TRoundItem;
532 FavoThreadItem : TFavoriteThreadItem;
536 if Board.IsThreadDatRead then
541 usePlugIn := Board.IsBoardPlugInAvailable;
543 FileName := Board.GetFolderIndexFileName;
545 FileList := TStringList.Create;
546 FileList.Sorted := True;
547 TmpFileList := TStringList.Create;
548 TmpFileList.Sorted := True;
550 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
551 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
552 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
553 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
555 //
\8fd
\95¡
\82ð
\96h
\82®
557 Board.Sorted := True;
559 sl := TStringList.Create;
561 if FileExists(FileName) then begin
562 sl.LoadFromFile(FileName);
564 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
565 for i := sl.Count - 1 downto 1 do begin
566 Rec := ParseIndexLine(sl[i]);
568 ThreadItem := TThreadItem.Create(
570 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
572 ThreadItem := TThreadItem.Create(
574 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
576 if FileList.Count <> 0 then
577 if FileList.Find( ThreadItem.FileName, Index ) then
578 FileList.Delete( Index );
580 ThreadItem.BeginUpdate;
581 ThreadItem.No := Rec.FNo;
582 ThreadItem.FileName := Rec.FFileName;
583 ThreadItem.Title := Rec.FTitle;
584 //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
585 ThreadItem.Count := Rec.FCount;
586 ThreadItem.Size := Rec.FSize;
587 // ThreadItem.RoundNo := Rec.FRoundNo;
588 ThreadItem.RoundDate := Rec.FRoundDate;
589 ThreadItem.LastModified := Rec.FLastModified;
590 ThreadItem.Kokomade := Rec.FKokomade;
591 ThreadItem.NewReceive := Rec.FNewReceive;
592 // ThreadItem.Round := Rec.FRound;
593 ThreadItem.UnRead := Rec.FUnRead;
594 ThreadItem.ScrollTop := Rec.FScrollTop;
595 ThreadItem.AllResCount := Rec.FAllResCount;
596 ThreadItem.NewResCount := Rec.FNewResCount;
597 ThreadItem.AgeSage := Rec.FAgeSage;
598 ThreadItem.ParentBoard := Board;
599 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
601 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
602 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
605 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
606 if ThreadItem.IsLogFile then begin
607 idx := RoundList.Find(ThreadItem);
608 if idx <> -1 then begin
609 RoundItem := RoundList.Items[idx, grtItem];
610 ThreadItem.RoundName := RoundItem.RoundName;
611 ThreadItem.Round := True;
615 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
616 if TmpFileList.Count <> 0 then begin
617 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
618 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
620 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
621 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
623 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
624 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
625 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
626 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
628 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
629 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
631 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
637 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
638 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
639 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
640 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
641 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
642 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
646 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
647 TmpFileList.Delete(Index);
651 ThreadItem.EndUpdate;
652 Board.Add(ThreadItem);
654 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
659 if UnRead <> Board.UnRead then
660 Board.UnRead := UnRead;
662 //
\83C
\83\93\83f
\83b
\83N
\83X
\82É
\96³
\82©
\82Á
\82½
\83\8d\83O
\82ð
\92Ç
\89Á
\81i
\95\85\82ê
\83C
\83\93\83f
\83b
\83N
\83X
\91Î
\89\9e\81j
663 for i := 0 to FileList.Count - 1 do begin
664 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
666 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
667 if usePlugIn then begin
668 ThreadItem := TThreadItem.Create(
670 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
671 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
673 ThreadItem := TThreadItem.Create(
674 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
675 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
678 ThreadItem.BeginUpdate;
679 ThreadItem.FilePath := FileName;
680 ThreadItem.No := Board.Count + 1;
681 ThreadItem.FileName := FileList[i];
682 ThreadItem.Title := ResRec.FTitle;
683 ThreadItem.Count := GetFileLineCount(FileName);
684 ThreadItem.AllResCount := ThreadItem.Count;
685 ThreadItem.NewResCount := ThreadItem.Count;
686 ThreadItem.Size := GetFileSize(FileName) - ThreadItem.Count;//1byte
\82¸
\82ê
\82é
\82Æ
\82«
\82ª
\82 \82é
\82¯
\82Ç
\82»
\82ê
\82Í
\82 \82«
\82ç
\82ß
\82é
687 ThreadItem.RoundDate := ZERO_DATE;
688 ThreadItem.LastModified := ZERO_DATE;
689 ThreadItem.Kokomade := -1;
690 ThreadItem.NewReceive := ThreadItem.Count;
691 ThreadItem.ParentBoard := Board;
692 ThreadItem.IsLogFile := True;
693 ThreadItem.Round := False;
694 ThreadItem.UnRead := False;
695 ThreadItem.ScrollTop := 0;
696 ThreadItem.AgeSage := gasNone;
697 ThreadItem.EndUpdate;
698 Board.Add(ThreadItem);
705 Board.Sorted := False;
707 Board.IsThreadDatRead := True;
710 (*************************************************************************
711 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
712 *************************************************************************)
713 procedure TGikoSys.CreateThreadDat(Board: TBoard);
717 SubjectList: TStringList;
723 if not FileExists(Board.GetSubjectFileName) then Exit;
724 FileName := Board.GetFolderIndexFileName;
726 SubjectList := TStringList.Create;
728 SubjectList.LoadFromFile(Board.GetSubjectFileName);
729 sl := TStringList.Create;
732 sl.Add(FOLDER_INDEX_VERSION);
733 for i := 0 to SubjectList.Count - 1 do begin
734 Rec := DivideSubject(SubjectList[i]);
736 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
739 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
740 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
741 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
742 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
743 + Format('%x', [0]) + #1 //size
744 + Format('%x', [0]) + #1 //RoundDate
745 + Format('%x', [0]) + #1 //LastModified
746 + Format('%x', [0]) + #1 //Kokomade
747 + Format('%x', [0]) + #1 //NewReceive
748 + '0' + #1 //
\96¢
\8eg
\97p
749 + Format('%x', [0]) + #1 //UnRead
750 + Format('%x', [0]) + #1 //ScrollTop
751 + Format('%x', [Rec.FCount]) + #1 //AllResCount
752 + Format('%x', [0]) + #1 //NewResCount
753 + Format('%x', [0]); //AgeSage
758 sl.SaveToFile(FileName);
767 (*************************************************************************
768 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
770 *************************************************************************)
771 procedure TGikoSys.WriteThreadDat(Board: TBoard);
773 // Values: array[Boolean] of string = ('0', '1');
779 TmpFileList: TStringList;
781 if not Board.IsThreadDatRead then
783 FileName := Board.GetFolderIndexFileName;
784 ForceDirectoriesEx( ExtractFilePath( FileName ) );
786 sl := TStringList.Create;
787 TmpFileList := TStringList.Create;
788 TmpFileList.Sorted := true;
790 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
792 sl.Add(FOLDER_INDEX_VERSION);
794 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
795 Sort.SortNoFlag := true;
796 Sort.SortOrder := true;
798 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
799 Board.CustomSort(ThreadItemSortProc);
801 for i := 0 to Board.Count - 1 do begin
802 Board.Items[i].No := i + 1;
803 s := Format('%x', [Board.Items[i].No]) + #1
804 + Board.Items[i].FileName + #1
805 + Board.Items[i].Title + #1
806 + Format('%x', [Board.Items[i].Count]) + #1
807 + Format('%x', [Board.Items[i].Size]) + #1
808 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
809 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
810 + Format('%x', [Board.Items[i].Kokomade]) + #1
811 + Format('%x', [Board.Items[i].NewReceive]) + #1
812 + '0' + #1 //
\96¢
\8eg
\97p
813 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
814 + Format('%x', [Board.Items[i].ScrollTop]) + #1
815 + Format('%x', [Board.Items[i].AllResCount]) + #1
816 + Format('%x', [Board.Items[i].NewResCount]) + #1
817 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
822 sl.SaveToFile(FileName);
824 for i := 0 to TmpFileList.Count - 1 do begin
825 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
834 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
836 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
837 Result.FFileName := RemoveToken(Line, #1);
838 Result.FTitle := RemoveToken(Line, #1);
839 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
840 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
841 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
842 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
843 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
844 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
845 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
846 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
847 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
848 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
849 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
850 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
854 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
855 // ListFiles('c:\', '*.txt', list, True);
856 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
859 SearchRec : TSearchRec;
863 maskExt := Copy(Mask, 1, Length(Mask) - 1);
865 Path := IncludeTrailingPathDelimiter(Path);
866 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
868 while rc = 0 do begin
869 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
870 s := Path + SearchRec.Name;
871 //if (SearchRec.Attr and faDirectory > 0) then
872 // s := IncludeTrailingPathDelimiter(s)
874 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
878 List.Add(SearchRec.Name);
879 if SubDir and (SearchRec.Attr and faDirectory > 0) then
880 GetFileList(s, Mask, List, True, IsPathAdd);
882 rc := FindNext(SearchRec);
885 SysUtils.FindClose(SearchRec);
889 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
890 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
891 // ListFiles('c:\', '*.txt', list, True);
892 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
895 SearchRec : TSearchRec;
898 Path := IncludeTrailingPathDelimiter(Path);
899 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
901 while rc = 0 do begin
902 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
903 s := Path + SearchRec.Name;
905 if (SearchRec.Attr and faDirectory = 0) then
909 List.Add(SearchRec.Name);
911 rc := FindNext(SearchRec);
914 SysUtils.FindClose(SearchRec);
918 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\83f
\83B
\83\8c\83N
\83g
\83\8a\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
919 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
922 SearchRec : TSearchRec;
925 Path := IncludeTrailingPathDelimiter(Path);
926 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
928 while rc = 0 do begin
929 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
930 s := Path + SearchRec.Name;
931 //if (SearchRec.Attr and faDirectory > 0) then
932 // s := IncludeTrailingPathDelimiter(s)
934 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
935 List.Add( IncludeTrailingPathDelimiter( s ) );
936 if SubDir and (SearchRec.Attr and faDirectory > 0) then
937 GetDirectoryList(s, Mask, List, True);
939 rc := FindNext(SearchRec);
942 SysUtils.FindClose(SearchRec);
946 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
947 function TGikoSys.LoadFromSkin(
949 ThreadItem: TThreadItem;
956 Skin := TStringList.Create;
958 if FileExists( fileName ) then begin
959 Skin.LoadFromFile( fileName );
961 //
\82â
\82è
\82©
\82½
\82ª
\8bê
\82µ
\82¢
\82¯
\82Ç
\81A
\83I
\83v
\83V
\83\87\83\93\83_
\83C
\83A
\83\8d\83O
\82Ì
\83v
\83\8c\83r
\83\85\81[
\97p try
963 if ThreadItem.ParentBoard <> nil then
964 if ThreadItem.ParentBoard.ParentCategory <> nil then
965 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
966 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
968 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
969 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
970 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
971 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
972 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
973 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
974 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
976 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
977 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
978 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
980 //-----
\82Æ
\82è
\82 \82¦
\82¸
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
981 //
\82â
\82è
\82©
\82½
\82ª
\8bê
\82µ
\82¢
\82¯
\82Ç
\81A
\83I
\83v
\83V
\83\87\83\93\83_
\83C
\83A
\83\8d\83O
\82Ì
\83v
\83\8c\83r
\83\85\81[
\97p try
983 if ThreadItem.ParentBoard <> nil then
984 if ThreadItem.ParentBoard.ParentCategory <> nil then
985 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
986 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
988 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
989 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
990 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
991 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
992 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
993 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
994 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
996 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
997 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
998 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
999 //-----
\82±
\82±
\82Ü
\82Å
1001 Result := Skin.Text;
1007 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1008 function TGikoSys.SkinedRes(
1014 spamminess : Extended;
1015 wordCount : TWordCount;
1018 wordCount := TWordCount.Create;
1020 spamminess := Floor( SpamParse(
1021 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1023 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1024 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1025 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1026 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1027 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1028 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1029 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1030 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1031 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1032 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1033 Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
1035 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1036 Skin := CustomStringReplace( Skin, '&NUMBER',
1037 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1038 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1039 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1040 Skin := CustomStringReplace( Skin, '&MAILNAME',
1041 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1042 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1043 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1044 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1045 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1046 Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
1047 //-----
\82±
\82±
\82Ü
\82Å
1056 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1060 //bufList : TStringList;
1061 ReadList: TStringList;
1062 SaveList: TStringList;
1063 CSSFileName: string;
1066 NewReceiveNo: Integer;
1068 boardPlugIn : TBoardPlugIn;
1070 UserOptionalStyle: string;
1077 function LoadSkin( fileName: string ): string;
1079 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1081 function ReplaceRes( skin: string ): string;
1083 Result := SkinedRes( skin, Res, No );
1086 if ThreadItem <> nil then begin
1087 if ThreadItem.IsBoardPlugInAvailable then begin
1088 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1089 boardPlugIn := ThreadItem.BoardPlugIn;
1090 NewReceiveNo := ThreadItem.NewReceive;
1091 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1092 UserOptionalStyle := SetUserOptionalStyle;
1093 SaveList := TStringList.Create;
1096 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1097 // doc.charset := 'Shift_JIS';
1100 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1101 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1103 SaveList.Add('<p id="idSearch"></p>');
1104 for i := 0 to threadItem.Count - 1 do begin
1105 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1106 if i <> 0 then begin
1107 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1110 if ThreadItem.Kokomade > (i + 1) then
1113 if NewReceiveNo > (i + 1) then
1116 if (threadItem.Count - i) > ResRange then
1121 //
\90V
\92\85\83}
\81[
\83N
1122 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1124 if GikoSys.Setting.UseSkin then begin
1125 if FileExists( GetSkinNewmarkFileName ) then
1126 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1128 SaveList.Add( '<a name="new"></a>' );
1129 end else if GikoSys.Setting.UseCSS then begin
1130 SaveList.Add('<a name="new"></a><div class="new">
\90V
\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1132 SaveList.Add('</dl>');
1133 SaveList.Add('<a name="new"></a>');
1134 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>
\90V
\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1135 SaveList.Add('<dl>');
1138 SaveList.Add( '<a name="new"></a>' );
1143 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1145 if ThreadItem.Kokomade = (i + 1) then begin
1146 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1148 if GikoSys.Setting.UseSkin then begin
1149 if FileExists( GetSkinBookmarkFileName ) then
1150 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1152 SaveList.Add( '<a name="koko"></a>' );
1153 end else if GikoSys.Setting.UseCSS then begin
1154 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1156 SaveList.Add('</dl>');
1157 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</b></font></td></tr></table>');
1158 SaveList.Add('<dl>');
1161 SaveList.Add( '<a name="koko"></a>' );
1165 doc.Write(SaveList.Text);
1170 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1171 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1172 doc.Write(SaveList.Text);
1181 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1182 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1183 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1184 ShortDayNames[7] := '
\93y';
1185 BBSID := ThreadItem.ParentBoard.BBSID;
1186 NewReceiveNo := ThreadItem.NewReceive;
1187 ReadList := TStringList.Create;
1189 if ThreadItem.IsLogFile then begin
1190 FileName := ThreadItem.GetThreadFileName;
1191 ReadList.LoadFromFile(FileName);
1192 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1193 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1194 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1195 Res := DivideStrLine(ReadList[0]);
1196 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1197 sTitle := Res.FTitle;
1199 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1201 SaveList := TStringList.Create;
1204 doc.charset := 'Shift_JIS';
1206 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1207 UserOptionalStyle := SetUserOptionalStyle;
1208 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1209 if GikoSys.Setting.UseSkin then begin
1210 //
\83X
\83L
\83\93\8eg
\97p
1211 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1213 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1214 if Length( UserOptionalStyle ) > 0 then
1215 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1216 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1217 SaveList.Add( SkinHeader );
1221 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1225 SkinRes := LoadSkin( GetSkinResFileName );
1228 SaveList.Add('<p id="idSearch"></p>');
1229 SaveList.Add('<a name="top"></a>');
1231 for i := 0 to ReadList.Count - 1 do begin
1232 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1233 if i <> 0 then begin
1234 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1237 if ThreadItem.Kokomade > (i + 1) then
1240 if NewReceiveNo > (i + 1) then
1243 if (threadItem.Count - i) > ResRange then
1248 //
\90V
\92\85\83}
\81[
\83N
1249 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1251 if FileExists( GetSkinNewmarkFileName ) then
1252 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1254 SaveList.Add( '<a name="new"></a>' );
1256 SaveList.Add( '<a name="new"></a>' );
1259 if (Trim(ReadList[i]) <> '') then begin
1260 No := IntToStr(i + 1);
1262 Res := DivideStrLine(ReadList[i]);
1263 if Res.FType = glt2chOld then begin
1264 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1265 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1266 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1269 Res.FBody := AddAnchorTag(Res.FBody);
1270 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1273 if NewReceiveNo <= (i + 1) then
1274 //
\90V
\92\85\83\8c\83X
1275 strTmp := ReplaceRes( SkinNewRes )
1277 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1278 strTmp := ReplaceRes( SkinRes );
1280 SaveList.Add( strTmp );
1285 if ThreadItem.Kokomade = (i + 1) then begin
1286 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1288 if FileExists( GetSkinBookmarkFileName ) then
1289 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1291 SaveList.Add( '<a name="koko"></a>' );
1293 SaveList.Add( '<a name="koko"></a>' );
1296 doc.Write(SaveList.Text);
1299 SaveList.Add('<a name="bottom"></a>');
1300 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1302 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1305 doc.Write(SaveList.Text);
1306 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1308 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1309 // SaveList.Add('<html lang="ja"><head>');
1310 SaveList.Add('<html><head>');
1311 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1312 SaveList.Add('<title>' + sTitle + '</title>');
1313 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1314 if Length( UserOptionalStyle ) > 0 then
1315 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1316 SaveList.Add('</head>');
1317 SaveList.Add('<body>');
1318 SaveList.Add('<a name="top"></a>');
1319 SaveList.Add('<p id="idSearch"></p>');
1320 SaveList.Add('<div class="title">' + sTitle + '</div>');
1321 doc.Write(SaveList.Text);
1323 //Application.ProcessMessages;
1324 for i := 0 to ReadList.Count - 1 do begin
1325 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1326 if i <> 0 then begin
1327 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1330 if ThreadItem.Kokomade > (i + 1) then
1333 if NewReceiveNo > (i + 1) then
1336 if (threadItem.Count - i) > ResRange then
1341 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1342 SaveList.Add('<a name="new"></a><div class="new">
\90V
\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1344 if (Trim(ReadList[i]) <> '') then begin
1345 No := IntToStr(i + 1);
1346 Res := DivideStrLine(ReadList[i]);
1347 if Res.FType = glt2chOld then begin
1348 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1349 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1350 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1352 Res.FBody := AddAnchorTag(Res.FBody);
1353 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1354 if Res.FMailTo = '' then
1355 SaveList.Add('<a name="' + No + '"></a>'
1356 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1357 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1358 + '<span class="name"><b>' + Res.FName + '</b></span> '
1359 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1360 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1361 + '<div class="mes">' + Res.FBody + ' </div>')
1362 else if GikoSys.Setting.ShowMail then
1363 SaveList.Add('<a name="' + No + '"></a>'
1364 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1365 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1366 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1367 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1368 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1369 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1370 + '<div class="mes">' + Res.FBody + ' </div>')
1372 SaveList.Add('<a name="' + No + '"></a>'
1373 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1374 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1375 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1376 + '<b>' + Res.FName + '</b></a>'
1377 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1378 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1379 + '<div class="mes">' + Res.FBody + ' </div>');
1381 if ThreadItem.Kokomade = (i + 1) then begin
1382 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1385 doc.Write(SaveList.Text);
1388 SaveList.Add('<a name="bottom"></a>');
1389 //SaveList.Add('</body></html>');
1390 SaveList.Add('<a name="last"></a>');
1391 SaveList.Add('</body></html>');
1392 doc.Write(SaveList.Text);
1395 // SaveList.Add('<html lang="ja"><head>');
1396 SaveList.Add('<html><head>');
1397 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1398 SaveList.Add('<title>' + sTitle + '</title></head>');
1399 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1400 SaveList.Add('<a name="top"></a>');
1401 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1402 SaveList.Add('<dl>');
1403 SaveList.Add('<p id="idSearch"></p>');
1404 doc.Write(SaveList.Text);
1406 //Application.ProcessMessages;
1407 for i := 0 to ReadList.Count - 1 do begin
1408 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1409 if i <> 0 then begin
1410 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1413 if ThreadItem.Kokomade > (i + 1) then
1416 if NewReceiveNo > (i + 1) then
1419 if (threadItem.Count - i) > ResRange then
1424 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1425 SaveList.Add('</dl>');
1426 SaveList.Add('<a name="new"></a>');
1427 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>
\90V
\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1428 SaveList.Add('<dl>');
1430 if (Trim(ReadList[i]) <> '') then begin
1431 No := IntToStr(i + 1);
1432 Res := DivideStrLine(ReadList[i]);
1433 if Res.FType = glt2chOld then begin
1434 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1435 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1436 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1438 Res.FBody := AddAnchorTag(Res.FBody);
1439 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1440 if Res.FMailTo = '' then
1441 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1442 else if GikoSys.Setting.ShowMail then
1443 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1445 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
1447 if ThreadItem.Kokomade = (i + 1) then begin
1448 SaveList.Add('</dl>');
1449 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</b></font></td></tr></table>');
1450 SaveList.Add('<dl>');
1452 doc.Write(SaveList.Text);
1455 SaveList.Add('</dl>');
1456 SaveList.Add('<a name="bottom"></a>');
1457 SaveList.Add('</body></html>');
1458 doc.Write(SaveList.Text);
1468 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1472 //bufList : TStringList;
1473 ReadList: TStringList;
1474 // SaveList: TStringList;
1475 CSSFileName: string;
1479 boardPlugIn : TBoardPlugIn;
1481 UserOptionalStyle: string;
1485 function LoadSkin( fileName: string ): string;
1487 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1489 function ReplaceRes( skin: string ): string;
1491 Result := SkinedRes( skin, Res, No );
1495 if ThreadItem <> nil then begin
1496 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1499 if ThreadItem.IsBoardPlugInAvailable then begin
1500 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1501 boardPlugIn := ThreadItem.BoardPlugIn;
1502 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1503 UserOptionalStyle := SetUserOptionalStyle;
1505 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1507 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1508 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1509 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1510 if Setting.UseSkin then begin
1511 tmp1 := './' +Setting.CSSFileName;
1512 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1513 tmp1 := CustomStringReplace(tmp1, '\', '/');
1514 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1515 end else if Setting.UseCSS then begin
1516 tmp1 := './' + CSSFileName;
1517 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1518 tmp1 := CustomStringReplace(tmp1, '\', '/');
1519 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1523 for i := 0 to threadItem.Count - 1 do begin
1526 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1529 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1530 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1537 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1538 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1539 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1540 ShortDayNames[7] := '
\93y';
1541 BBSID := ThreadItem.ParentBoard.BBSID;
1542 ReadList := TStringList.Create;
1544 if ThreadItem.IsLogFile then begin
1545 FileName := ThreadItem.GetThreadFileName;
1546 ReadList.LoadFromFile(FileName);
1547 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1548 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1549 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1550 Res := DivideStrLine(ReadList[0]);
1551 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1552 sTitle := Res.FTitle;
1554 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1557 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1558 UserOptionalStyle := SetUserOptionalStyle;
1560 if GikoSys.Setting.UseSkin then begin
1561 //
\83X
\83L
\83\93\8eg
\97p
1562 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1564 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1565 if Length( UserOptionalStyle ) > 0 then
1566 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1567 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1568 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1569 tmp1 := './' +Setting.CSSFileName;
1570 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1571 tmp1 := CustomStringReplace(tmp1, '\', '/');
1572 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1573 html.Append( SkinHeader );
1577 SkinRes := LoadSkin( GetSkinResFileName );
1580 html.Append('<a name="top"></a>');
1581 for i := 0 to ReadList.Count - 1 do begin
1582 if (Trim(ReadList[i]) <> '') then begin
1583 No := IntToStr(i + 1);
1585 Res := DivideStrLine(ReadList[i]);
1586 if Res.FType = glt2chOld then begin
1587 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1588 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1589 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1592 Res.FBody := AddAnchorTag(Res.FBody);
1593 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1596 html.Append( ReplaceRes( SkinRes ) );
1602 html.Append('<a name="bottom"></a>');
1603 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1605 html.Append( LoadSkin( GetSkinFooterFileName ) );
1608 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1610 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1611 html.Append('<html><head>');
1612 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1613 html.Append('<title>' + sTitle + '</title>');
1614 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1615 tmp1 := './' + CSSFileName;
1616 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1617 tmp1 := CustomStringReplace(tmp1, '\', '/');
1619 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1620 if Length( UserOptionalStyle ) > 0 then
1621 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1622 html.Append('</head>');
1623 html.Append('<body>');
1624 html.Append('<a name="top"></a>');
1625 html.Append('<div class="title">' + sTitle + '</div>');
1626 for i := 0 to ReadList.Count - 1 do begin
1627 if (Trim(ReadList[i]) <> '') then begin
1628 No := IntToStr(i + 1);
1629 Res := DivideStrLine(ReadList[i]);
1630 if Res.FType = glt2chOld then begin
1631 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1632 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1633 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1635 Res.FBody := AddAnchorTag(Res.FBody);
1636 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1637 if Res.FMailTo = '' then
1638 html.Append('<a name="' + No + '"></a>'
1639 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1640 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1641 + '<span class="name"><b>' + Res.FName + '</b></span> '
1642 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1643 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1644 + '<div class="mes">' + Res.FBody + ' </div>')
1645 else if GikoSys.Setting.ShowMail then
1646 html.Append('<a name="' + No + '"></a>'
1647 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1648 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1649 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1650 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1651 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1652 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1653 + '<div class="mes">' + Res.FBody + ' </div>')
1655 html.Append('<a name="' + No + '"></a>'
1656 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1657 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1658 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1659 + '<b>' + Res.FName + '</b></a>'
1660 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1661 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1662 + '<div class="mes">' + Res.FBody + ' </div>');
1665 html.Append('<a name="bottom"></a>');
1666 //html.Append('</body></html>');
1667 html.Append('<a name="last"></a>');
1668 html.Append('</body></html>');
1671 html.Append('<html><head>');
1672 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1673 html.Append('<title>' + sTitle + '</title></head>');
1674 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1675 html.Append('<a name="top"></a>');
1676 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1677 html.Append('<dl>');
1678 for i := 0 to ReadList.Count - 1 do begin
1679 if (Trim(ReadList[i]) <> '') then begin
1680 No := IntToStr(i + 1);
1681 Res := DivideStrLine(ReadList[i]);
1682 if Res.FType = glt2chOld then begin
1683 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1684 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1685 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1687 Res.FBody := AddAnchorTag(Res.FBody);
1688 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1689 if Res.FMailTo = '' then
1690 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1691 else if GikoSys.Setting.ShowMail then
1692 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1694 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1697 html.Append('</dl>');
1698 html.Append('<a name="bottom"></a>');
1699 html.Append('</body></html>');
1708 function TGikoSys.ConvertResAnchor(res: string): string;
1710 _HEAD : string = '<a href="../';
1711 _TAIL : string = ' target="_blank">';
1712 _ST: string = '&st=';
1713 _TO: string = '&to=';
1714 _STA: string = '&START=';
1715 _END: string = '&END=';
1721 i := AnsiPos(_HEAD, res);
1722 while i <> 0 do begin
1723 Result := Result + Copy(res, 1, i -1);
1724 Delete(res, 1, i - 1);
1725 j := AnsiPos(_TAIL, res);
1727 Result := Result + res;
1730 tmp := Copy(res, 1, j - 1);
1731 Delete(res, 1, j + 16);
1732 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1733 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1734 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1735 Result := Result + '<a href="#' + tmp + '">';
1736 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1737 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1738 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1739 Result := Result + '<a href="#' + tmp + '">';
1741 k := LastDelimiter('/', tmp);
1743 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1744 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1746 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1748 Result := Result + '<a href="#' + tmp + '">';
1750 i := AnsiPos(_HEAD, res);
1752 Result := Result + res;
1756 (*************************************************************************
1757 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1758 *************************************************************************)
1759 function TGikoSys.AddAnchorTag(s: string): string;
1761 URL_CHAR: string = '0123456789'
1762 + 'abcdefghijklmnopqrstuvwxyz'
1763 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1764 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1765 ANCHOR_REF = 'href=';
1766 RES_REF = '>>';
1768 wkIdx: array[0..9] of Integer;
1773 anchorLen : Integer;
1776 // + 3
\82Í 'href="' ('"'
\82Â
\82«)
\82È
\82Ç
\82Ì
\83o
\83\8a\83G
\81[
\83V
\83\87\83\93\82É
\97]
\97T
\82ð
\8e\9d\82½
\82¹
\82é
\82½
\82ß
1777 anchorLen := Length( ANCHOR_REF ) + 3;
1780 wkIdx[0] := AnsiPos('http://', s);
1781 wkIdx[1] := AnsiPos('ttp://', s);
1782 wkIdx[2] := AnsiPos('tp://', s);
1783 wkIdx[3] := AnsiPos('ms-help://', s);
1784 wkIdx[4] := AnsiPos('p://', s);
1785 wkIdx[5] := AnsiPos('https://', s);
1786 wkIdx[6] := AnsiPos('www.', s);
1787 wkIdx[7] := AnsiPos('ftp://', s);
1788 wkIdx[8] := AnsiPos('news://', s);
1789 wkIdx[9] := AnsiPos('rtsp://', s);
1793 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1795 if idx = MaxInt then begin
1796 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1797 Result := Result + s;
1802 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1803 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1804 href := Copy( s, idx, Length( s ) );
1805 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1807 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1812 Result := Result + Copy(s, 0, idx - 1);
1814 s := Copy(s, idx, length(s));
1816 b := Length( s ) + 1;
1817 for i := 1 to b do begin
1821 idx := AnsiPos(s[i], URL_CHAR);
1822 if idx = 0 then begin
1823 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1824 url := Copy(s, 0, i - 1);
1826 if AnsiPos('ttp://', url) = 1 then
1828 else if AnsiPos('tp://', url) = 1 then
1830 else if AnsiPos('p://', url) = 1 then
1832 else if AnsiPos('www.', url) = 1 then
1833 href := 'http://' + url
1836 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1837 s := Copy(s, i, MaxInt);
1844 (*************************************************************************
1845 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1846 *************************************************************************)
1847 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1857 if AnsiPos('<>', Line) = 0 then
1861 Result.FFileName := RemoveToken(Line, Delim);
1862 Result.FTitle := RemoveToken(Line, Delim);
1864 ws := Trim(Result.FTitle);
1866 if Copy(ws, Length(ws), 1) = ')' then begin
1869 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1872 end else if Copy(ws, Length(ws), 1) = '<' then begin
1877 for i := Length(ws) - 1 downto 1 do begin
1878 if ws[i] = LeftK then begin
1879 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1880 if IsNumeric(ws) then
1881 Result.FCount := StrToInt(ws);
1882 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1888 (*************************************************************************
1889 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1890 *************************************************************************)
1891 function TGikoSys.DivideStrLine(Line: string): TResRec;
1896 if AnsiPos('<>', Line) = 0 then begin
1898 Result.FType := glt2chOld;
1901 Result.FType := glt2chNew;
1903 Result.FName := Trim(RemoveToken(Line, Delim));
1904 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1905 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1906 bufBody := Trim(RemoveToken(Line, Delim));
1908 if bufbody = '' then begin
1909 Insert(' ',bufbody, 1);
1911 Result.FBody := bufBody;
1912 Result.FTitle := Trim(RemoveToken(Line, Delim));
1916 (*************************************************************************
1917 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1918 *************************************************************************)
1919 function TGikoSys.UrlToID(url: string): string;
1926 if url = '' then Exit;
1928 url := Copy(url, 0, Length(url) - 1);
1929 for i := Length(url) downto 0 do begin
1930 if url[i] = '/' then begin
1931 Result := Copy(url, i + 1, Length(url));
1937 (*************************************************************************
1938 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1939 *************************************************************************)
1940 function TGikoSys.UrlToServer(url: string): string;
1947 wsURL := Trim(wsURL);
1949 if wsURL = '' then exit;
1951 if Copy(wsURL, Length(wsURL), 1) = '/' then
1952 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1954 for i := Length(wsURL) downto 0 do begin
1955 if wsURL[i] = '/' then begin
1956 Result := Copy(wsURL, 0, i);
1962 (*************************************************************************
1963 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1964 *************************************************************************)
1965 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1969 Code := GetFileAttributes(PChar(Name));
1970 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1973 (*************************************************************************
1974 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1975 *************************************************************************)
1976 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1979 if Length(Dir) = 0 then
1980 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1981 Dir := ExcludeTrailingPathDelimiter(Dir);
1982 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1983 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1984 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1987 (*************************************************************************
1988 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
\81i
\8f\89\8aú
\8f\88\97\9d\81j
1989 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1990 *************************************************************************)
1991 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1995 Result := StrTokNext(sep, Rec);
1998 (*************************************************************************
1999 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2000 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2001 *************************************************************************)
2002 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2009 if Len >= Pos then begin
2010 while (Pos <= Len) and (Str[Pos] in sep) do begin
2014 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2015 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2020 Result := Copy(Str, I, Pos - I);
2021 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2028 (*************************************************************************
2029 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2030 *************************************************************************)
2031 function TGikoSys.GetFileSize(FileName : string): longint;
2036 if not FileExists(FileName) then begin
2040 Assign(F, FileName);
2042 Result := FileSize(F);
2049 (*************************************************************************
2050 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2051 *************************************************************************)
2052 function TGikoSys.GetFileLineCount(FileName : string): longint;
2056 sl := TStringList.Create;
2059 sl.LoadFromFile(FileName);
2070 (*************************************************************************
2071 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2072 *************************************************************************)
2073 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2075 fileTmp : TStringList;
2078 if FileExists(FileName) then begin
2079 fileTmp := TStringList.Create;
2082 fileTmp.LoadFromFile( FileName );
2083 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2084 Result := fileTmp.Strings[ Line-1 ];
2087 //on EFOpenError do Result := '';
2095 (*************************************************************************
2096 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2097 *************************************************************************)
2098 procedure TGikoSys.MenuFont(Font: TFont);
2101 nm: NONCLIENTMETRICS;
2103 nm.cbSize := sizeof(NONCLIENTMETRICS);
2105 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2106 lf := nm.lfMenuFont;
2108 Font.Name := lf.lfFaceName;
2109 Font.Height := lf.lfHeight;
2111 if lf.lfWeight >= 700 then
2112 Font.Style := Font.Style + [fsBold];
2113 if lf.lfItalic = 1 then
2114 Font.Style := Font.Style + [fsItalic];
2117 (*************************************************************************
2119 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2120 *************************************************************************)
2121 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2125 p := AnsiPos(delimiter, s);
2129 Result := Copy(s, 1, p - 1);
2130 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2133 (*************************************************************************
2135 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2136 *************************************************************************)
2137 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2142 for i := 0 to index do
2143 Result := RemoveToken(s, delimiter);
2146 (*************************************************************************
2148 *************************************************************************)
2149 function TGikoSys.DeleteLink(const s: string): string;
2159 s1 := GetTokenIndex(s, '<a href="', i);
2160 s2 := GetTokenIndex(s, '<a href="', i + 1);
2162 idx := Pos('">', s1);
2164 Delete(s1, 1, idx + 1);
2165 idx := Pos('">', s2);
2167 Delete(s2, 1, idx + 1);
2169 Result := Result + s1 + s2;
2178 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2179 {procedure TGikoSys.FlashExitWrite;
2183 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2184 for i := 0 to FExitWrite.Count - 1 do
2185 WriteThreadDat(FExitWrite[i]);
2189 (*************************************************************************
2190 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2192 *************************************************************************)
2193 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2195 ERASECHAR : array [1..39] of string =
2196 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2197 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2198 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2199 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2201 Chr : array [0..255] of char;
2205 s := Trim(LongName);
2206 if (Length(s) <= ALength) then begin
2210 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2211 S := CustomStringReplace(S, ERASECHAR[i], '');
2213 if (Length(S) <= ALength) then begin
2216 Windows.LCMapString(
2217 GetUserDefaultLCID(),
2225 S := Copy(S,1,ALength);
2227 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2228 S := Copy(S, 1, Length(S) - 1);
2238 (*************************************************************************
2241 *************************************************************************)
2242 function TGikoSys.ConvRes(const Body, Bbs, Key,
2243 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2244 DatToHTML: boolean = false): string;
2248 FIndexFrom : integer;
2255 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2269 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2274 FIndex.FIndexFrom := IndexFrom;
2275 FIndex.FIndexTo := IndexTo;
2279 function ChooseString(const Text, Separator: string; Index: integer): string;
2285 for i := 0 to Index - 1 do begin
2286 if (AnsiPos(Separator, S) = 0) then S := ''
2287 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2289 p := AnsiPos(Separator, S);
2290 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2299 List:= TList.Create;
2305 b := ByteType(s, i);
2307 mbSingleByte : begin
2308 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2309 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2317 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2318 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2324 if (not sw) and (Copy(s,i,4) = GT) then begin
2325 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2333 if ((not sw) and (Copy(s,i,1) = ',')) or
2334 ((not sw) and (Copy(s,i,1) = '=')) then begin
2335 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2336 ((Chk) and (oc = '')) or
2337 ((not Chk) and (al)) then
2347 if (AnsiPos(sx, SN) > 0) then begin
2350 if (No <> '') and (No <> '-') then begin
2363 if Copy(s,i,1) = '<' then oc := '';
2364 oc := oc + Copy(s,i,1);
2370 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2376 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2384 if (AnsiPos(sx, ZN) > 0) then begin
2385 No := No + ZenToHan(sx);
2387 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2402 if (i > Length(Body)) then begin
2404 if (No <> '') then Add(sp, i, No);
2409 for i := List.Count - 1 downto 0 do begin
2410 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2411 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2412 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2414 st := PIndex(List[i]).FNo;
2415 et := PIndex(List[i]).FNo;
2417 if not DatToHTML then
2418 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2419 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2420 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2421 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2422 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2424 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2425 Format('<a href="#%s">', [st]) +
2426 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2427 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2429 Dispose(PIndex(List[i]));
2435 function TGikoSys.ConvRes(
2436 const Body, Bbs, Key, ParamBBS, ParamKey,
2437 ParamStart, ParamTo, ParamNoFirst,
2438 ParamTrue, FullURL : string
2443 FIndexFrom : integer;
2450 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2464 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2469 FIndex.FIndexFrom := IndexFrom;
2470 FIndex.FIndexTo := IndexTo;
2474 function ChooseString(const Text, Separator: string; Index: integer): string;
2480 for i := 0 to Index - 1 do begin
2481 if (AnsiPos(Separator, S) = 0) then S := ''
2482 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2484 p := AnsiPos(Separator, S);
2485 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2494 List:= TList.Create;
2500 b := ByteType(s, i);
2502 mbSingleByte : begin
2503 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2504 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2512 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2513 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2519 if (not sw) and (Copy(s,i,4) = GT) then begin
2520 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2528 if ((not sw) and (Copy(s,i,1) = ',')) or
2529 ((not sw) and (Copy(s,i,1) = '=')) then begin
2530 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2531 ((Chk) and (oc = '')) or
2532 ((not Chk) and (al)) then
2542 if (AnsiPos(sx, SN) > 0) then begin
2545 if (No <> '') and (No <> '-') then begin
2558 if Copy(s,i,1) = '<' then oc := '';
2559 oc := oc + Copy(s,i,1);
2565 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2571 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2579 if (AnsiPos(sx, ZN) > 0) then begin
2580 No := No + ZenToHan(sx);
2582 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2597 if (i > Length(Body)) then begin
2599 if (No <> '') then Add(sp, i, No);
2604 for i := List.Count - 1 downto 0 do begin
2605 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2606 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2607 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2608 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2610 st := PIndex(List[i]).FNo;
2611 et := PIndex(List[i]).FNo;
2613 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2614 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2615 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2616 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2617 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2618 Dispose(PIndex(List[i]));
2625 function TGikoSys.BoolToInt(b: Boolean): Integer;
2627 Result := IfThen(b, 1, 0);
2630 function TGikoSys.IntToBool(i: Integer): Boolean;
2635 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2636 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2640 GZipStream: TGzipDecompressStream;
2641 TextStream: TStringStream;
2642 buf: array[0..BUF_SIZE - 1] of Byte;
2648 TextStream := TStringStream.Create('');
2650 //
\83m
\81[
\83g
\83\93\83E
\83\93\83`
\83E
\83B
\83\8b\83X2003
\91Î
\8dô(x-gzip
\82Æ
\82©
\82É
\82È
\82é
\82Ý
\82½
\82¢)
2651 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2652 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2653 ResStream.Position := 0;
2654 GZipStream := TGzipDecompressStream.Create(TextStream);
2657 FillChar(buf, BUF_SIZE, 0);
2658 cnt := ResStream.Read(buf, BUF_SIZE);
2660 GZipStream.Write(buf, BUF_SIZE);
2666 ResStream.Position := 0;
2668 FillChar(buf, BUF_SIZE, 0);
2669 cnt := ResStream.Read(buf, BUF_SIZE);
2671 TextStream.Write(buf, BUF_SIZE);
2675 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2676 s := TextStream.DataString;
2678 while (i > 0) and (s[i] = #0) do
2683 while i <> 0 do begin
2693 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2695 STD_SEC = 'KeySetting';
2701 SecList: TStringList;
2702 Component: TComponent;
2704 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2706 SecList := TStringList.Create;
2707 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2709 ini.ReadSection(STD_SEC, SecList);
2710 for i := 0 to SecList.Count - 1 do begin
2711 ActionName := SecList[i];
2712 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2713 if ActionKey <> -1 then begin
2714 Component := ActionList.Owner.FindComponent(ActionName);
2715 if TObject(Component) is TAction then begin
2716 TAction(Component).ShortCut := ActionKey;
2726 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2728 STD_SEC = 'KeySetting';
2733 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2735 for i := 0 to ActionList.ActionCount - 1 do begin
2736 if ActionList.Actions[i].Tag = -1 then
2738 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2746 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2748 STD_SEC = 'KeySetting';
2754 SecList: TStringList;
2755 Component: TComponent;
2757 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2759 SecList := TStringList.Create;
2760 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2762 ini.ReadSection(STD_SEC, SecList);
2763 for i := 0 to SecList.Count - 1 do begin
2764 ActionName := SecList[i];
2765 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2766 if ActionKey <> -1 then begin
2767 Component := ActionList.Owner.FindComponent(ActionName);
2768 if TObject(Component) is TAction then begin
2769 TAction(Component).ShortCut := ActionKey;
2779 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2781 STD_SEC = 'KeySetting';
2786 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2788 for i := 0 to ActionList.ActionCount - 1 do begin
2789 if ActionList.Actions[i].Tag = -1 then
2791 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2800 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2802 PI: TProcessInformation;
2806 Path := '"' + AppPath + '"';
2808 Path := Path + ' ' + Param;
2810 SI.Cb := SizeOf(Si);
2811 SI.lpReserved := nil;
2812 SI.lpDesktop := nil;
2815 SI.cbReserved2 := 0;
2816 SI.lpReserved2 := nil;
2818 Windows.CreateProcess(nil,
2830 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2834 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2835 gbtUserApp, gbtAuto:
2836 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2837 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2839 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2843 function TGikoSys.HTMLDecode(const AStr: String): String;
2845 Sp, Rp, Cp, Tp: PChar;
2850 SetLength(Result, Length(AStr));
2852 Rp := PChar(Result);
2855 while Sp^ <> #0 do begin
2861 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2867 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2871 while (Sp^ <> ';') and (Sp^ <> #0) do
2878 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2886 Num := IsNumeric(Copy(Tp, 1, 1));
2887 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2888 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2892 SetString(S, Tp, Sp - Tp);
2897 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2898 //[Cp^ + Sp^, Cp - PChar(AStr)])
2908 // on E:EConvertError do
2909 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2910 // [Cp^ + Sp^, Cp - PChar(AStr)])
2912 SetLength(Result, Rp - PChar(Result));
2915 function TGikoSys.GetHRefText(s: string): string;
2925 Index := AnsiPos('href', LowerCase(s));
2928 s := Trim(Copy(s, Index + 4, Length(s)));
2929 s := Trim(Copy(s, 2, Length(s)));
2931 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2932 //if Copy(s, 1, 1) = '"' then begin
2933 if s[1] = '"' then begin
2934 s := Trim(Copy(s, 2, Length(s)));
2937 Index := AnsiPos('"', s);
2938 if Index <> 0 then begin
2939 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2940 s := Copy(s, 1, Index - 1);
2942 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2943 Index := AnsiPos(' ', s);
2944 Index2 := AnsiPos('>', s);
2947 if Index > Index2 then
2950 s := Copy(s, 1, Index - 1)
2952 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2958 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2959 function TGikoSys.Is2chHost(Host: string): Boolean;
2961 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2967 if RightStr( Host, 1 ) = '/' then
2968 Host := Copy( Host, 1, Length( Host ) - 1 );
2969 OutputDebugString(pchar(HOST_NAME[0]));
2970 for i := 0 to Length(HOST_NAME) - 1 do begin
2971 // Len := Length(HOST_NAME[i]);
2972 if (AnsiPos(HOST_NAME[i], Host) > 0) and
2973 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
2980 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2990 Index := AnsiPos(READ_PATH, path);
2991 if Index <> 0 then begin
2992 s := Copy(path, Index + Length(READ_PATH), Length(path));
2995 BBSID := GetTokenIndex(s, '/', 0);
2996 BBSKey := GetTokenIndex(s, '/', 1);
2999 Result := (BBSID <> '') or (BBSKey <> '');
3002 Index := AnsiPos(KAKO_PATH, path);
3003 if Index <> 0 then begin
3004 s := Copy(path, 2, Length(path));
3005 BBSID := GetTokenIndex(s, '/', 0);
3006 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3007 BBSID := GetTokenIndex(s, '/', 1);
3008 BBSKey := ChangeFileExt(Document, '');
3009 Result := (BBSID <> '') or (BBSKey <> '');
3012 Index := AnsiPos('read.cgi?', URL);
3013 if Index <> 0 then begin
3014 SList := TStringList.Create;
3017 // s := HTMLDecode(Document);
3018 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3019 BBSID := SList.Values['bbs'];
3020 BBSKey := SList.Values['key'];
3021 Result := (BBSID <> '') or (BBSKey <> '');
3031 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3038 URL := Trim(LowerCase(URL));
3039 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3043 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3045 stRes := StrToInt64( buf );
3046 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3047 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3049 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3052 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3053 buf := Copy( buf, 1, ps );
3057 endRes := StrToInt64(buf)
3064 if (stRes <> 0) and (endRes = 0) then
3065 endRes := stRes + MAX_POPUP_RES
3066 else if (stRes = 0) and (endRes <> 0) then begin
3067 stRes := endRes - MAX_POPUP_RES;
3071 GikoSys.GetBrowsableThreadURL( URL );
3072 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3074 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3077 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3078 buf := Copy( buf, 1, ps );
3081 stRes := StrToInt(buf)
3088 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3090 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3091 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3092 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3094 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3097 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3098 buf := Copy( buf, 1, ps );
3102 endRes := StrToInt64(buf);
3109 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3110 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3111 if Length(buf) > 0 then begin
3112 if AnsiPos('-', buf) = 1 then begin
3117 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3119 convBuf := Copy( buf, 1, ps );
3120 if convBuf <> '' then
3121 endRes := StrToInt64(convBuf)
3127 if endRes <> 0 then begin
3128 stRes := endRes - MAX_POPUP_RES;
3135 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3137 convBuf := Copy( buf, 1, ps );
3138 if convBuf <> '' then begin
3139 stRes := StrToInt64(convBuf);
3143 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3145 convBuf := Copy( buf, 1, ps );
3146 if convBuf <> '' then
3147 endRes := StrToInt64(convBuf)
3168 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3173 // convBuf : String;
3184 URL := Trim(LowerCase(URL));
3189 Result.FFirst := False;
3190 Result.FStBegin := False;
3191 Result.FToEnd := False;
3192 Result.FDone := False;
3193 Result.FNoParam := False;
3197 if URL[length(URL)] = '\' then
3199 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3200 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3201 s := Copy(URL, RStart + RLength - 1, Length(URL));
3203 //
\95W
\8f\80\8f\91\8e®
3204 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3205 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3206 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3207 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3208 s := Copy(s, 15, Length(s));
3210 SList := TStringList.Create;
3213 FAWKStr.RegExp := '/';
3214 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3215 Result.FBBS := SList[1];
3216 Result.FKey := SList[2];
3217 if SList.Count >= 4 then
3221 Result.FNoParam := true;
3227 FAWKStr.LineSeparator := mcls_CRLF;
3228 FAWKStr.RegExp := '-';
3229 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3230 Result.FFirst := True;
3232 FAWKStr.RegExp := 'l[0-9]+';
3233 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3234 Result.FFirst := True;
3236 for i := 0 to SList.Count - 1 do begin
3237 if Trim(SList[i]) = '' then begin
3239 Result.FStBegin := True;
3240 if i = (SList.Count - 1) then
3241 Result.FToEnd := True;
3242 end else if IsNumeric(SList[i]) then begin
3243 wkInt := StrToInt(SList[i]);
3244 wkMax := Max(wkMax, wkInt);
3248 wkMin := Min(wkMin, wkInt);
3249 end else if Trim(SList[i]) = 'n' then begin
3250 Result.FFirst := True;
3252 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3253 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3254 if Copy(SList[i], 1, 1) = 'n' then
3255 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3257 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3258 Result.FFirst := True;
3259 wkMax := Max(wkMax, wkInt);
3263 wkMin := Min(wkMin, wkInt);
3267 if Result.FStBegin and (not Result.FToEnd) then
3269 else if (not Result.FStBegin) and Result.FToEnd then
3271 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3272 Result.FSt := wkMin;
3273 Result.FTo := wkMax;
3275 //Result.FSt := wkMin;
3276 //Result.FTo := wkMax;
3282 Result.FDone := True;
3286 //
\90Vkako
\8f\91\8e®
3287 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3288 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3289 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3290 SList := TStringList.Create;
3293 FAWKStr.RegExp := '/';
3294 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3295 Result.FBBS := SList[1];
3296 Result.FKey := ChangeFileExt(SList[5], '');
3297 Result.FFirst := True;
3303 Result.FDone := True;
3307 //
\8b\8ckako
\8f\91\8e®
3308 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3309 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3310 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3311 SList := TStringList.Create;
3314 FAWKStr.RegExp := '/';
3315 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3316 Result.FBBS := SList[1];
3317 Result.FKey := ChangeFileExt(SList[4], '');
3318 Result.FFirst := True;
3324 Result.FDone := True;
3328 //log
\8by
\82Ñlog2
\8f\91\8e®
3329 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3330 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3331 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3332 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3333 SList := TStringList.Create;
3336 FAWKStr.RegExp := '/';
3337 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3338 Result.FBBS := SList[2];
3339 Result.FKey := ChangeFileExt(SList[5], '');
3340 Result.FFirst := True;
3346 Result.FDone := True;
3351 //
\8b\8cURL
\8f\91\8e®
3352 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3353 FAWKStr.RegExp := '/test/read\.cgi\?';
3354 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3355 s := Copy(s, 16, Length(s));
3356 SList := TStringList.Create;
3359 FAWKStr.RegExp := '&';
3360 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3361 Result.FFirst := True;
3362 for i := 0 to SList.Count - 1 do begin
3363 if Pos('bbs=', SList[i]) = 1 then begin
3364 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3365 end else if Pos('key=', SList[i]) = 1 then begin
3366 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3367 end else if Pos('st=', SList[i]) = 1 then begin
3368 wk := Copy(SList[i], 4, Length(SList[i]));
3369 if IsNumeric(wk) then
3370 Result.FSt := StrToInt(wk)
3371 else if wk = '' then
3372 Result.FStBegin := True;
3373 end else if Pos('to=', SList[i]) = 1 then begin
3374 wk := Copy(SList[i], 4, Length(SList[i]));
3375 if IsNumeric(wk) then
3376 Result.FTo := StrToInt(wk)
3377 else if wk = '' then
3378 Result.FToEnd := True;
3379 end else if Pos('nofirst=', SList[i]) = 1 then begin
3380 Result.FFirst := False;
3389 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3390 Result.FDone := True;
3397 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3407 URI := TIdURI.Create(URL);
3409 Protocol := URI.Protocol;
3412 Document := URI.Document;
3414 Bookmark := URI.Bookmark;
3420 function TGikoSys.GetVersionBuild: Integer;
3422 FixedFileInfo: PVSFixedFileInfo;
3423 VersionHandle, VersionSize: DWORD;
3424 pVersionInfo: Pointer;
3429 AppFile := Application.ExeName;
3430 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3431 if VersionSize = 0 then
3433 GetMem(pVersionInfo, VersionSize);
3435 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3436 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3437 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3439 FreeMem(pVersionInfo, VersionSize);
3443 function TGikoSys.GetBrowsableThreadURL(
3447 threadItem : TThreadItem;
3448 boardPlugIn : TBoardPlugIn;
3452 //=====
\83v
\83\89\83O
\83C
\83\93
3454 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3455 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3456 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3457 boardPlugIn := BoardPlugIns[ i ];
3458 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3459 Result := threadItem.URL;
3467 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3470 if Length( Result ) = 0 then
3471 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3475 function TGikoSys.GetThreadURL2BoardURL(
3479 threadItem : TThreadItem;
3480 boardPlugIn : TBoardPlugIn;
3484 //=====
\83v
\83\89\83O
\83C
\83\93
3486 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3487 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3488 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3489 boardPlugIn := BoardPlugIns[ i ];
3490 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3491 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3499 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3502 if Length( Result ) = 0 then
3503 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3507 function TGikoSys.Get2chThreadURL2BoardURL(
3511 Protocol, Host, Path, Document, Port, Bookmark : string;
3512 BBSID, BBSKey : string;
3516 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3517 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3519 foundPos := Pos( '/test/read.cgi', inURL );
3520 if {(Is2chHost(Host)) and} (foundPos > 0) then
3521 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3523 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3527 function TGikoSys.Get2chBrowsableThreadURL(
3531 Protocol, Host, Path, Document, Port, Bookmark : string;
3532 BBSID, BBSKey : string;
3536 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3539 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3540 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3541 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3543 if Is2chHost( Host ) then begin
3544 Result := Protocol + '://' + Host +
3545 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3547 if foundPos > 0 then
3548 Result := Copy( inURL, 1, foundPos ) +
3549 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3551 Result := Protocol + '://' + Host +
3552 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3558 function TGikoSys.Get2chBoard2ThreadURL(
3566 server := UrlToServer( inBoard.URL );
3567 if Is2chHost( server ) then
3568 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3570 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3574 (*************************************************************************
3575 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3576 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3577 *************************************************************************)
3578 procedure TGikoSys.ListBoardFile;
3580 boardFileList : TStringList;
3585 for i := 0 to Length( BBSs ) - 1 do
3589 SetLength( BBSs, 0 );
3592 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3593 if FileExists( GikoSys.GetBoardFileName ) then begin
3594 SetLength( BBSs, l + 1 );
3595 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3596 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3600 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3601 SetLength( BBSs, l + 1 );
3602 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3603 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3607 // Board
\83t
\83H
\83\8b\83_
3608 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3609 BoardFileList := TStringList.Create;
3611 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3612 for k := BoardFileList.Count - 1 downto 0 do begin
3613 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3614 BoardFileList.Delete(k);
3616 SetLength( BBSs, l + BoardFileList.Count );
3617 for i := BoardFileList.Count - 1 downto 0 do begin
3618 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3619 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3628 (*************************************************************************
3629 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3630 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3631 *************************************************************************)
3632 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3637 boardFile : TStringList;
3638 CategoryList : TStringList;
3639 BoardList : TStringList;
3640 Category : TCategory;
3643 RoundItem : TRoundItem;
3645 i, iBound : Integer;
3646 j, jBound : Integer;
3647 k, kBound : Integer;
3650 if not FileExists( bbs.FilePath ) then
3653 ini := TMemIniFile.Create('');
3654 boardFile := TStringList.Create;
3656 boardFile.LoadFromFile( bbs.FilePath );
3658 ini.SetStrings( boardFile );
3659 CategoryList := TStringList.Create;
3660 BoardList := TStringList.Create;
3662 ini.ReadSections( CategoryList );
3664 iBound := CategoryList.Count - 1;
3665 for i := 0 to iBound do begin
3666 ini.ReadSection( CategoryList[i], BoardList );
3667 Category := TCategory.Create;
3668 Category.No := i + 1;
3669 Category.Title := CategoryList[i];
3671 jBound := BoardList.Count - 1;
3672 for j := 0 to jBound do begin
3674 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3675 p := FBoardURLList.IndexOf(inistr);
3676 if p = -1 then begin
3677 //=====
\83v
\83\89\83O
\83C
\83\93
3679 kBound := Length( BoardPlugIns ) - 1;
3680 for k := 0 to kBound do begin
3681 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3682 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3683 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3690 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3694 Board := TBoard.Create( nil, inistr );
3697 Board.Title := BoardList[j];
3698 Board.RoundDate := ZERO_DATE;
3700 idx := RoundList.Find(Board);
3701 if idx <> -1 then begin
3702 RoundItem := RoundList.Items[idx, grtBoard];
3703 Board.Round := True;
3704 Board.RoundName := RoundItem.RoundName;
3706 Board.Multiplicity := 0;
3707 Category.Add(Board);
3710 FBoardURLList.AddObject(inistr, Board);
3712 Board := TBoard(FBoardURLList.Objects[p]);
3713 Board.Multiplicity := Board.Multiplicity + 1;
3714 Category.Add(Board);
3718 bbs.Add( Category );
3720 bbs.IsBoardFileRead := True;
3732 function TGikoSys.GetUnknownCategory : TCategory;
3734 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3737 if Length( BBSs ) < 2 then begin
3742 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3743 if Result = nil then begin
3744 Result := TCategory.Create;
3745 Result.Title := UNKNOWN_CATEGORY;
3746 BBSs[ 1 ].Add( Result );
3751 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3753 category : TCategory;
3755 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3758 category := GetUnknownCategory;
3759 if category = nil then begin
3762 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3763 if Result = nil then begin
3764 Result := TBoard.Create( inPlugIn, inURL );
3765 Result.Title := UNKNOWN_BOARD;
3766 category.Add( Result );
3771 function TGikoSys.GetSambaFileName : string;
3773 Result := Setting.GetSambaFileName;
3775 procedure TGikoSys.SambaFileExists();
3778 sambaStrList: TStringList;
3780 if not FileExists(GikoSys.GetSambaFileName) then begin
3781 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3782 sambaStrList := TStringList.Create;
3784 if FileExists(sambaTmp) then begin
3785 sambaStrList.LoadFromFile(sambaTmp);
3786 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3793 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string;
3799 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3800 body := TStringList.Create;
3802 GetSameIDRes(AID, ThreadItem, body);
3803 for i := 0 to body.Count - 1 do begin
3804 Result := Result + '>' + body[i] + ' ';
3809 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3812 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
3815 ReadList: TStringList;
3817 boardPlugIn : TBoardPlugIn;
3819 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3820 if ThreadItem.IsBoardPlugInAvailable then begin
3821 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3822 boardPlugIn := ThreadItem.BoardPlugIn;
3824 for i := 0 to threadItem.Count - 1 do begin
3826 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3827 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3828 body.Add(IntToStr(i+1));
3832 ReadList := TStringList.Create;
3834 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3835 for i := 0 to ReadList.Count - 1 do begin
3836 Res := DivideStrLine(ReadList[i]);
3837 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3838 body.Add(IntToStr(i+1));
3847 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string;
3853 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3854 body := TStringList.Create;
3856 GetSameIDRes(AIDNum, ThreadItem, body);
3857 for i := 0 to body.Count - 1 do begin
3858 Result := Result + '>' + body[i] + ' ';
3863 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3867 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
3870 boardPlugIn : TBoardPlugIn;
3872 stList: TStringList;
3875 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
3876 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
3877 if ThreadItem.IsBoardPlugInAvailable then begin
3878 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3879 boardPlugIn := ThreadItem.BoardPlugIn;
3880 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
3882 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
3884 AID := Res.FDateTime;
3885 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then
3886 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11)
3888 stlist := TStringList.Create;
3890 stList.DelimitedText := AID;
3891 for i := 0 to stList.Count - 1 do
3892 if Length(WideString(stList[i])) = 8 then begin
3893 if NotDateorTimeString(stList[i]) then begin
3903 GetSameIDRes(AID, ThreadItem, body);
3906 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
3922 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
3925 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3926 Bayesian.CountWord( text, wordCount );
3930 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
3933 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3934 Bayesian.Forget( wordCount, isSpam );
3938 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
3941 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3942 Bayesian.Learn( wordCount, isSpam );
3946 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
3949 case Setting.SpamFilterAlgorithm of
3950 gsfaNone: Result := 0;
3951 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
3952 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
3953 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
3958 function TGikoSys.SetUserOptionalStyle(): string;
3961 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
3962 Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
3963 if GikoSys.Setting.BrowserFontSize <> 0 then
3964 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
3965 if GikoSys.Setting.BrowserFontColor <> -1 then
3966 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
3967 if GikoSys.Setting.BrowserBackColor <> -1 then
3968 Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
3969 case GikoSys.Setting.BrowserFontBold of
3970 -1: Result := Result + 'font-weight:normal;';
3971 1: Result := Result + 'font-weight:bold;';
3973 case GikoSys.Setting.BrowserFontItalic of
3974 -1: Result := Result + 'font-style:normal;';
3975 1: Result := Result + 'font-style:italic;';
3980 GikoSys := TGikoSys.Create;
3983 if GikoSys <> nil then begin