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;
103 FSelectResFilter : TAbon;
106 destructor Destroy; override;
107 property ResRange : Longint read FResRange write FResRange;
108 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
109 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
110 function IsNumeric(s: string): boolean;
111 function IsFloat(s: string): boolean;
112 function DirectoryExistsEx(const Name: string): Boolean;
113 function ForceDirectoriesEx(Dir: string): Boolean;
114 // function GetVersion: string;
116 function GetBoardFileName: string;
117 function GetCustomBoardFileName: string;
118 function GetHtmlTempFileName: string;
119 function GetAppDir: string;
120 function GetTempFolder: string;
121 function GetSentFileName: string;
122 function GetConfigDir: string;
123 function GetSkinDir: string;
124 function GetSkinHeaderFileName: string;
125 function GetSkinFooterFileName: string;
126 function GetSkinResFileName: string;
127 function GetSkinNewResFileName: string;
128 function GetSkinBookmarkFileName: string;
129 function GetSkinNewmarkFileName: string;
130 function GetStyleSheetDir: string;
131 function GetOutBoxFileName: string;
132 function GetUserAgent: string;
133 function GetSambaFileName : string;
135 procedure ReadSubjectFile(Board: TBoard);
136 procedure CreateThreadDat(Board: TBoard);
137 procedure WriteThreadDat(Board: TBoard);
138 function ParseIndexLine(Line: string): TIndexRec;
139 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
140 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¢
141 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
143 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
144 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
145 function AddAnchorTag(s: string): string;
147 function DivideSubject(Line: string): TSubjectRec;
148 function DivideStrLine(Line: string): TResRec;
150 property Setting: TSetting read FSetting write FSetting;
151 property Dolib: TDolib read FDolib write FDolib;
153 function UrlToID(url: string): string;
154 function UrlToServer(url: string): string;
156 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
157 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
159 function GetFileSize(FileName : string) : longint;
160 function GetFileLineCount(FileName : string): longint;
161 function Get2chDate(aDate: TDateTime): string;
162 function IntToDateTime(val: Int64): TDateTime;
163 function DateTimeToInt(ADate: TDateTime): Int64;
165 function ReadThreadFile(FileName: string; Line: Integer): string;
167 procedure MenuFont(Font: TFont);
169 function RemoveToken(var s:string; const delimiter:string):string;
170 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
171 function DeleteLink(const s: string): string;
173 function GetShortName(const LongName: string; ALength: integer): string;
174 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
175 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
176 function ConvertResAnchor(res: string): string;
177 function BoolToInt(b: Boolean): Integer;
178 function IntToBool(i: Integer): Boolean;
179 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
180 procedure LoadKeySetting(ActionList: TActionList);
181 procedure SaveKeySetting(ActionList: TActionList);
182 procedure LoadEditorKeySetting(ActionList: TActionList);
183 procedure SaveEditorKeySetting(ActionList: TActionList);
185 procedure CreateProcess(const AppPath: string; const Param: string);
186 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
187 function HTMLDecode(const AStr: String): String;
188 function GetHRefText(s: string): string;
189 function Is2chHost(Host: string): Boolean;
190 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
191 function Parse2chURL2(URL: string): TPathRec;
192 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
193 function GetVersionBuild: Integer;
194 function GetBrowsableThreadURL( inURL : string ) : string;
195 function GetThreadURL2BoardURL( inURL : string ) : string;
196 function Get2chThreadURL2BoardURL( inURL : string ) : string;
197 function Get2chBrowsableThreadURL( inURL : string ) : string;
198 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
199 procedure ListBoardFile;
200 procedure ReadBoardFile( bbs : TBBS );
202 function GetUnknownCategory : TCategory;
203 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
205 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
207 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
208 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
209 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
210 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
212 //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é
213 procedure SambaFileExists();
215 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
216 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string; overload;
217 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string; overload;
218 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
219 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
221 procedure SpamCountWord( const text : string; wordCount : TWordCount );
222 //!
\8aw
\8fK
\83N
\83\8a\83A
223 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
224 //!
\83X
\83p
\83\80\8aw
\8fK
225 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
226 //!
\83X
\83p
\83\80\93x
\90\94
227 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
228 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
229 function NotDateorTimeString(const AStr : string): boolean;
235 //LENGTH_RESTITLE = 40;
236 ZERO_DATE: Integer = 25569;
237 BETA_VERSION_NAME_E = 'beta';
238 BETA_VERSION_NAME_J = 'ÊÞÀ';
240 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
241 APP_NAME = 'gikoNavi';
246 Giko, RoundData, Favorite;
249 FOLDER_INDEX_VERSION = '1.01';
250 USER_AGENT = 'Monazilla';
251 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
252 NGWORDs_DIR_NAME : String = 'NGwords';
254 READ_PATH: string = '/test/read.cgi/';
255 OLD_READ_PATH: string = '/test/read.cgi?';
256 KAKO_PATH: string = '/kako/';
258 (*************************************************************************
259 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
260 *************************************************************************)
261 constructor TGikoSys.Create;
263 FSetting := TSetting.Create;
264 FDolib := TDolib.Create;
265 FAWKStr := TAWKStr.Create(nil);
266 if DirectoryExists(GetConfigDir) = false then begin
267 CreateDir(GetConfigDir);
269 FAbon := TAbon.Create;
270 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
272 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
273 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
274 FAbon.DeleteSyria := FSetting.DeleteSyria;
275 FAbon.Deleterlo := FSetting.AbonDeleterlo;
276 FAbon.Replaceul := FSetting.AbonReplaceul;
277 FAbon.AbonPopupRes := FSetting.PopUpAbon;
279 FSelectResFilter := TAbon.Create;
280 //
\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
281 FSelectResFilter.AbonString := '';
283 ResRange := FSetting.ResRange;
284 FBayesian := TGikoBayesian.Create;
287 (*************************************************************************
288 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
289 *************************************************************************)
290 destructor TGikoSys.Destroy;
293 FileList: TStringList;
295 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
304 FSelectResFilter.Free;
305 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
306 FileList := TStringList.Create;
308 GetFileList(GetTempFolder, '*.html', FileList, False, True);
309 for i := 0 to FileList.Count - 1 do begin
310 DeleteFile(FileList[i]);
318 (*************************************************************************
319 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
320 *************************************************************************)
322 function TGikoSys.IsNumeric(s: string): boolean;
332 (*************************************************************************
333 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
334 *************************************************************************)
335 function TGikoSys.IsFloat(s: string): boolean;
339 Result := TextToFloat(PChar(s), v, fvExtended);
342 (*************************************************************************
343 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
344 *************************************************************************)
345 function TGikoSys.GetBoardFileName: string;
347 Result := Setting.GetBoardFileName;
350 (*************************************************************************
351 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
352 *************************************************************************)
353 function TGikoSys.GetCustomBoardFileName: string;
355 Result := Setting.GetCustomBoardFileName;
358 (*************************************************************************
359 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
360 *************************************************************************)
361 function TGikoSys.GetHtmlTempFileName: string;
363 Result := Setting.GetHtmlTempFileName;
367 (*************************************************************************
368 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
369 *************************************************************************)
370 function TGikoSys.GetAppDir: string;
372 Result := Setting.GetAppDir;
375 (*************************************************************************
376 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
377 *************************************************************************)
378 function TGikoSys.GetTempFolder: string;
380 Result := Setting.GetTempFolder;
383 (*************************************************************************
384 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
385 *************************************************************************)
386 function TGikoSys.GetSentFileName: string;
388 Result := Setting.GetSentFileName;
391 (*************************************************************************
392 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
393 *************************************************************************)
394 function TGikoSys.GetOutBoxFileName: string;
396 Result := Setting.GetOutBoxFileName;
399 (*************************************************************************
400 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
401 *************************************************************************)
402 function TGikoSys.GetConfigDir: string;
404 Result := Setting.GetConfigDir;
407 function TGikoSys.GetStyleSheetDir: string;
409 Result := Setting.GetStyleSheetDir;
412 function TGikoSys.GetSkinDir: string;
414 Result := Setting.GetSkinDir;
417 function TGikoSys.GetSkinHeaderFileName: string;
419 Result := Setting.GetSkinHeaderFileName;
422 function TGikoSys.GetSkinFooterFileName: string;
424 Result := Setting.GetSkinFooterFileName;
427 function TGikoSys.GetSkinNewResFileName: string;
429 Result := Setting.GetSkinNewResFileName;
432 function TGikoSys.GetSkinResFileName: string;
434 Result := Setting.GetSkinResFileName;
437 function TGikoSys.GetSkinBookmarkFileName: string;
439 Result := Setting.GetSkinBookmarkFileName;
442 function TGikoSys.GetSkinNewmarkFileName: string;
444 Result := Setting.GetSkinNewmarkFileName;
448 function TGikoSys.GetUserAgent: string;
450 if Dolib.Connected then begin
451 Result := Format('%s %s/%s%d%s', [
458 BETA_VERSION_BUILD]);
460 Result := Format('%s/%s %s/%s%d%s', [
468 BETA_VERSION_BUILD]);
472 (*************************************************************************
473 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
474 *************************************************************************)
475 function TGikoSys.Get2chDate(aDate: TDateTime): string;
480 d1 := EncodeDate(1970, 1, 1);
481 d2 := aDate - EncodeTime(9, 0, 0, 0);
482 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
483 Result := FloatToStr(Trunc((d2 - d1) * 86400));
487 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
492 d1 := EncodeDate(1970, 1, 1);
493 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
497 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
502 d := EncodeDate(1970, 1, 1);
503 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
508 (*************************************************************************
509 *Subject
\83t
\83@
\83C
\83\8bRead
510 *************************************************************************)
511 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
513 ThreadItem: TThreadItem;
515 FileList: TStringList;
516 TmpFileList: TStringList;
524 RoundItem: TRoundItem;
529 FavoThreadItem : TFavoriteThreadItem;
533 if Board.IsThreadDatRead then
538 usePlugIn := Board.IsBoardPlugInAvailable;
540 FileName := Board.GetFolderIndexFileName;
542 FileList := TStringList.Create;
543 FileList.Sorted := True;
544 TmpFileList := TStringList.Create;
545 TmpFileList.Sorted := True;
547 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
548 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
549 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
550 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
552 //
\8fd
\95¡
\82ð
\96h
\82®
554 Board.Sorted := True;
556 sl := TStringList.Create;
558 if FileExists(FileName) then begin
559 sl.LoadFromFile(FileName);
561 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
562 for i := sl.Count - 1 downto 1 do begin
563 Rec := ParseIndexLine(sl[i]);
565 ThreadItem := TThreadItem.Create(
567 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
569 ThreadItem := TThreadItem.Create(
571 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
573 if FileList.Count <> 0 then
574 if FileList.Find( ThreadItem.FileName, Index ) then
575 FileList.Delete( Index );
577 ThreadItem.BeginUpdate;
578 ThreadItem.No := Rec.FNo;
579 ThreadItem.FileName := Rec.FFileName;
580 ThreadItem.Title := Rec.FTitle;
581 ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
582 ThreadItem.Count := Rec.FCount;
583 ThreadItem.Size := Rec.FSize;
584 // ThreadItem.RoundNo := Rec.FRoundNo;
585 ThreadItem.RoundDate := Rec.FRoundDate;
586 ThreadItem.LastModified := Rec.FLastModified;
587 ThreadItem.Kokomade := Rec.FKokomade;
588 ThreadItem.NewReceive := Rec.FNewReceive;
589 // ThreadItem.Round := Rec.FRound;
590 ThreadItem.UnRead := Rec.FUnRead;
591 ThreadItem.ScrollTop := Rec.FScrollTop;
592 ThreadItem.AllResCount := Rec.FAllResCount;
593 ThreadItem.NewResCount := Rec.FNewResCount;
594 ThreadItem.AgeSage := Rec.FAgeSage;
595 ThreadItem.ParentBoard := Board;
596 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
598 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
599 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
602 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
603 if ThreadItem.IsLogFile then begin
604 idx := RoundList.Find(ThreadItem);
605 if idx <> -1 then begin
606 RoundItem := RoundList.Items[idx, grtItem];
607 ThreadItem.RoundName := RoundItem.RoundName;
608 ThreadItem.Round := True;
612 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
613 if TmpFileList.Count <> 0 then begin
614 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
615 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
617 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
618 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
620 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
621 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
622 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
623 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
625 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
626 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
628 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
634 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
635 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
636 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
637 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
638 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
639 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
643 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
644 TmpFileList.Delete(Index);
648 ThreadItem.EndUpdate;
649 Board.Add(ThreadItem);
651 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
656 if UnRead <> Board.UnRead then
657 Board.UnRead := UnRead;
659 //
\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
660 for i := 0 to FileList.Count - 1 do begin
661 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
663 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
664 if usePlugIn then begin
665 ThreadItem := TThreadItem.Create(
667 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
668 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
670 ThreadItem := TThreadItem.Create(
671 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
672 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
675 ThreadItem.BeginUpdate;
676 ThreadItem.FilePath := FileName;
677 ThreadItem.No := Board.Count + 1;
678 ThreadItem.FileName := FileList[i];
679 ThreadItem.Title := ResRec.FTitle;
680 ThreadItem.Count := GetFileLineCount(FileName);
681 ThreadItem.AllResCount := ThreadItem.Count;
682 ThreadItem.NewResCount := ThreadItem.Count;
683 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é
684 ThreadItem.RoundDate := ZERO_DATE;
685 ThreadItem.LastModified := ZERO_DATE;
686 ThreadItem.Kokomade := -1;
687 ThreadItem.NewReceive := ThreadItem.Count;
688 ThreadItem.ParentBoard := Board;
689 ThreadItem.IsLogFile := True;
690 ThreadItem.Round := False;
691 ThreadItem.UnRead := False;
692 ThreadItem.ScrollTop := 0;
693 ThreadItem.AgeSage := gasNone;
694 ThreadItem.EndUpdate;
695 Board.Add(ThreadItem);
702 Board.Sorted := False;
704 Board.IsThreadDatRead := True;
707 (*************************************************************************
708 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
709 *************************************************************************)
710 procedure TGikoSys.CreateThreadDat(Board: TBoard);
714 SubjectList: TStringList;
720 if not FileExists(Board.GetSubjectFileName) then Exit;
721 FileName := Board.GetFolderIndexFileName;
723 SubjectList := TStringList.Create;
725 SubjectList.LoadFromFile(Board.GetSubjectFileName);
726 sl := TStringList.Create;
729 sl.Add(FOLDER_INDEX_VERSION);
730 for i := 0 to SubjectList.Count - 1 do begin
731 Rec := DivideSubject(SubjectList[i]);
733 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
736 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
737 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
738 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
739 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
740 + Format('%x', [0]) + #1 //size
741 + Format('%x', [0]) + #1 //RoundDate
742 + Format('%x', [0]) + #1 //LastModified
743 + Format('%x', [0]) + #1 //Kokomade
744 + Format('%x', [0]) + #1 //NewReceive
745 + '0' + #1 //
\96¢
\8eg
\97p
746 + Format('%x', [0]) + #1 //UnRead
747 + Format('%x', [0]) + #1 //ScrollTop
748 + Format('%x', [Rec.FCount]) + #1 //AllResCount
749 + Format('%x', [0]) + #1 //NewResCount
750 + Format('%x', [0]); //AgeSage
755 sl.SaveToFile(FileName);
764 (*************************************************************************
765 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
767 *************************************************************************)
768 procedure TGikoSys.WriteThreadDat(Board: TBoard);
770 // Values: array[Boolean] of string = ('0', '1');
776 TmpFileList: TStringList;
778 if not Board.IsThreadDatRead then
780 FileName := Board.GetFolderIndexFileName;
781 ForceDirectoriesEx( ExtractFilePath( FileName ) );
783 sl := TStringList.Create;
784 TmpFileList := TStringList.Create;
785 TmpFileList.Sorted := true;
787 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
789 sl.Add(FOLDER_INDEX_VERSION);
791 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
792 Sort.SortNoFlag := true;
793 Sort.SortOrder := true;
795 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
796 Board.CustomSort(ThreadItemSortProc);
798 for i := 0 to Board.Count - 1 do begin
799 Board.Items[i].No := i + 1;
800 s := Format('%x', [Board.Items[i].No]) + #1
801 + Board.Items[i].FileName + #1
802 + Board.Items[i].Title + #1
803 + Format('%x', [Board.Items[i].Count]) + #1
804 + Format('%x', [Board.Items[i].Size]) + #1
805 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
806 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
807 + Format('%x', [Board.Items[i].Kokomade]) + #1
808 + Format('%x', [Board.Items[i].NewReceive]) + #1
809 + '0' + #1 //
\96¢
\8eg
\97p
810 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
811 + Format('%x', [Board.Items[i].ScrollTop]) + #1
812 + Format('%x', [Board.Items[i].AllResCount]) + #1
813 + Format('%x', [Board.Items[i].NewResCount]) + #1
814 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
819 sl.SaveToFile(FileName);
821 for i := 0 to TmpFileList.Count - 1 do begin
822 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
831 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
833 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
834 Result.FFileName := RemoveToken(Line, #1);
835 Result.FTitle := RemoveToken(Line, #1);
836 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
837 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
838 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
839 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
840 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
841 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
842 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
843 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
844 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
845 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
846 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
847 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
851 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
852 // ListFiles('c:\', '*.txt', list, True);
853 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
856 SearchRec : TSearchRec;
860 maskExt := Copy(Mask, 1, Length(Mask) - 1);
862 Path := IncludeTrailingPathDelimiter(Path);
863 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
865 while rc = 0 do begin
866 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
867 s := Path + SearchRec.Name;
868 //if (SearchRec.Attr and faDirectory > 0) then
869 // s := IncludeTrailingPathDelimiter(s)
871 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
875 List.Add(SearchRec.Name);
876 if SubDir and (SearchRec.Attr and faDirectory > 0) then
877 GetFileList(s, Mask, List, True, IsPathAdd);
879 rc := FindNext(SearchRec);
882 SysUtils.FindClose(SearchRec);
886 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
887 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
888 // ListFiles('c:\', '*.txt', list, True);
889 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
892 SearchRec : TSearchRec;
895 Path := IncludeTrailingPathDelimiter(Path);
896 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
898 while rc = 0 do begin
899 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
900 s := Path + SearchRec.Name;
902 if (SearchRec.Attr and faDirectory = 0) then
906 List.Add(SearchRec.Name);
908 rc := FindNext(SearchRec);
911 SysUtils.FindClose(SearchRec);
915 //
\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é
916 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
919 SearchRec : TSearchRec;
922 Path := IncludeTrailingPathDelimiter(Path);
923 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
925 while rc = 0 do begin
926 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
927 s := Path + SearchRec.Name;
928 //if (SearchRec.Attr and faDirectory > 0) then
929 // s := IncludeTrailingPathDelimiter(s)
931 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
932 List.Add( IncludeTrailingPathDelimiter( s ) );
933 if SubDir and (SearchRec.Attr and faDirectory > 0) then
934 GetDirectoryList(s, Mask, List, True);
936 rc := FindNext(SearchRec);
939 SysUtils.FindClose(SearchRec);
943 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
944 function TGikoSys.LoadFromSkin(
946 ThreadItem: TThreadItem;
953 Skin := TStringList.Create;
955 if FileExists( fileName ) then begin
956 Skin.LoadFromFile( fileName );
958 //
\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
960 if ThreadItem.ParentBoard <> nil then
961 if ThreadItem.ParentBoard.ParentCategory <> nil then
962 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
963 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
965 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
966 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
967 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
968 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
969 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
970 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
971 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
973 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
974 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
975 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
977 //-----
\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µ
978 //
\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
980 if ThreadItem.ParentBoard <> nil then
981 if ThreadItem.ParentBoard.ParentCategory <> nil then
982 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
983 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
985 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
986 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
987 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
988 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
989 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
990 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
991 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
993 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
994 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
995 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
996 //-----
\82±
\82±
\82Ü
\82Å
1004 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1005 function TGikoSys.SkinedRes(
1011 spamminess : Extended;
1012 wordCount : TWordCount;
1015 wordCount := TWordCount.Create;
1017 spamminess := Floor( SpamParse(
1018 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1020 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1021 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1022 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1023 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1024 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1025 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1026 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1027 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1028 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1029 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1030 Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
1032 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1033 Skin := CustomStringReplace( Skin, '&NUMBER',
1034 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1035 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1036 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1037 Skin := CustomStringReplace( Skin, '&MAILNAME',
1038 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1039 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1040 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1041 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1042 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1043 Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
1044 //-----
\82±
\82±
\82Ü
\82Å
1053 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1057 //bufList : TStringList;
1058 ReadList: TStringList;
1059 SaveList: TStringList;
1060 CSSFileName: string;
1063 NewReceiveNo: Integer;
1065 boardPlugIn : TBoardPlugIn;
1067 UserOptionalStyle: string;
1074 function LoadSkin( fileName: string ): string;
1076 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1078 function ReplaceRes( skin: string ): string;
1080 Result := SkinedRes( skin, Res, No );
1083 if ThreadItem <> nil then begin
1084 if ThreadItem.IsBoardPlugInAvailable then begin
1085 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1086 boardPlugIn := ThreadItem.BoardPlugIn;
1087 NewReceiveNo := ThreadItem.NewReceive;
1088 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1089 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1090 UserOptionalStyle := UserOptionalStyle +
1091 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1092 if GikoSys.Setting.BrowserFontSize <> 0 then
1093 UserOptionalStyle := UserOptionalStyle +
1094 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1095 if GikoSys.Setting.BrowserFontColor <> -1 then
1096 UserOptionalStyle := UserOptionalStyle +
1097 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1098 if GikoSys.Setting.BrowserBackColor <> -1 then
1099 UserOptionalStyle := UserOptionalStyle +
1100 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1101 case GikoSys.Setting.BrowserFontBold of
1102 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1103 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1105 case GikoSys.Setting.BrowserFontItalic of
1106 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1107 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1110 SaveList := TStringList.Create;
1113 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1114 // doc.charset := 'Shift_JIS';
1117 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1118 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1120 SaveList.Add('<p id="idSearch"></p>');
1121 for i := 0 to threadItem.Count - 1 do begin
1122 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1123 if i <> 0 then begin
1124 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1127 if ThreadItem.Kokomade > (i + 1) then
1130 if NewReceiveNo > (i + 1) then
1133 if (threadItem.Count - i) > ResRange then
1138 //
\90V
\92\85\83}
\81[
\83N
1139 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1141 if GikoSys.Setting.UseSkin then begin
1142 if FileExists( GetSkinNewmarkFileName ) then
1143 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1145 SaveList.Add( '<a name="new"></a>' );
1146 end else if GikoSys.Setting.UseCSS then begin
1147 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>');
1149 SaveList.Add('</dl>');
1150 SaveList.Add('<a name="new"></a>');
1151 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>');
1152 SaveList.Add('<dl>');
1155 SaveList.Add( '<a name="new"></a>' );
1160 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1162 if ThreadItem.Kokomade = (i + 1) then begin
1163 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1165 if GikoSys.Setting.UseSkin then begin
1166 if FileExists( GetSkinBookmarkFileName ) then
1167 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1169 SaveList.Add( '<a name="koko"></a>' );
1170 end else if GikoSys.Setting.UseCSS then begin
1171 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1173 SaveList.Add('</dl>');
1174 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>');
1175 SaveList.Add('<dl>');
1178 SaveList.Add( '<a name="koko"></a>' );
1182 doc.Write(SaveList.Text);
1187 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1188 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1189 doc.Write(SaveList.Text);
1198 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1199 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1200 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1201 ShortDayNames[7] := '
\93y';
1202 BBSID := ThreadItem.ParentBoard.BBSID;
1203 NewReceiveNo := ThreadItem.NewReceive;
1204 ReadList := TStringList.Create;
1206 if ThreadItem.IsLogFile then begin
1207 FileName := ThreadItem.GetThreadFileName;
1208 ReadList.LoadFromFile(FileName);
1209 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1210 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1211 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1212 Res := DivideStrLine(ReadList[0]);
1213 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1214 sTitle := Res.FTitle;
1216 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1218 SaveList := TStringList.Create;
1221 doc.charset := 'Shift_JIS';
1223 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1224 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1225 UserOptionalStyle := UserOptionalStyle +
1226 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1227 if GikoSys.Setting.BrowserFontSize <> 0 then
1228 UserOptionalStyle := UserOptionalStyle +
1229 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1230 if GikoSys.Setting.BrowserFontColor <> -1 then
1231 UserOptionalStyle := UserOptionalStyle +
1232 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1233 if GikoSys.Setting.BrowserBackColor <> -1 then
1234 UserOptionalStyle := UserOptionalStyle +
1235 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1236 case GikoSys.Setting.BrowserFontBold of
1237 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1238 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1240 case GikoSys.Setting.BrowserFontItalic of
1241 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1242 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1245 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1246 if GikoSys.Setting.UseSkin then begin
1247 //
\83X
\83L
\83\93\8eg
\97p
1248 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1250 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1251 if Length( UserOptionalStyle ) > 0 then
1252 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1253 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1254 SaveList.Add( SkinHeader );
1258 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1262 SkinRes := LoadSkin( GetSkinResFileName );
1265 SaveList.Add('<p id="idSearch"></p>');
1266 SaveList.Add('<a name="top"></a>');
1268 for i := 0 to ReadList.Count - 1 do begin
1269 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1270 if i <> 0 then begin
1271 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1274 if ThreadItem.Kokomade > (i + 1) then
1277 if NewReceiveNo > (i + 1) then
1280 if (threadItem.Count - i) > ResRange then
1285 //
\90V
\92\85\83}
\81[
\83N
1286 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1288 if FileExists( GetSkinNewmarkFileName ) then
1289 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1291 SaveList.Add( '<a name="new"></a>' );
1293 SaveList.Add( '<a name="new"></a>' );
1296 if (Trim(ReadList[i]) <> '') then begin
1297 No := IntToStr(i + 1);
1299 Res := DivideStrLine(ReadList[i]);
1300 if Res.FType = glt2chOld then begin
1301 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1302 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1303 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1306 Res.FBody := AddAnchorTag(Res.FBody);
1307 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1310 if NewReceiveNo <= (i + 1) then
1311 //
\90V
\92\85\83\8c\83X
1312 strTmp := ReplaceRes( SkinNewRes )
1314 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1315 strTmp := ReplaceRes( SkinRes );
1317 SaveList.Add( strTmp );
1322 if ThreadItem.Kokomade = (i + 1) then begin
1323 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1325 if FileExists( GetSkinBookmarkFileName ) then
1326 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1328 SaveList.Add( '<a name="koko"></a>' );
1330 SaveList.Add( '<a name="koko"></a>' );
1333 doc.Write(SaveList.Text);
1336 SaveList.Add('<a name="bottom"></a>');
1337 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1339 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1342 doc.Write(SaveList.Text);
1343 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1345 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1346 // SaveList.Add('<html lang="ja"><head>');
1347 SaveList.Add('<html><head>');
1348 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1349 SaveList.Add('<title>' + sTitle + '</title>');
1350 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1351 if Length( UserOptionalStyle ) > 0 then
1352 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1353 SaveList.Add('</head>');
1354 SaveList.Add('<body>');
1355 SaveList.Add('<a name="top"></a>');
1356 SaveList.Add('<p id="idSearch"></p>');
1357 SaveList.Add('<div class="title">' + sTitle + '</div>');
1358 doc.Write(SaveList.Text);
1360 //Application.ProcessMessages;
1361 for i := 0 to ReadList.Count - 1 do begin
1362 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1363 if i <> 0 then begin
1364 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1367 if ThreadItem.Kokomade > (i + 1) then
1370 if NewReceiveNo > (i + 1) then
1373 if (threadItem.Count - i) > ResRange then
1378 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1379 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>');
1381 if (Trim(ReadList[i]) <> '') then begin
1382 No := IntToStr(i + 1);
1383 Res := DivideStrLine(ReadList[i]);
1384 Res.FBody := AddAnchorTag(Res.FBody);
1385 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1386 if Res.FMailTo = '' then
1387 SaveList.Add('<a name="' + No + '"></a>'
1388 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1389 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1390 + '<span class="name"><b>' + Res.FName + '</b></span> '
1391 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1392 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1393 + '<div class="mes">' + Res.FBody + ' </div>')
1394 else if GikoSys.Setting.ShowMail then
1395 SaveList.Add('<a name="' + No + '"></a>'
1396 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1397 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1398 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1399 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1400 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1401 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1402 + '<div class="mes">' + Res.FBody + ' </div>')
1404 SaveList.Add('<a name="' + No + '"></a>'
1405 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1406 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1407 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1408 + '<b>' + Res.FName + '</b></a>'
1409 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1410 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1411 + '<div class="mes">' + Res.FBody + ' </div>');
1413 if ThreadItem.Kokomade = (i + 1) then begin
1414 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1417 doc.Write(SaveList.Text);
1420 SaveList.Add('<a name="bottom"></a>');
1421 //SaveList.Add('</body></html>');
1422 SaveList.Add('<a name="last"></a>');
1423 SaveList.Add('</body></html>');
1424 doc.Write(SaveList.Text);
1427 // SaveList.Add('<html lang="ja"><head>');
1428 SaveList.Add('<html><head>');
1429 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1430 SaveList.Add('<title>' + sTitle + '</title></head>');
1431 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1432 SaveList.Add('<a name="top"></a>');
1433 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1434 SaveList.Add('<dl>');
1435 SaveList.Add('<p id="idSearch"></p>');
1436 doc.Write(SaveList.Text);
1438 //Application.ProcessMessages;
1439 for i := 0 to ReadList.Count - 1 do begin
1440 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1441 if i <> 0 then begin
1442 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1445 if ThreadItem.Kokomade > (i + 1) then
1448 if NewReceiveNo > (i + 1) then
1451 if (threadItem.Count - i) > ResRange then
1456 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1457 SaveList.Add('</dl>');
1458 SaveList.Add('<a name="new"></a>');
1459 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>');
1460 SaveList.Add('<dl>');
1462 if (Trim(ReadList[i]) <> '') then begin
1463 No := IntToStr(i + 1);
1464 Res := DivideStrLine(ReadList[i]);
1465 if Res.FType = glt2chOld then begin
1466 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1467 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1468 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1470 Res.FBody := AddAnchorTag(Res.FBody);
1471 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1472 if Res.FMailTo = '' then
1473 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>')
1474 else if GikoSys.Setting.ShowMail then
1475 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>')
1477 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>');
1479 if ThreadItem.Kokomade = (i + 1) then begin
1480 SaveList.Add('</dl>');
1481 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>');
1482 SaveList.Add('<dl>');
1484 doc.Write(SaveList.Text);
1487 SaveList.Add('</dl>');
1488 SaveList.Add('<a name="bottom"></a>');
1489 SaveList.Add('</body></html>');
1490 doc.Write(SaveList.Text);
1500 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1504 //bufList : TStringList;
1505 ReadList: TStringList;
1506 // SaveList: TStringList;
1507 CSSFileName: string;
1511 boardPlugIn : TBoardPlugIn;
1513 UserOptionalStyle: string;
1517 function LoadSkin( fileName: string ): string;
1519 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1521 function ReplaceRes( skin: string ): string;
1523 Result := SkinedRes( skin, Res, No );
1527 if ThreadItem <> nil then begin
1528 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1531 if ThreadItem.IsBoardPlugInAvailable then begin
1532 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1533 boardPlugIn := ThreadItem.BoardPlugIn;
1534 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1535 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1536 UserOptionalStyle := UserOptionalStyle +
1537 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1538 if GikoSys.Setting.BrowserFontSize <> 0 then
1539 UserOptionalStyle := UserOptionalStyle +
1540 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1541 if GikoSys.Setting.BrowserFontColor <> -1 then
1542 UserOptionalStyle := UserOptionalStyle +
1543 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1544 if GikoSys.Setting.BrowserBackColor <> -1 then
1545 UserOptionalStyle := UserOptionalStyle +
1546 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1547 case GikoSys.Setting.BrowserFontBold of
1548 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1549 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1551 case GikoSys.Setting.BrowserFontItalic of
1552 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1553 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1557 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1559 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1560 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1561 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1562 if Setting.UseSkin then begin
1563 tmp1 := './' +Setting.CSSFileName;
1564 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1565 tmp1 := CustomStringReplace(tmp1, '\', '/');
1566 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1567 end else if Setting.UseCSS then begin
1568 tmp1 := './' + CSSFileName;
1569 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1570 tmp1 := CustomStringReplace(tmp1, '\', '/');
1571 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1575 for i := 0 to threadItem.Count - 1 do begin
1578 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1581 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1582 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1589 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1590 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1591 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1592 ShortDayNames[7] := '
\93y';
1593 BBSID := ThreadItem.ParentBoard.BBSID;
1594 ReadList := TStringList.Create;
1596 if ThreadItem.IsLogFile then begin
1597 FileName := ThreadItem.GetThreadFileName;
1598 ReadList.LoadFromFile(FileName);
1599 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1600 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1601 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1602 Res := DivideStrLine(ReadList[0]);
1603 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1604 sTitle := Res.FTitle;
1606 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1609 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1610 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1611 UserOptionalStyle := UserOptionalStyle +
1612 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1613 if GikoSys.Setting.BrowserFontSize <> 0 then
1614 UserOptionalStyle := UserOptionalStyle +
1615 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1616 if GikoSys.Setting.BrowserFontColor <> -1 then
1617 UserOptionalStyle := UserOptionalStyle +
1618 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1619 if GikoSys.Setting.BrowserBackColor <> -1 then
1620 UserOptionalStyle := UserOptionalStyle +
1621 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1622 case GikoSys.Setting.BrowserFontBold of
1623 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1624 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1626 case GikoSys.Setting.BrowserFontItalic of
1627 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1628 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1632 if GikoSys.Setting.UseSkin then begin
1633 //
\83X
\83L
\83\93\8eg
\97p
1634 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1636 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1637 if Length( UserOptionalStyle ) > 0 then
1638 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1639 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1640 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1641 tmp1 := './' +Setting.CSSFileName;
1642 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1643 tmp1 := CustomStringReplace(tmp1, '\', '/');
1644 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1645 html.Append( SkinHeader );
1649 SkinRes := LoadSkin( GetSkinResFileName );
1652 html.Append('<a name="top"></a>');
1653 for i := 0 to ReadList.Count - 1 do begin
1654 if (Trim(ReadList[i]) <> '') then begin
1655 No := IntToStr(i + 1);
1657 Res := DivideStrLine(ReadList[i]);
1658 if Res.FType = glt2chOld then begin
1659 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1660 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1661 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1664 Res.FBody := AddAnchorTag(Res.FBody);
1665 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1668 html.Append( ReplaceRes( SkinRes ) );
1674 html.Append('<a name="bottom"></a>');
1675 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1677 html.Append( LoadSkin( GetSkinFooterFileName ) );
1680 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1682 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1683 html.Append('<html><head>');
1684 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1685 html.Append('<title>' + sTitle + '</title>');
1686 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1687 tmp1 := './' + CSSFileName;
1688 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1689 tmp1 := CustomStringReplace(tmp1, '\', '/');
1691 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1692 if Length( UserOptionalStyle ) > 0 then
1693 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1694 html.Append('</head>');
1695 html.Append('<body>');
1696 html.Append('<a name="top"></a>');
1697 html.Append('<div class="title">' + sTitle + '</div>');
1698 for i := 0 to ReadList.Count - 1 do begin
1699 if (Trim(ReadList[i]) <> '') then begin
1700 No := IntToStr(i + 1);
1701 Res := DivideStrLine(ReadList[i]);
1702 Res.FBody := AddAnchorTag(Res.FBody);
1703 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1704 if Res.FMailTo = '' then
1705 html.Append('<a name="' + No + '"></a>'
1706 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1707 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1708 + '<span class="name"><b>' + Res.FName + '</b></span> '
1709 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1710 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1711 + '<div class="mes">' + Res.FBody + ' </div>')
1712 else if GikoSys.Setting.ShowMail then
1713 html.Append('<a name="' + No + '"></a>'
1714 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1715 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1716 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1717 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1718 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1719 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1720 + '<div class="mes">' + Res.FBody + ' </div>')
1722 html.Append('<a name="' + No + '"></a>'
1723 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1724 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1725 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1726 + '<b>' + Res.FName + '</b></a>'
1727 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1728 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1729 + '<div class="mes">' + Res.FBody + ' </div>');
1732 html.Append('<a name="bottom"></a>');
1733 html.Append('</body></html>');
1734 html.Append('<a name="last"></a>');
1735 html.Append('</body></html>');
1738 html.Append('<html><head>');
1739 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1740 html.Append('<title>' + sTitle + '</title></head>');
1741 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1742 html.Append('<a name="top"></a>');
1743 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1744 html.Append('<dl>');
1745 for i := 0 to ReadList.Count - 1 do begin
1746 if (Trim(ReadList[i]) <> '') then begin
1747 No := IntToStr(i + 1);
1748 Res := DivideStrLine(ReadList[i]);
1749 if Res.FType = glt2chOld then begin
1750 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1751 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1752 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1754 Res.FBody := AddAnchorTag(Res.FBody);
1755 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1756 if Res.FMailTo = '' then
1757 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>')
1758 else if GikoSys.Setting.ShowMail then
1759 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>')
1761 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>');
1764 html.Append('</dl>');
1765 html.Append('<a name="bottom"></a>');
1766 html.Append('</body></html>');
1775 function TGikoSys.ConvertResAnchor(res: string): string;
1777 _HEAD : string = '<a href="../';
1778 _TAIL : string = ' target="_blank">';
1779 _ST: string = '&st=';
1780 _TO: string = '&to=';
1781 _STA: string = '&START=';
1782 _END: string = '&END=';
1788 i := AnsiPos(_HEAD, res);
1789 while i <> 0 do begin
1790 Result := Result + Copy(res, 1, i -1);
1791 Delete(res, 1, i - 1);
1792 j := AnsiPos(_TAIL, res);
1794 Result := Result + res;
1797 tmp := Copy(res, 1, j - 1);
1798 Delete(res, 1, j + 16);
1799 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1800 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1801 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1802 Result := Result + '<a href="#' + tmp + '">';
1803 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1804 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1805 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1806 Result := Result + '<a href="#' + tmp + '">';
1808 k := LastDelimiter('/', tmp);
1810 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1811 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1813 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1815 Result := Result + '<a href="#' + tmp + '">';
1817 i := AnsiPos(_HEAD, res);
1819 Result := Result + res;
1823 (*************************************************************************
1824 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1825 *************************************************************************)
1826 function TGikoSys.AddAnchorTag(s: string): string;
1828 URL_CHAR: string = '0123456789'
1829 + 'abcdefghijklmnopqrstuvwxyz'
1830 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1831 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1832 ANCHOR_REF = 'href=';
1833 RES_REF = '>>';
1835 wkIdx: array[0..9] of Integer;
1840 anchorLen : Integer;
1843 // + 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ß
1844 anchorLen := Length( ANCHOR_REF ) + 3;
1847 wkIdx[0] := AnsiPos('http://', s);
1848 wkIdx[1] := AnsiPos('ttp://', s);
1849 wkIdx[2] := AnsiPos('tp://', s);
1850 wkIdx[3] := AnsiPos('ms-help://', s);
1851 wkIdx[4] := AnsiPos('p://', s);
1852 wkIdx[5] := AnsiPos('https://', s);
1853 wkIdx[6] := AnsiPos('www.', s);
1854 wkIdx[7] := AnsiPos('ftp://', s);
1855 wkIdx[8] := AnsiPos('news://', s);
1856 wkIdx[9] := AnsiPos('rtsp://', s);
1860 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1862 if idx = MaxInt then begin
1863 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1864 Result := Result + s;
1869 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1870 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1871 href := Copy( s, idx, Length( s ) );
1872 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1874 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1879 Result := Result + Copy(s, 0, idx - 1);
1881 s := Copy(s, idx, length(s));
1883 b := Length( s ) + 1;
1884 for i := 1 to b do begin
1888 idx := AnsiPos(s[i], URL_CHAR);
1889 if idx = 0 then begin
1890 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1891 url := Copy(s, 0, i - 1);
1893 if AnsiPos('ttp://', url) = 1 then
1895 else if AnsiPos('tp://', url) = 1 then
1897 else if AnsiPos('p://', url) = 1 then
1899 else if AnsiPos('www.', url) = 1 then
1900 href := 'http://' + url
1903 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1904 s := Copy(s, i, MaxInt);
1911 (*************************************************************************
1912 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1913 *************************************************************************)
1914 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1924 if AnsiPos('<>', Line) = 0 then
1928 Result.FFileName := RemoveToken(Line, Delim);
1929 Result.FTitle := RemoveToken(Line, Delim);
1931 ws := Trim(Result.FTitle);
1933 if Copy(ws, Length(ws), 1) = ')' then begin
1936 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1939 end else if Copy(ws, Length(ws), 1) = '<' then begin
1944 for i := Length(ws) - 1 downto 1 do begin
1945 if ws[i] = LeftK then begin
1946 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1947 if IsNumeric(ws) then
1948 Result.FCount := StrToInt(ws);
1949 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1955 (*************************************************************************
1956 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1957 *************************************************************************)
1958 function TGikoSys.DivideStrLine(Line: string): TResRec;
1963 if AnsiPos('<>', Line) = 0 then begin
1965 Result.FType := glt2chOld;
1968 Result.FType := glt2chNew;
1970 Result.FName := Trim(RemoveToken(Line, Delim));
1971 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1972 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1973 bufBody := Trim(RemoveToken(Line, Delim));
1975 if bufbody = '' then begin
1976 Insert(' ',bufbody, 1);
1978 Result.FBody := bufBody;
1979 Result.FTitle := Trim(RemoveToken(Line, Delim));
1983 (*************************************************************************
1984 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1985 *************************************************************************)
1986 function TGikoSys.UrlToID(url: string): string;
1993 if url = '' then Exit;
1995 url := Copy(url, 0, Length(url) - 1);
1996 for i := Length(url) downto 0 do begin
1997 if url[i] = '/' then begin
1998 Result := Copy(url, i + 1, Length(url));
2004 (*************************************************************************
2005 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
2006 *************************************************************************)
2007 function TGikoSys.UrlToServer(url: string): string;
2014 wsURL := Trim(wsURL);
2016 if wsURL = '' then exit;
2018 if Copy(wsURL, Length(wsURL), 1) = '/' then
2019 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
2021 for i := Length(wsURL) downto 0 do begin
2022 if wsURL[i] = '/' then begin
2023 Result := Copy(wsURL, 0, i);
2029 (*************************************************************************
2030 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
2031 *************************************************************************)
2032 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
2036 Code := GetFileAttributes(PChar(Name));
2037 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2040 (*************************************************************************
2041 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
2042 *************************************************************************)
2043 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2046 if Length(Dir) = 0 then
2047 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
2048 Dir := ExcludeTrailingPathDelimiter(Dir);
2049 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2050 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2051 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2054 (*************************************************************************
2055 *
\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
2056 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2057 *************************************************************************)
2058 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2062 Result := StrTokNext(sep, Rec);
2065 (*************************************************************************
2066 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2067 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2068 *************************************************************************)
2069 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2076 if Len >= Pos then begin
2077 while (Pos <= Len) and (Str[Pos] in sep) do begin
2081 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2082 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2087 Result := Copy(Str, I, Pos - I);
2088 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2095 (*************************************************************************
2096 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2097 *************************************************************************)
2098 function TGikoSys.GetFileSize(FileName : string): longint;
2103 if not FileExists(FileName) then begin
2107 Assign(F, FileName);
2109 Result := FileSize(F);
2116 (*************************************************************************
2117 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2118 *************************************************************************)
2119 function TGikoSys.GetFileLineCount(FileName : string): longint;
2123 sl := TStringList.Create;
2126 sl.LoadFromFile(FileName);
2137 (*************************************************************************
2138 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2139 *************************************************************************)
2140 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2142 fileTmp : TStringList;
2145 if FileExists(FileName) then begin
2146 fileTmp := TStringList.Create;
2149 fileTmp.LoadFromFile( FileName );
2150 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2151 Result := fileTmp.Strings[ Line-1 ];
2154 //on EFOpenError do Result := '';
2162 (*************************************************************************
2163 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2164 *************************************************************************)
2165 procedure TGikoSys.MenuFont(Font: TFont);
2168 nm: NONCLIENTMETRICS;
2170 nm.cbSize := sizeof(NONCLIENTMETRICS);
2172 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2173 lf := nm.lfMenuFont;
2175 Font.Name := lf.lfFaceName;
2176 Font.Height := lf.lfHeight;
2178 if lf.lfWeight >= 700 then
2179 Font.Style := Font.Style + [fsBold];
2180 if lf.lfItalic = 1 then
2181 Font.Style := Font.Style + [fsItalic];
2184 (*************************************************************************
2186 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2187 *************************************************************************)
2188 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2192 p := AnsiPos(delimiter, s);
2196 Result := Copy(s, 1, p - 1);
2197 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2200 (*************************************************************************
2202 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2203 *************************************************************************)
2204 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2209 for i := 0 to index do
2210 Result := RemoveToken(s, delimiter);
2213 (*************************************************************************
2215 *************************************************************************)
2216 function TGikoSys.DeleteLink(const s: string): string;
2226 s1 := GetTokenIndex(s, '<a href="', i);
2227 s2 := GetTokenIndex(s, '<a href="', i + 1);
2229 idx := Pos('">', s1);
2231 Delete(s1, 1, idx + 1);
2232 idx := Pos('">', s2);
2234 Delete(s2, 1, idx + 1);
2236 Result := Result + s1 + s2;
2245 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2246 {procedure TGikoSys.FlashExitWrite;
2250 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2251 for i := 0 to FExitWrite.Count - 1 do
2252 WriteThreadDat(FExitWrite[i]);
2256 (*************************************************************************
2257 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2259 *************************************************************************)
2260 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2262 ERASECHAR : array [1..39] of string =
2263 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2264 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2265 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2266 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2268 Chr : array [0..255] of char;
2272 s := Trim(LongName);
2273 if (Length(s) <= ALength) then begin
2277 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2278 S := CustomStringReplace(S, ERASECHAR[i], '');
2280 if (Length(S) <= ALength) then begin
2283 Windows.LCMapString(
2284 GetUserDefaultLCID(),
2292 S := Copy(S,1,ALength);
2294 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2295 S := Copy(S, 1, Length(S) - 1);
2305 (*************************************************************************
2308 *************************************************************************)
2309 function TGikoSys.ConvRes(const Body, Bbs, Key,
2310 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2311 DatToHTML: boolean = false): string;
2315 FIndexFrom : integer;
2322 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2336 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2341 FIndex.FIndexFrom := IndexFrom;
2342 FIndex.FIndexTo := IndexTo;
2346 function ChooseString(const Text, Separator: string; Index: integer): string;
2352 for i := 0 to Index - 1 do begin
2353 if (AnsiPos(Separator, S) = 0) then S := ''
2354 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2356 p := AnsiPos(Separator, S);
2357 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2366 List:= TList.Create;
2372 b := ByteType(s, i);
2374 mbSingleByte : begin
2375 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2376 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2384 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2385 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2391 if (not sw) and (Copy(s,i,4) = GT) then begin
2392 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2400 if ((not sw) and (Copy(s,i,1) = ',')) or
2401 ((not sw) and (Copy(s,i,1) = '=')) then begin
2402 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2403 ((Chk) and (oc = '')) or
2404 ((not Chk) and (al)) then
2414 if (AnsiPos(sx, SN) > 0) then begin
2417 if (No <> '') and (No <> '-') then begin
2430 if Copy(s,i,1) = '<' then oc := '';
2431 oc := oc + Copy(s,i,1);
2437 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2443 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2451 if (AnsiPos(sx, ZN) > 0) then begin
2452 No := No + ZenToHan(sx);
2454 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2469 if (i > Length(Body)) then begin
2471 if (No <> '') then Add(sp, i, No);
2476 for i := List.Count - 1 downto 0 do begin
2477 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2478 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2479 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2481 st := PIndex(List[i]).FNo;
2482 et := PIndex(List[i]).FNo;
2484 if not DatToHTML then
2485 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2486 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2487 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2488 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2489 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2491 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2492 Format('<a href="#%s">', [st]) +
2493 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2494 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2496 Dispose(PIndex(List[i]));
2502 function TGikoSys.ConvRes(
2503 const Body, Bbs, Key, ParamBBS, ParamKey,
2504 ParamStart, ParamTo, ParamNoFirst,
2505 ParamTrue, FullURL : string
2510 FIndexFrom : integer;
2517 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2531 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2536 FIndex.FIndexFrom := IndexFrom;
2537 FIndex.FIndexTo := IndexTo;
2541 function ChooseString(const Text, Separator: string; Index: integer): string;
2547 for i := 0 to Index - 1 do begin
2548 if (AnsiPos(Separator, S) = 0) then S := ''
2549 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2551 p := AnsiPos(Separator, S);
2552 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2561 List:= TList.Create;
2567 b := ByteType(s, i);
2569 mbSingleByte : begin
2570 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2571 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2579 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2580 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2586 if (not sw) and (Copy(s,i,4) = GT) then begin
2587 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2595 if ((not sw) and (Copy(s,i,1) = ',')) or
2596 ((not sw) and (Copy(s,i,1) = '=')) then begin
2597 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2598 ((Chk) and (oc = '')) or
2599 ((not Chk) and (al)) then
2609 if (AnsiPos(sx, SN) > 0) then begin
2612 if (No <> '') and (No <> '-') then begin
2625 if Copy(s,i,1) = '<' then oc := '';
2626 oc := oc + Copy(s,i,1);
2632 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2638 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2646 if (AnsiPos(sx, ZN) > 0) then begin
2647 No := No + ZenToHan(sx);
2649 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2664 if (i > Length(Body)) then begin
2666 if (No <> '') then Add(sp, i, No);
2671 for i := List.Count - 1 downto 0 do begin
2672 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2673 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2674 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2675 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2677 st := PIndex(List[i]).FNo;
2678 et := PIndex(List[i]).FNo;
2680 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2681 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2682 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2683 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2684 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2685 Dispose(PIndex(List[i]));
2692 function TGikoSys.BoolToInt(b: Boolean): Integer;
2694 Result := IfThen(b, 1, 0);
2697 function TGikoSys.IntToBool(i: Integer): Boolean;
2702 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2703 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2707 GZipStream: TGzipDecompressStream;
2708 TextStream: TStringStream;
2709 buf: array[0..BUF_SIZE - 1] of Byte;
2715 TextStream := TStringStream.Create('');
2717 //
\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¢)
2718 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2719 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2720 ResStream.Position := 0;
2721 GZipStream := TGzipDecompressStream.Create(TextStream);
2724 FillChar(buf, BUF_SIZE, 0);
2725 cnt := ResStream.Read(buf, BUF_SIZE);
2727 GZipStream.Write(buf, BUF_SIZE);
2733 ResStream.Position := 0;
2735 FillChar(buf, BUF_SIZE, 0);
2736 cnt := ResStream.Read(buf, BUF_SIZE);
2738 TextStream.Write(buf, BUF_SIZE);
2742 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2743 s := TextStream.DataString;
2745 while (i > 0) and (s[i] = #0) do
2750 while i <> 0 do begin
2760 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2762 STD_SEC = 'KeySetting';
2768 SecList: TStringList;
2769 Component: TComponent;
2771 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2773 SecList := TStringList.Create;
2774 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2776 ini.ReadSection(STD_SEC, SecList);
2777 for i := 0 to SecList.Count - 1 do begin
2778 ActionName := SecList[i];
2779 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2780 if ActionKey <> -1 then begin
2781 Component := ActionList.Owner.FindComponent(ActionName);
2782 if TObject(Component) is TAction then begin
2783 TAction(Component).ShortCut := ActionKey;
2793 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2795 STD_SEC = 'KeySetting';
2800 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2802 for i := 0 to ActionList.ActionCount - 1 do begin
2803 if ActionList.Actions[i].Tag = -1 then
2805 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2813 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2815 STD_SEC = 'KeySetting';
2821 SecList: TStringList;
2822 Component: TComponent;
2824 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2826 SecList := TStringList.Create;
2827 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2829 ini.ReadSection(STD_SEC, SecList);
2830 for i := 0 to SecList.Count - 1 do begin
2831 ActionName := SecList[i];
2832 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2833 if ActionKey <> -1 then begin
2834 Component := ActionList.Owner.FindComponent(ActionName);
2835 if TObject(Component) is TAction then begin
2836 TAction(Component).ShortCut := ActionKey;
2846 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2848 STD_SEC = 'KeySetting';
2853 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2855 for i := 0 to ActionList.ActionCount - 1 do begin
2856 if ActionList.Actions[i].Tag = -1 then
2858 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2867 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2869 PI: TProcessInformation;
2873 Path := '"' + AppPath + '"';
2875 Path := Path + ' ' + Param;
2877 SI.Cb := SizeOf(Si);
2878 SI.lpReserved := nil;
2879 SI.lpDesktop := nil;
2882 SI.cbReserved2 := 0;
2883 SI.lpReserved2 := nil;
2885 Windows.CreateProcess(nil,
2897 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2901 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2902 gbtUserApp, gbtAuto:
2903 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2904 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2906 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2910 function TGikoSys.HTMLDecode(const AStr: String): String;
2912 Sp, Rp, Cp, Tp: PChar;
2917 SetLength(Result, Length(AStr));
2919 Rp := PChar(Result);
2922 while Sp^ <> #0 do begin
2928 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2934 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2938 while (Sp^ <> ';') and (Sp^ <> #0) do
2945 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2953 Num := IsNumeric(Copy(Tp, 1, 1));
2954 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2955 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2959 SetString(S, Tp, Sp - Tp);
2964 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2965 //[Cp^ + Sp^, Cp - PChar(AStr)])
2975 // on E:EConvertError do
2976 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2977 // [Cp^ + Sp^, Cp - PChar(AStr)])
2979 SetLength(Result, Rp - PChar(Result));
2982 function TGikoSys.GetHRefText(s: string): string;
2992 Index := AnsiPos('href', LowerCase(s));
2995 s := Trim(Copy(s, Index + 4, Length(s)));
2996 s := Trim(Copy(s, 2, Length(s)));
2998 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2999 //if Copy(s, 1, 1) = '"' then begin
3000 if s[1] = '"' then begin
3001 s := Trim(Copy(s, 2, Length(s)));
3004 Index := AnsiPos('"', s);
3005 if Index <> 0 then begin
3006 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
3007 s := Copy(s, 1, Index - 1);
3009 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
3010 Index := AnsiPos(' ', s);
3011 Index2 := AnsiPos('>', s);
3014 if Index > Index2 then
3017 s := Copy(s, 1, Index - 1)
3019 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
3025 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
3026 function TGikoSys.Is2chHost(Host: string): Boolean;
3028 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
3034 if RightStr( Host, 1 ) = '/' then
3035 Host := Copy( Host, 1, Length( Host ) - 1 );
3036 OutputDebugString(pchar(HOST_NAME[0]));
3037 for i := 0 to Length(HOST_NAME) - 1 do begin
3038 // Len := Length(HOST_NAME[i]);
3039 if (AnsiPos(HOST_NAME[i], Host) > 0) and
3040 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
3047 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
3057 Index := AnsiPos(READ_PATH, path);
3058 if Index <> 0 then begin
3059 s := Copy(path, Index + Length(READ_PATH), Length(path));
3062 BBSID := GetTokenIndex(s, '/', 0);
3063 BBSKey := GetTokenIndex(s, '/', 1);
3066 Result := (BBSID <> '') or (BBSKey <> '');
3069 Index := AnsiPos(KAKO_PATH, path);
3070 if Index <> 0 then begin
3071 s := Copy(path, 2, Length(path));
3072 BBSID := GetTokenIndex(s, '/', 0);
3073 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3074 BBSID := GetTokenIndex(s, '/', 1);
3075 BBSKey := ChangeFileExt(Document, '');
3076 Result := (BBSID <> '') or (BBSKey <> '');
3079 Index := AnsiPos('read.cgi?', URL);
3080 if Index <> 0 then begin
3081 SList := TStringList.Create;
3084 // s := HTMLDecode(Document);
3085 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3086 BBSID := SList.Values['bbs'];
3087 BBSKey := SList.Values['key'];
3088 Result := (BBSID <> '') or (BBSKey <> '');
3098 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3105 URL := Trim(LowerCase(URL));
3106 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3110 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3112 stRes := StrToInt64( buf );
3113 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3114 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3116 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3119 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3120 buf := Copy( buf, 1, ps );
3124 endRes := StrToInt64(buf)
3131 if (stRes <> 0) and (endRes = 0) then
3132 endRes := stRes + MAX_POPUP_RES
3133 else if (stRes = 0) and (endRes <> 0) then begin
3134 stRes := endRes - MAX_POPUP_RES;
3138 GikoSys.GetBrowsableThreadURL( URL );
3139 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3141 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3144 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3145 buf := Copy( buf, 1, ps );
3148 stRes := StrToInt(buf)
3155 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3157 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3158 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3159 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3161 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3164 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3165 buf := Copy( buf, 1, ps );
3169 endRes := StrToInt64(buf);
3176 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3177 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3178 if Length(buf) > 0 then begin
3179 if AnsiPos('-', buf) = 1 then begin
3184 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3186 convBuf := Copy( buf, 1, ps );
3187 if convBuf <> '' then
3188 endRes := StrToInt64(convBuf)
3194 if endRes <> 0 then begin
3195 stRes := endRes - MAX_POPUP_RES;
3202 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3204 convBuf := Copy( buf, 1, ps );
3205 if convBuf <> '' then begin
3206 stRes := StrToInt64(convBuf);
3210 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3212 convBuf := Copy( buf, 1, ps );
3213 if convBuf <> '' then
3214 endRes := StrToInt64(convBuf)
3235 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3240 // convBuf : String;
3251 URL := Trim(LowerCase(URL));
3256 Result.FFirst := False;
3257 Result.FStBegin := False;
3258 Result.FToEnd := False;
3259 Result.FDone := False;
3260 Result.FNoParam := False;
3264 if URL[length(URL)] = '\' then
3266 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3267 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3268 s := Copy(URL, RStart + RLength - 1, Length(URL));
3270 //
\95W
\8f\80\8f\91\8e®
3271 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3272 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3273 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3274 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3275 s := Copy(s, 15, Length(s));
3277 SList := TStringList.Create;
3280 FAWKStr.RegExp := '/';
3281 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3282 Result.FBBS := SList[1];
3283 Result.FKey := SList[2];
3284 if SList.Count >= 4 then
3288 Result.FNoParam := true;
3294 FAWKStr.LineSeparator := mcls_CRLF;
3295 FAWKStr.RegExp := '-';
3296 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3297 Result.FFirst := True;
3299 FAWKStr.RegExp := 'l[0-9]+';
3300 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3301 Result.FFirst := True;
3303 for i := 0 to SList.Count - 1 do begin
3304 if Trim(SList[i]) = '' then begin
3306 Result.FStBegin := True;
3307 if i = (SList.Count - 1) then
3308 Result.FToEnd := True;
3309 end else if IsNumeric(SList[i]) then begin
3310 wkInt := StrToInt(SList[i]);
3311 wkMax := Max(wkMax, wkInt);
3315 wkMin := Min(wkMin, wkInt);
3316 end else if Trim(SList[i]) = 'n' then begin
3317 Result.FFirst := True;
3319 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3320 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3321 if Copy(SList[i], 1, 1) = 'n' then
3322 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3324 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3325 Result.FFirst := True;
3326 wkMax := Max(wkMax, wkInt);
3330 wkMin := Min(wkMin, wkInt);
3334 if Result.FStBegin and (not Result.FToEnd) then
3336 else if (not Result.FStBegin) and Result.FToEnd then
3338 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3339 Result.FSt := wkMin;
3340 Result.FTo := wkMax;
3342 //Result.FSt := wkMin;
3343 //Result.FTo := wkMax;
3349 Result.FDone := True;
3353 //
\90Vkako
\8f\91\8e®
3354 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3355 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3356 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3357 SList := TStringList.Create;
3360 FAWKStr.RegExp := '/';
3361 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3362 Result.FBBS := SList[1];
3363 Result.FKey := ChangeFileExt(SList[5], '');
3364 Result.FFirst := True;
3370 Result.FDone := True;
3374 //
\8b\8ckako
\8f\91\8e®
3375 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3376 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3377 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3378 SList := TStringList.Create;
3381 FAWKStr.RegExp := '/';
3382 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3383 Result.FBBS := SList[1];
3384 Result.FKey := ChangeFileExt(SList[4], '');
3385 Result.FFirst := True;
3391 Result.FDone := True;
3395 //log
\8by
\82Ñlog2
\8f\91\8e®
3396 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3397 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3398 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3399 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3400 SList := TStringList.Create;
3403 FAWKStr.RegExp := '/';
3404 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3405 Result.FBBS := SList[2];
3406 Result.FKey := ChangeFileExt(SList[5], '');
3407 Result.FFirst := True;
3413 Result.FDone := True;
3418 //
\8b\8cURL
\8f\91\8e®
3419 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3420 FAWKStr.RegExp := '/test/read\.cgi\?';
3421 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3422 s := Copy(s, 16, Length(s));
3423 SList := TStringList.Create;
3426 FAWKStr.RegExp := '&';
3427 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3428 Result.FFirst := True;
3429 for i := 0 to SList.Count - 1 do begin
3430 if Pos('bbs=', SList[i]) = 1 then begin
3431 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3432 end else if Pos('key=', SList[i]) = 1 then begin
3433 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3434 end else if Pos('st=', SList[i]) = 1 then begin
3435 wk := Copy(SList[i], 4, Length(SList[i]));
3436 if IsNumeric(wk) then
3437 Result.FSt := StrToInt(wk)
3438 else if wk = '' then
3439 Result.FStBegin := True;
3440 end else if Pos('to=', SList[i]) = 1 then begin
3441 wk := Copy(SList[i], 4, Length(SList[i]));
3442 if IsNumeric(wk) then
3443 Result.FTo := StrToInt(wk)
3444 else if wk = '' then
3445 Result.FToEnd := True;
3446 end else if Pos('nofirst=', SList[i]) = 1 then begin
3447 Result.FFirst := False;
3456 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3457 Result.FDone := True;
3464 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3474 URI := TIdURI.Create(URL);
3476 Protocol := URI.Protocol;
3479 Document := URI.Document;
3481 Bookmark := URI.Bookmark;
3487 function TGikoSys.GetVersionBuild: Integer;
3489 FixedFileInfo: PVSFixedFileInfo;
3490 VersionHandle, VersionSize: DWORD;
3491 pVersionInfo: Pointer;
3496 AppFile := Application.ExeName;
3497 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3498 if VersionSize = 0 then
3500 GetMem(pVersionInfo, VersionSize);
3502 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3503 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3504 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3506 FreeMem(pVersionInfo, VersionSize);
3510 function TGikoSys.GetBrowsableThreadURL(
3514 threadItem : TThreadItem;
3515 boardPlugIn : TBoardPlugIn;
3519 //=====
\83v
\83\89\83O
\83C
\83\93
3521 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3522 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3523 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3524 boardPlugIn := BoardPlugIns[ i ];
3525 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3526 Result := threadItem.URL;
3534 // 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¢
3537 if Length( Result ) = 0 then
3538 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3542 function TGikoSys.GetThreadURL2BoardURL(
3546 threadItem : TThreadItem;
3547 boardPlugIn : TBoardPlugIn;
3551 //=====
\83v
\83\89\83O
\83C
\83\93
3553 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3554 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3555 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3556 boardPlugIn := BoardPlugIns[ i ];
3557 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3558 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3566 // 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¢
3569 if Length( Result ) = 0 then
3570 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3574 function TGikoSys.Get2chThreadURL2BoardURL(
3578 Protocol, Host, Path, Document, Port, Bookmark : string;
3579 BBSID, BBSKey : string;
3583 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3584 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3586 foundPos := Pos( '/test/read.cgi', inURL );
3587 if {(Is2chHost(Host)) and} (foundPos > 0) then
3588 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3590 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3594 function TGikoSys.Get2chBrowsableThreadURL(
3598 Protocol, Host, Path, Document, Port, Bookmark : string;
3599 BBSID, BBSKey : string;
3603 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3606 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3607 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3608 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3610 if Is2chHost( Host ) then begin
3611 Result := Protocol + '://' + Host +
3612 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3614 if foundPos > 0 then
3615 Result := Copy( inURL, 1, foundPos ) +
3616 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3618 Result := Protocol + '://' + Host +
3619 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3625 function TGikoSys.Get2chBoard2ThreadURL(
3633 server := UrlToServer( inBoard.URL );
3634 if Is2chHost( server ) then
3635 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3637 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3641 (*************************************************************************
3642 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3643 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3644 *************************************************************************)
3645 procedure TGikoSys.ListBoardFile;
3647 boardFileList : TStringList;
3653 for i := 0 to Length( BBSs ) - 1 do
3657 SetLength( BBSs, 0 );
3660 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3661 if FileExists( GikoSys.GetBoardFileName ) then begin
3662 SetLength( BBSs, l + 1 );
3663 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3664 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3668 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3669 SetLength( BBSs, l + 1 );
3670 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3671 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3675 // Board
\83t
\83H
\83\8b\83_
3676 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3677 BoardFileList := TStringList.Create;
3679 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3680 for k := BoardFileList.Count - 1 downto 0 do begin
3681 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3682 BoardFileList.Delete(k);
3684 SetLength( BBSs, l + BoardFileList.Count );
3685 for i := BoardFileList.Count - 1 downto 0 do begin
3686 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3687 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3698 (*************************************************************************
3699 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3700 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3701 *************************************************************************)
3702 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3707 boardFile : TStringList;
3708 CategoryList : TStringList;
3709 BoardList : TStringList;
3710 Category : TCategory;
3713 RoundItem : TRoundItem;
3715 i, iBound : Integer;
3716 j, jBound : Integer;
3717 k, kBound : Integer;
3720 if not FileExists( bbs.FilePath ) then
3724 ini := TMemIniFile.Create('');
3725 boardFile := TStringList.Create;
3727 boardFile.LoadFromFile( bbs.FilePath );
3729 ini.SetStrings( boardFile );
3730 CategoryList := TStringList.Create;
3731 BoardList := TStringList.Create;
3733 ini.ReadSections( CategoryList );
3735 iBound := CategoryList.Count - 1;
3736 for i := 0 to iBound do begin
3737 ini.ReadSection( CategoryList[i], BoardList );
3738 Category := TCategory.Create;
3739 Category.No := i + 1;
3740 Category.Title := CategoryList[i];
3742 jBound := BoardList.Count - 1;
3743 for j := 0 to jBound do begin
3745 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3747 //=====
\83v
\83\89\83O
\83C
\83\93
3749 kBound := Length( BoardPlugIns ) - 1;
3750 for k := 0 to kBound do begin
3751 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3752 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3753 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3760 // 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¢
3764 Board := TBoard.Create( nil, inistr );
3767 Board.Title := BoardList[j];
3768 Board.RoundDate := ZERO_DATE;
3770 idx := RoundList.Find(Board);
3771 if idx <> -1 then begin
3772 RoundItem := RoundList.Items[idx, grtBoard];
3773 Board.Round := True;
3774 Board.RoundName := RoundItem.RoundName;
3777 Category.Add(Board);
3782 bbs.Add( Category );
3784 bbs.IsBoardFileRead := True;
3796 function TGikoSys.GetUnknownCategory : TCategory;
3798 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3801 if Length( BBSs ) < 2 then begin
3806 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3807 if Result = nil then begin
3808 Result := TCategory.Create;
3809 Result.Title := UNKNOWN_CATEGORY;
3810 BBSs[ 1 ].Add( Result );
3815 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3817 category : TCategory;
3819 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3822 category := GetUnknownCategory;
3823 if category = nil then begin
3826 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3827 if Result = nil then begin
3828 Result := TBoard.Create( inPlugIn, inURL );
3829 Result.Title := UNKNOWN_BOARD;
3830 category.Add( Result );
3835 function TGikoSys.GetSambaFileName : string;
3837 Result := Setting.GetSambaFileName;
3839 procedure TGikoSys.SambaFileExists();
3842 sambaStrList: TStringList;
3844 if not FileExists(GikoSys.GetSambaFileName) then begin
3845 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3846 sambaStrList := TStringList.Create;
3848 if FileExists(sambaTmp) then begin
3849 sambaStrList.LoadFromFile(sambaTmp);
3850 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3857 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string;
3863 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3864 body := TStringList.Create;
3866 GetSameIDRes(AID, ThreadItem, body);
3867 for i := 0 to body.Count - 1 do begin
3868 Result := Result + '>' + body[i] + ' ';
3873 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3876 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
3879 ReadList: TStringList;
3881 boardPlugIn : TBoardPlugIn;
3883 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3884 if ThreadItem.IsBoardPlugInAvailable then begin
3885 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3886 boardPlugIn := ThreadItem.BoardPlugIn;
3888 for i := 0 to threadItem.Count - 1 do begin
3890 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3891 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3892 body.Add(IntToStr(i+1));
3896 ReadList := TStringList.Create;
3898 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3899 for i := 0 to ReadList.Count - 1 do begin
3900 Res := DivideStrLine(ReadList[i]);
3901 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3902 body.Add(IntToStr(i+1));
3911 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string;
3917 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3918 body := TStringList.Create;
3920 GetSameIDRes(AIDNum, ThreadItem, body);
3921 for i := 0 to body.Count - 1 do begin
3922 Result := Result + '>' + body[i] + ' ';
3927 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3931 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
3934 boardPlugIn : TBoardPlugIn;
3936 stList: TStringList;
3939 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
3940 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
3941 if ThreadItem.IsBoardPlugInAvailable then begin
3942 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3943 boardPlugIn := ThreadItem.BoardPlugIn;
3944 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
3946 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
3948 AID := Res.FDateTime;
3949 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then
3950 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11)
3952 stlist := TStringList.Create;
3954 stList.DelimitedText := AID;
3955 for i := 0 to stList.Count - 1 do
3956 if Length(WideString(stList[i])) = 8 then begin
3957 if NotDateorTimeString(stList[i]) then begin
3967 GetSameIDRes(AID, ThreadItem, body);
3970 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
3986 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
3989 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3990 Bayesian.CountWord( text, wordCount );
3994 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
3997 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3998 Bayesian.Forget( wordCount, isSpam );
4002 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
4005 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
4006 Bayesian.Learn( wordCount, isSpam );
4010 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
4013 case Setting.SpamFilterAlgorithm of
4014 gsfaNone: Result := 0;
4015 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
4016 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
4017 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
4024 GikoSys := TGikoSys.Create;
4027 if GikoSys <> nil then begin