6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
22 TGikoBBSType = (gbt2ch);
23 //
\83\8d\83O
\83^
\83C
\83v
24 TGikoLogType = (glt2chNew, glt2chOld);
25 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
26 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
27 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
28 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
31 TStrTokSeparator = set of Char;
37 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
45 FRoundDate: TDateTime;
46 FLastModified: TDateTime;
49 FMishiyou: Boolean; //
\96¢
\8eg
\97p
53 FAllResCount: Integer;
54 FNewResCount: Integer;
55 FAgeSage: TGikoAgeSage;
58 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
65 //
\83\8c\83X
\83\8c\83R
\81[
\83h
75 //URLPath
\83\8c\83R
\81[
\83h
78 FKey: string; //ThreadID
79 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
80 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
81 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
82 FStBegin: Boolean; //1
\81`
\95\
\8e¦
83 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
84 FDone: Boolean; //
\90¬
\8c÷
85 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
89 TGikoMessageListType = (gmLogout, gmLogin, gmForceLogin, gmSureItiran,
90 gmUnKnown, gmSureSyutoku, gmSureDiff, gmNotMod, gmAbort, gmError,
91 gmNewRes, gmNewSure, gmResError, gmSureError);
93 TGikoSys = class(TObject)
100 FBayesian : TGikoBayesian; //!<
\83x
\83C
\83W
\83A
\83\93\83t
\83B
\83\8b\83^
102 // FExitWrite: TStringList;
103 // function StrToFloatDef(s: string; Default: Double): Double;
104 function SetUserOptionalStyle(): string;
108 FSelectResFilter : TAbon;
109 FBoardURLList: TStringList;
112 destructor Destroy; override;
113 property ResRange : Longint read FResRange write FResRange;
114 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
115 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
116 function IsNumeric(s: string): boolean;
117 function IsFloat(s: string): boolean;
118 function DirectoryExistsEx(const Name: string): Boolean;
119 function ForceDirectoriesEx(Dir: string): Boolean;
120 // function GetVersion: string;
122 function GetBoardFileName: string;
123 function GetCustomBoardFileName: string;
124 function GetHtmlTempFileName: string;
125 function GetAppDir: string;
126 function GetTempFolder: string;
127 function GetSentFileName: string;
128 function GetConfigDir: string;
129 function GetSkinDir: string;
130 function GetSkinHeaderFileName: string;
131 function GetSkinFooterFileName: string;
132 function GetSkinResFileName: string;
133 function GetSkinNewResFileName: string;
134 function GetSkinBookmarkFileName: string;
135 function GetSkinNewmarkFileName: string;
136 function GetStyleSheetDir: string;
137 function GetOutBoxFileName: string;
138 function GetUserAgent: string;
139 function GetSambaFileName : string;
141 procedure ReadSubjectFile(Board: TBoard);
142 procedure CreateThreadDat(Board: TBoard);
143 procedure WriteThreadDat(Board: TBoard);
144 function ParseIndexLine(Line: string): TIndexRec;
145 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
146 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¢
147 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
149 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
150 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
151 function AddAnchorTag(s: string): string;
153 function DivideSubject(Line: string): TSubjectRec;
154 function DivideStrLine(Line: string): TResRec;
156 property Setting: TSetting read FSetting write FSetting;
157 property Dolib: TDolib read FDolib write FDolib;
159 function UrlToID(url: string): string;
160 function UrlToServer(url: string): string;
162 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
163 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
165 function GetFileSize(FileName : string) : longint;
166 function GetFileLineCount(FileName : string): longint;
167 function Get2chDate(aDate: TDateTime): string;
168 function IntToDateTime(val: Int64): TDateTime;
169 function DateTimeToInt(ADate: TDateTime): Int64;
171 function ReadThreadFile(FileName: string; Line: Integer): string;
173 procedure MenuFont(Font: TFont);
175 function RemoveToken(var s:string; const delimiter:string):string;
176 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
177 function DeleteLink(const s: string): string;
179 function GetShortName(const LongName: string; ALength: integer): string;
180 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
181 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
182 function ConvertResAnchor(res: string): string;
183 function BoolToInt(b: Boolean): Integer;
184 function IntToBool(i: Integer): Boolean;
185 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
186 procedure LoadKeySetting(ActionList: TActionList);
187 procedure SaveKeySetting(ActionList: TActionList);
188 procedure LoadEditorKeySetting(ActionList: TActionList);
189 procedure SaveEditorKeySetting(ActionList: TActionList);
191 procedure CreateProcess(const AppPath: string; const Param: string);
192 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
193 function HTMLDecode(const AStr: String): String;
194 function GetHRefText(s: string): string;
195 function Is2chHost(Host: string): Boolean;
196 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
197 function Parse2chURL2(URL: string): TPathRec;
198 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
199 function GetVersionBuild: Integer;
200 function GetBrowsableThreadURL( inURL : string ) : string;
201 function GetThreadURL2BoardURL( inURL : string ) : string;
202 function Get2chThreadURL2BoardURL( inURL : string ) : string;
203 function Get2chBrowsableThreadURL( inURL : string ) : string;
204 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
205 procedure ListBoardFile;
206 procedure ReadBoardFile( bbs : TBBS );
208 function GetUnknownCategory : TCategory;
209 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
211 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
213 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
214 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
215 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
216 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
218 //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é
219 procedure SambaFileExists();
221 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
222 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string; overload;
223 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string; overload;
224 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
225 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
226 function GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer; overload;
227 function GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer; overload;
230 procedure SpamCountWord( const text : string; wordCount : TWordCount );
231 //!
\8aw
\8fK
\83N
\83\8a\83A
232 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
233 //!
\83X
\83p
\83\80\8aw
\8fK
234 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
235 //!
\83X
\83p
\83\80\93x
\90\94
236 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
237 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
238 function NotDateorTimeString(const AStr : string): boolean;
244 //LENGTH_RESTITLE = 40;
245 ZERO_DATE: Integer = 25569;
246 BETA_VERSION_NAME_E = 'beta';
247 BETA_VERSION_NAME_J = 'ÊÞÀ';
249 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
250 APP_NAME = 'gikoNavi';
255 Giko, RoundData, Favorite;
258 FOLDER_INDEX_VERSION = '1.01';
259 USER_AGENT = 'Monazilla';
260 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
261 NGWORDs_DIR_NAME : String = 'NGwords';
263 READ_PATH: string = '/test/read.cgi/';
264 OLD_READ_PATH: string = '/test/read.cgi?';
265 KAKO_PATH: string = '/kako/';
267 (*************************************************************************
268 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
269 *************************************************************************)
270 constructor TGikoSys.Create;
272 FSetting := TSetting.Create;
273 FDolib := TDolib.Create;
274 FAWKStr := TAWKStr.Create(nil);
275 if DirectoryExists(GetConfigDir) = false then begin
276 CreateDir(GetConfigDir);
278 FAbon := TAbon.Create;
279 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
281 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
282 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
283 FAbon.DeleteSyria := FSetting.DeleteSyria;
284 FAbon.Deleterlo := FSetting.AbonDeleterlo;
285 FAbon.Replaceul := FSetting.AbonReplaceul;
286 FAbon.AbonPopupRes := FSetting.PopUpAbon;
288 FSelectResFilter := TAbon.Create;
289 //
\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
290 FSelectResFilter.AbonString := '';
292 ResRange := FSetting.ResRange;
293 FBayesian := TGikoBayesian.Create;
294 FBoardURLList := TStringList.Create;
297 (*************************************************************************
298 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
299 *************************************************************************)
300 destructor TGikoSys.Destroy;
303 FileList: TStringList;
305 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
314 FSelectResFilter.Free;
316 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
317 FileList := TStringList.Create;
319 GetFileList(GetTempFolder, '*.html', FileList, False, True);
320 for i := 0 to FileList.Count - 1 do begin
321 DeleteFile(FileList[i]);
329 (*************************************************************************
330 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
331 *************************************************************************)
333 function TGikoSys.IsNumeric(s: string): boolean;
343 (*************************************************************************
344 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
345 *************************************************************************)
346 function TGikoSys.IsFloat(s: string): boolean;
350 Result := TextToFloat(PChar(s), v, fvExtended);
353 (*************************************************************************
354 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
355 *************************************************************************)
356 function TGikoSys.GetBoardFileName: string;
358 Result := Setting.GetBoardFileName;
361 (*************************************************************************
362 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
363 *************************************************************************)
364 function TGikoSys.GetCustomBoardFileName: string;
366 Result := Setting.GetCustomBoardFileName;
369 (*************************************************************************
370 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
371 *************************************************************************)
372 function TGikoSys.GetHtmlTempFileName: string;
374 Result := Setting.GetHtmlTempFileName;
378 (*************************************************************************
379 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
380 *************************************************************************)
381 function TGikoSys.GetAppDir: string;
383 Result := Setting.GetAppDir;
386 (*************************************************************************
387 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
388 *************************************************************************)
389 function TGikoSys.GetTempFolder: string;
391 Result := Setting.GetTempFolder;
394 (*************************************************************************
395 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
396 *************************************************************************)
397 function TGikoSys.GetSentFileName: string;
399 Result := Setting.GetSentFileName;
402 (*************************************************************************
403 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
404 *************************************************************************)
405 function TGikoSys.GetOutBoxFileName: string;
407 Result := Setting.GetOutBoxFileName;
410 (*************************************************************************
411 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
412 *************************************************************************)
413 function TGikoSys.GetConfigDir: string;
415 Result := Setting.GetConfigDir;
418 function TGikoSys.GetStyleSheetDir: string;
420 Result := Setting.GetStyleSheetDir;
423 function TGikoSys.GetSkinDir: string;
425 Result := Setting.GetSkinDir;
428 function TGikoSys.GetSkinHeaderFileName: string;
430 Result := Setting.GetSkinHeaderFileName;
433 function TGikoSys.GetSkinFooterFileName: string;
435 Result := Setting.GetSkinFooterFileName;
438 function TGikoSys.GetSkinNewResFileName: string;
440 Result := Setting.GetSkinNewResFileName;
443 function TGikoSys.GetSkinResFileName: string;
445 Result := Setting.GetSkinResFileName;
448 function TGikoSys.GetSkinBookmarkFileName: string;
450 Result := Setting.GetSkinBookmarkFileName;
453 function TGikoSys.GetSkinNewmarkFileName: string;
455 Result := Setting.GetSkinNewmarkFileName;
459 function TGikoSys.GetUserAgent: string;
461 if Dolib.Connected then begin
462 Result := Format('%s %s/%s%d%s', [
469 BETA_VERSION_BUILD]);
471 Result := Format('%s/%s %s/%s%d%s', [
479 BETA_VERSION_BUILD]);
483 (*************************************************************************
484 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
485 *************************************************************************)
486 function TGikoSys.Get2chDate(aDate: TDateTime): string;
490 d2 := aDate - EncodeTime(9, 0, 0, 0);
491 Result := FloatToStr(Trunc((d2 - ZERO_DATE) * 86400));
494 //val
\82Í
\81A1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
495 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
497 Result := ZERO_DATE + val / 86400.0;
499 //ADate
\82ð1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
\82É
\95Ï
\8a·
\82·
\82é
500 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
502 Result := Trunc((ADate - ZERO_DATE) * 86400);
506 (*************************************************************************
507 *Subject
\83t
\83@
\83C
\83\8bRead
508 *************************************************************************)
509 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
511 ThreadItem: TThreadItem;
513 FileList: TStringList;
514 TmpFileList: TStringList;
522 RoundItem: TRoundItem;
527 protocol, host, path, document, port, bookmark : string;
530 FavoThreadItem : TFavoriteThreadItem;
534 if Board.IsThreadDatRead then
539 usePlugIn := Board.IsBoardPlugInAvailable;
540 if not usePlugIn then begin
541 GikoSys.ParseURI(Board.URL, protocol, host, path, document, port, bookmark );
542 is2ch := Is2chHost(host);
545 FileName := Board.GetFolderIndexFileName;
547 FileList := TStringList.Create;
548 FileList.Sorted := True;
549 TmpFileList := TStringList.Create;
550 TmpFileList.Sorted := True;
552 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
553 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
554 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
555 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
557 //
\8fd
\95¡
\82ð
\96h
\82®
559 Board.Sorted := True;
561 sl := TStringList.Create;
563 if FileExists(FileName) then begin
564 sl.LoadFromFile(FileName);
566 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
567 for i := sl.Count - 1 downto 1 do begin
568 Rec := ParseIndexLine(sl[i]);
570 ThreadItem := TThreadItem.Create(
572 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
574 //ThreadItem := TThreadItem.Create(
576 // Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' )) );
577 ThreadItem := TThreadItem.Create(
579 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' )),
580 host, Board.BBSID, ChangeFileExt( Rec.FFileName, '' ) );
583 ThreadItem.BeginUpdate;
584 if FileList.Count <> 0 then
585 if FileList.Find( ThreadItem.FileName, Index ) then
586 FileList.Delete( Index );
588 ThreadItem.No := Rec.FNo;
589 ThreadItem.FileName := Rec.FFileName;
590 ThreadItem.Title := Rec.FTitle;
591 //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
592 ThreadItem.Count := Rec.FCount;
593 ThreadItem.Size := Rec.FSize;
594 // ThreadItem.RoundNo := Rec.FRoundNo;
595 ThreadItem.RoundDate := Rec.FRoundDate;
596 ThreadItem.LastModified := Rec.FLastModified;
597 ThreadItem.Kokomade := Rec.FKokomade;
598 ThreadItem.NewReceive := Rec.FNewReceive;
599 // ThreadItem.Round := Rec.FRound;
600 ThreadItem.UnRead := Rec.FUnRead;
601 ThreadItem.ScrollTop := Rec.FScrollTop;
602 ThreadItem.AllResCount := Rec.FAllResCount;
603 ThreadItem.NewResCount := Rec.FNewResCount;
604 ThreadItem.AgeSage := Rec.FAgeSage;
605 ThreadItem.ParentBoard := Board;
606 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
608 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
609 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
612 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
613 if ThreadItem.IsLogFile then begin
614 idx := RoundList.Find(ThreadItem);
615 if idx <> -1 then begin
616 RoundItem := RoundList.Items[idx, grtItem];
617 ThreadItem.RoundName := RoundItem.RoundName;
618 ThreadItem.Round := True;
623 ThreadItem.EndUpdate;
624 Board.Add(ThreadItem);
626 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
631 if UnRead <> Board.UnRead then
632 Board.UnRead := UnRead;
634 Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
635 //
\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
636 for i := 0 to FileList.Count - 1 do begin
637 FileName := Boardpath + FileList[i];
639 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
640 if usePlugIn then begin
641 ThreadItem := TThreadItem.Create(
643 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
644 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
646 ThreadItem := TThreadItem.Create(
647 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
648 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
651 ThreadItem.BeginUpdate;
652 ThreadItem.FilePath := FileName;
653 ThreadItem.No := Board.Count + 1;
654 ThreadItem.FileName := FileList[i];
655 ThreadItem.Title := ResRec.FTitle;
656 ThreadItem.Count := GetFileLineCount(FileName);
657 ThreadItem.AllResCount := ThreadItem.Count;
658 ThreadItem.NewResCount := ThreadItem.Count;
659 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é
660 ThreadItem.RoundDate := ZERO_DATE;
661 ThreadItem.LastModified := ZERO_DATE;
662 ThreadItem.Kokomade := -1;
663 ThreadItem.NewReceive := ThreadItem.Count;
664 ThreadItem.ParentBoard := Board;
665 ThreadItem.IsLogFile := True;
666 ThreadItem.Round := False;
667 ThreadItem.UnRead := False;
668 ThreadItem.ScrollTop := 0;
669 ThreadItem.AgeSage := gasNone;
670 ThreadItem.EndUpdate;
671 Board.Add(ThreadItem);
675 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
676 for i := TmpFileList.Count - 1 downto 0 do begin
677 //if TmpFileList.Count <> 0 then begin
678 ThreadItem := Board.FindThreadFromFileName(ChangeFileExt(TmpFileList[i], '.dat'));
679 if ThreadItem <> nil then begin
680 //if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
681 ini := TMemIniFile.Create(Boardpath + TmpFileList[i]);
683 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
684 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
686 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
687 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
688 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
689 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
691 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
692 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
694 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
700 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
701 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
702 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
703 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
704 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
705 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
709 DeleteFile(Boardpath + TmpFileList[i]);
717 Board.Sorted := False;
719 Board.IsThreadDatRead := True;
722 (*************************************************************************
723 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
724 *************************************************************************)
725 procedure TGikoSys.CreateThreadDat(Board: TBoard);
729 SubjectList: TStringList;
735 if not FileExists(Board.GetSubjectFileName) then Exit;
736 FileName := Board.GetFolderIndexFileName;
738 SubjectList := TStringList.Create;
740 SubjectList.LoadFromFile(Board.GetSubjectFileName);
741 sl := TStringList.Create;
744 sl.Add(FOLDER_INDEX_VERSION);
745 for i := 0 to SubjectList.Count - 1 do begin
746 Rec := DivideSubject(SubjectList[i]);
748 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
751 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
752 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
753 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
754 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
755 + Format('%x', [0]) + #1 //size
756 + Format('%x', [0]) + #1 //RoundDate
757 + Format('%x', [0]) + #1 //LastModified
758 + Format('%x', [0]) + #1 //Kokomade
759 + Format('%x', [0]) + #1 //NewReceive
760 + '0' + #1 //
\96¢
\8eg
\97p
761 + Format('%x', [0]) + #1 //UnRead
762 + Format('%x', [0]) + #1 //ScrollTop
763 + Format('%x', [Rec.FCount]) + #1 //AllResCount
764 + Format('%x', [0]) + #1 //NewResCount
765 + Format('%x', [0]); //AgeSage
770 sl.SaveToFile(FileName);
779 (*************************************************************************
780 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
782 *************************************************************************)
783 procedure TGikoSys.WriteThreadDat(Board: TBoard);
785 // Values: array[Boolean] of string = ('0', '1');
791 TmpFileList: TStringList;
793 if not Board.IsThreadDatRead then
795 FileName := Board.GetFolderIndexFileName;
796 ForceDirectoriesEx( ExtractFilePath( FileName ) );
798 sl := TStringList.Create;
799 TmpFileList := TStringList.Create;
800 TmpFileList.Sorted := true;
802 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
804 sl.Add(FOLDER_INDEX_VERSION);
806 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
807 Sort.SortNoFlag := true;
808 Sort.SortOrder := true;
810 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
811 Board.CustomSort(ThreadItemSortProc);
813 for i := 0 to Board.Count - 1 do begin
814 Board.Items[i].No := i + 1;
815 s := Format('%x', [Board.Items[i].No]) + #1
816 + Board.Items[i].FileName + #1
817 + Board.Items[i].Title + #1
818 + Format('%x', [Board.Items[i].Count]) + #1
819 + Format('%x', [Board.Items[i].Size]) + #1
820 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
821 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
822 + Format('%x', [Board.Items[i].Kokomade]) + #1
823 + Format('%x', [Board.Items[i].NewReceive]) + #1
824 + '0' + #1 //
\96¢
\8eg
\97p
825 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
826 + Format('%x', [Board.Items[i].ScrollTop]) + #1
827 + Format('%x', [Board.Items[i].AllResCount]) + #1
828 + Format('%x', [Board.Items[i].NewResCount]) + #1
829 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
834 sl.SaveToFile(FileName);
836 for i := 0 to TmpFileList.Count - 1 do begin
837 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
846 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
848 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
849 Result.FFileName := RemoveToken(Line, #1);
850 Result.FTitle := RemoveToken(Line, #1);
851 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
852 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
853 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
854 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
855 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
856 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
857 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
858 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
859 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
860 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
861 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
862 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
866 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
867 // ListFiles('c:\', '*.txt', list, True);
868 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
871 SearchRec : TSearchRec;
875 maskExt := Copy(Mask, 1, Length(Mask) - 1);
877 Path := IncludeTrailingPathDelimiter(Path);
878 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
880 while rc = 0 do begin
881 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
882 s := Path + SearchRec.Name;
883 //if (SearchRec.Attr and faDirectory > 0) then
884 // s := IncludeTrailingPathDelimiter(s)
886 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
890 List.Add(SearchRec.Name);
891 if SubDir and (SearchRec.Attr and faDirectory > 0) then
892 GetFileList(s, Mask, List, True, IsPathAdd);
894 rc := FindNext(SearchRec);
897 SysUtils.FindClose(SearchRec);
901 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
902 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
903 // ListFiles('c:\', '*.txt', list, True);
904 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
907 SearchRec : TSearchRec;
910 Path := IncludeTrailingPathDelimiter(Path);
911 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
913 while rc = 0 do begin
914 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
915 s := Path + SearchRec.Name;
917 if (SearchRec.Attr and faDirectory = 0) then
921 List.Add(SearchRec.Name);
923 rc := FindNext(SearchRec);
926 SysUtils.FindClose(SearchRec);
930 //
\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é
931 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
934 SearchRec : TSearchRec;
937 Path := IncludeTrailingPathDelimiter(Path);
938 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
940 while rc = 0 do begin
941 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
942 s := Path + SearchRec.Name;
943 //if (SearchRec.Attr and faDirectory > 0) then
944 // s := IncludeTrailingPathDelimiter(s)
946 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
947 List.Add( IncludeTrailingPathDelimiter( s ) );
948 if SubDir and (SearchRec.Attr and faDirectory > 0) then
949 GetDirectoryList(s, Mask, List, True);
951 rc := FindNext(SearchRec);
954 SysUtils.FindClose(SearchRec);
958 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
959 function TGikoSys.LoadFromSkin(
961 ThreadItem: TThreadItem;
968 Skin := TStringList.Create;
970 if FileExists( fileName ) then begin
971 Skin.LoadFromFile( fileName );
973 //
\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
975 if ThreadItem.ParentBoard <> nil then
976 if ThreadItem.ParentBoard.ParentCategory <> nil then
977 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
978 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
980 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
981 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
982 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
983 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
984 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
985 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
986 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
988 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
989 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
990 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
992 //-----
\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µ
993 //
\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
995 if ThreadItem.ParentBoard <> nil then
996 if ThreadItem.ParentBoard.ParentCategory <> nil then
997 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
998 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
1000 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
1001 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
1002 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
1003 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
1004 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
1005 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
1006 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
1008 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1009 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
1010 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
1011 //-----
\82±
\82±
\82Ü
\82Å
1013 Result := Skin.Text;
1019 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1020 function TGikoSys.SkinedRes(
1026 spamminess : Extended;
1027 wordCount : TWordCount;
1030 wordCount := TWordCount.Create;
1032 spamminess := Floor( SpamParse(
1033 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1035 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1036 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1037 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1038 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1039 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1040 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1041 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1042 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1043 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1044 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1045 Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
1047 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1048 Skin := CustomStringReplace( Skin, '&NUMBER',
1049 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1050 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1051 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1052 Skin := CustomStringReplace( Skin, '&MAILNAME',
1053 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1054 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1055 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1056 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1057 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1058 Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
1059 //-----
\82±
\82±
\82Ü
\82Å
1068 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1072 //bufList : TStringList;
1073 ReadList: TStringList;
1074 SaveList: TStringList;
1075 CSSFileName: string;
1078 NewReceiveNo: Integer;
1080 boardPlugIn : TBoardPlugIn;
1082 UserOptionalStyle: string;
1089 function LoadSkin( fileName: string ): string;
1091 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1093 function ReplaceRes( skin: string ): string;
1095 Result := SkinedRes( skin, Res, No );
1098 if ThreadItem <> nil then begin
1099 if ThreadItem.IsBoardPlugInAvailable then begin
1100 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1101 boardPlugIn := ThreadItem.BoardPlugIn;
1102 NewReceiveNo := ThreadItem.NewReceive;
1103 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1104 UserOptionalStyle := SetUserOptionalStyle;
1105 SaveList := TStringList.Create;
1108 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1109 // doc.charset := 'Shift_JIS';
1112 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1113 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1115 SaveList.Add('<p id="idSearch"></p>');
1116 for i := 0 to threadItem.Count - 1 do begin
1117 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1118 if i <> 0 then begin
1119 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1122 if ThreadItem.Kokomade > (i + 1) then
1125 if NewReceiveNo > (i + 1) then
1128 if (threadItem.Count - i) > ResRange then
1133 //
\90V
\92\85\83}
\81[
\83N
1134 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1136 if GikoSys.Setting.UseSkin then begin
1137 if FileExists( GetSkinNewmarkFileName ) then
1138 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1140 SaveList.Add( '<a name="new"></a>' );
1141 end else if GikoSys.Setting.UseCSS then begin
1142 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>');
1144 SaveList.Add('</dl>');
1145 SaveList.Add('<a name="new"></a>');
1146 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>');
1147 SaveList.Add('<dl>');
1150 SaveList.Add( '<a name="new"></a>' );
1155 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1157 if ThreadItem.Kokomade = (i + 1) then begin
1158 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1160 if GikoSys.Setting.UseSkin then begin
1161 if FileExists( GetSkinBookmarkFileName ) then
1162 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1164 SaveList.Add( '<a name="koko"></a>' );
1165 end else if GikoSys.Setting.UseCSS then begin
1166 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1168 SaveList.Add('</dl>');
1169 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>');
1170 SaveList.Add('<dl>');
1173 SaveList.Add( '<a name="koko"></a>' );
1177 doc.Write(SaveList.Text);
1182 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1183 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1184 doc.Write(SaveList.Text);
1193 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1194 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1195 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1196 ShortDayNames[7] := '
\93y';
1197 BBSID := ThreadItem.ParentBoard.BBSID;
1198 NewReceiveNo := ThreadItem.NewReceive;
1199 ReadList := TStringList.Create;
1201 if ThreadItem.IsLogFile then begin
1202 FileName := ThreadItem.GetThreadFileName;
1203 ReadList.LoadFromFile(FileName);
1204 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1205 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1206 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1207 if ThreadItem.Title = '' then begin
1208 Res := DivideStrLine(ReadList[0]);
1209 sTitle := Res.FTitle;
1211 sTitle := ThreadItem.Title;
1213 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1215 SaveList := TStringList.Create;
1218 doc.charset := 'Shift_JIS';
1220 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1221 UserOptionalStyle := SetUserOptionalStyle;
1222 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1223 if GikoSys.Setting.UseSkin then begin
1224 //
\83X
\83L
\83\93\8eg
\97p
1225 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1227 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1228 if Length( UserOptionalStyle ) > 0 then
1229 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1230 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1231 SaveList.Add( SkinHeader );
1235 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1239 SkinRes := LoadSkin( GetSkinResFileName );
1242 SaveList.Add('<p id="idSearch"></p>');
1243 SaveList.Add('<a name="top"></a>');
1245 for i := 0 to ReadList.Count - 1 do begin
1246 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1247 if i <> 0 then begin
1248 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1251 if ThreadItem.Kokomade > (i + 1) then
1254 if NewReceiveNo > (i + 1) then
1257 if (threadItem.Count - i) > ResRange then
1262 //
\90V
\92\85\83}
\81[
\83N
1263 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1265 if FileExists( GetSkinNewmarkFileName ) then
1266 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1268 SaveList.Add( '<a name="new"></a>' );
1270 SaveList.Add( '<a name="new"></a>' );
1273 if (Trim(ReadList[i]) <> '') then begin
1274 No := IntToStr(i + 1);
1276 Res := DivideStrLine(ReadList[i]);
1277 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1279 if NewReceiveNo <= (i + 1) then
1280 //
\90V
\92\85\83\8c\83X
1281 strTmp := ReplaceRes( SkinNewRes )
1283 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1284 strTmp := ReplaceRes( SkinRes );
1286 SaveList.Add( strTmp );
1291 if ThreadItem.Kokomade = (i + 1) then begin
1292 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1294 if FileExists( GetSkinBookmarkFileName ) then
1295 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1297 SaveList.Add( '<a name="koko"></a>' );
1299 SaveList.Add( '<a name="koko"></a>' );
1302 doc.Write(SaveList.Text);
1305 SaveList.Add('<a name="bottom"></a>');
1306 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1308 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1311 doc.Write(SaveList.Text);
1312 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1314 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1315 // SaveList.Add('<html lang="ja"><head>');
1316 SaveList.Add('<html><head>');
1317 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1318 SaveList.Add('<title>' + sTitle + '</title>');
1319 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1320 if Length( UserOptionalStyle ) > 0 then
1321 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1322 SaveList.Add('</head>');
1323 SaveList.Add('<body>');
1324 SaveList.Add('<a name="top"></a>');
1325 SaveList.Add('<p id="idSearch"></p>');
1326 SaveList.Add('<div class="title">' + sTitle + '</div>');
1327 doc.Write(SaveList.Text);
1329 //Application.ProcessMessages;
1330 for i := 0 to ReadList.Count - 1 do begin
1331 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1332 if i <> 0 then begin
1333 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1336 if ThreadItem.Kokomade > (i + 1) then
1339 if NewReceiveNo > (i + 1) then
1342 if (threadItem.Count - i) > ResRange then
1347 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1348 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>');
1350 if (Trim(ReadList[i]) <> '') then begin
1351 No := IntToStr(i + 1);
1352 Res := DivideStrLine(ReadList[i]);
1353 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1354 if Res.FMailTo = '' then
1355 SaveList.Add('<a name="' + No + '"></a>'
1356 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1357 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1358 + '<span class="name"><b>' + Res.FName + '</b></span> '
1359 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1360 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1361 + '<div class="mes">' + Res.FBody + ' </div>')
1362 else if GikoSys.Setting.ShowMail then
1363 SaveList.Add('<a name="' + No + '"></a>'
1364 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1365 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1366 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1367 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1368 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1369 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1370 + '<div class="mes">' + Res.FBody + ' </div>')
1372 SaveList.Add('<a name="' + No + '"></a>'
1373 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1374 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1375 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1376 + '<b>' + Res.FName + '</b></a>'
1377 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1378 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1379 + '<div class="mes">' + Res.FBody + ' </div>');
1381 if ThreadItem.Kokomade = (i + 1) then begin
1382 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1385 doc.Write(SaveList.Text);
1388 SaveList.Add('<a name="bottom"></a>');
1389 //SaveList.Add('</body></html>');
1390 SaveList.Add('<a name="last"></a>');
1391 SaveList.Add('</body></html>');
1392 doc.Write(SaveList.Text);
1395 // SaveList.Add('<html lang="ja"><head>');
1396 SaveList.Add('<html><head>');
1397 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1398 SaveList.Add('<title>' + sTitle + '</title></head>');
1399 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1400 SaveList.Add('<a name="top"></a>');
1401 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1402 SaveList.Add('<dl>');
1403 SaveList.Add('<p id="idSearch"></p>');
1404 doc.Write(SaveList.Text);
1406 //Application.ProcessMessages;
1407 for i := 0 to ReadList.Count - 1 do begin
1408 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1409 if i <> 0 then begin
1410 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1413 if ThreadItem.Kokomade > (i + 1) then
1416 if NewReceiveNo > (i + 1) then
1419 if (threadItem.Count - i) > ResRange then
1424 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1425 SaveList.Add('</dl>');
1426 SaveList.Add('<a name="new"></a>');
1427 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>
\90V
\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1428 SaveList.Add('<dl>');
1430 if (Trim(ReadList[i]) <> '') then begin
1431 No := IntToStr(i + 1);
1432 Res := DivideStrLine(ReadList[i]);
1433 Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1434 if Res.FMailTo = '' then
1435 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>')
1436 else if GikoSys.Setting.ShowMail then
1437 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>')
1439 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>');
1441 if ThreadItem.Kokomade = (i + 1) then begin
1442 SaveList.Add('</dl>');
1443 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>');
1444 SaveList.Add('<dl>');
1446 doc.Write(SaveList.Text);
1449 SaveList.Add('</dl>');
1450 SaveList.Add('<a name="bottom"></a>');
1451 SaveList.Add('</body></html>');
1452 doc.Write(SaveList.Text);
1464 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1468 //bufList : TStringList;
1469 ReadList: TStringList;
1470 // SaveList: TStringList;
1471 CSSFileName: string;
1475 boardPlugIn : TBoardPlugIn;
1477 UserOptionalStyle: string;
1481 function LoadSkin( fileName: string ): string;
1483 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1485 function ReplaceRes( skin: string ): string;
1487 Result := SkinedRes( skin, Res, No );
1491 if ThreadItem <> nil then begin
1492 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1495 if ThreadItem.IsBoardPlugInAvailable then begin
1496 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1497 boardPlugIn := ThreadItem.BoardPlugIn;
1498 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1499 UserOptionalStyle := SetUserOptionalStyle;
1501 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1503 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1504 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1505 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1506 if Setting.UseSkin then begin
1507 tmp1 := './' +Setting.CSSFileName;
1508 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1509 tmp1 := CustomStringReplace(tmp1, '\', '/');
1510 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1511 end else if Setting.UseCSS then begin
1512 tmp1 := './' + CSSFileName;
1513 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1514 tmp1 := CustomStringReplace(tmp1, '\', '/');
1515 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1519 for i := 0 to threadItem.Count - 1 do begin
1522 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1525 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1526 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1532 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1533 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1534 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1535 ShortDayNames[7] := '
\93y';
1536 BBSID := ThreadItem.ParentBoard.BBSID;
1537 ReadList := TStringList.Create;
1539 if ThreadItem.IsLogFile then begin
1540 FileName := ThreadItem.GetThreadFileName;
1541 ReadList.LoadFromFile(FileName);
1542 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1543 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1544 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1545 Res := DivideStrLine(ReadList[0]);
1546 //Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1547 sTitle := Res.FTitle;
1549 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1552 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1553 UserOptionalStyle := SetUserOptionalStyle;
1555 if GikoSys.Setting.UseSkin then begin
1556 //
\83X
\83L
\83\93\8eg
\97p
1557 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1559 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1560 if Length( UserOptionalStyle ) > 0 then
1561 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1562 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1563 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1564 tmp1 := './' +Setting.CSSFileName;
1565 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1566 tmp1 := CustomStringReplace(tmp1, '\', '/');
1567 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1568 html.Append( SkinHeader );
1572 SkinRes := LoadSkin( GetSkinResFileName );
1575 html.Append('<a name="top"></a>');
1576 for i := 0 to ReadList.Count - 1 do begin
1577 if (Trim(ReadList[i]) <> '') then begin
1578 No := IntToStr(i + 1);
1580 Res := DivideStrLine(ReadList[i]);
1581 {if Res.FType = glt2chOld then begin
1582 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1583 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1584 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1587 Res.FBody := AddAnchorTag(Res.FBody);
1588 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1591 html.Append( ReplaceRes( SkinRes ) );
1597 html.Append('<a name="bottom"></a>');
1598 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1600 html.Append( LoadSkin( GetSkinFooterFileName ) );
1603 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1605 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1606 html.Append('<html><head>');
1607 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1608 html.Append('<title>' + sTitle + '</title>');
1609 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1610 tmp1 := './' + CSSFileName;
1611 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1612 tmp1 := CustomStringReplace(tmp1, '\', '/');
1614 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1615 if Length( UserOptionalStyle ) > 0 then
1616 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1617 html.Append('</head>');
1618 html.Append('<body>');
1619 html.Append('<a name="top"></a>');
1620 html.Append('<div class="title">' + sTitle + '</div>');
1621 for i := 0 to ReadList.Count - 1 do begin
1622 if (Trim(ReadList[i]) <> '') then begin
1623 No := IntToStr(i + 1);
1624 Res := DivideStrLine(ReadList[i]);
1625 {if Res.FType = glt2chOld then begin
1626 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1627 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1628 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1631 Res.FBody := AddAnchorTag(Res.FBody);
1632 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1633 if Res.FMailTo = '' then
1634 html.Append('<a name="' + No + '"></a>'
1635 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1636 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1637 + '<span class="name"><b>' + Res.FName + '</b></span> '
1638 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1639 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1640 + '<div class="mes">' + Res.FBody + ' </div>')
1641 else if GikoSys.Setting.ShowMail then
1642 html.Append('<a name="' + No + '"></a>'
1643 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1644 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1645 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1646 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1647 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1648 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1649 + '<div class="mes">' + Res.FBody + ' </div>')
1651 html.Append('<a name="' + No + '"></a>'
1652 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1653 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1654 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1655 + '<b>' + Res.FName + '</b></a>'
1656 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1657 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1658 + '<div class="mes">' + Res.FBody + ' </div>');
1661 html.Append('<a name="bottom"></a>');
1662 //html.Append('</body></html>');
1663 html.Append('<a name="last"></a>');
1664 html.Append('</body></html>');
1667 html.Append('<html><head>');
1668 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1669 html.Append('<title>' + sTitle + '</title></head>');
1670 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1671 html.Append('<a name="top"></a>');
1672 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1673 html.Append('<dl>');
1674 for i := 0 to ReadList.Count - 1 do begin
1675 if (Trim(ReadList[i]) <> '') then begin
1676 No := IntToStr(i + 1);
1677 Res := DivideStrLine(ReadList[i]);
1678 {if Res.FType = glt2chOld then begin
1679 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1680 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1681 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1684 Res.FBody := AddAnchorTag(Res.FBody);
1685 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1686 if Res.FMailTo = '' then
1687 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>')
1688 else if GikoSys.Setting.ShowMail then
1689 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>')
1691 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>');
1694 html.Append('</dl>');
1695 html.Append('<a name="bottom"></a>');
1696 html.Append('</body></html>');
1707 function TGikoSys.ConvertResAnchor(res: string): string;
1709 _HEAD : string = '<a href="../';
1710 _TAIL : string = ' target="_blank">';
1711 _ST: string = '&st=';
1712 _TO: string = '&to=';
1713 _STA: string = '&START=';
1714 _END: string = '&END=';
1720 i := AnsiPos(_HEAD, res);
1721 while i <> 0 do begin
1722 Result := Result + Copy(res, 1, i -1);
1723 Delete(res, 1, i - 1);
1724 j := AnsiPos(_TAIL, res);
1726 Result := Result + res;
1729 tmp := Copy(res, 1, j - 1);
1730 Delete(res, 1, j + 16);
1731 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1732 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1733 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1734 Result := Result + '<a href="#' + tmp + '">';
1735 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1736 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1737 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1738 Result := Result + '<a href="#' + tmp + '">';
1740 k := LastDelimiter('/', tmp);
1742 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1743 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1745 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1747 Result := Result + '<a href="#' + tmp + '">';
1749 i := AnsiPos(_HEAD, res);
1751 Result := Result + res;
1755 (*************************************************************************
1756 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1757 *************************************************************************)
1758 function TGikoSys.AddAnchorTag(s: string): string;
1760 URL_CHAR: string = '0123456789'
1761 + 'abcdefghijklmnopqrstuvwxyz'
1762 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1763 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1764 ANCHOR_REF = 'href=';
1765 RES_REF = '>>';
1767 wkIdx: array[0..9] of Integer;
1772 anchorLen : Integer;
1775 // + 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ß
1776 anchorLen := Length( ANCHOR_REF ) + 3;
1779 wkIdx[0] := AnsiPos('http://', s);
1780 wkIdx[1] := AnsiPos('ttp://', s);
1781 wkIdx[2] := AnsiPos('tp://', s);
1782 wkIdx[3] := AnsiPos('ms-help://', s);
1783 wkIdx[4] := AnsiPos('p://', s);
1784 wkIdx[5] := AnsiPos('https://', s);
1785 wkIdx[6] := AnsiPos('www.', s);
1786 wkIdx[7] := AnsiPos('ftp://', s);
1787 wkIdx[8] := AnsiPos('news://', s);
1788 wkIdx[9] := AnsiPos('rtsp://', s);
1792 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1794 if idx = MaxInt then begin
1795 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1796 Result := Result + s;
1801 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1802 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1803 href := Copy( s, idx, Length( s ) );
1804 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1806 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1811 Result := Result + Copy(s, 0, idx - 1);
1813 s := Copy(s, idx, length(s));
1815 b := Length( s ) + 1;
1816 for i := 1 to b do begin
1820 idx := AnsiPos(s[i], URL_CHAR);
1821 if idx = 0 then begin
1822 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1823 url := Copy(s, 0, i - 1);
1825 if AnsiPos('ttp://', url) = 1 then
1827 else if AnsiPos('tp://', url) = 1 then
1829 else if AnsiPos('p://', url) = 1 then
1831 else if AnsiPos('www.', url) = 1 then
1832 href := 'http://' + url
1835 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1836 s := Copy(s, i, MaxInt);
1843 (*************************************************************************
1844 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1845 *************************************************************************)
1846 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1856 if AnsiPos('<>', Line) = 0 then
1860 Result.FFileName := RemoveToken(Line, Delim);
1861 Result.FTitle := RemoveToken(Line, Delim);
1863 ws := Trim(Result.FTitle);
1865 if Copy(ws, Length(ws), 1) = ')' then begin
1868 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1871 end else if Copy(ws, Length(ws), 1) = '<' then begin
1876 for i := Length(ws) - 1 downto 1 do begin
1877 if ws[i] = LeftK then begin
1878 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1879 if IsNumeric(ws) then
1880 Result.FCount := StrToInt(ws);
1881 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1887 (*************************************************************************
1888 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1889 *************************************************************************)
1890 function TGikoSys.DivideStrLine(Line: string): TResRec;
1895 if AnsiPos('<>', Line) = 0 then begin
1897 //Result.FType := glt2chOld;
1898 Line := CustomStringReplace(Line, '<>', '<>');
1899 Line := CustomStringReplace(Line, ',', '<>');
1900 Line := CustomStringReplace(Line, '
\81\97\81M', ',');
1903 Result.FType := glt2chNew;
1905 Result.FName := Trim(RemoveToken(Line, Delim));
1906 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1907 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1908 bufBody := Trim(RemoveToken(Line, Delim));
1910 //Trim
\82µ
\82Ä
\82Í
\82¢
\82¯
\82È
\82¢
\8bC
\82ª
\82·
\82é
\81@by
\82à
\82¶
\82ã
1911 Result.FName := RemoveToken(Line, Delim);
1912 Result.FMailTo := RemoveToken(Line, Delim);
1913 Result.FDateTime := RemoveToken(Line, Delim);
1914 Result.FBody := RemoveToken(Line, Delim);
1915 if Result.FBody = '' then begin
1916 Result.FBody := ' ';
1918 //Result.FTitle := Trim(RemoveToken(Line, Delim));
1919 Result.FTitle := RemoveToken(Line, Delim);
1923 (*************************************************************************
1924 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1925 *************************************************************************)
1926 function TGikoSys.UrlToID(url: string): string;
1933 if url = '' then Exit;
1935 url := Copy(url, 0, Length(url) - 1);
1936 for i := Length(url) downto 0 do begin
1937 if url[i] = '/' then begin
1938 Result := Copy(url, i + 1, Length(url));
1944 (*************************************************************************
1945 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1946 *************************************************************************)
1947 function TGikoSys.UrlToServer(url: string): string;
1954 wsURL := Trim(wsURL);
1956 if wsURL = '' then exit;
1958 if Copy(wsURL, Length(wsURL), 1) = '/' then
1959 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1961 for i := Length(wsURL) downto 0 do begin
1962 if wsURL[i] = '/' then begin
1963 Result := Copy(wsURL, 0, i);
1969 (*************************************************************************
1970 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1971 *************************************************************************)
1972 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1976 Code := GetFileAttributes(PChar(Name));
1977 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1980 (*************************************************************************
1981 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1982 *************************************************************************)
1983 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1986 if Length(Dir) = 0 then
1987 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1988 Dir := ExcludeTrailingPathDelimiter(Dir);
1989 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1990 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1991 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1994 (*************************************************************************
1995 *
\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
1996 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1997 *************************************************************************)
1998 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2002 Result := StrTokNext(sep, Rec);
2005 (*************************************************************************
2006 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2007 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2008 *************************************************************************)
2009 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2016 if Len >= Pos then begin
2017 while (Pos <= Len) and (Str[Pos] in sep) do begin
2021 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2022 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2027 Result := Copy(Str, I, Pos - I);
2028 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2035 (*************************************************************************
2036 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2037 *************************************************************************)
2038 function TGikoSys.GetFileSize(FileName : string): longint;
2043 if not FileExists(FileName) then begin
2047 Assign(F, FileName);
2049 Result := FileSize(F);
2056 (*************************************************************************
2057 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2058 *************************************************************************)
2059 function TGikoSys.GetFileLineCount(FileName : string): longint;
2063 sl := TStringList.Create;
2066 sl.LoadFromFile(FileName);
2077 (*************************************************************************
2078 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2079 *************************************************************************)
2080 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2082 fileTmp : TStringList;
2085 if FileExists(FileName) then begin
2086 fileTmp := TStringList.Create;
2089 fileTmp.LoadFromFile( FileName );
2090 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2091 Result := fileTmp.Strings[ Line-1 ];
2094 //on EFOpenError do Result := '';
2102 (*************************************************************************
2103 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2104 *************************************************************************)
2105 procedure TGikoSys.MenuFont(Font: TFont);
2108 nm: NONCLIENTMETRICS;
2110 nm.cbSize := sizeof(NONCLIENTMETRICS);
2112 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2113 lf := nm.lfMenuFont;
2115 Font.Name := lf.lfFaceName;
2116 Font.Height := lf.lfHeight;
2118 if lf.lfWeight >= 700 then
2119 Font.Style := Font.Style + [fsBold];
2120 if lf.lfItalic = 1 then
2121 Font.Style := Font.Style + [fsItalic];
2124 (*************************************************************************
2126 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2127 *************************************************************************)
2128 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2132 p := AnsiPos(delimiter, s);
2136 Result := Copy(s, 1, p - 1);
2137 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2140 (*************************************************************************
2142 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2143 *************************************************************************)
2144 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2149 for i := 0 to index do
2150 Result := RemoveToken(s, delimiter);
2153 (*************************************************************************
2155 *************************************************************************)
2156 function TGikoSys.DeleteLink(const s: string): string;
2166 s1 := GetTokenIndex(s, '<a href="', i);
2167 s2 := GetTokenIndex(s, '<a href="', i + 1);
2169 idx := Pos('">', s1);
2171 Delete(s1, 1, idx + 1);
2172 idx := Pos('">', s2);
2174 Delete(s2, 1, idx + 1);
2176 Result := Result + s1 + s2;
2185 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2186 {procedure TGikoSys.FlashExitWrite;
2190 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2191 for i := 0 to FExitWrite.Count - 1 do
2192 WriteThreadDat(FExitWrite[i]);
2196 (*************************************************************************
2197 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2199 *************************************************************************)
2200 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2202 ERASECHAR : array [1..39] of string =
2203 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2204 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2205 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2206 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2208 Chr : array [0..255] of char;
2212 s := Trim(LongName);
2213 if (Length(s) <= ALength) then begin
2217 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2218 S := CustomStringReplace(S, ERASECHAR[i], '');
2220 if (Length(S) <= ALength) then begin
2223 Windows.LCMapString(
2224 GetUserDefaultLCID(),
2232 S := Copy(S,1,ALength);
2234 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2235 S := Copy(S, 1, Length(S) - 1);
2245 (*************************************************************************
2248 *************************************************************************)
2249 function TGikoSys.ConvRes(const Body, Bbs, Key,
2250 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2251 DatToHTML: boolean = false): string;
2255 FIndexFrom : integer;
2262 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2276 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2281 FIndex.FIndexFrom := IndexFrom;
2282 FIndex.FIndexTo := IndexTo;
2286 function ChooseString(const Text, Separator: string; Index: integer): string;
2292 for i := 0 to Index - 1 do begin
2293 if (AnsiPos(Separator, S) = 0) then S := ''
2294 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2296 p := AnsiPos(Separator, S);
2297 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2306 List:= TList.Create;
2312 b := ByteType(s, i);
2314 mbSingleByte : begin
2315 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2316 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2324 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2325 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2331 if (not sw) and (Copy(s,i,4) = GT) then begin
2332 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2340 if ((not sw) and (Copy(s,i,1) = ',')) or
2341 ((not sw) and (Copy(s,i,1) = '=')) then begin
2342 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2343 ((Chk) and (oc = '')) or
2344 ((not Chk) and (al)) then
2354 if (AnsiPos(sx, SN) > 0) then begin
2357 if (No <> '') and (No <> '-') then begin
2370 if Copy(s,i,1) = '<' then oc := '';
2371 oc := oc + Copy(s,i,1);
2377 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2383 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2391 if (AnsiPos(sx, ZN) > 0) then begin
2392 No := No + ZenToHan(sx);
2394 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2409 if (i > Length(Body)) then begin
2411 if (No <> '') then Add(sp, i, No);
2416 for i := List.Count - 1 downto 0 do begin
2417 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2418 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2419 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2421 st := PIndex(List[i]).FNo;
2422 et := PIndex(List[i]).FNo;
2424 if not DatToHTML then
2425 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2426 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2427 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2428 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2429 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2431 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2432 Format('<a href="#%s">', [st]) +
2433 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2434 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2436 Dispose(PIndex(List[i]));
2442 function TGikoSys.ConvRes(
2443 const Body, Bbs, Key, ParamBBS, ParamKey,
2444 ParamStart, ParamTo, ParamNoFirst,
2445 ParamTrue, FullURL : string
2450 FIndexFrom : integer;
2457 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2471 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2476 FIndex.FIndexFrom := IndexFrom;
2477 FIndex.FIndexTo := IndexTo;
2481 function ChooseString(const Text, Separator: string; Index: integer): string;
2487 for i := 0 to Index - 1 do begin
2488 if (AnsiPos(Separator, S) = 0) then S := ''
2489 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2491 p := AnsiPos(Separator, S);
2492 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2501 List:= TList.Create;
2507 b := ByteType(s, i);
2509 mbSingleByte : begin
2510 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2511 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2519 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2520 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2526 if (not sw) and (Copy(s,i,4) = GT) then begin
2527 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2535 if ((not sw) and (Copy(s,i,1) = ',')) or
2536 ((not sw) and (Copy(s,i,1) = '=')) then begin
2537 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2538 ((Chk) and (oc = '')) or
2539 ((not Chk) and (al)) then
2549 if (AnsiPos(sx, SN) > 0) then begin
2552 if (No <> '') and (No <> '-') then begin
2565 if Copy(s,i,1) = '<' then oc := '';
2566 oc := oc + Copy(s,i,1);
2572 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2578 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2586 if (AnsiPos(sx, ZN) > 0) then begin
2587 No := No + ZenToHan(sx);
2589 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2604 if (i > Length(Body)) then begin
2606 if (No <> '') then Add(sp, i, No);
2611 for i := List.Count - 1 downto 0 do begin
2612 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2613 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2614 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2615 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2617 st := PIndex(List[i]).FNo;
2618 et := PIndex(List[i]).FNo;
2620 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2621 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2622 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2623 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2624 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2625 Dispose(PIndex(List[i]));
2632 function TGikoSys.BoolToInt(b: Boolean): Integer;
2634 Result := IfThen(b, 1, 0);
2637 function TGikoSys.IntToBool(i: Integer): Boolean;
2642 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2643 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2647 GZipStream: TGzipDecompressStream;
2648 TextStream: TStringStream;
2649 buf: array[0..BUF_SIZE - 1] of Byte;
2655 TextStream := TStringStream.Create('');
2657 //
\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¢)
2658 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2659 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2660 ResStream.Position := 0;
2661 GZipStream := TGzipDecompressStream.Create(TextStream);
2664 FillChar(buf, BUF_SIZE, 0);
2665 cnt := ResStream.Read(buf, BUF_SIZE);
2667 GZipStream.Write(buf, BUF_SIZE);
2673 ResStream.Position := 0;
2675 FillChar(buf, BUF_SIZE, 0);
2676 cnt := ResStream.Read(buf, BUF_SIZE);
2678 TextStream.Write(buf, BUF_SIZE);
2682 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2683 s := TextStream.DataString;
2685 while (i > 0) and (s[i] = #0) do
2690 while i <> 0 do begin
2700 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2702 STD_SEC = 'KeySetting';
2708 SecList: TStringList;
2709 Component: TComponent;
2711 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2713 SecList := TStringList.Create;
2714 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2716 ini.ReadSection(STD_SEC, SecList);
2717 for i := 0 to SecList.Count - 1 do begin
2718 ActionName := SecList[i];
2719 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2720 if ActionKey <> -1 then begin
2721 Component := ActionList.Owner.FindComponent(ActionName);
2722 if TObject(Component) is TAction then begin
2723 TAction(Component).ShortCut := ActionKey;
2733 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2735 STD_SEC = 'KeySetting';
2740 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2742 for i := 0 to ActionList.ActionCount - 1 do begin
2743 if ActionList.Actions[i].Tag = -1 then
2745 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2753 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2755 STD_SEC = 'KeySetting';
2761 SecList: TStringList;
2762 Component: TComponent;
2764 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2766 SecList := TStringList.Create;
2767 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2769 ini.ReadSection(STD_SEC, SecList);
2770 for i := 0 to SecList.Count - 1 do begin
2771 ActionName := SecList[i];
2772 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2773 if ActionKey <> -1 then begin
2774 Component := ActionList.Owner.FindComponent(ActionName);
2775 if TObject(Component) is TAction then begin
2776 TAction(Component).ShortCut := ActionKey;
2786 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2788 STD_SEC = 'KeySetting';
2793 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2795 for i := 0 to ActionList.ActionCount - 1 do begin
2796 if ActionList.Actions[i].Tag = -1 then
2798 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2807 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2809 PI: TProcessInformation;
2813 Path := '"' + AppPath + '"';
2815 Path := Path + ' ' + Param;
2817 SI.Cb := SizeOf(Si);
2818 SI.lpReserved := nil;
2819 SI.lpDesktop := nil;
2822 SI.cbReserved2 := 0;
2823 SI.lpReserved2 := nil;
2825 Windows.CreateProcess(nil,
2837 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2841 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2842 gbtUserApp, gbtAuto:
2843 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2844 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2846 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2850 function TGikoSys.HTMLDecode(const AStr: String): String;
2852 Sp, Rp, Cp, Tp: PChar;
2857 SetLength(Result, Length(AStr));
2859 Rp := PChar(Result);
2862 while Sp^ <> #0 do begin
2868 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2874 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2878 while (Sp^ <> ';') and (Sp^ <> #0) do
2885 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2893 Num := IsNumeric(Copy(Tp, 1, 1));
2894 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2895 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2899 SetString(S, Tp, Sp - Tp);
2904 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2905 //[Cp^ + Sp^, Cp - PChar(AStr)])
2915 // on E:EConvertError do
2916 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2917 // [Cp^ + Sp^, Cp - PChar(AStr)])
2919 SetLength(Result, Rp - PChar(Result));
2922 function TGikoSys.GetHRefText(s: string): string;
2932 Index := AnsiPos('href', LowerCase(s));
2935 s := Trim(Copy(s, Index + 4, Length(s)));
2936 s := Trim(Copy(s, 2, Length(s)));
2938 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2939 //if Copy(s, 1, 1) = '"' then begin
2940 if s[1] = '"' then begin
2941 s := Trim(Copy(s, 2, Length(s)));
2944 Index := AnsiPos('"', s);
2945 if Index <> 0 then begin
2946 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2947 s := Copy(s, 1, Index - 1);
2949 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2950 Index := AnsiPos(' ', s);
2951 Index2 := AnsiPos('>', s);
2954 if Index > Index2 then
2957 s := Copy(s, 1, Index - 1)
2959 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2965 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2966 function TGikoSys.Is2chHost(Host: string): Boolean;
2968 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2974 if RightStr( Host, 1 ) = '/' then
2975 Host := Copy( Host, 1, Length( Host ) - 1 );
2976 OutputDebugString(pchar(HOST_NAME[0]));
2977 for i := 0 to Length(HOST_NAME) - 1 do begin
2978 // Len := Length(HOST_NAME[i]);
2979 if (AnsiPos(HOST_NAME[i], Host) > 0) and
2980 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
2987 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2997 Index := AnsiPos(READ_PATH, path);
2998 if Index <> 0 then begin
2999 s := Copy(path, Index + Length(READ_PATH), Length(path));
3002 BBSID := GetTokenIndex(s, '/', 0);
3003 BBSKey := GetTokenIndex(s, '/', 1);
3006 Result := (BBSID <> '') or (BBSKey <> '');
3009 Index := AnsiPos(KAKO_PATH, path);
3010 if Index <> 0 then begin
3011 s := Copy(path, 2, Length(path));
3012 BBSID := GetTokenIndex(s, '/', 0);
3013 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3014 BBSID := GetTokenIndex(s, '/', 1);
3015 BBSKey := ChangeFileExt(Document, '');
3016 Result := (BBSID <> '') or (BBSKey <> '');
3019 Index := AnsiPos('read.cgi?', URL);
3020 if Index <> 0 then begin
3021 SList := TStringList.Create;
3024 // s := HTMLDecode(Document);
3025 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3026 BBSID := SList.Values['bbs'];
3027 BBSKey := SList.Values['key'];
3028 Result := (BBSID <> '') or (BBSKey <> '');
3038 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3045 URL := Trim(LowerCase(URL));
3046 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3050 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3052 stRes := StrToInt64( buf );
3053 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3054 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3056 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3059 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3060 buf := Copy( buf, 1, ps );
3064 endRes := StrToInt64(buf)
3071 if (stRes <> 0) and (endRes = 0) then
3072 endRes := stRes + MAX_POPUP_RES
3073 else if (stRes = 0) and (endRes <> 0) then begin
3074 stRes := endRes - MAX_POPUP_RES;
3078 GikoSys.GetBrowsableThreadURL( URL );
3079 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3081 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3084 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3085 buf := Copy( buf, 1, ps );
3088 stRes := StrToInt(buf)
3095 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3097 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3098 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3099 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3101 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3104 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3105 buf := Copy( buf, 1, ps );
3109 endRes := StrToInt64(buf);
3116 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3117 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3118 if Length(buf) > 0 then begin
3119 if AnsiPos('-', buf) = 1 then begin
3124 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3126 convBuf := Copy( buf, 1, ps );
3127 if convBuf <> '' then
3128 endRes := StrToInt64(convBuf)
3134 if endRes <> 0 then begin
3135 stRes := endRes - MAX_POPUP_RES;
3142 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3144 convBuf := Copy( buf, 1, ps );
3145 if convBuf <> '' then begin
3146 stRes := StrToInt64(convBuf);
3150 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3152 convBuf := Copy( buf, 1, ps );
3153 if convBuf <> '' then
3154 endRes := StrToInt64(convBuf)
3175 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3180 // convBuf : String;
3191 URL := Trim(LowerCase(URL));
3196 Result.FFirst := False;
3197 Result.FStBegin := False;
3198 Result.FToEnd := False;
3199 Result.FDone := False;
3200 Result.FNoParam := False;
3204 if URL[length(URL)] = '\' then
3206 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3207 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3208 s := Copy(URL, RStart + RLength - 1, Length(URL));
3210 //
\95W
\8f\80\8f\91\8e®
3211 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3212 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3213 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3214 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3215 s := Copy(s, 15, Length(s));
3217 SList := TStringList.Create;
3220 FAWKStr.RegExp := '/';
3221 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3222 Result.FBBS := SList[1];
3223 Result.FKey := SList[2];
3224 if SList.Count >= 4 then
3228 Result.FNoParam := true;
3234 FAWKStr.LineSeparator := mcls_CRLF;
3235 FAWKStr.RegExp := '-';
3236 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3237 Result.FFirst := True;
3239 FAWKStr.RegExp := 'l[0-9]+';
3240 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3241 Result.FFirst := True;
3243 for i := 0 to SList.Count - 1 do begin
3244 if Trim(SList[i]) = '' then begin
3246 Result.FStBegin := True;
3247 if i = (SList.Count - 1) then
3248 Result.FToEnd := True;
3249 end else if IsNumeric(SList[i]) then begin
3250 wkInt := StrToInt(SList[i]);
3251 wkMax := Max(wkMax, wkInt);
3255 wkMin := Min(wkMin, wkInt);
3256 end else if Trim(SList[i]) = 'n' then begin
3257 Result.FFirst := True;
3259 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3260 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3261 if Copy(SList[i], 1, 1) = 'n' then
3262 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3264 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3265 Result.FFirst := True;
3266 wkMax := Max(wkMax, wkInt);
3270 wkMin := Min(wkMin, wkInt);
3274 if Result.FStBegin and (not Result.FToEnd) then
3276 else if (not Result.FStBegin) and Result.FToEnd then
3278 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3279 Result.FSt := wkMin;
3280 Result.FTo := wkMax;
3282 //Result.FSt := wkMin;
3283 //Result.FTo := wkMax;
3289 Result.FDone := True;
3293 //
\90Vkako
\8f\91\8e®
3294 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3295 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3296 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3297 SList := TStringList.Create;
3300 FAWKStr.RegExp := '/';
3301 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3302 Result.FBBS := SList[1];
3303 Result.FKey := ChangeFileExt(SList[5], '');
3304 Result.FFirst := True;
3310 Result.FDone := True;
3314 //
\8b\8ckako
\8f\91\8e®
3315 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3316 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3317 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3318 SList := TStringList.Create;
3321 FAWKStr.RegExp := '/';
3322 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3323 Result.FBBS := SList[1];
3324 Result.FKey := ChangeFileExt(SList[4], '');
3325 Result.FFirst := True;
3331 Result.FDone := True;
3335 //log
\8by
\82Ñlog2
\8f\91\8e®
3336 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3337 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3338 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3339 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3340 SList := TStringList.Create;
3343 FAWKStr.RegExp := '/';
3344 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3345 Result.FBBS := SList[2];
3346 Result.FKey := ChangeFileExt(SList[5], '');
3347 Result.FFirst := True;
3353 Result.FDone := True;
3358 //
\8b\8cURL
\8f\91\8e®
3359 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3360 FAWKStr.RegExp := '/test/read\.cgi\?';
3361 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3362 s := Copy(s, 16, Length(s));
3363 SList := TStringList.Create;
3366 FAWKStr.RegExp := '&';
3367 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3368 Result.FFirst := True;
3369 for i := 0 to SList.Count - 1 do begin
3370 if Pos('bbs=', SList[i]) = 1 then begin
3371 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3372 end else if Pos('key=', SList[i]) = 1 then begin
3373 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3374 end else if Pos('st=', SList[i]) = 1 then begin
3375 wk := Copy(SList[i], 4, Length(SList[i]));
3376 if IsNumeric(wk) then
3377 Result.FSt := StrToInt(wk)
3378 else if wk = '' then
3379 Result.FStBegin := True;
3380 end else if Pos('to=', SList[i]) = 1 then begin
3381 wk := Copy(SList[i], 4, Length(SList[i]));
3382 if IsNumeric(wk) then
3383 Result.FTo := StrToInt(wk)
3384 else if wk = '' then
3385 Result.FToEnd := True;
3386 end else if Pos('nofirst=', SList[i]) = 1 then begin
3387 Result.FFirst := False;
3396 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3397 Result.FDone := True;
3404 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3414 URI := TIdURI.Create(URL);
3416 Protocol := URI.Protocol;
3419 Document := URI.Document;
3421 Bookmark := URI.Bookmark;
3427 function TGikoSys.GetVersionBuild: Integer;
3429 FixedFileInfo: PVSFixedFileInfo;
3430 VersionHandle, VersionSize: DWORD;
3431 pVersionInfo: Pointer;
3436 AppFile := Application.ExeName;
3437 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3438 if VersionSize = 0 then
3440 GetMem(pVersionInfo, VersionSize);
3442 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3443 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3444 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3446 FreeMem(pVersionInfo, VersionSize);
3450 function TGikoSys.GetBrowsableThreadURL(
3454 threadItem : TThreadItem;
3455 boardPlugIn : TBoardPlugIn;
3459 //=====
\83v
\83\89\83O
\83C
\83\93
3461 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3462 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3463 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3464 boardPlugIn := BoardPlugIns[ i ];
3465 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3466 Result := threadItem.URL;
3474 // 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¢
3477 if Length( Result ) = 0 then
3478 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3482 function TGikoSys.GetThreadURL2BoardURL(
3486 threadItem : TThreadItem;
3487 boardPlugIn : TBoardPlugIn;
3491 //=====
\83v
\83\89\83O
\83C
\83\93
3493 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3494 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3495 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3496 boardPlugIn := BoardPlugIns[ i ];
3497 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3498 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3506 // 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¢
3509 if Length( Result ) = 0 then
3510 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3514 function TGikoSys.Get2chThreadURL2BoardURL(
3518 Protocol, Host, Path, Document, Port, Bookmark : string;
3519 BBSID, BBSKey : string;
3523 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3524 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3526 foundPos := Pos( '/test/read.cgi', inURL );
3527 if {(Is2chHost(Host)) and} (foundPos > 0) then
3528 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3530 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3534 function TGikoSys.Get2chBrowsableThreadURL(
3538 Protocol, Host, Path, Document, Port, Bookmark : string;
3539 BBSID, BBSKey : string;
3543 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3546 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3547 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3548 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3550 if Is2chHost( Host ) then begin
3551 Result := Protocol + '://' + Host +
3552 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3554 if foundPos > 0 then
3555 Result := Copy( inURL, 1, foundPos ) +
3556 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3558 Result := Protocol + '://' + Host +
3559 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3565 function TGikoSys.Get2chBoard2ThreadURL(
3573 server := UrlToServer( inBoard.URL );
3574 if Is2chHost( server ) then
3575 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3577 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3581 (*************************************************************************
3582 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3583 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3584 *************************************************************************)
3585 procedure TGikoSys.ListBoardFile;
3587 boardFileList : TStringList;
3592 for i := 0 to Length( BBSs ) - 1 do
3596 SetLength( BBSs, 0 );
3599 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3600 if FileExists( GikoSys.GetBoardFileName ) then begin
3601 SetLength( BBSs, l + 1 );
3602 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3603 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3607 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3608 SetLength( BBSs, l + 1 );
3609 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3610 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3614 // Board
\83t
\83H
\83\8b\83_
3615 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3616 BoardFileList := TStringList.Create;
3618 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3619 for k := BoardFileList.Count - 1 downto 0 do begin
3620 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3621 BoardFileList.Delete(k);
3623 SetLength( BBSs, l + BoardFileList.Count );
3624 for i := BoardFileList.Count - 1 downto 0 do begin
3625 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3626 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3635 (*************************************************************************
3636 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3637 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3638 *************************************************************************)
3639 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3644 boardFile : TStringList;
3645 CategoryList : TStringList;
3646 BoardList : TStringList;
3647 Category : TCategory;
3650 RoundItem : TRoundItem;
3652 i, iBound : Integer;
3653 j, jBound : Integer;
3654 k, kBound : Integer;
3657 if not FileExists( bbs.FilePath ) then
3660 ini := TMemIniFile.Create('');
3661 boardFile := TStringList.Create;
3663 boardFile.LoadFromFile( bbs.FilePath );
3665 ini.SetStrings( boardFile );
3666 CategoryList := TStringList.Create;
3667 BoardList := TStringList.Create;
3669 ini.ReadSections( CategoryList );
3671 iBound := CategoryList.Count - 1;
3672 for i := 0 to iBound do begin
3673 ini.ReadSection( CategoryList[i], BoardList );
3674 Category := TCategory.Create;
3675 Category.No := i + 1;
3676 Category.Title := CategoryList[i];
3678 jBound := BoardList.Count - 1;
3679 for j := 0 to jBound do begin
3681 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3682 p := FBoardURLList.IndexOf(inistr);
3683 if p = -1 then begin
3684 //=====
\83v
\83\89\83O
\83C
\83\93
3686 kBound := Length( BoardPlugIns ) - 1;
3687 for k := 0 to kBound do begin
3688 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3689 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3690 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3697 // 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¢
3701 Board := TBoard.Create( nil, inistr );
3704 Board.Title := BoardList[j];
3705 Board.RoundDate := ZERO_DATE;
3707 idx := RoundList.Find(Board);
3708 if idx <> -1 then begin
3709 RoundItem := RoundList.Items[idx, grtBoard];
3710 Board.Round := True;
3711 Board.RoundName := RoundItem.RoundName;
3713 Board.Multiplicity := 0;
3714 Category.Add(Board);
3717 FBoardURLList.AddObject(inistr, Board);
3719 Board := TBoard(FBoardURLList.Objects[p]);
3720 Board.Multiplicity := Board.Multiplicity + 1;
3721 Category.Add(Board);
3725 bbs.Add( Category );
3727 bbs.IsBoardFileRead := True;
3739 function TGikoSys.GetUnknownCategory : TCategory;
3741 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3744 if Length( BBSs ) < 2 then begin
3749 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3750 if Result = nil then begin
3751 Result := TCategory.Create;
3752 Result.Title := UNKNOWN_CATEGORY;
3753 BBSs[ 1 ].Add( Result );
3758 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3760 category : TCategory;
3762 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3765 category := GetUnknownCategory;
3766 if category = nil then begin
3769 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3770 if Result = nil then begin
3771 Result := TBoard.Create( inPlugIn, inURL );
3772 Result.Title := UNKNOWN_BOARD;
3773 category.Add( Result );
3778 function TGikoSys.GetSambaFileName : string;
3780 Result := Setting.GetSambaFileName;
3782 procedure TGikoSys.SambaFileExists();
3785 sambaStrList: TStringList;
3787 if not FileExists(GikoSys.GetSambaFileName) then begin
3788 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3789 sambaStrList := TStringList.Create;
3791 if FileExists(sambaTmp) then begin
3792 sambaStrList.LoadFromFile(sambaTmp);
3793 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3800 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string;
3806 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3807 body := TStringList.Create;
3809 GetSameIDRes(AID, ThreadItem, body);
3810 if (limited) and (body.Count > 20) then begin
3811 for i := body.Count - 20 to body.Count - 1 do begin
3812 Result := Result + '>' + body[i] + ' ';
3815 for i := 0 to body.Count - 1 do begin
3816 Result := Result + '>' + body[i] + ' ';
3822 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3825 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
3828 ReadList: TStringList;
3830 boardPlugIn : TBoardPlugIn;
3832 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3833 if ThreadItem.IsBoardPlugInAvailable then begin
3834 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3835 boardPlugIn := ThreadItem.BoardPlugIn;
3837 for i := 0 to threadItem.Count - 1 do begin
3839 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3840 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3841 body.Add(IntToStr(i+1));
3845 ReadList := TStringList.Create;
3847 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3848 for i := 0 to ReadList.Count - 1 do begin
3849 Res := DivideStrLine(ReadList[i]);
3850 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3851 body.Add(IntToStr(i+1));
3860 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string;
3866 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3867 body := TStringList.Create;
3869 GetSameIDRes(AIDNum, ThreadItem, body);
3870 if (limited) and (body.Count > 20) then begin
3871 for i := body.Count - 20 to body.Count - 1 do begin
3872 Result := Result + '>' + body[i] + ' ';
3875 for i := 0 to body.Count - 1 do begin
3876 Result := Result + '>' + body[i] + ' ';
3882 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3886 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
3889 boardPlugIn : TBoardPlugIn;
3891 stList: TStringList;
3894 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
3895 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
3896 if ThreadItem.IsBoardPlugInAvailable then begin
3897 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3898 boardPlugIn := ThreadItem.BoardPlugIn;
3899 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
3901 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
3903 AID := Res.FDateTime;
3904 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then
3905 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11)
3907 stlist := TStringList.Create;
3909 stList.DelimitedText := AID;
3910 for i := 0 to stList.Count - 1 do
3911 if Length(WideString(stList[i])) = 8 then begin
3912 if NotDateorTimeString(stList[i]) then begin
3922 GetSameIDRes(AID, ThreadItem, body);
3925 function TGikoSys.GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer;
3930 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3931 body := TStringList.Create;
3933 GetSameIDRes(AID, ThreadItem, body);
3934 Result := body.Count;
3941 function TGikoSys.GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer;
3947 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3948 body := TStringList.Create;
3950 GetSameIDRes(AIDNum, ThreadItem, body);
3951 Result := body.Count;
3958 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
3974 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
3977 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3978 Bayesian.CountWord( text, wordCount );
3982 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
3985 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3986 Bayesian.Forget( wordCount, isSpam );
3990 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
3993 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3994 Bayesian.Learn( wordCount, isSpam );
3998 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
4001 case Setting.SpamFilterAlgorithm of
4002 gsfaNone: Result := 0;
4003 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
4004 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
4005 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
4010 function TGikoSys.SetUserOptionalStyle(): string;
4013 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
4014 Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
4015 if GikoSys.Setting.BrowserFontSize <> 0 then
4016 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
4017 if GikoSys.Setting.BrowserFontColor <> -1 then
4018 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
4019 if GikoSys.Setting.BrowserBackColor <> -1 then
4020 Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
4021 case GikoSys.Setting.BrowserFontBold of
4022 -1: Result := Result + 'font-weight:normal;';
4023 1: Result := Result + 'font-weight:bold;';
4025 case GikoSys.Setting.BrowserFontItalic of
4026 -1: Result := Result + 'font-style:normal;';
4027 1: Result := Result + 'font-style:italic;';
4032 GikoSys := TGikoSys.Create;
4035 if GikoSys <> nil then begin