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 vrComments, //
\83R
\83\81\83\93\83g
23 vrCompanyName, //
\89ï
\8eÐ
\96¼
24 vrFileDescription, //
\90à
\96¾
25 vrFileVersion, //
\83t
\83@
\83C
\83\8b\83o
\81[
\83W
\83\87\83\93
26 vrInternalName, //
\93à
\95\94\96¼
27 vrLegalCopyright, //
\92\98\8dì
\8c
28 vrLegalTrademarks, //
\8f¤
\95W
29 vrOriginalFilename, //
\90³
\8e®
\83t
\83@
\83C
\83\8b\96¼
30 vrPrivateBuild, //
\83v
\83\89\83C
\83x
\81[
\83g
\83r
\83\8b\83h
\8fî
\95ñ
31 vrProductName, //
\90»
\95i
\96¼
32 vrProductVersion, //
\90»
\95i
\83o
\81[
\83W
\83\87\83\93
33 vrSpecialBuild); //
\83X
\83y
\83V
\83\83\83\8b\83r
\83\8b\83h
\8fî
\95ñ
36 TGikoBBSType = (gbt2ch);
37 //
\83\8d\83O
\83^
\83C
\83v
38 TGikoLogType = (glt2chNew, glt2chOld);
39 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
40 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
41 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
42 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
45 TStrTokSeparator = set of Char;
51 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
59 FRoundDate: TDateTime;
60 FLastModified: TDateTime;
63 FMishiyou: Boolean; //
\96¢
\8eg
\97p
67 FAllResCount: Integer;
68 FNewResCount: Integer;
69 FAgeSage: TGikoAgeSage;
72 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
79 //
\83\8c\83X
\83\8c\83R
\81[
\83h
89 //URLPath
\83\8c\83R
\81[
\83h
92 FKey: string; //ThreadID
93 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
94 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
95 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
96 FStBegin: Boolean; //1
\81`
\95\
\8e¦
97 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
98 FDone: Boolean; //
\90¬
\8c÷
99 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
103 TGikoMessageListType = (gmLogout, gmLogin, gmForceLogin, gmSureItiran,
104 gmUnKnown, gmSureSyutoku, gmSureDiff, gmNotMod, gmAbort, gmError,
105 gmNewRes, gmNewSure, gmResError, gmSureError);
107 TGikoSys = class(TObject)
114 FBayesian : TGikoBayesian; //!<
\83x
\83C
\83W
\83A
\83\93\83t
\83B
\83\8b\83^
115 FVersion : String; //
\83t
\83@
\83C
\83\8b\83o
\81[
\83W
\83\87\83\93
116 // FExitWrite: TStringList;
117 // function StrToFloatDef(s: string; Default: Double): Double;
118 function SetUserOptionalStyle(): string;
122 FSelectResFilter : TAbon;
123 //FBoardURLList: TStringList;
126 destructor Destroy; override;
127 property ResRange : Longint read FResRange write FResRange;
128 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
129 property Version : String read FVersion;
130 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
131 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
132 function IsNumeric(s: string): boolean;
133 function IsFloat(s: string): boolean;
134 function DirectoryExistsEx(const Name: string): Boolean;
135 function ForceDirectoriesEx(Dir: string): Boolean;
136 // function GetVersion: string;
138 function GetBoardFileName: string;
139 function GetCustomBoardFileName: string;
140 function GetHtmlTempFileName: string;
141 function GetAppDir: string;
142 function GetTempFolder: string;
143 function GetSentFileName: string;
144 function GetConfigDir: string;
145 function GetSkinDir: string;
146 function GetSkinHeaderFileName: string;
147 function GetSkinFooterFileName: string;
148 function GetSkinResFileName: string;
149 function GetSkinNewResFileName: string;
150 function GetSkinBookmarkFileName: string;
151 function GetSkinNewmarkFileName: string;
152 function GetStyleSheetDir: string;
153 function GetOutBoxFileName: string;
154 function GetUserAgent: string;
155 function GetSambaFileName : string;
157 procedure ReadSubjectFile(Board: TBoard);
158 procedure CreateThreadDat(Board: TBoard);
159 procedure WriteThreadDat(Board: TBoard);
160 function ParseIndexLine(Line: string): TIndexRec;
161 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
162 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¢
163 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
165 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
166 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
167 function AddAnchorTag(s: string): string;
169 function DivideSubject(Line: string): TSubjectRec;
170 function DivideStrLine(Line: string): TResRec;
172 property Setting: TSetting read FSetting write FSetting;
173 property Dolib: TDolib read FDolib write FDolib;
175 function UrlToID(url: string): string;
176 function UrlToServer(url: string): string;
178 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
179 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
181 function GetFileSize(FileName : string) : longint;
182 function GetFileLineCount(FileName : string): longint;
183 function Get2chDate(aDate: TDateTime): string;
184 function IntToDateTime(val: Int64): TDateTime;
185 function DateTimeToInt(ADate: TDateTime): Int64;
187 function ReadThreadFile(FileName: string; Line: Integer): string;
189 procedure MenuFont(Font: TFont);
191 function RemoveToken(var s:string; const delimiter:string):string;
192 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
193 function DeleteLink(const s: string): string;
195 function GetShortName(const LongName: string; ALength: integer): string;
196 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
197 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
198 function ConvertResAnchor(res: string): string;
199 function BoolToInt(b: Boolean): Integer;
200 function IntToBool(i: Integer): Boolean;
201 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
202 procedure LoadKeySetting(ActionList: TActionList);
203 procedure SaveKeySetting(ActionList: TActionList);
204 procedure LoadEditorKeySetting(ActionList: TActionList);
205 procedure SaveEditorKeySetting(ActionList: TActionList);
207 procedure CreateProcess(const AppPath: string; const Param: string);
208 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
209 function HTMLDecode(const AStr: String): String;
210 function GetHRefText(s: string): string;
211 function Is2chHost(Host: string): Boolean;
212 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
213 function Parse2chURL2(URL: string): TPathRec;
214 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
215 function GetVersionBuild: Integer;
216 function GetBrowsableThreadURL( inURL : string ) : string;
217 function GetThreadURL2BoardURL( inURL : string ) : string;
218 function Get2chThreadURL2BoardURL( inURL : string ) : string;
219 function Get2chBrowsableThreadURL( inURL : string ) : string;
220 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
221 procedure ListBoardFile;
222 procedure ReadBoardFile( bbs : TBBS );
224 function GetUnknownCategory : TCategory;
225 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
227 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
229 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
230 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
231 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
232 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
234 //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é
235 procedure SambaFileExists();
237 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
238 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string; overload;
239 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string; overload;
240 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
241 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
242 function GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer; overload;
243 function GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer; overload;
246 procedure SpamCountWord( const text : string; wordCount : TWordCount );
247 //!
\8aw
\8fK
\83N
\83\8a\83A
248 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
249 //!
\83X
\83p
\83\80\8aw
\8fK
250 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
251 //!
\83X
\83p
\83\80\93x
\90\94
252 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
253 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
254 function NotDateorTimeString(const AStr : string): boolean;
256 //
\88ø
\90\94\82É
\91\97\82ç
\82ê
\82Ä
\82«
\82½
\93ú
\95t/ID
\95\94\82ÉBE
\82Ì
\95¶
\8e\9a\97ñ
\82ª
\82 \82Á
\82½
\82ç
\81A
\83v
\83\8d\83t
\83@
\83C
\83\8b\82Ö
\82Ì
\83\8a\83\93\83N
\82ð
\92Ç
\89Á
257 function AddBeProfileLink(AID : string; ANum: Integer): string;
258 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
259 function GetVersionInfo(KeyWord: TVerResourceKey): string;
260 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
261 function GetPluginsInfo(): string;
262 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
263 function GetIEVersion: string;
269 //LENGTH_RESTITLE = 40;
270 ZERO_DATE: Integer = 25569;
271 BETA_VERSION_NAME_E = 'beta';
272 BETA_VERSION_NAME_J = 'ÊÞÀ';
274 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
275 APP_NAME = 'gikoNavi';
276 BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
282 Giko, RoundData, Favorite, Registry;
285 FOLDER_INDEX_VERSION = '1.01';
286 USER_AGENT = 'Monazilla';
287 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
288 NGWORDs_DIR_NAME : String = 'NGwords';
290 READ_PATH: string = '/test/read.cgi/';
291 OLD_READ_PATH: string = '/test/read.cgi?';
292 KAKO_PATH: string = '/kako/';
294 KeyWordStr: array [TVerResourceKey] of String = (
308 (*************************************************************************
309 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
310 *************************************************************************)
311 constructor TGikoSys.Create;
313 FSetting := TSetting.Create;
314 FDolib := TDolib.Create;
315 FAWKStr := TAWKStr.Create(nil);
316 if DirectoryExists(GetConfigDir) = false then begin
317 CreateDir(GetConfigDir);
319 FAbon := TAbon.Create;
320 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
322 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
323 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
324 FAbon.DeleteSyria := FSetting.DeleteSyria;
325 FAbon.Deleterlo := FSetting.AbonDeleterlo;
326 FAbon.Replaceul := FSetting.AbonReplaceul;
327 FAbon.AbonPopupRes := FSetting.PopUpAbon;
329 FSelectResFilter := TAbon.Create;
330 //
\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
331 FSelectResFilter.AbonString := '';
333 ResRange := FSetting.ResRange;
334 FVersion := Trim(GetVersionInfo(vrFileVersion));
335 FBayesian := TGikoBayesian.Create;
336 //FBoardURLList := TStringList.Create;
339 (*************************************************************************
340 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
341 *************************************************************************)
342 destructor TGikoSys.Destroy;
345 FileList: TStringList;
347 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
356 FSelectResFilter.Free;
357 //FBoardURLList.Free;
358 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
359 FileList := TStringList.Create;
361 FileList.BeginUpdate;
362 GetFileList(GetTempFolder, '*.html', FileList, False, True);
364 for i := 0 to FileList.Count - 1 do begin
365 DeleteFile(FileList[i]);
373 (*************************************************************************
374 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
375 *************************************************************************)
377 function TGikoSys.IsNumeric(s: string): boolean;
387 (*************************************************************************
388 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
389 *************************************************************************)
390 function TGikoSys.IsFloat(s: string): boolean;
394 Result := TextToFloat(PChar(s), v, fvExtended);
397 (*************************************************************************
398 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
399 *************************************************************************)
400 function TGikoSys.GetBoardFileName: string;
402 Result := Setting.GetBoardFileName;
405 (*************************************************************************
406 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
407 *************************************************************************)
408 function TGikoSys.GetCustomBoardFileName: string;
410 Result := Setting.GetCustomBoardFileName;
413 (*************************************************************************
414 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
415 *************************************************************************)
416 function TGikoSys.GetHtmlTempFileName: string;
418 Result := Setting.GetHtmlTempFileName;
422 (*************************************************************************
423 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
424 *************************************************************************)
425 function TGikoSys.GetAppDir: string;
427 Result := Setting.GetAppDir;
430 (*************************************************************************
431 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
432 *************************************************************************)
433 function TGikoSys.GetTempFolder: string;
435 Result := Setting.GetTempFolder;
438 (*************************************************************************
439 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
440 *************************************************************************)
441 function TGikoSys.GetSentFileName: string;
443 Result := Setting.GetSentFileName;
446 (*************************************************************************
447 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
448 *************************************************************************)
449 function TGikoSys.GetOutBoxFileName: string;
451 Result := Setting.GetOutBoxFileName;
454 (*************************************************************************
455 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
456 *************************************************************************)
457 function TGikoSys.GetConfigDir: string;
459 Result := Setting.GetConfigDir;
462 function TGikoSys.GetStyleSheetDir: string;
464 Result := Setting.GetStyleSheetDir;
467 function TGikoSys.GetSkinDir: string;
469 Result := Setting.GetSkinDir;
472 function TGikoSys.GetSkinHeaderFileName: string;
474 Result := Setting.GetSkinHeaderFileName;
477 function TGikoSys.GetSkinFooterFileName: string;
479 Result := Setting.GetSkinFooterFileName;
482 function TGikoSys.GetSkinNewResFileName: string;
484 Result := Setting.GetSkinNewResFileName;
487 function TGikoSys.GetSkinResFileName: string;
489 Result := Setting.GetSkinResFileName;
492 function TGikoSys.GetSkinBookmarkFileName: string;
494 Result := Setting.GetSkinBookmarkFileName;
497 function TGikoSys.GetSkinNewmarkFileName: string;
499 Result := Setting.GetSkinNewmarkFileName;
503 function TGikoSys.GetUserAgent: string;
505 if Dolib.Connected then begin
506 Result := Format('%s %s/%s%d/%s', [
513 Result := Format('%s/%s %s/%s%d/%s', [
523 (*************************************************************************
524 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
525 *************************************************************************)
526 function TGikoSys.Get2chDate(aDate: TDateTime): string;
530 d2 := aDate - EncodeTime(9, 0, 0, 0);
531 Result := FloatToStr(Trunc((d2 - ZERO_DATE) * 86400));
534 //val
\82Í
\81A1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
535 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
537 Result := ZERO_DATE + val / 86400.0;
539 //ADate
\82ð1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
\82É
\95Ï
\8a·
\82·
\82é
540 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
542 Result := Trunc((ADate - ZERO_DATE) * 86400);
546 (*************************************************************************
547 *Subject
\83t
\83@
\83C
\83\8bRead
548 *************************************************************************)
549 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
551 ThreadItem: TThreadItem;
553 FileList: TStringList;
554 TmpFileList: TStringList;
562 // RoundItem: TRoundItem;
569 //protocol, host, path, document, port, bookmark : string;
572 FavoThreadItem : TFavoriteThreadItem;
576 if Board.IsThreadDatRead then
581 usePlugIn := Board.IsBoardPlugInAvailable;
582 server := UrlToServer( Board.URL );
583 //is2ch := Is2chHost(server);
585 FileName := Board.GetFolderIndexFileName;
587 FileList := TStringList.Create;
588 FileList.Sorted := True;
589 FileList.BeginUpdate;
590 TmpFileList := TStringList.Create;
591 TmpFileList.Sorted := True;
592 TmpFileList.BeginUpdate;
593 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
594 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
596 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
597 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
598 TmpFileList.EndUpdate;
600 //
\8fd
\95¡
\82ð
\96h
\82®
602 Board.Sorted := True;
604 sl := TStringList.Create;
606 if FileExists(FileName) then begin
607 sl.LoadFromFile(FileName);
609 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
610 for i := sl.Count - 1 downto 1 do begin
611 Rec := ParseIndexLine(sl[i]);
612 islog := FileList.Find( Rec.FFileName, Index );
614 ThreadItem := TThreadItem.Create(
617 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
619 if Board.is2ch then begin
620 ThreadItem := TThreadItem.Create(
623 server + 'test/read.cgi/' + Board.BBSID + '/' + ChangeFileExt( Rec.FFileName, '' ) + '/l50',
628 ThreadItem := TThreadItem.Create(
631 server + 'test/read.cgi?bbs=' + Board.BBSID + '&key=' + ChangeFileExt( Rec.FFileName, '' ) + '&ls=50',
638 ThreadItem.BeginUpdate;
640 FileList.Delete( Index );
642 ThreadItem.No := Rec.FNo;
643 ThreadItem.FileName := Rec.FFileName;
644 ThreadItem.Title := Rec.FTitle;
645 //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
646 ThreadItem.Count := Rec.FCount;
647 ThreadItem.Size := Rec.FSize;
648 // ThreadItem.RoundNo := Rec.FRoundNo;
649 ThreadItem.RoundDate := Rec.FRoundDate;
650 ThreadItem.LastModified := Rec.FLastModified;
651 ThreadItem.Kokomade := Rec.FKokomade;
652 ThreadItem.NewReceive := Rec.FNewReceive;
653 // ThreadItem.Round := Rec.FRound;
654 ThreadItem.UnRead := Rec.FUnRead;
655 ThreadItem.ScrollTop := Rec.FScrollTop;
656 ThreadItem.AllResCount := Rec.FAllResCount;
657 ThreadItem.NewResCount := Rec.FNewResCount;
658 ThreadItem.AgeSage := Rec.FAgeSage;
659 ThreadItem.ParentBoard := Board;
660 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
662 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
663 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
666 {//
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
667 if ThreadItem.IsLogFile then begin
668 idx := RoundList.Find(ThreadItem);
669 if idx <> -1 then begin
670 RoundItem := RoundList.Items[idx, grtItem];
671 ThreadItem.RoundName := RoundItem.RoundName;
672 ThreadItem.Round := True;
677 ThreadItem.EndUpdate;
678 Board.Add(ThreadItem);
680 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
685 if UnRead <> Board.UnRead then
686 Board.UnRead := UnRead;
688 Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
689 //
\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
690 for i := 0 to FileList.Count - 1 do begin
691 FileName := Boardpath + FileList[i];
693 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
694 if usePlugIn then begin
695 ThreadItem := TThreadItem.Create(
698 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
699 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
701 ThreadItem := TThreadItem.Create(
704 Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
705 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
708 ThreadItem.BeginUpdate;
709 ThreadItem.FileName := FileList[i];
710 //ThreadItem.FilePath := FileName;
711 ThreadItem.No := Board.Count + 1;
712 ThreadItem.Title := ResRec.FTitle;
713 ThreadItem.Count := GetFileLineCount(FileName);
714 ThreadItem.AllResCount := ThreadItem.Count;
715 ThreadItem.NewResCount := ThreadItem.Count;
716 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é
717 ThreadItem.RoundDate := ZERO_DATE;
718 ThreadItem.LastModified := ZERO_DATE;
719 ThreadItem.Kokomade := -1;
720 ThreadItem.NewReceive := ThreadItem.Count;
721 ThreadItem.ParentBoard := Board;
722 ThreadItem.IsLogFile := True;
723 ThreadItem.Round := False;
724 ThreadItem.UnRead := False;
725 ThreadItem.ScrollTop := 0;
726 ThreadItem.AgeSage := gasNone;
727 ThreadItem.EndUpdate;
728 Board.Add(ThreadItem);
732 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
733 for i := TmpFileList.Count - 1 downto 0 do begin
734 //if TmpFileList.Count <> 0 then begin
735 ThreadItem := Board.FindThreadFromFileName(ChangeFileExt(TmpFileList[i], '.dat'));
736 if ThreadItem <> nil then begin
737 //if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
738 ini := TMemIniFile.Create(Boardpath + TmpFileList[i]);
740 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
741 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
743 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
744 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
745 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
746 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
748 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
749 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
751 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
756 //
\8f\84\89ñ
\82Ì
\90Ý
\92è
\82ÍRoundData
\82Ì
\95û
\82ª
\82â
\82é
\82©
\82ç
\8f\9f\8eè
\82É
\90Ý
\92è
\82µ
\82Ä
\82Í
\83_
\83\81\81I
\81@by
\82à
\82¶
\82ã
757 //ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
758 //ThreadItem.RoundName := ini.ReadString('Setting', 'RoundName', ThreadItem.RoundName);
759 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
760 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
761 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
762 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
763 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
767 DeleteFile(Boardpath + TmpFileList[i]);
775 Board.Sorted := False;
777 Board.IsThreadDatRead := True;
780 (*************************************************************************
781 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
782 *************************************************************************)
783 procedure TGikoSys.CreateThreadDat(Board: TBoard);
787 SubjectList: TStringList;
793 if not FileExists(Board.GetSubjectFileName) then Exit;
794 FileName := Board.GetFolderIndexFileName;
796 SubjectList := TStringList.Create;
798 SubjectList.LoadFromFile(Board.GetSubjectFileName);
799 sl := TStringList.Create;
803 sl.Add(FOLDER_INDEX_VERSION);
804 for i := 0 to SubjectList.Count - 1 do begin
805 Rec := DivideSubject(SubjectList[i]);
807 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
810 {s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
811 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
812 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
813 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
814 + Format('%x', [0]) + #1 //size
815 + Format('%x', [0]) + #1 //RoundDate
816 + Format('%x', [0]) + #1 //LastModified
817 + Format('%x', [0]) + #1 //Kokomade
818 + Format('%x', [0]) + #1 //NewReceive
819 + '0' + #1 //
\96¢
\8eg
\97p
820 + Format('%x', [0]) + #1 //UnRead
821 + Format('%x', [0]) + #1 //ScrollTop
822 + Format('%x', [Rec.FCount]) + #1 //AllResCount
823 + Format('%x', [0]) + #1 //NewResCount
824 + Format('%x', [0]); //AgeSage
826 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
827 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
829 Rec.FFileName, //
\83t
\83@
\83C
\83\8b\96¼
830 Rec.FTitle, //
\83^
\83C
\83g
\83\8b
831 Rec.FCount, //
\83J
\83E
\83\93\83g
840 Rec.FCount, //AllResCount
849 sl.SaveToFile(FileName);
858 (*************************************************************************
859 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
861 *************************************************************************)
862 procedure TGikoSys.WriteThreadDat(Board: TBoard);
864 // Values: array[Boolean] of string = ('0', '1');
870 TmpFileList: TStringList;
872 if not Board.IsThreadDatRead then
874 FileName := Board.GetFolderIndexFileName;
875 ForceDirectoriesEx( ExtractFilePath( FileName ) );
877 sl := TStringList.Create;
878 TmpFileList := TStringList.Create;
879 TmpFileList.Sorted := true;
881 TmpFileList.BeginUpdate;
882 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
883 TmpFileList.EndUpdate;
885 sl.Add(FOLDER_INDEX_VERSION);
887 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
888 Sort.SortNoFlag := true;
889 Sort.SortOrder := true;
891 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
892 Board.CustomSort(ThreadItemSortProc);
894 for i := 0 to Board.Count - 1 do begin
895 Board.Items[i].No := i + 1;
896 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
897 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
898 [Board.Items[i].No, //
\94Ô
\8d\86
899 Board.Items[i].FileName, //
\83t
\83@
\83C
\83\8b\96¼
900 Board.Items[i].Title, //
\83^
\83C
\83g
\83\8b
901 Board.Items[i].Count, //
\83J
\83E
\83\93\83g
902 Board.Items[i].Size, //size
903 DateTimeToInt(Board.Items[i].RoundDate), //RoundDate
904 DateTimeToInt(Board.Items[i].LastModified), //LastModified
905 Board.Items[i].Kokomade, //Kokomade
906 Board.Items[i].NewReceive, //NewReceive
908 BoolToInt(Board.Items[i].UnRead), //UnRead
909 Board.Items[i].ScrollTop, //ScrollTop
910 Board.Items[i].AllResCount, //AllResCount
911 Board.Items[i].NewResCount, //NewResCount
912 Ord(Board.Items[i].AgeSage)] //AgeSage
918 sl.SaveToFile(FileName);
920 for i := 0 to TmpFileList.Count - 1 do begin
921 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
930 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
932 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
933 Result.FFileName := RemoveToken(Line, #1);
934 Result.FTitle := RemoveToken(Line, #1);
935 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
936 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
937 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
938 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
939 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
940 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
941 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
942 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
943 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
944 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
945 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
946 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
950 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
951 // ListFiles('c:\', '*.txt', list, True);
952 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
955 SearchRec : TSearchRec;
959 //maskExt := Copy(Mask, 1, Length(Mask) - 1);
961 Path := IncludeTrailingPathDelimiter(Path);
962 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
964 while rc = 0 do begin
965 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
966 s := Path + SearchRec.Name;
967 //if (SearchRec.Attr and faDirectory > 0) then
968 // s := IncludeTrailingPathDelimiter(s)
970 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
974 List.Add(SearchRec.Name);
975 if SubDir and (SearchRec.Attr and faDirectory > 0) then
976 GetFileList(s, Mask, List, True, IsPathAdd);
978 rc := FindNext(SearchRec);
981 SysUtils.FindClose(SearchRec);
985 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
986 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
987 // ListFiles('c:\', '*.txt', list, True);
988 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
991 SearchRec : TSearchRec;
994 Path := IncludeTrailingPathDelimiter(Path);
995 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
997 while rc = 0 do begin
998 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
999 s := Path + SearchRec.Name;
1001 if (SearchRec.Attr and faDirectory = 0) then
1005 List.Add(SearchRec.Name);
1007 rc := FindNext(SearchRec);
1010 SysUtils.FindClose(SearchRec);
1014 //
\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é
1015 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
1018 SearchRec : TSearchRec;
1021 Path := IncludeTrailingPathDelimiter(Path);
1022 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
1024 while rc = 0 do begin
1025 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
1026 s := Path + SearchRec.Name;
1027 //if (SearchRec.Attr and faDirectory > 0) then
1028 // s := IncludeTrailingPathDelimiter(s)
1030 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
1031 List.Add( IncludeTrailingPathDelimiter( s ) );
1032 if SubDir and (SearchRec.Attr and faDirectory > 0) then
1033 GetDirectoryList(s, Mask, List, True);
1035 rc := FindNext(SearchRec);
1038 SysUtils.FindClose(SearchRec);
1042 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
1043 function TGikoSys.LoadFromSkin(
1045 ThreadItem: TThreadItem;
1052 Skin := TStringList.Create;
1054 if FileExists( fileName ) then begin
1055 Skin.LoadFromFile( fileName );
1057 //
\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
1059 if ThreadItem.ParentBoard <> nil then
1060 if ThreadItem.ParentBoard.ParentCategory <> nil then
1061 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1062 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
1064 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
1065 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
1066 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
1067 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
1068 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
1069 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
1070 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
1072 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1073 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
1074 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
1076 //-----
\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µ
1077 //
\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
1079 if ThreadItem.ParentBoard <> nil then
1080 if ThreadItem.ParentBoard.ParentCategory <> nil then
1081 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1082 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
1084 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
1085 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
1086 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
1087 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
1088 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
1089 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
1090 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
1092 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1093 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
1094 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
1095 //-----
\82±
\82±
\82Ü
\82Å
1097 Result := Skin.Text;
1103 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1104 function TGikoSys.SkinedRes(
1110 spamminess : Extended;
1111 wordCount : TWordCount;
1114 wordCount := TWordCount.Create;
1116 spamminess := Floor( SpamParse(
1117 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1119 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1120 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1121 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1122 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1123 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1124 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1125 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1126 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1127 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1128 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1129 Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
1131 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1132 Skin := CustomStringReplace( Skin, '&NUMBER',
1133 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1134 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1135 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1136 Skin := CustomStringReplace( Skin, '&MAILNAME',
1137 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1138 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1139 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1140 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1141 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1142 Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
1143 //-----
\82±
\82±
\82Ü
\82Å
1152 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1156 //bufList : TStringList;
1157 ReadList: TStringList;
1158 SaveList: TStringList;
1159 CSSFileName: string;
1162 NewReceiveNo: Integer;
1164 boardPlugIn : TBoardPlugIn;
1166 UserOptionalStyle: string;
1172 // threadURL : string;
1173 function LoadSkin( fileName: string ): string;
1175 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1177 function ReplaceRes( skin: string ): string;
1179 Result := SkinedRes( skin, Res, No );
1182 if ThreadItem <> nil then begin
1183 //if ThreadItem.IsBoardPlugInAvailable then begin
1184 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1185 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1186 //boardPlugIn := ThreadItem.BoardPlugIn;
1187 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1188 NewReceiveNo := ThreadItem.NewReceive;
1189 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1190 UserOptionalStyle := SetUserOptionalStyle;
1191 SaveList := TStringList.Create;
1194 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1195 // doc.charset := 'Shift_JIS';
1198 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1199 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1201 SaveList.Add('<p id="idSearch"></p>');
1202 for i := 0 to threadItem.Count - 1 do begin
1203 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1204 if i <> 0 then begin
1205 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1208 if ThreadItem.Kokomade > (i + 1) then
1211 if NewReceiveNo > (i + 1) then
1214 if (threadItem.Count - i) > ResRange then
1219 //
\90V
\92\85\83}
\81[
\83N
1220 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1222 if GikoSys.Setting.UseSkin then begin
1223 if FileExists( GetSkinNewmarkFileName ) then
1224 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1226 SaveList.Add( '<a name="new"></a>' );
1227 end else if GikoSys.Setting.UseCSS then begin
1228 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>');
1230 SaveList.Add('</dl>');
1231 SaveList.Add('<a name="new"></a>');
1232 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>');
1233 SaveList.Add('<dl>');
1236 SaveList.Add( '<a name="new"></a>' );
1241 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1243 if ThreadItem.Kokomade = (i + 1) then begin
1244 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1246 if GikoSys.Setting.UseSkin then begin
1247 if FileExists( GetSkinBookmarkFileName ) then
1248 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1250 SaveList.Add( '<a name="koko"></a>' );
1251 end else if GikoSys.Setting.UseCSS then begin
1252 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1254 SaveList.Add('</dl>');
1255 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>');
1256 SaveList.Add('<dl>');
1259 SaveList.Add( '<a name="koko"></a>' );
1263 doc.Write(SaveList.Text);
1268 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1269 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1270 doc.Write(SaveList.Text);
1279 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1280 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1281 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1282 ShortDayNames[7] := '
\93y';
1283 BBSID := ThreadItem.ParentBoard.BBSID;
1284 NewReceiveNo := ThreadItem.NewReceive;
1285 ReadList := TStringList.Create;
1288 if ThreadItem.IsLogFile then begin
1289 FileName := ThreadItem.GetThreadFileName;
1290 ReadList.LoadFromFile(FileName);
1291 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1292 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1293 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1294 if ThreadItem.Title = '' then begin
1295 Res := DivideStrLine(ReadList[0]);
1296 sTitle := Res.FTitle;
1298 sTitle := ThreadItem.Title
1300 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1302 SaveList := TStringList.Create;
1303 //threadURL := CustomStringReplace(ThreadItem.URL, 'l50', '');
1306 doc.charset := 'Shift_JIS';
1308 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1309 UserOptionalStyle := SetUserOptionalStyle;
1310 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1311 if GikoSys.Setting.UseSkin then begin
1312 //
\83X
\83L
\83\93\8eg
\97p
1313 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1315 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1316 if Length( UserOptionalStyle ) > 0 then
1317 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1318 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1319 SaveList.Add( SkinHeader );
1323 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1327 SkinRes := LoadSkin( GetSkinResFileName );
1330 SaveList.Add('<p id="idSearch"></p>');
1331 SaveList.Add('<a name="top"></a>');
1333 for i := 0 to ReadList.Count - 1 do begin
1334 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1335 if i <> 0 then begin
1336 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1339 if ThreadItem.Kokomade > (i + 1) then
1342 if NewReceiveNo > (i + 1) then
1345 if (threadItem.Count - i) > ResRange then
1350 //
\90V
\92\85\83}
\81[
\83N
1351 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1353 if FileExists( GetSkinNewmarkFileName ) then
1354 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1356 SaveList.Add( '<a name="new"></a>' );
1358 SaveList.Add( '<a name="new"></a>' );
1361 if (Trim(ReadList[i]) <> '') then begin
1362 No := IntToStr(i + 1);
1364 Res := DivideStrLine(ReadList[i]);
1365 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1366 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1368 if NewReceiveNo <= (i + 1) then
1369 //
\90V
\92\85\83\8c\83X
1370 strTmp := ReplaceRes( SkinNewRes )
1372 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1373 strTmp := ReplaceRes( SkinRes );
1375 SaveList.Add( strTmp );
1380 if ThreadItem.Kokomade = (i + 1) then begin
1381 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1383 if FileExists( GetSkinBookmarkFileName ) then
1384 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1386 SaveList.Add( '<a name="koko"></a>' );
1388 SaveList.Add( '<a name="koko"></a>' );
1391 doc.Write(SaveList.Text);
1394 SaveList.Add('<a name="bottom"></a>');
1395 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1397 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1400 doc.Write(SaveList.Text);
1401 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1403 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1404 // SaveList.Add('<html lang="ja"><head>');
1405 SaveList.Add('<html><head>');
1406 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1407 SaveList.Add('<title>' + sTitle + '</title>');
1408 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1409 if Length( UserOptionalStyle ) > 0 then
1410 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1411 SaveList.Add('</head>');
1412 SaveList.Add('<body>');
1413 SaveList.Add('<a name="top"></a>');
1414 SaveList.Add('<p id="idSearch"></p>');
1415 SaveList.Add('<div class="title">' + sTitle + '</div>');
1416 doc.Write(SaveList.Text);
1418 //Application.ProcessMessages;
1419 for i := 0 to ReadList.Count - 1 do begin
1420 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1421 if i <> 0 then begin
1422 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1425 if ThreadItem.Kokomade > (i + 1) then
1428 if NewReceiveNo > (i + 1) then
1431 if (threadItem.Count - i) > ResRange then
1436 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1437 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>');
1439 if (Trim(ReadList[i]) <> '') then begin
1440 No := IntToStr(i + 1);
1441 Res := DivideStrLine(ReadList[i]);
1442 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1443 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1444 if Res.FMailTo = '' then
1445 SaveList.Add('<a name="' + No + '"></a>'
1446 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1447 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1448 + '<span class="name"><b>' + Res.FName + '</b></span> '
1449 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1450 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1451 + '<div class="mes">' + Res.FBody + ' </div>')
1452 else if GikoSys.Setting.ShowMail then
1453 SaveList.Add('<a name="' + No + '"></a>'
1454 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1455 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1456 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1457 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1458 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1459 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1460 + '<div class="mes">' + Res.FBody + ' </div>')
1462 SaveList.Add('<a name="' + No + '"></a>'
1463 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1464 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1465 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1466 + '<b>' + Res.FName + '</b></a>'
1467 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1468 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1469 + '<div class="mes">' + Res.FBody + ' </div>');
1471 if ThreadItem.Kokomade = (i + 1) then begin
1472 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1475 doc.Write(SaveList.Text);
1478 SaveList.Add('<a name="bottom"></a>');
1479 //SaveList.Add('</body></html>');
1480 SaveList.Add('<a name="last"></a>');
1481 SaveList.Add('</body></html>');
1482 doc.Write(SaveList.Text);
1485 // SaveList.Add('<html lang="ja"><head>');
1486 SaveList.Add('<html><head>');
1487 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1488 SaveList.Add('<title>' + sTitle + '</title></head>');
1489 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1490 SaveList.Add('<a name="top"></a>');
1491 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1492 SaveList.Add('<dl>');
1493 SaveList.Add('<p id="idSearch"></p>');
1494 doc.Write(SaveList.Text);
1496 //Application.ProcessMessages;
1497 for i := 0 to ReadList.Count - 1 do begin
1498 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1499 if i <> 0 then begin
1500 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1503 if ThreadItem.Kokomade > (i + 1) then
1506 if NewReceiveNo > (i + 1) then
1509 if (threadItem.Count - i) > ResRange then
1514 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1515 SaveList.Add('</dl>');
1516 SaveList.Add('<a name="new"></a>');
1517 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>');
1518 SaveList.Add('<dl>');
1520 if (Trim(ReadList[i]) <> '') then begin
1521 No := IntToStr(i + 1);
1522 Res := DivideStrLine(ReadList[i]);
1523 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1524 Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1);
1525 if Res.FMailTo = '' then
1526 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>')
1527 else if GikoSys.Setting.ShowMail then
1528 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>')
1530 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>');
1532 if ThreadItem.Kokomade = (i + 1) then begin
1533 SaveList.Add('</dl>');
1534 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>');
1535 SaveList.Add('<dl>');
1537 doc.Write(SaveList.Text);
1540 SaveList.Add('</dl>');
1541 SaveList.Add('<a name="bottom"></a>');
1542 SaveList.Add('</body></html>');
1543 doc.Write(SaveList.Text);
1555 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1559 //bufList : TStringList;
1560 ReadList: TStringList;
1561 // SaveList: TStringList;
1562 CSSFileName: string;
1566 boardPlugIn : TBoardPlugIn;
1568 UserOptionalStyle: string;
1572 function LoadSkin( fileName: string ): string;
1574 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1576 function ReplaceRes( skin: string ): string;
1578 Result := SkinedRes( skin, Res, No );
1582 if ThreadItem <> nil then begin
1583 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1586 //if ThreadItem.IsBoardPlugInAvailable then begin
1587 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1588 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1589 //boardPlugIn := ThreadItem.BoardPlugIn;
1590 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1591 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1592 UserOptionalStyle := SetUserOptionalStyle;
1594 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1596 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1597 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1598 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1599 if Setting.UseSkin then begin
1600 tmp1 := './' +Setting.CSSFileName;
1601 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1602 tmp1 := CustomStringReplace(tmp1, '\', '/');
1603 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1604 end else if Setting.UseCSS then begin
1605 tmp1 := './' + CSSFileName;
1606 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1607 tmp1 := CustomStringReplace(tmp1, '\', '/');
1608 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1612 for i := 0 to threadItem.Count - 1 do begin
1615 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1618 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1619 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1625 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1626 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1627 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1628 ShortDayNames[7] := '
\93y';
1629 BBSID := ThreadItem.ParentBoard.BBSID;
1630 ReadList := TStringList.Create;
1632 if ThreadItem.IsLogFile then begin
1633 FileName := ThreadItem.GetThreadFileName;
1634 ReadList.LoadFromFile(FileName);
1635 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1636 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1637 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1638 Res := DivideStrLine(ReadList[0]);
1639 //Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1640 sTitle := Res.FTitle;
1642 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1645 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1646 UserOptionalStyle := SetUserOptionalStyle;
1648 if GikoSys.Setting.UseSkin then begin
1649 //
\83X
\83L
\83\93\8eg
\97p
1650 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1652 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1653 if Length( UserOptionalStyle ) > 0 then
1654 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1655 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1656 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1657 tmp1 := './' +Setting.CSSFileName;
1658 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1659 tmp1 := CustomStringReplace(tmp1, '\', '/');
1660 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1661 html.Append( SkinHeader );
1665 SkinRes := LoadSkin( GetSkinResFileName );
1668 html.Append('<a name="top"></a>');
1669 for i := 0 to ReadList.Count - 1 do begin
1670 if (Trim(ReadList[i]) <> '') then begin
1671 No := IntToStr(i + 1);
1673 Res := DivideStrLine(ReadList[i]);
1674 Res.FBody := AddAnchorTag(Res.FBody);
1675 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1678 html.Append( ReplaceRes( SkinRes ) );
1684 html.Append('<a name="bottom"></a>');
1685 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1687 html.Append( LoadSkin( GetSkinFooterFileName ) );
1690 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1692 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1693 html.Append('<html><head>');
1694 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1695 html.Append('<title>' + sTitle + '</title>');
1696 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1697 tmp1 := './' + CSSFileName;
1698 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1699 tmp1 := CustomStringReplace(tmp1, '\', '/');
1701 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1702 if Length( UserOptionalStyle ) > 0 then
1703 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1704 html.Append('</head>');
1705 html.Append('<body>');
1706 html.Append('<a name="top"></a>');
1707 html.Append('<div class="title">' + sTitle + '</div>');
1708 for i := 0 to ReadList.Count - 1 do begin
1709 if (Trim(ReadList[i]) <> '') then begin
1710 No := IntToStr(i + 1);
1711 Res := DivideStrLine(ReadList[i]);
1712 Res.FBody := AddAnchorTag(Res.FBody);
1713 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1714 if Res.FMailTo = '' then
1715 html.Append('<a name="' + No + '"></a>'
1716 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1717 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1718 + '<span class="name"><b>' + Res.FName + '</b></span> '
1719 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1720 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1721 + '<div class="mes">' + Res.FBody + ' </div>')
1722 else if GikoSys.Setting.ShowMail then
1723 html.Append('<a name="' + No + '"></a>'
1724 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1725 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1726 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1727 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1728 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1729 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1730 + '<div class="mes">' + Res.FBody + ' </div>')
1732 html.Append('<a name="' + No + '"></a>'
1733 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1734 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1735 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1736 + '<b>' + Res.FName + '</b></a>'
1737 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1738 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1739 + '<div class="mes">' + Res.FBody + ' </div>');
1742 html.Append('<a name="bottom"></a>');
1743 html.Append('<a name="last"></a>');
1744 html.Append('</body></html>');
1747 html.Append('<html><head>');
1748 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1749 html.Append('<title>' + sTitle + '</title></head>');
1750 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1751 html.Append('<a name="top"></a>');
1752 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1753 html.Append('<dl>');
1754 for i := 0 to ReadList.Count - 1 do begin
1755 if (Trim(ReadList[i]) <> '') then begin
1756 No := IntToStr(i + 1);
1757 Res := DivideStrLine(ReadList[i]);
1758 Res.FBody := AddAnchorTag(Res.FBody);
1759 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1760 if Res.FMailTo = '' then
1761 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>')
1762 else if GikoSys.Setting.ShowMail then
1763 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>')
1765 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>');
1768 html.Append('</dl>');
1769 html.Append('<a name="bottom"></a>');
1770 html.Append('</body></html>');
1781 function TGikoSys.ConvertResAnchor(res: string): string;
1783 _HEAD : string = '<a href="../';
1784 _TAIL : string = ' target="_blank">';
1785 _ST: string = '&st=';
1786 _TO: string = '&to=';
1787 _STA: string = '&START=';
1788 _END: string = '&END=';
1794 i := AnsiPos(_HEAD, res);
1795 while i <> 0 do begin
1796 Result := Result + Copy(res, 1, i -1);
1797 Delete(res, 1, i - 1);
1798 j := AnsiPos(_TAIL, res);
1800 Result := Result + res;
1803 tmp := Copy(res, 1, j - 1);
1804 Delete(res, 1, j + 16);
1805 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1806 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1807 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1808 Result := Result + '<a href="#' + tmp + '">';
1809 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1810 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1811 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1812 Result := Result + '<a href="#' + tmp + '">';
1814 k := LastDelimiter('/', tmp);
1816 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1817 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1819 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1821 Result := Result + '<a href="#' + tmp + '">';
1823 i := AnsiPos(_HEAD, res);
1825 Result := Result + res;
1829 (*************************************************************************
1830 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1831 *************************************************************************)
1832 function TGikoSys.AddAnchorTag(s: string): string;
1834 URL_CHAR: string = '0123456789'
1835 + 'abcdefghijklmnopqrstuvwxyz'
1836 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1837 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1838 ANCHOR_REF = 'href=';
1839 RES_REF = '>>';
1840 REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
1841 'ms-help://','p://', 'https://',
1842 'www.', 'ftp://','news://','rtsp://');
1845 // wkIdx: array[0..9] of Integer;
1851 anchorLen : Integer;
1857 // + 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ß
1858 anchorLen := Length( ANCHOR_REF ) + 3;
1859 pURLCHARs := PChar(URL_CHAR);
1860 pURLCHARe := pURLCHARs + Length(URL_CHAR);
1864 for j := 0 to 9 do begin
1865 tmp := AnsiPos(REF_MARK[j], s);
1866 if tmp <> 0 then idx := Min(tmp, idx);
1867 if idx = tmp then idx2 := j; //
\82Ç
\82Ì
\83}
\81[
\83N
\82Å
\88ø
\82Á
\82©
\82©
\82Á
\82½
\82©
\82ð
\95Û
\91¶
1869 if idx = MaxInt then begin
1870 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1871 Result := Result + s;
1876 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1877 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1878 href := Copy( s, idx, Length( s ) );
1879 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1881 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1886 Result := Result + Copy(s, 1, idx - 1);
1888 Delete(s, 1, idx - 1);
1889 b := Length( s ) + 1;
1891 for i := 1 to b do begin
1892 pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
1894 if pe = nil then begin
1895 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1896 url := Copy(s, 1, i - 1);
1898 1 : href := 'h' + url;
1899 2 : href := 'ht' + url;
1900 4 : href := 'htt' + url;
1901 6 : href := 'http://' + url;
1906 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1907 Delete(s, 1, i - 1);
1910 //
\88ê
\95¶
\8e\9a\90i
\82ß
\82é
\81B
1916 (*************************************************************************
1917 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1918 *************************************************************************)
1919 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1929 if AnsiPos('<>', Line) = 0 then
1933 Result.FFileName := RemoveToken(Line, Delim);
1934 Result.FTitle := Trim(RemoveToken(Line, Delim));
1936 ws := Result.FTitle;
1937 if Copy(ws, Length(ws), 1) = ')' then begin
1940 end else if Copy(ws, Length(ws)-1, 2) = '
\81j' then begin
1943 end else if Copy(ws, Length(ws), 1) = '>' then begin
1947 for i := Length(ws) - 1 downto 1 do begin
1948 if Copy(ws, i, Length(LeftK)) = LeftK then begin
1949 Result.FTitle := TrimRight(Copy(ws, 1, i - 1));
1950 ws := Copy(ws, i + Length(LeftK), Length(ws) - i - Length(RightK));
1951 if IsNumeric(ws) then
1952 Result.FCount := StrToInt(ws);
1953 //Delete(Result.FTitle, i, Length(LeftK) + Length(ws) + Length(RightK));
1959 (*************************************************************************
1960 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1961 *************************************************************************)
1962 function TGikoSys.DivideStrLine(Line: string): TResRec;
1966 if AnsiPos('<>', Line) = 0 then begin
1968 //Result.FType := glt2chOld;
1969 Line := CustomStringReplace(Line, '<>', '<>');
1970 Line := CustomStringReplace(Line, ',', '<>');
1971 Line := CustomStringReplace(Line, '
\81\97\81M', ',');
1974 Result.FType := glt2chNew;
1975 //Trim
\82µ
\82Ä
\82Í
\82¢
\82¯
\82È
\82¢
\8bC
\82ª
\82·
\82é
\81@by
\82à
\82¶
\82ã
1976 Result.FName := RemoveToken(Line, Delim);
1977 Result.FMailTo := RemoveToken(Line, Delim);
1978 Result.FDateTime := RemoveToken(Line, Delim);
1979 Result.FBody := RemoveToken(Line, Delim);
1980 //
\8bó
\82¾
\82Æ
\96â
\91è
\82ª
\8bN
\82«
\82é
\82©
\82ç
\81A
\8bó
\94\92\82ð
\90Ý
\92è
\82·
\82é
1981 if Result.FBody = '' then begin
1982 Result.FBody := ' ';
1983 end else if ( Result.FBody[1] = ' ' ) then begin
1984 //
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\82Æ
\82©
\82¾
\82Æ
\81A
\96{
\95¶
\82Ì
\90æ
\93ª
\82É
\82P
\82Â
\94¼
\8ap
\8bó
\94\92\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8dí
\8f\9c\82·
\82é
1985 //
\91¼
\82Ì
\8cf
\8e¦
\94Â
\82Å
\81A
\83\8c\83X
\8e©
\91Ì
\82Ì
\8bó
\94\92\82©
\82à
\82µ
\82ê
\82È
\82¢
\82¯
\82Ç
\82»
\82ê
\82Í
\92ú
\82ß
\82é
1986 Delete(Result.FBody, 1, 1);
1988 //Result.FTitle := Trim(RemoveToken(Line, Delim));
1989 Result.FTitle := RemoveToken(Line, Delim);
1993 (*************************************************************************
1994 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1995 *************************************************************************)
1996 function TGikoSys.UrlToID(url: string): string;
2003 if url = '' then Exit;
2005 url := Copy(url, 0, Length(url) - 1);
2006 for i := Length(url) downto 0 do begin
2007 if url[i] = '/' then begin
2008 Result := Copy(url, i + 1, Length(url));
2017 (*************************************************************************
2018 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
2019 *************************************************************************)
2020 function TGikoSys.UrlToServer(url: string): string;
2027 wsURL := Trim(wsURL);
2029 if wsURL = '' then exit;
2031 if Copy(wsURL, Length(wsURL), 1) = '/' then
2032 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
2034 for i := Length(wsURL) downto 0 do begin
2035 if wsURL[i] = '/' then begin
2036 Result := Copy(wsURL, 0, i);
2042 (*************************************************************************
2043 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
2044 *************************************************************************)
2045 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
2049 Code := GetFileAttributes(PChar(Name));
2050 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2053 (*************************************************************************
2054 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
2055 *************************************************************************)
2056 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2059 if Length(Dir) = 0 then
2060 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
2061 Dir := ExcludeTrailingPathDelimiter(Dir);
2062 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2063 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2064 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2067 (*************************************************************************
2068 *
\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
2069 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2070 *************************************************************************)
2071 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2075 Result := StrTokNext(sep, Rec);
2078 (*************************************************************************
2079 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2080 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2081 *************************************************************************)
2082 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2089 if Len >= Pos then begin
2090 while (Pos <= Len) and (Str[Pos] in sep) do begin
2094 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2095 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2100 Result := Copy(Str, I, Pos - I);
2101 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2108 (*************************************************************************
2109 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2110 *************************************************************************)
2111 function TGikoSys.GetFileSize(FileName : string): longint;
2116 if not FileExists(FileName) then begin
2120 Assign(F, FileName);
2122 Result := FileSize(F);
2129 (*************************************************************************
2130 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2131 *************************************************************************)
2132 function TGikoSys.GetFileLineCount(FileName : string): longint;
2136 sl := TStringList.Create;
2139 sl.LoadFromFile(FileName);
2150 (*************************************************************************
2151 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2152 *************************************************************************)
2153 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2155 fileTmp : TStringList;
2158 if FileExists(FileName) then begin
2159 fileTmp := TStringList.Create;
2162 fileTmp.LoadFromFile( FileName );
2163 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2164 Result := fileTmp.Strings[ Line-1 ];
2167 //on EFOpenError do Result := '';
2175 (*************************************************************************
2176 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2177 *************************************************************************)
2178 procedure TGikoSys.MenuFont(Font: TFont);
2181 nm: NONCLIENTMETRICS;
2183 nm.cbSize := sizeof(NONCLIENTMETRICS);
2185 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2186 lf := nm.lfMenuFont;
2188 Font.Name := lf.lfFaceName;
2189 Font.Height := lf.lfHeight;
2191 if lf.lfWeight >= 700 then
2192 Font.Style := Font.Style + [fsBold];
2193 if lf.lfItalic = 1 then
2194 Font.Style := Font.Style + [fsItalic];
2197 (*************************************************************************
2199 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2200 *************************************************************************)
2201 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2205 p := AnsiPos(delimiter, s);
2209 Result := Copy(s, 1, p - 1);
2210 Delete(s, 1, Length(Result) + Length(delimiter));
2213 (*************************************************************************
2215 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2216 *************************************************************************)
2217 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2222 for i := 0 to index do
2223 Result := RemoveToken(s, delimiter);
2226 (*************************************************************************
2228 *************************************************************************)
2229 function TGikoSys.DeleteLink(const s: string): string;
2239 s1 := GetTokenIndex(s, '<a href="', i);
2240 s2 := GetTokenIndex(s, '<a href="', i + 1);
2242 idx := Pos('">', s1);
2244 Delete(s1, 1, idx + 1);
2245 idx := Pos('">', s2);
2247 Delete(s2, 1, idx + 1);
2249 Result := Result + s1 + s2;
2258 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2259 {procedure TGikoSys.FlashExitWrite;
2263 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2264 for i := 0 to FExitWrite.Count - 1 do
2265 WriteThreadDat(FExitWrite[i]);
2269 (*************************************************************************
2270 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2272 *************************************************************************)
2273 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2275 ERASECHAR : array [1..39] of string =
2276 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2277 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2278 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2279 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2281 Chr : array [0..255] of char;
2285 s := Trim(LongName);
2286 if (Length(s) <= ALength) then begin
2290 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2291 S := CustomStringReplace(S, ERASECHAR[i], '');
2293 if (Length(S) <= ALength) then begin
2296 Windows.LCMapString(
2297 GetUserDefaultLCID(),
2305 S := Copy(S,1,ALength);
2307 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2308 S := Copy(S, 1, Length(S) - 1);
2318 (*************************************************************************
2321 *************************************************************************)
2322 function TGikoSys.ConvRes(const Body, Bbs, Key,
2323 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2324 DatToHTML: boolean = false): string;
2328 FIndexFrom : integer;
2335 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2349 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2354 FIndex.FIndexFrom := IndexFrom;
2355 FIndex.FIndexTo := IndexTo;
2359 function ChooseString(const Text, Separator: string; Index: integer): string;
2365 for i := 0 to Index - 1 do begin
2366 if (AnsiPos(Separator, S) = 0) then S := ''
2367 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2369 p := AnsiPos(Separator, S);
2370 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2379 List:= TList.Create;
2385 b := ByteType(s, i);
2387 mbSingleByte : begin
2388 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2389 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2397 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2398 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2404 if (not sw) and (Copy(s,i,4) = GT) then begin
2405 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2413 if ((not sw) and (Copy(s,i,1) = ',')) or
2414 ((not sw) and (Copy(s,i,1) = '=')) then begin
2415 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2416 ((Chk) and (oc = '')) or
2417 ((not Chk) and (al)) then
2427 if (AnsiPos(sx, SN) > 0) then begin
2430 if (No <> '') and (No <> '-') then begin
2443 if Copy(s,i,1) = '<' then oc := '';
2444 oc := oc + Copy(s,i,1);
2450 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2456 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2464 if (AnsiPos(sx, ZN) > 0) then begin
2465 No := No + ZenToHan(sx);
2467 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2482 if (i > Length(Body)) then begin
2484 if (No <> '') then Add(sp, i, No);
2489 for i := List.Count - 1 downto 0 do begin
2490 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2491 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2492 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2494 st := PIndex(List[i]).FNo;
2495 et := PIndex(List[i]).FNo;
2497 if not DatToHTML then
2498 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2499 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2500 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2501 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2502 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2504 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2505 Format('<a href="#%s">', [st]) +
2506 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2507 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2509 Dispose(PIndex(List[i]));
2515 function TGikoSys.ConvRes(
2516 const Body, Bbs, Key, ParamBBS, ParamKey,
2517 ParamStart, ParamTo, ParamNoFirst,
2518 ParamTrue, FullURL : string
2523 FIndexFrom : integer;
2530 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2544 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2549 FIndex.FIndexFrom := IndexFrom;
2550 FIndex.FIndexTo := IndexTo;
2554 function ChooseString(const Text, Separator: string; Index: integer): string;
2560 for i := 0 to Index - 1 do begin
2561 if (AnsiPos(Separator, S) = 0) then S := ''
2562 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2564 p := AnsiPos(Separator, S);
2565 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2574 List:= TList.Create;
2580 b := ByteType(s, i);
2582 mbSingleByte : begin
2583 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2584 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2592 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2593 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2599 if (not sw) and (Copy(s,i,4) = GT) then begin
2600 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2608 if ((not sw) and (Copy(s,i,1) = ',')) or
2609 ((not sw) and (Copy(s,i,1) = '=')) then begin
2610 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2611 ((Chk) and (oc = '')) or
2612 ((not Chk) and (al)) then
2622 if (AnsiPos(sx, SN) > 0) then begin
2625 if (No <> '') and (No <> '-') then begin
2638 if Copy(s,i,1) = '<' then oc := '';
2639 oc := oc + Copy(s,i,1);
2645 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2651 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2659 if (AnsiPos(sx, ZN) > 0) then begin
2660 No := No + ZenToHan(sx);
2662 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2677 if (i > Length(Body)) then begin
2679 if (No <> '') then Add(sp, i, No);
2684 for i := List.Count - 1 downto 0 do begin
2685 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2686 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2687 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2688 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2690 st := PIndex(List[i]).FNo;
2691 et := PIndex(List[i]).FNo;
2693 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2694 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2695 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2696 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2697 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2698 Dispose(PIndex(List[i]));
2705 function TGikoSys.BoolToInt(b: Boolean): Integer;
2707 Result := IfThen(b, 1, 0);
2710 function TGikoSys.IntToBool(i: Integer): Boolean;
2715 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2716 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2720 GZipStream: TGzipDecompressStream;
2721 TextStream: TStringStream;
2722 buf: array[0..BUF_SIZE - 1] of Byte;
2728 TextStream := TStringStream.Create('');
2730 //
\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¢)
2731 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2732 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2733 ResStream.Position := 0;
2734 GZipStream := TGzipDecompressStream.Create(TextStream);
2737 FillChar(buf, BUF_SIZE, 0);
2738 cnt := ResStream.Read(buf, BUF_SIZE);
2740 GZipStream.Write(buf, BUF_SIZE);
2746 ResStream.Position := 0;
2748 FillChar(buf, BUF_SIZE, 0);
2749 cnt := ResStream.Read(buf, BUF_SIZE);
2751 TextStream.Write(buf, BUF_SIZE);
2755 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2756 s := TextStream.DataString;
2758 while (i > 0) and (s[i] = #0) do
2763 while i <> 0 do begin
2773 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2775 STD_SEC = 'KeySetting';
2781 SecList: TStringList;
2782 Component: TComponent;
2784 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2786 SecList := TStringList.Create;
2787 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2789 ini.ReadSection(STD_SEC, SecList);
2790 for i := 0 to SecList.Count - 1 do begin
2791 ActionName := SecList[i];
2792 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2793 if ActionKey <> -1 then begin
2794 Component := ActionList.Owner.FindComponent(ActionName);
2795 if TObject(Component) is TAction then begin
2796 TAction(Component).ShortCut := ActionKey;
2806 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2808 STD_SEC = 'KeySetting';
2813 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2815 for i := 0 to ActionList.ActionCount - 1 do begin
2816 if ActionList.Actions[i].Tag = -1 then
2818 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2826 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2828 STD_SEC = 'KeySetting';
2834 SecList: TStringList;
2835 Component: TComponent;
2837 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2839 SecList := TStringList.Create;
2840 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2842 ini.ReadSection(STD_SEC, SecList);
2843 for i := 0 to SecList.Count - 1 do begin
2844 ActionName := SecList[i];
2845 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2846 if ActionKey <> -1 then begin
2847 Component := ActionList.Owner.FindComponent(ActionName);
2848 if TObject(Component) is TAction then begin
2849 TAction(Component).ShortCut := ActionKey;
2859 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2861 STD_SEC = 'KeySetting';
2866 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2868 for i := 0 to ActionList.ActionCount - 1 do begin
2869 if ActionList.Actions[i].Tag = -1 then
2871 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2880 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2882 PI: TProcessInformation;
2886 Path := '"' + AppPath + '"';
2888 Path := Path + ' ' + Param;
2890 SI.Cb := SizeOf(Si);
2891 SI.lpReserved := nil;
2892 SI.lpDesktop := nil;
2895 SI.cbReserved2 := 0;
2896 SI.lpReserved2 := nil;
2898 Windows.CreateProcess(nil,
2910 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2914 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2915 gbtUserApp, gbtAuto:
2916 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2917 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2919 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2923 function TGikoSys.HTMLDecode(const AStr: String): String;
2925 Sp, Rp, Cp, Tp: PChar;
2930 SetLength(Result, Length(AStr));
2932 Rp := PChar(Result);
2935 while Sp^ <> #0 do begin
2941 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2947 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2951 while (Sp^ <> ';') and (Sp^ <> #0) do
2958 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2966 Num := IsNumeric(Copy(Tp, 1, 1));
2967 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2968 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2972 SetString(S, Tp, Sp - Tp);
2977 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2978 //[Cp^ + Sp^, Cp - PChar(AStr)])
2988 // on E:EConvertError do
2989 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2990 // [Cp^ + Sp^, Cp - PChar(AStr)])
2992 SetLength(Result, Rp - PChar(Result));
2995 function TGikoSys.GetHRefText(s: string): string;
3005 Index := AnsiPos('href', LowerCase(s));
3008 s := Trim(Copy(s, Index + 4, Length(s)));
3009 s := Trim(Copy(s, 2, Length(s)));
3011 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
3012 //if Copy(s, 1, 1) = '"' then begin
3013 if s[1] = '"' then begin
3014 s := Trim(Copy(s, 2, Length(s)));
3017 Index := AnsiPos('"', s);
3018 if Index <> 0 then begin
3019 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
3020 s := Copy(s, 1, Index - 1);
3022 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
3023 Index := AnsiPos(' ', s);
3024 Index2 := AnsiPos('>', s);
3027 if Index > Index2 then
3030 s := Copy(s, 1, Index - 1)
3032 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
3038 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
3039 function TGikoSys.Is2chHost(Host: string): Boolean;
3041 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
3047 if RightStr( Host, 1 ) = '/' then
3048 Host := Copy( Host, 1, Length( Host ) - 1 );
3049 OutputDebugString(pchar(HOST_NAME[0]));
3050 for i := 0 to Length(HOST_NAME) - 1 do begin
3051 // Len := Length(HOST_NAME[i]);
3052 if (AnsiPos(HOST_NAME[i], Host) > 0) and
3053 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
3060 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
3070 Index := AnsiPos(READ_PATH, path);
3071 if Index <> 0 then begin
3072 s := Copy(path, Index + Length(READ_PATH), Length(path));
3074 if (Length(s) > 0) and (s[1] = '/') then
3076 BBSID := GetTokenIndex(s, '/', 0);
3077 BBSKey := GetTokenIndex(s, '/', 1);
3080 Result := (BBSID <> '') or (BBSKey <> '');
3083 Index := AnsiPos(KAKO_PATH, path);
3084 if Index <> 0 then begin
3085 s := Copy(path, 2, Length(path));
3086 BBSID := GetTokenIndex(s, '/', 0);
3087 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3088 BBSID := GetTokenIndex(s, '/', 1);
3089 BBSKey := ChangeFileExt(Document, '');
3090 Result := (BBSID <> '') or (BBSKey <> '');
3093 Index := AnsiPos('read.cgi?', URL);
3094 if Index <> 0 then begin
3095 SList := TStringList.Create;
3098 // s := HTMLDecode(Document);
3099 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3100 BBSID := SList.Values['bbs'];
3101 BBSKey := SList.Values['key'];
3102 Result := (BBSID <> '') or (BBSKey <> '');
3112 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3119 URL := Trim(LowerCase(URL));
3120 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3124 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3126 stRes := StrToInt64( buf );
3127 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3128 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3130 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3133 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3134 buf := Copy( buf, 1, ps );
3138 endRes := StrToInt64(buf)
3145 if (stRes <> 0) and (endRes = 0) then
3146 endRes := stRes + MAX_POPUP_RES
3147 else if (stRes = 0) and (endRes <> 0) then begin
3148 stRes := endRes - MAX_POPUP_RES;
3152 GikoSys.GetBrowsableThreadURL( URL );
3153 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3155 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3158 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3159 buf := Copy( buf, 1, ps );
3162 stRes := StrToInt(buf)
3169 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3171 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3172 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3173 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3175 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3178 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3179 buf := Copy( buf, 1, ps );
3183 endRes := StrToInt64(buf);
3190 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3191 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3192 if Length(buf) > 0 then begin
3193 if AnsiPos('-', buf) = 1 then begin
3198 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3200 convBuf := Copy( buf, 1, ps );
3201 if convBuf <> '' then
3202 endRes := StrToInt64(convBuf)
3208 if endRes <> 0 then begin
3209 stRes := endRes - MAX_POPUP_RES;
3216 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3218 convBuf := Copy( buf, 1, ps );
3219 if convBuf <> '' then begin
3220 stRes := StrToInt64(convBuf);
3224 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3226 convBuf := Copy( buf, 1, ps );
3227 if convBuf <> '' then
3228 endRes := StrToInt64(convBuf)
3249 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3254 // convBuf : String;
3265 URL := Trim(LowerCase(URL));
3270 Result.FFirst := False;
3271 Result.FStBegin := False;
3272 Result.FToEnd := False;
3273 Result.FDone := False;
3274 Result.FNoParam := False;
3278 if URL[length(URL)] = '\' then
3280 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3281 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3282 s := Copy(URL, RStart + RLength - 1, Length(URL));
3284 //
\95W
\8f\80\8f\91\8e®
3285 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3286 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3287 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3288 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3289 s := Copy(s, 15, Length(s));
3291 SList := TStringList.Create;
3294 FAWKStr.RegExp := '/';
3295 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3296 Result.FBBS := SList[1];
3297 Result.FKey := SList[2];
3298 if SList.Count >= 4 then
3302 Result.FNoParam := true;
3308 FAWKStr.LineSeparator := mcls_CRLF;
3309 FAWKStr.RegExp := '-';
3310 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3311 Result.FFirst := True;
3313 FAWKStr.RegExp := 'l[0-9]+';
3314 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3315 Result.FFirst := True;
3317 for i := 0 to SList.Count - 1 do begin
3318 if Trim(SList[i]) = '' then begin
3320 Result.FStBegin := True;
3321 if i = (SList.Count - 1) then
3322 Result.FToEnd := True;
3323 end else if IsNumeric(SList[i]) then begin
3324 wkInt := StrToInt(SList[i]);
3325 wkMax := Max(wkMax, wkInt);
3329 wkMin := Min(wkMin, wkInt);
3330 end else if Trim(SList[i]) = 'n' then begin
3331 Result.FFirst := True;
3333 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3334 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3335 if Copy(SList[i], 1, 1) = 'n' then
3336 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3338 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3339 Result.FFirst := True;
3340 wkMax := Max(wkMax, wkInt);
3344 wkMin := Min(wkMin, wkInt);
3348 if Result.FStBegin and (not Result.FToEnd) then
3350 else if (not Result.FStBegin) and Result.FToEnd then
3352 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3353 Result.FSt := wkMin;
3354 Result.FTo := wkMax;
3356 //Result.FSt := wkMin;
3357 //Result.FTo := wkMax;
3363 Result.FDone := True;
3367 //
\90Vkako
\8f\91\8e®
3368 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3369 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3370 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3371 SList := TStringList.Create;
3374 FAWKStr.RegExp := '/';
3375 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3376 Result.FBBS := SList[1];
3377 Result.FKey := ChangeFileExt(SList[5], '');
3378 Result.FFirst := True;
3384 Result.FDone := True;
3388 //
\8b\8ckako
\8f\91\8e®
3389 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3390 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3391 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3392 SList := TStringList.Create;
3395 FAWKStr.RegExp := '/';
3396 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3397 Result.FBBS := SList[1];
3398 Result.FKey := ChangeFileExt(SList[4], '');
3399 Result.FFirst := True;
3405 Result.FDone := True;
3409 //log
\8by
\82Ñlog2
\8f\91\8e®
3410 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3411 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3412 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3413 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3414 SList := TStringList.Create;
3417 FAWKStr.RegExp := '/';
3418 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3419 Result.FBBS := SList[2];
3420 Result.FKey := ChangeFileExt(SList[5], '');
3421 Result.FFirst := True;
3427 Result.FDone := True;
3432 //
\8b\8cURL
\8f\91\8e®
3433 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3434 FAWKStr.RegExp := '/test/read\.cgi\?';
3435 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3436 s := Copy(s, 16, Length(s));
3437 SList := TStringList.Create;
3440 FAWKStr.RegExp := '&';
3441 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3442 Result.FFirst := True;
3443 for i := 0 to SList.Count - 1 do begin
3444 if Pos('bbs=', SList[i]) = 1 then begin
3445 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3446 end else if Pos('key=', SList[i]) = 1 then begin
3447 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3448 end else if Pos('st=', SList[i]) = 1 then begin
3449 wk := Copy(SList[i], 4, Length(SList[i]));
3450 if IsNumeric(wk) then
3451 Result.FSt := StrToInt(wk)
3452 else if wk = '' then
3453 Result.FStBegin := True;
3454 end else if Pos('to=', SList[i]) = 1 then begin
3455 wk := Copy(SList[i], 4, Length(SList[i]));
3456 if IsNumeric(wk) then
3457 Result.FTo := StrToInt(wk)
3458 else if wk = '' then
3459 Result.FToEnd := True;
3460 end else if Pos('nofirst=', SList[i]) = 1 then begin
3461 Result.FFirst := False;
3470 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3471 Result.FDone := True;
3478 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3488 URI := TIdURI.Create(URL);
3490 Protocol := URI.Protocol;
3493 Document := URI.Document;
3495 Bookmark := URI.Bookmark;
3501 function TGikoSys.GetVersionBuild: Integer;
3503 FixedFileInfo: PVSFixedFileInfo;
3504 VersionHandle, VersionSize: DWORD;
3505 pVersionInfo: Pointer;
3510 AppFile := Application.ExeName;
3511 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3512 if VersionSize = 0 then
3514 GetMem(pVersionInfo, VersionSize);
3516 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3517 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3518 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3520 FreeMem(pVersionInfo, VersionSize);
3524 function TGikoSys.GetBrowsableThreadURL(
3528 threadItem : TThreadItem;
3529 boardPlugIn : TBoardPlugIn;
3534 //=====
\83v
\83\89\83O
\83C
\83\93
3536 for i := Length( BoardGroups ) - 1 downto 1 do begin
3537 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
3538 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
3539 board := BBSsFindBoardFromURL( BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL) );
3540 if board <> nil then begin
3541 boardPlugIn := BoardGroups[i].BoardPlugIn;
3542 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
3543 Result := threadItem.URL;
3552 // 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¢
3555 if Length( Result ) = 0 then
3556 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3560 function TGikoSys.GetThreadURL2BoardURL(
3564 threadItem : TThreadItem;
3565 boardPlugIn : TBoardPlugIn;
3570 //=====
\83v
\83\89\83O
\83C
\83\93
3572 for i := Length( BoardGroups ) - 1 downto 1 do begin
3573 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
3574 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
3575 board := BBSsFindBoardFromURL(BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL));
3576 boardPlugIn := BoardGroups[i].BoardPlugIn;
3577 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
3578 Result := BoardGroups[i].BoardPlugIn.GetBoardURL( Longword( threadItem ) );
3586 // 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¢
3589 if Length( Result ) = 0 then
3590 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3594 function TGikoSys.Get2chThreadURL2BoardURL(
3598 Protocol, Host, Path, Document, Port, Bookmark : string;
3599 BBSID, BBSKey : string;
3603 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3604 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3606 foundPos := Pos( '/test/read.cgi', inURL );
3607 if {(Is2chHost(Host)) and} (foundPos > 0) then
3608 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3610 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3614 function TGikoSys.Get2chBrowsableThreadURL(
3618 Protocol, Host, Path, Document, Port, Bookmark : string;
3619 BBSID, BBSKey : string;
3623 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3626 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3627 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3628 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3630 if Is2chHost( Host ) then begin
3631 Result := Protocol + '://' + Host +
3632 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3634 if foundPos > 0 then
3635 Result := Copy( inURL, 1, foundPos ) +
3636 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3638 Result := Protocol + '://' + Host +
3639 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3645 function TGikoSys.Get2chBoard2ThreadURL(
3653 server := UrlToServer( inBoard.URL );
3654 //if Is2chHost( server ) then
3655 if inBoard.Is2ch then
3656 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3658 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3662 (*************************************************************************
3663 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3664 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3665 *************************************************************************)
3666 procedure TGikoSys.ListBoardFile;
3668 boardFileList : TStringList;
3673 for i := 0 to Length( BBSs ) - 1 do
3677 SetLength( BBSs, 0 );
3680 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3681 if FileExists( GikoSys.GetBoardFileName ) then begin
3682 SetLength( BBSs, l + 1 );
3683 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3684 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3688 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3689 SetLength( BBSs, l + 1 );
3690 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3691 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3695 // Board
\83t
\83H
\83\8b\83_
3696 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3697 BoardFileList := TStringList.Create;
3699 BoardFileList.BeginUpdate;
3700 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3701 BoardFileList.EndUpdate;
3702 for k := BoardFileList.Count - 1 downto 0 do begin
3703 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3704 BoardFileList.Delete(k);
3706 SetLength( BBSs, l + BoardFileList.Count );
3707 for i := BoardFileList.Count - 1 downto 0 do begin
3708 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3709 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3717 (*************************************************************************
3718 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3719 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3720 *************************************************************************)
3721 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3726 boardFile : TStringList;
3727 CategoryList : TStringList;
3728 BoardList : TStringList;
3729 Category : TCategory;
3733 // RoundItem : TRoundItem;
3735 i, iBound : Integer;
3736 j, jBound : Integer;
3737 k, kBound : Integer;
3740 if not FileExists( bbs.FilePath ) then
3744 ini := TMemIniFile.Create('');
3745 boardFile := TStringList.Create;
3748 boardFile.LoadFromFile( bbs.FilePath );
3750 ini.SetStrings( boardFile );
3751 CategoryList := TStringList.Create;
3752 BoardList := TStringList.Create;
3754 ini.ReadSections( CategoryList );
3756 iBound := CategoryList.Count - 1;
3757 for i := 0 to iBound do begin
3758 ini.ReadSection( CategoryList[i], BoardList );
3759 Category := TCategory.Create;
3760 Category.No := i + 1;
3761 Category.Title := CategoryList[i];
3763 jBound := BoardList.Count - 1;
3764 for j := 0 to jBound do begin
3766 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3767 //'http://'
\82ð
\8aÜ
\82Ü
\82È
\82¢
\95¶
\8e\9a\97ñ
\82Ì
\8e\9e\82Í
\96³
\8e\8b\82·
\82é
3768 if (AnsiPos('http://', AnsiLowerCase(inistr)) = 0) then Continue;
3769 //=====
\83v
\83\89\83O
\83C
\83\93
3771 kBound := Length(BoardGroups) - 1;
3772 for k := 1 to kBound do begin //0
\82Í
\81A2
\82¿
\82á
\82ñ
3773 if Assigned( Pointer( BoardGroups[k].BoardPlugIn.Module ) ) then begin
3774 if BoardGroups[k].BoardPlugIn.AcceptURL( inistr ) = atBoard then begin
3775 if not BoardGroups[k].Find(inistr, p) then begin
3776 tmpstring := BoardGroups[k].BoardPlugIn.ExtractBoardURL( inistr );
3777 if AnsiCompareStr(tmpString, inistr) <> 0 then begin
3778 if not BoardGroups[k].Find(tmpstring, p) then begin
3780 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
3781 BoardGroups[k].AddObject(tmpstring, Board);
3782 Category.Add(Board);
3784 //
\82±
\82±
\82É
\97\88\82é
\82Æ
\82µ
\82½
\82çBoard
\82Ì
\8dì
\90¬
\82É
\8e¸
\94s
\82µ
\82½
\82Æ
\82«
\82¾
\82©
\82çBoard
\82ðnil
\82É
\82·
\82é
3788 Board := TBoard(BoardGroups[k].Objects[p]);
3789 if Board.ParentCategory <> Category then
3790 Category.Add(Board);
3794 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
3795 BoardGroups[k].AddObject(tmpstring, Board);
3796 Category.Add(Board);
3798 //
\82±
\82±
\82É
\97\88\82é
\82Æ
\82µ
\82½
\82çBoard
\82Ì
\8dì
\90¬
\82É
\8e¸
\94s
\82µ
\82½
\82Æ
\82«
\82¾
\82©
\82çBoard
\82ðnil
\82É
\82·
\82é
3803 Board := TBoard(BoardGroups[k].Objects[p]);
3804 if Board.ParentCategory <> Category then
3805 Category.Add(Board);
3812 // 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¢
3815 if (Board = nil) then begin
3816 if not BoardGroups[0].Find(inistr,p) then begin
3817 Board := TBoard.Create( nil, inistr );
3818 BoardGroups[0].AddObject(inistr, Board);
3819 Category.Add(Board);
3821 Board := TBoard(BoardGroups[0].Objects[p]);
3822 if Board.ParentCategory <> Category then
3823 Category.Add(Board);
3827 if (Board.Multiplicity = 0) then begin
3830 Board.Multiplicity := 1;
3831 Board.Title := BoardList[j];
3832 Board.RoundDate := ZERO_DATE;
3837 Board.Multiplicity := Board.Multiplicity + 1;
3842 bbs.Add( Category );
3847 bbs.IsBoardFileRead := True;
3859 function TGikoSys.GetUnknownCategory : TCategory;
3861 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3864 if Length( BBSs ) < 2 then begin
3869 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3870 if Result = nil then begin
3871 Result := TCategory.Create;
3872 Result.Title := UNKNOWN_CATEGORY;
3873 BBSs[ 1 ].Add( Result );
3878 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3880 category : TCategory;
3882 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3885 category := GetUnknownCategory;
3886 if category = nil then begin
3889 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3890 if Result = nil then begin
3891 Result := TBoard.Create( inPlugIn, inURL );
3892 Result.Title := UNKNOWN_BOARD;
3893 category.Add( Result );
3898 function TGikoSys.GetSambaFileName : string;
3900 Result := Setting.GetSambaFileName;
3902 procedure TGikoSys.SambaFileExists();
3905 sambaStrList: TStringList;
3907 if not FileExists(GikoSys.GetSambaFileName) then begin
3908 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3909 sambaStrList := TStringList.Create;
3911 if FileExists(sambaTmp) then begin
3912 sambaStrList.LoadFromFile(sambaTmp);
3913 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3920 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string;
3926 if (not IsNoValidID(AID)) and
3927 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3928 body := TStringList.Create;
3930 GetSameIDRes(AID, ThreadItem, body);
3931 if (limited) and (body.Count > 20) then begin
3932 for i := body.Count - 20 to body.Count - 1 do begin
3933 Result := Result + '>' + body[i] + ' ';
3936 for i := 0 to body.Count - 1 do begin
3937 Result := Result + '>' + body[i] + ' ';
3943 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3946 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
3949 ReadList: TStringList;
3951 boardPlugIn : TBoardPlugIn;
3953 if (not IsNoValidID(AID)) and
3954 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3955 //if ThreadItem.IsBoardPlugInAvailable then begin
3956 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
3957 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3958 //boardPlugIn := ThreadItem.BoardPlugIn;
3959 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
3961 for i := 0 to threadItem.Count - 1 do begin
3963 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3964 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3965 body.Add(IntToStr(i+1));
3969 ReadList := TStringList.Create;
3971 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3972 for i := 0 to ReadList.Count - 1 do begin
3973 Res := DivideStrLine(ReadList[i]);
3974 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3975 body.Add(IntToStr(i+1));
3984 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string;
3990 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3991 body := TStringList.Create;
3993 GetSameIDRes(AIDNum, ThreadItem, body);
3994 if (limited) and (body.Count > 20) then begin
3995 for i := body.Count - 20 to body.Count - 1 do begin
3996 Result := Result + '>' + body[i] + ' ';
3999 for i := 0 to body.Count - 1 do begin
4000 Result := Result + '>' + body[i] + ' ';
4006 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
4010 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
4013 boardPlugIn : TBoardPlugIn;
4015 stList: TStringList;
4018 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
4019 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
4020 //if ThreadItem.IsBoardPlugInAvailable then begin
4021 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
4022 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
4023 //boardPlugIn := ThreadItem.BoardPlugIn;
4024 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
4025 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
4027 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
4029 AID := Res.FDateTime;
4030 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
4031 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);
4032 if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin
4033 AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)
4036 stlist := TStringList.Create;
4038 stList.DelimitedText := AID;
4040 for i := 0 to stList.Count - 1 do
4041 if Length(WideString(stList[i])) = 8 then begin
4042 if NotDateorTimeString(stList[i]) then begin
4051 if not IsNoValidID(AID) then
4052 GetSameIDRes(AID, ThreadItem, body);
4055 function TGikoSys.GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer;
4060 if (not IsNoValidID(AID))
4061 and (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
4062 body := TStringList.Create;
4064 GetSameIDRes(AID, ThreadItem, body);
4065 Result := body.Count;
4072 function TGikoSys.GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer;
4077 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
4078 body := TStringList.Create;
4080 GetSameIDRes(AIDNum, ThreadItem, body);
4081 Result := body.Count;
4088 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
4104 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
4107 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
4108 Bayesian.CountWord( text, wordCount );
4112 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
4115 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
4116 Bayesian.Forget( wordCount, isSpam );
4120 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
4123 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
4124 Bayesian.Learn( wordCount, isSpam );
4128 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
4131 case Setting.SpamFilterAlgorithm of
4132 gsfaNone: Result := 0;
4133 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
4134 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
4135 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
4140 function TGikoSys.SetUserOptionalStyle(): string;
4143 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
4144 Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
4145 if GikoSys.Setting.BrowserFontSize <> 0 then
4146 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
4147 if GikoSys.Setting.BrowserFontColor <> -1 then
4148 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
4149 if GikoSys.Setting.BrowserBackColor <> -1 then
4150 Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
4151 case GikoSys.Setting.BrowserFontBold of
4152 -1: Result := Result + 'font-weight:normal;';
4153 1: Result := Result + 'font-weight:bold;';
4155 case GikoSys.Setting.BrowserFontItalic of
4156 -1: Result := Result + 'font-style:normal;';
4157 1: Result := Result + 'font-style:italic;';
4160 //
\88ø
\90\94\81AAID
\81F
\91Î
\8fÛ
\82Æ
\82È
\82é
\93ú
\95tID
\95¶
\8e\9a\97ñ
\81AANum:
\83\8c\83X
\94Ô AURL
\81F
\82»
\82Ì
\83X
\83\8c\83b
\83h
\82ÌURL
4161 function TGikoSys.AddBeProfileLink(AID : string; ANum: Integer):string ;
4164 BNum, BMark : string;
4166 p := AnsiPos('BE:', AnsiUpperCase(AID));
4168 BNum := Copy(AID, p, Length(AID));
4169 AID := Copy(AID, 1, p - 1);
4170 p := AnsiPos('-', BNum);
4172 BMark := '?' + Trim(Copy(BNum, p + 1, Length(BNum)));
4173 BNum := Copy(BNum, 1, p - 1);
4176 Result := AID + ' <a href="' + BNum + '/' + IntToStr(ANum)
4177 + '" target=_blank>' + BMark + '</a>';
4181 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82ð
\8eæ
\93¾
4182 function TGikoSys.GetVersionInfo(KeyWord: TVerResourceKey): string;
4184 Translation = '\VarFileInfo\Translation';
4185 FileInfo = '\StringFileInfo\%0.4s%0.4s\';
4187 BufSize, HWnd: DWORD;
4188 VerInfoBuf: Pointer;
4190 VerDataLen: Longword;
4193 //
\95K
\97v
\82È
\83o
\83b
\83t
\83@
\82Ì
\83T
\83C
\83Y
\82ð
\8eæ
\93¾
4194 BufSize := GetFileVersionInfoSize(PChar(Application.ExeName), HWnd);
4195 if BufSize <> 0 then begin
4196 //
\83\81\83\82\83\8a\82ð
\8am
\95Û
4197 GetMem(VerInfoBuf, BufSize);
4199 GetFileVersionInfo(PChar(Application.ExeName), 0, BufSize, VerInfoBuf);
4200 //
\95Ï
\90\94\8fî
\95ñ
\83u
\83\8d\83b
\83N
\93à
\82Ì
\95Ï
\8a·
\83e
\81[
\83u
\83\8b\82ð
\8ew
\92è
4201 VerQueryValue(VerInfoBuf, PChar(Translation), VerData, VerDataLen);
4203 if not (VerDataLen > 0) then
4204 raise Exception.Create('
\8fî
\95ñ
\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
4206 // 8
\8c\85\82Ì
\82P
\82U
\90i
\90\94\82É
\95Ï
\8a·
4207 //
\81¨'\StringFileInfo\027382\FileDescription'
4208 PathLocale := Format(FileInfo + KeyWordStr[KeyWord],
4209 [IntToHex(Integer(VerData^) and $FFFF, 4),
4210 IntToHex((Integer(VerData^) shr 16) and $FFFF, 4)]);
4211 VerQueryValue(VerInfoBuf, PChar(PathLocale), VerData, VerDataLen);
4213 if VerDataLen > 0 then begin
4214 // VerData
\82Í
\83[
\83\8d\82Å
\8fI
\82í
\82é
\95¶
\8e\9a\97ñ
\82Å
\82Í
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
4216 SetLength(result, VerDataLen);
4217 StrLCopy(PChar(result), VerData, VerDataLen);
4221 FreeMem(VerInfoBuf);
4225 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
4226 //Load
\82³
\82ê
\82½
\91S
\82Ä
\82Ì
\83v
\83\89\83O
\83C
\83\93\82Ì
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82ð
\95Ô
\82·
4228 function TGikoSys.GetPluginsInfo(): String;
4231 major, minor, revision : Cardinal;
4232 agent, release : String;
4234 //
\8c\8b\89Ê
\82ð
\83N
\83\8a\83A
\82µ
\82Ä
\82¨
\82
4237 //BoardGroups
\8co
\97R
\82ÅPlugin
\82É
\83A
\83N
\83Z
\83X
\82·
\82é
4238 for i := 0 to Length(BoardGroups) - 1 do begin
4239 //BoardGroups
\82Ì
\92\86\82É
\82Í
\81APlugin
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82È
\82¢
\82Ì
\81i2
\82¿
\82á
\82ñ
\81j
\82ª
4240 //
\82¢
\82é
\82Ì
\82Å
\82»
\82ê
\82ð
\8f\9c\82
4241 if BoardGroups[i].BoardPlugIn <> nil then begin
4242 BoardGroups[i].BoardPlugIn.VersionInfo(agent, major, minor, release, revision);
4245 //"Plugin
\82Ì
\96¼
\91O(major.minor.revision)"
4247 Format('%s(%d.%d.%d)', [agent, major, minor, revision]) + #13#10;
4253 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\82ð
\8eæ
\93¾
\82·
\82é
4254 function TGikoSys.GetIEVersion: string;
4258 R := TRegistry.Create;
4260 //
\93Ç
\82Ý
\8eæ
\82è
\90ê
\97p
\82É
\82µ
\82È
\82¢
\82Æ
\81A
\90§
\8cÀUSER
\82Æ
\82©
\82Ì
\8fê
\8d\87\81A
\8aJ
\82¯
\82È
\82¢
\82Ý
\82½
\82¢
4261 R.Access := KEY_EXECUTE;
4262 R.RootKey := HKEY_LOCAL_MACHINE;
4263 R.OpenKey('Software\Microsoft\Internet Explorer', False);
4265 Result := R.ReadString('version');
4267 Result := '
\83o
\81[
\83W
\83\87\83\93\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B';
4277 GikoSys := TGikoSys.Create;
4280 if GikoSys <> nil then begin