OSDN Git Service

・何を寝ぼけてたのかスタイルの色が 4 桁になっていたので修正。
[gikonavigoeson/gikonavi.git] / GikoSystem.pas
index 02ca437..317da99 100644 (file)
@@ -77,7 +77,7 @@ type
                FSt: Integer;                           //\8aJ\8en\83\8c\83X\94Ô
                FTo: Integer;                           //\8fI\97¹\83\8c\83X\94Ô
                FFirst: Boolean;                //>>1\82Ì\95\\8e¦
-               FStBegin: Boolean;  //1\81`\95\\8e¦
+               FStBegin: Boolean;      //1\81`\95\\8e¦
                FToEnd: Boolean;                //\81`\8dÅ\8cã\82Ü\82Å\95\\8e¦
                FDone: Boolean;                 //\90¬\8c÷
        end;
@@ -93,8 +93,8 @@ type
 
        public
                { Public \90é\8c¾ }
-        FAbon : TAbon;
-        FSelectResFilter : TAbon;
+               FAbon : TAbon;
+               FSelectResFilter : TAbon;
                constructor Create;
 
                destructor Destroy; override;
@@ -115,6 +115,7 @@ type
                function GetTempFolder: string;
                function GetSentFileName: string;
                function GetConfigDir: string;
+               function GetSkinDir: string;
                function GetStyleSheetDir: string;
                function GetOutBoxFileName: string;
                function GetURL(BBSID: string; FileName: string): string;
@@ -125,6 +126,7 @@ type
                procedure WriteThreadDat(Board: TBoard);
                function ParseIndexLine(Line: string): TIndexRec;
                procedure GetFileList(Path: string; Mask: string; List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
+               procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
 
                procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
                function AddAnchorTag(s: string): string;
@@ -180,12 +182,12 @@ type
 var
        GikoSys: TGikoSys;
 const
-       LENGTH_RESTITLE     = 40;
-       ZERO_DATE: Integer  = 25569;
+       LENGTH_RESTITLE                 = 40;
+       ZERO_DATE: Integer      = 25569;
        BETA_VERSION_NAME_E = 'beta';
        BETA_VERSION_NAME_J = 'ÊÞÀ';
-       BETA_VERSION        = 39;
-       BETA_VERSION_BUILD  = '';                               //debug\94Å\82È\82Ç
+       BETA_VERSION                            = 41;
+       BETA_VERSION_BUILD      = '';                           //debug\94Å\82È\82Ç
 
 implementation
 
@@ -193,19 +195,26 @@ uses
        Giko, RoundData;
 
 const
-       BOARD_FILE_NAME               = 'board.2ch';
-       CUSTOMBOARD_FILE_NAME         = 'custom.2ch';
-       KEY_SETTING_FILE_NAME         = 'key.ini';
-       TEMP_FOLDER                   = 'Temp';
-       OUTBOX_FILE_NAME              = 'outbox.ini';
-       SENT_FILE_NAME                = 'sent.ini';
-       CONFIG_DIR_NAME               = 'config';
+       BOARD_FILE_NAME                                                         = 'board.2ch';
+       CUSTOMBOARD_FILE_NAME                                   = 'custom.2ch';
+       KEY_SETTING_FILE_NAME                                   = 'key.ini';
+       TEMP_FOLDER                                                                             = 'Temp';
+       OUTBOX_FILE_NAME                                                        = 'outbox.ini';
+       SENT_FILE_NAME                                                          = 'sent.ini';
+       CONFIG_DIR_NAME                                                         = 'config';
        CSS_DIR_NAME                                                                    = 'css';
-       FOLDER_INDEX_VERSION          = '1.01';
-       USER_AGENT                    = 'Monazilla';
-       APP_NAME                      = 'gikoNavi';
-               DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
-        NGWORDs_DIR_NAME : String = 'NGwords';
+       SKIN_DIR_NAME                                                                   = 'skin';
+       SKIN_HEADER_FILE_NAME                                   = 'Header.html';
+       SKIN_FOOTER_FILE_NAME                                   = 'Footer.html';
+       SKIN_NEWRES_FILE_NAME                                   = 'NewRes.html';
+       SKIN_RES_FILE_NAME                                              = 'Res.html';
+       SKIN_BOOKMARK_FILE_NAME                         = 'Bookmark.html';
+       SKIN_NEWMARK_FILE_NAME                          = 'Newmark.html';
+       FOLDER_INDEX_VERSION                                    = '1.01';
+       USER_AGENT                                                                              = 'Monazilla';
+       APP_NAME                                                                                        = 'gikoNavi';
+       DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
+       NGWORDs_DIR_NAME : String               = 'NGwords';
 
 (*************************************************************************
  *GikoSys\83R\83\93\83X\83g\83\89\83N\83^
@@ -215,14 +224,14 @@ begin
        FSetting := TSetting.Create;
        FDolib := TDolib.Create;
        FAWKStr := TAWKStr.Create(nil);
-    if DirectoryExists(GetConfigDir) = false then begin
-       CreateDir(GetConfigDir);
-    end;
+       if DirectoryExists(GetConfigDir) = false then begin
+               CreateDir(GetConfigDir);
+       end;
        FAbon := TAbon.Create;
        FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
-    //FAbon.SetNGwordpath(DEFAULT_NGWORD_FILE_NAME);
-    FAbon.GoHome;
-    FSelectResFilter := TAbon.Create;
+       //FAbon.SetNGwordpath(DEFAULT_NGWORD_FILE_NAME);
+       FAbon.GoHome;
+       FSelectResFilter := TAbon.Create;
        // \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
        FSelectResFilter.AbonString := '';
 end;
@@ -350,6 +359,11 @@ begin
        Result := IncludeTrailingPathDelimiter(GetConfigDir + CSS_DIR_NAME);
 end;
 
+function TGikoSys.GetSkinDir: string;
+begin
+       Result := IncludeTrailingPathDelimiter(GetConfigDir + SKIN_DIR_NAME);
+end;
+
 (*************************************************************************
  *URL\82ð\8dì\90¬(\83R\83s\83y\97p)
  *************************************************************************)
@@ -622,7 +636,7 @@ begin
                                         + Format('%x', [0]) + #1                                               //LastModified
                                         + Format('%x', [0]) + #1                                               //Kokomade
                                         + Format('%x', [0]) + #1                                               //NewReceive
-                                        + '0' + #1                                                             //\96¢\8eg\97p
+                                        + '0' + #1                                                                                             //\96¢\8eg\97p
                                         + Format('%x', [0]) + #1                                               //UnRead
                                         + Format('%x', [0]) + #1                                               //ScrollTop
                                         + Format('%x', [Rec.FCount]) + #1      //AllResCount
@@ -761,11 +775,39 @@ begin
        end;
 end;
 
+//\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é
+procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
+var
+       rc: Integer;
+       SearchRec : TSearchRec;
+       s: string;
+begin
+       Path := IncludeTrailingPathDelimiter(Path);
+       rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
+       try
+               while rc = 0 do begin
+                       if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
+                               s := Path + SearchRec.Name;
+                               //if (SearchRec.Attr and faDirectory > 0) then
+                               //      s := IncludeTrailingPathDelimiter(s)
+
+                               if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
+                                       List.Add( IncludeTrailingPathDelimiter( s ) );
+                               if SubDir and (SearchRec.Attr and faDirectory > 0) then
+                                       GetDirectoryList(s, Mask, List, True);
+                       end;
+                       rc := FindNext(SearchRec);
+               end;
+       finally
+               SysUtils.FindClose(SearchRec);
+       end;
+end;
+
 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
 var
        i: integer;
        No: string;
-    //bufList : TStringList;
+               //bufList : TStringList;
        ReadList: TStringList;
        SaveList: TStringList;
        CSSFileName: string;
@@ -773,6 +815,95 @@ var
        FileName: string;
        NewReceiveNo: Integer;
        Res: TResRec;
+
+  UserOptionalStyle: string;
+       SkinHeaderFileName: string;
+       SkinNewResFileName: string;
+       SkinResFileName: string;
+       SkinFooterFileName: string;
+       SkinBookmarkFileName: string;
+  SkinNewmarkFileName: string;
+  SkinHeader: string;
+       SkinNewRes: string;
+       SkinRes: string;
+       SizeByte: Integer;
+
+  // \83X\83L\83\93\82ð\93Ç\82Ý\8d\9e\82Ý\81A\92l\82ð\92u\8a·\82·\82é
+  function LoadSkin( fileName: string ): string;
+  var
+    Skin: TStringList;
+  begin
+
+    Skin := TStringList.Create;
+    try
+      Skin.LoadFromFile( fileName );
+
+      Skin.Text := StringReplace( Skin.Text, '<THREADNAME/>', sTitle, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<THREADURL/>', ThreadItem.GetSendURL, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<SKINPATH/>', Setting.CSSFileName, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<GETRESCOUNT/>', IntToStr( NewReceiveNo - 1 ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<ALLRESCOUNT/>', IntToStr( ThreadItem.AllResCount ), [rfReplaceAll] );
+
+      Skin.Text := StringReplace( Skin.Text, '<NEWDATE/>',
+        FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '<SIZE/>', IntToStr( SizeByte ), [rfReplaceAll] );
+
+      //----- \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µ
+      Skin.Text := StringReplace( Skin.Text, '&THREADNAME', sTitle, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&THREADURL', ThreadItem.GetSendURL, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&SKINPATH', Setting.CSSFileName, [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&GETRESCOUNT', IntToStr( NewReceiveNo - 1 ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ), [rfReplaceAll] );
+
+      Skin.Text := StringReplace( Skin.Text, '&NEWDATE',
+        FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ), [rfReplaceAll] );
+      Skin.Text := StringReplace( Skin.Text, '&SIZE', IntToStr( SizeByte ), [rfReplaceAll] );
+      //----- \82±\82±\82Ü\82Å
+
+      Result := Skin.Text;
+    finally
+      Skin.Free;
+    end;
+
+  end;
+
+  // \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
+  function ReplaceRes( skin: string ): string;
+  begin
+
+    try
+      Skin := StringReplace( Skin, '<NUMBER/>',
+       '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<PLAINNUMBER/>', No, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<MAILNAME/>',
+       '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<MAIL/>', Res.FMailTo, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<DATE/>', Res.FDateTime, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '<MESSAGE/>', Res.FBody, [rfReplaceAll] );
+
+      //----- \82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
+      Skin := StringReplace( Skin, '&NUMBER',
+       '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&PLAINNUMBER', No, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&MAILNAME',
+       '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>', [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&MAIL', Res.FMailTo, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&DATE', Res.FDateTime, [rfReplaceAll] );
+      Skin := StringReplace( Skin, '&MESSAGE', Res.FBody, [rfReplaceAll] );
+      //----- \82±\82±\82Ü\82Å
+
+      Result := Skin;
+    finally
+    end;
+
+  end;
+
 begin
        ShortDayNames[1] := '\93ú';               ShortDayNames[2] := '\8c\8e';
        ShortDayNames[3] := '\89Î';               ShortDayNames[4] := '\90\85';
@@ -783,15 +914,15 @@ begin
        NewReceiveNo := ThreadItem.NewReceive;
        FileName := ThreadItem.GetThreadFileName;
        ReadList := TStringList.Create;
-    FAbon.Deleterlo := FSetting.AbonDeleterlo;
-    FAbon.Replaceul := FSetting.AbonReplaceul;
-    FAbon.AbonPopupRes := FSetting.PopUpAbon;
+       FAbon.Deleterlo := FSetting.AbonDeleterlo;
+       FAbon.Replaceul := FSetting.AbonReplaceul;
+       FAbon.AbonPopupRes := FSetting.PopUpAbon;
        try
                if ThreadItem.IsLogFile then begin
-            ReadList.LoadFromFile(FileName);
-            FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
-            FAbon.Execute(ReadList);    //   \82 \82Ú\81`\82ñ\82µ\82Ä
-            FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
+                       ReadList.LoadFromFile(FileName);
+                       FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
+                       FAbon.Execute(ReadList);                //       \82 \82Ú\81`\82ñ\82µ\82Ä
+                       FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
                        Res := DivideStrLine(ReadList[0]);
                        Res.FTitle := StringReplace(Res.FTitle, '\81\97\81M', ',', [rfReplaceAll]);
                        sTitle := Res.FTitle;
@@ -804,15 +935,147 @@ begin
                        doc.open;
                        doc.charset := 'Shift_JIS';
 
+      // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
+      if Length( GikoSys.Setting.BrowserFontName ) > 0 then
+        UserOptionalStyle := UserOptionalStyle +
+          'font-family:' + GikoSys.Setting.BrowserFontName + ';';
+      if GikoSys.Setting.BrowserFontSize <> 0 then
+        UserOptionalStyle := UserOptionalStyle +
+          'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
+      if GikoSys.Setting.BrowserFontColor <> -1 then
+        UserOptionalStyle := UserOptionalStyle +
+          'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
+      if GikoSys.Setting.BrowserBackColor <> -1 then
+        UserOptionalStyle := UserOptionalStyle +
+          'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
+                       case GikoSys.Setting.BrowserFontBold of
+      -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
+      1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
+      end;
+                       case GikoSys.Setting.BrowserFontItalic of
+      -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
+      1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
+      end;
+
                        CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
-                       if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
+                       SkinHeaderFileName := Setting.CSSFileName + SKIN_HEADER_FILE_NAME;
+                       SkinNewResFileName := Setting.CSSFileName + SKIN_NEWRES_FILE_NAME;
+                       SkinResFileName := Setting.CSSFileName + SKIN_RES_FILE_NAME;
+                       SkinFooterFileName := Setting.CSSFileName + SKIN_FOOTER_FILE_NAME;
+                       SkinBookmarkFileName := Setting.CSSFileName + SKIN_BOOKMARK_FILE_NAME;
+      SkinNewmarkFileName := Setting.CSSFileName + SKIN_NEWMARK_FILE_NAME;
+                       if GikoSys.Setting.UseCSS and
+                               (Pos(GetSkinDir, Setting.CSSFileName) > 0) and
+                               FileExists( SkinHeaderFileName ) then begin
+                               // \83X\83L\83\93\8eg\97p
+
+                               // \83X\83L\83\93\82Ì\90Ý\92è
+        try
+               SkinHeader := LoadSkin( SkinHeaderFileName );
+          if Length( UserOptionalStyle ) > 0 then
+            SkinHeader := StringReplace( SkinHeader, '</head>',
+              '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
+          SaveList.Add( SkinHeader );
+        except
+        end;
+        try
+          SkinNewRes := LoadSkin( SkinNewResFileName );
+        except
+        end;
+        try
+          SkinRes := LoadSkin( SkinResFileName );
+        except
+        end;
+
+                               SaveList.Add('<a name="top"></a>');
+
+                               for i := 0 to ReadList.Count - 1 do begin
+                                       if (Trim(ReadList[i]) <> '') then begin
+                                               No := IntToStr(i + 1);
+
+                                               Res := DivideStrLine(ReadList[i]);
+                                               Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
+
+                                               if Res.FType = glt2chOld then begin
+                                                       Res.FMailTo := StringReplace(Res.FMailTo, '\81\97\81M', ',', [rfReplaceAll]);
+                                                       Res.FName := StringReplace(Res.FName, '\81\97\81M', ',', [rfReplaceAll]);
+                                                       Res.FBody := StringReplace(Res.FBody, '\81\97\81M', ',', [rfReplaceAll]);
+                                               end;
+
+                                               Res.FBody := AddAnchorTag(Res.FBody);
+                                               if Res.FName = '' then
+                                                       Res.FName := '&nbsp;';
+
+            // \90V\92\85\83}\81[\83N
+            if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
+               try
+               SaveList.Add( LoadSkin( SkinNewmarkFileName ) );
+              except
+               SaveList.Add( '<a name="new"></a>' );
+              end;
+            end;
+
+            try
+              if NewReceiveNo <= (i + 1) then
+                // \90V\92\85\83\8c\83X
+                SaveList.Add( ReplaceRes( SkinNewRes ) )
+              else
+                // \92Ê\8fí\82Ì\83\8c\83X
+                SaveList.Add( ReplaceRes( SkinRes ) );
+            except
+            end;
+
+                                               if ThreadItem.Kokomade = (i + 1) then begin
+              // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
+               try
+               SaveList.Add( LoadSkin( SkinBookmarkFileName ) );
+              except
+               SaveList.Add( '<a name="koko"></a>' );
+              end;
+            end;
+                                       end;
+
+                                       //if SaveList.Count > 50 then begin
+                                       if i = 20 then begin
+                                               //Sleep(1);
+                                               //Application.ProcessMessages;
+
+                                               doc.Write(SaveList.Text);
+                                               //while GikoForm.Browser.Busy do begin
+                                               //      Sleep(1);
+                                               //      Application.ProcessMessages;
+                                               //end;
+                                               while (GikoForm.Browser.ReadyState <> READYSTATE_COMPLETE) and
+                                                                       (GikoForm.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
+                                                       //Sleep(1);
+                                                       //Application.ProcessMessages;
+                                               end;
+                                               SaveList.Clear;
+                                       end;
+                               end;
+
+                               SaveList.Add('<a name="bottom"></a>');
+
+                               SizeByte := Length( SaveList.Text );
+
+                               // \83X\83L\83\93(\83t\83b\83^)
+        try
+               SaveList.Add( LoadSkin( SkinFooterFileName ) );
+        except
+        end;
+
+                               doc.Write(SaveList.Text);
+
+                       end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
                                //CSS\8eg\97p
                                //CSSFileName := GetAppDir + CSS_FILE_NAME;
 //                             SaveList.Add('<html lang="ja"><head>');
                                SaveList.Add('<html><head>');
                                SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
                                SaveList.Add('<title>' + sTitle + '</title>');
-                SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
+                               SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
+        if Length( UserOptionalStyle ) > 0 then
+                                       SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
                                SaveList.Add('</head>');
                                SaveList.Add('<body>');
                                SaveList.Add('<a name="top"></a>');
@@ -843,7 +1106,7 @@ begin
                                                        Res.FName := '&nbsp;';
                                                if Res.FMailTo = '' then
                                                        SaveList.Add('<a name="' + No + '"></a>'
-                                                                                                + '<div class="header"><span class="no"><a href="giko://?no=' + No + '">' + No + '</a></span> '
+                                                                                                + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
                                                                                                 + '<span class="name_label">\96¼\91O\81F</span> '
                                                                                                 + '<span class="name"><b>' + Res.FName + '</b></span> '
                                                                                                 + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
@@ -852,19 +1115,19 @@ begin
                                                else
                                                        if GikoSys.Setting.ShowMail then
                                                                SaveList.Add('<a name="' + No + '"></a>'
-                                                                                                        + '<div class="header"><span class="no"><a href="giko://?no=' + No + '">' + No + '</a></span>'
+                                                                                                        + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
                                                                                                         + '<span class="name_label"> \96¼\91O\81F </span>'
                                                                                                         + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
-                                                                                                        + '<b>' + Res.FName + '</a></b><span class="mail"> [' + Res.FMailTo + ']</span>'
+                                                                                                        + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
                                                                                                         + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
                                                                                                         + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
                                                                                                         + '<div class="mes">' + Res.FBody + ' </div>')
                                                        else
                                                                SaveList.Add('<a name="' + No + '"></a>'
-                                                                                                        + '<div class="header"><span class="no"><a href="giko://?no=' + No + '">' + No + '</a></span>'
+                                                                                                        + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
                                                                                                         + '<span class="name_label"> \96¼\91O\81F </span>'
                                                                                                         + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
-                                                                                                        + '<b>' + Res.FName + '</a></b>'
+                                                                                                        + '<b>' + Res.FName + '</b></a>'
                                                                                                         + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
                                                                                                         + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
                                                                                                         + '<div class="mes">' + Res.FBody + ' </div>');
@@ -892,9 +1155,9 @@ begin
                                end;
                                SaveList.Add('<a name="bottom"></a>');
                                SaveList.Add('</body></html>');
-                               SaveList.Add('</dl>');
                                SaveList.Add('<a name="last"></a>');
                                SaveList.Add('</body></html>');
+
                                doc.Write(SaveList.Text);
                        end else begin
                                //CSS\94ñ\8eg\97p
@@ -932,12 +1195,12 @@ begin
                                                //Res.FBody := StringReplace(Res.FBody, '&amp', '&amp;', [rfReplaceAll]);
                                                Res.FBody := AddAnchorTag(Res.FBody);
                                                if Res.FMailTo = '' then
-                                                       SaveList.Add('<a name="' + No + '"></a><dt><a href="giko://?no=' + 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>')
+                                                       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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
                                                else
                                                        if GikoSys.Setting.ShowMail then
-                                                               SaveList.Add('<a name="' + No + '"></a><dt><a href="giko://?no=' + 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>')
+                                                               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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
                                                        else
-                                                               SaveList.Add('<a name="' + No + '"></a><dt><a href="giko://?no=' + 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>');
+                                                               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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
                                                if ThreadItem.Kokomade = (i + 1) then begin
                                                        SaveList.Add('</dl>');
                                                        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>');
@@ -1090,7 +1353,7 @@ end;
 function TGikoSys.DivideStrLine(Line: string): TResRec;
 var
        Delim: string;
-    bufbody : String;
+               bufbody : String;
 begin
        if Pos('<>', Line) = 0 then begin
                Delim := ',';
@@ -1102,11 +1365,11 @@ begin
        Result.FName := Trim(GetTokenIndex(Line, Delim, 0));
        Result.FMailTo := Trim(GetTokenIndex(Line, Delim, 1));
        Result.FDateTime := Trim(GetTokenIndex(Line, Delim, 2));
-    bufBody := Trim(GetTokenIndex(Line, Delim, 3));
-    if bufbody = '' then begin
-        Insert('&nbsp;',bufbody, 1);
-    end;
-    Result.FBody := bufBody;
+       bufBody := Trim(GetTokenIndex(Line, Delim, 3));
+       if bufbody = '' then begin
+               Insert('&nbsp;',bufbody, 1);
+       end;
+       Result.FBody := bufBody;
        Result.FTitle := Trim(GetTokenIndex(Line, Delim, 4));
 
 end;
@@ -1253,12 +1516,12 @@ var
 begin
        sl := TStringList.Create;
        try
-        try
+               try
                        sl.LoadFromFile(FileName);
                        Result := sl.Count;
-        except
-               Result := 0;
-        end;
+               except
+                       Result := 0;
+               end;
        finally
                sl.Free;
        end;
@@ -1405,7 +1668,7 @@ const
                 '\81g','\81h','\81k','\81l','\81e','\81f','\81\83','\81\84','\81á','\81â',
                 '\81o','\81p','\81q','\81r','\81w','\81x','\81¬','\81c', '\81@');
 var
-       Chr : array [0..255]  of  char;
+       Chr : array [0..255]    of      char;
        S : string;
        i : integer;
 begin
@@ -1414,7 +1677,7 @@ begin
                Result := s;
        end else begin
                S := s;
-               for i := Low(ERASECHAR)  to  High(ERASECHAR) do  begin
+               for i := Low(ERASECHAR) to      High(ERASECHAR) do      begin
                        S := StringReplace(S, ERASECHAR[i], '', [rfReplaceAll]);
                end;
                if (Length(S) <= ALength) then begin
@@ -1451,14 +1714,14 @@ function TGikoSys.ConvRes(const Body, Bbs, Key,
 type
        PIndex = ^TIndex;
        TIndex = record
-               FIndexFrom  : integer;
-               FIndexTo    : integer;
-               FNo         : string;
+               FIndexFrom      : integer;
+               FIndexTo                : integer;
+               FNo                              : string;
        end;
 const
-       GT  = '&gt;';
-       SN  = '0123456789-';
-       ZN  = '\82O\82P\82Q\82R\82S\82T\82U\82V\82W\82X\81|';
+       GT      = '&gt;';
+       SN      = '0123456789-';
+       ZN      = '\82O\82P\82Q\82R\82S\82T\82U\82V\82W\82X\81|';
 var
        i : integer;
        s,r : string;
@@ -1468,7 +1731,7 @@ var
        No: string;
        sx: string;
        List: TList;
-       oc  : string;
+       oc      : string;
        st, et: string;
        chk : boolean;
        al : boolean;
@@ -1477,9 +1740,9 @@ var
                FIndex : PIndex;
        begin
                New(FIndex);
-               FIndex.FIndexFrom  := IndexFrom;
-               FIndex.FIndexTo    := IndexTo;
-               FIndex.FNo         := No;
+               FIndex.FIndexFrom       := IndexFrom;
+               FIndex.FIndexTo         := IndexTo;
+               FIndex.FNo                               := No;
                List.Add(FIndex);
        end;
        function ChooseString(const Text, Separator: string; Index: integer): string;
@@ -1487,140 +1750,140 @@ var
                S : string;
                i, p : integer;
        begin
-               S :=  Text;
-               for i :=  0 to  Index - 1 do  begin
-                       if  (AnsiPos(Separator, S) = 0) then  S :=  ''
-                       else  S :=  Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
+               S :=    Text;
+               for i :=        0 to    Index - 1 do    begin
+                       if      (AnsiPos(Separator, S) = 0) then        S :=    ''
+                       else    S :=    Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
                end;
-               p :=  AnsiPos(Separator, S);
-               if  (p > 0) then  Result  :=  Copy(S, 1, p - 1) else Result :=  S;
+               p :=    AnsiPos(Separator, S);
+               if      (p > 0) then    Result  :=      Copy(S, 1, p - 1) else Result :=        S;
        end;
 begin
        { v1.0 b2 - 03 }
-       s   :=  Body;
-       r   :=  Body;
-       i   :=  1;
-       sw  :=  False;
-       No  :=  '';
-       List:=  TList.Create;
-       oc  :=  '';
-       sp  :=  0;
-       chk :=  False;
-       al  :=  False;
-       while true  do  begin
-               b :=  ByteType(s, i);
-               case  b of
-                       mbSingleByte  : begin
-                               if  (not sw) and (Copy(s,i,8) = GT + GT) then  begin
-                                       if  (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then  begin
-                                               sw  :=  True;
-                                               sp  :=  i;
-                                               i :=  i + 7;
+       s        :=     Body;
+       r        :=     Body;
+       i        :=     1;
+       sw      :=      False;
+       No      :=      '';
+       List:=  TList.Create;
+       oc      :=      '';
+       sp      :=      0;
+       chk :=  False;
+       al      :=      False;
+       while true      do      begin
+               b :=    ByteType(s, i);
+               case    b of
+                       mbSingleByte    : begin
+                               if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
+                                       if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin
+                                               sw      :=      True;
+                                               sp      :=      i;
+                                               i :=    i + 7;
                                                oc:='';
-                                               chk :=  True;
+                                               chk :=  True;
                                        end;
                                end else
-                               if  (not sw) and (Copy(s,i,8) = GT + GT) then  begin
-                                       if  (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then  begin
-                                               i :=  i + 7;
+                               if      (not sw) and (Copy(s,i,8) = GT + GT) then       begin
+                                       if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then        begin
+                                               i :=    i + 7;
                                                oc:='';
-                                               chk :=  True;
+                                               chk :=  True;
                                        end;
                                end else
-                               if  (not sw) and (Copy(s,i,4) = GT) then  begin
-                                       if  (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then  begin
-            sw  :=  True;
-                                               sp  :=  i;
-                                               i :=  i + 3;
+                               if      (not sw) and (Copy(s,i,4) = GT) then    begin
+                                       if      (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then        begin
+                                               sw      :=      True;
+                                               sp      :=      i;
+                                               i :=    i + 3;
                                                oc:='';
-            chk :=  True;
+                                               chk :=  True;
                                        end;
-        end else
-        if  ((not sw) and (Copy(s,i,1) = ',')) or
-                                               ((not sw) and (Copy(s,i,1) = '=')) then  begin
-          if  ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
-              ((Chk) and  (oc = '')) or
-              ((not Chk) and (al)) then
+                               end else
+                               if      ((not sw) and (Copy(s,i,1) = ',')) or
+                                               ((not sw) and (Copy(s,i,1) = '=')) then begin
+                                       if      ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
+                                                       ((Chk) and      (oc = '')) or
+                                                       ((not Chk) and (al)) then
                                        begin
-                                               sw  :=  True;
-            sp  :=  i;
-                                               //i :=  i + 1;
-            oc:='';
-          end;
-        end else
-        if  (sw) then begin
-          sx  :=  Copy(s,i,1);
-          if  (AnsiPos(sx, SN) > 0)  then  begin
-            No  :=  No  + sx;
-          end else begin
-                                               if  (No <> '') and (No <> '-')   then  begin
+                                               sw      :=      True;
+                                               sp      :=      i;
+                                               //i :=  i + 1;
+                                               oc:='';
+                                       end;
+                               end else
+                               if      (sw) then begin
+                                       sx      :=      Copy(s,i,1);
+                                       if      (AnsiPos(sx, SN) > 0)   then    begin
+                                               No      :=      No      + sx;
+                                       end else begin
+                                               if      (No <> '') and (No <> '-')       then   begin
                                                        Add(sp, i, No);
-              al := True;
+                                                       al := True;
                                                end;
-            sw  :=  False;
-            //
+                                               sw      :=      False;
+                                               //
                                                i := i - 1;
                                                //
-            No  := '';
-            oc:='';
-            //chk :=  False;
-          end;
-        end else begin
-          if  Copy(s,i,1) = '<' then  oc  :=  '';
-          oc  :=  oc + Copy(s,i,1);
-                                       chk :=  False;
-          al  :=  False;
-        end;
-      end;
-                       mbLeadByte  : begin
-                               if  (not sw) and (Copy(s,i,4) = '\81\84\81\84') then  begin
-                                       sw  :=  True;
-          sp  :=  i;
-                                       i :=  i + 3;
-                                       chk :=  True;
-        end else
-        if  (not sw) and (Copy(s,i,2) = '\81\84') then  begin
-          sw  :=  True;
-          sp  :=  i;
-                                       i :=  i + 1;
-          chk :=  True;
-        end else
-                               if  (sw) then begin
-          sx  :=  Copy(s,i,2);
-          if  (AnsiPos(sx, ZN) > 0)  then  begin
-                                               No  :=  No  + ZenToHan(sx);
+                                               No      := '';
+                                               oc:='';
+                                               //chk :=        False;
+                                       end;
+                               end else begin
+                                       if      Copy(s,i,1) = '<' then  oc      :=      '';
+                                       oc      :=      oc + Copy(s,i,1);
+                                       chk :=  False;
+                                       al      :=      False;
+                               end;
+                       end;
+                       mbLeadByte      : begin
+                               if      (not sw) and (Copy(s,i,4) = '\81\84\81\84') then        begin
+                                       sw      :=      True;
+                                       sp      :=      i;
+                                       i :=    i + 3;
+                                       chk :=  True;
+                               end else
+                               if      (not sw) and (Copy(s,i,2) = '\81\84') then  begin
+                                       sw      :=      True;
+                                       sp      :=      i;
+                                       i :=    i + 1;
+                                       chk :=  True;
+                               end else
+                               if      (sw) then begin
+                                       sx      :=      Copy(s,i,2);
+                                       if      (AnsiPos(sx, ZN) > 0)   then    begin
+                                               No      :=      No      + ZenToHan(sx);
                                        end else begin
-                                               if  (No <> '') and (No <> '-')  and (No <> '\81|') then  begin
-              Add(sp, i, No);
-            end;
-            sw  :=  False;
-            i := i - 1;
-                                               No  :=  '';
-          end;
-        end else begin
-          oc  :=  '';
-          chk :=  False;
+                                               if      (No <> '') and (No <> '-')      and (No <> '\81|') then   begin
+                                                       Add(sp, i, No);
+                                               end;
+                                               sw      :=      False;
+                                               i := i - 1;
+                                               No      :=      '';
+                                       end;
+                               end else begin
+                                       oc      :=      '';
+                                       chk :=  False;
                                end;
-        al  :=  False;
-      end;
-    end;
-    inc(i);
-               if  (i > Length(Body))  then  begin
-      if  (sw)  then  begin
-        if  (No <> '')  then  Add(sp, i, No);
+                               al      :=      False;
                        end;
-      Break;
-    end;
-  end;
-       for i :=  List.Count - 1  downto  0 do  begin
-    if  (AnsiPos('-', PIndex(List[i]).FNo) > 0) then  begin
-                       st  :=  ChooseString(PIndex(List[i]).FNo, '-', 0);
-                       et  :=  ChooseString(PIndex(List[i]).FNo, '-', 1);
-    end else begin
-                       st  :=  PIndex(List[i]).FNo;
-                       et  :=  PIndex(List[i]).FNo;
-    end;
-               r :=  Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
+               end;
+               inc(i);
+               if      (i > Length(Body))      then    begin
+                       if      (sw)    then    begin
+                               if      (No <> '')      then    Add(sp, i, No);
+                       end;
+                       Break;
+               end;
+       end;
+       for i :=        List.Count - 1  downto  0 do    begin
+               if      (AnsiPos('-', PIndex(List[i]).FNo) > 0) then    begin
+                       st      :=      ChooseString(PIndex(List[i]).FNo, '-', 0);
+                       et      :=      ChooseString(PIndex(List[i]).FNo, '-', 1);
+               end else begin
+                       st      :=      PIndex(List[i]).FNo;
+                       et      :=      PIndex(List[i]).FNo;
+               end;
+               r :=    Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
                                        Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
                                                                [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
                                        Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
@@ -1628,7 +1891,7 @@ begin
                Dispose(PIndex(List[i]));
        end;
        List.Free;
-       Result  :=  r;
+       Result  :=      r;
 end;
 
 (*************************************************************************
@@ -1792,13 +2055,13 @@ begin
                Path := Path + ' ' + Param;
 
        SI.Cb := SizeOf(Si);
-       SI.lpReserved  := nil;
-       SI.lpDesktop   := nil;
-       SI.lpTitle     := nil;
-       SI.dwFlags     := 0;
+       SI.lpReserved   := nil;
+       SI.lpDesktop     := nil;
+       SI.lpTitle               := nil;
+       SI.dwFlags               := 0;
        SI.cbReserved2 := 0;
        SI.lpReserved2 := nil;
-       SI.dwysize     := 0;
+       SI.dwysize               := 0;
        Windows.CreateProcess(nil,
                                                                PChar(Path),
                                                                nil,
@@ -2236,23 +2499,23 @@ procedure TGikoSys.ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookm
 var
        URI: TIdURI;
 begin
-               Protocol := '';
-               Host := '';
-               Path := '';
-               Document := '';
-               Port := '';
-               Bookmark := '';
-               URI := TIdURI.Create(URL);
-               try
-                       Protocol := URI.Protocol;
-                       Host := URI.Host;
-                       Path := URI.Path;
-                       Document := URI.Document;
-                       Port := URI.Port;
-                       Bookmark := URI.Bookmark;
-               finally
-                       URI.Free;
-               end;
+       Protocol := '';
+       Host := '';
+       Path := '';
+       Document := '';
+       Port := '';
+       Bookmark := '';
+       URI := TIdURI.Create(URL);
+       try
+               Protocol := URI.Protocol;
+               Host := URI.Host;
+               Path := URI.Path;
+               Document := URI.Document;
+               Port := URI.Port;
+               Bookmark := URI.Bookmark;
+       finally
+               URI.Free;
+       end;
 end;
 
 function TGikoSys.GetVersionBuild: Integer;