Changeset 137 for trunk/Packages/CoolWeb


Ignore:
Timestamp:
Sep 9, 2022, 1:16:58 AM (22 months ago)
Author:
chronos
Message:
  • Added: Robots page.
  • Modified: Canonical URL for webcams.
  • Modified: Removed compiler mode delphi as it is already set in project.
  • Modified: Updated Common package.
  • Modified: Use Generics.Collections instead of fgl.
Location:
trunk/Packages/CoolWeb
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/CoolWeb/Common/UHtmlClasses.pas

    r84 r137  
    11unit UHtmlClasses;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    242240  end;
    243241
     242
    244243implementation
    245244
    246245resourcestring
    247246  SStringToIPConversionError = 'String to IP address conversion error';
    248 
    249247
    250248function LeftCutString(var Source, Output: string; Delimiter: string; Allowed: string = ''): Boolean;
     
    322320begin
    323321  Value.Free;
    324   inherited Destroy;
     322  inherited;
    325323end;
    326324
     
    345343begin
    346344  Cells.Free;
    347   inherited Destroy;
     345  inherited;
    348346end;
    349347
     
    370368begin
    371369  Rows.Free;
    372   inherited Destroy;
     370  inherited;
    373371end;
    374372
     
    421419constructor THtmlInput.Create;
    422420begin
    423 
    424421end;
    425422
    426423destructor THtmlInput.Destroy;
    427424begin
    428   inherited Destroy;
     425  inherited;
    429426end;
    430427
     
    452449begin
    453450  Action.Free;
    454   inherited Destroy;
     451  inherited;
    455452end;
    456453
     
    754751begin
    755752  Levels.Free;
    756   inherited Destroy;
     753  inherited;
    757754end;
    758755
     
    893890begin
    894891  Data.Free;
    895   inherited Destroy;
     892  inherited;
    896893end;
    897894
  • trunk/Packages/CoolWeb/Common/UMIMEType.pas

    r84 r137  
    11unit UMIMEType;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    1210var
    1311  MIMETypeList: TStringList;
     12
    1413
    1514implementation
  • trunk/Packages/CoolWeb/Common/UMemoryStreamEx.pas

    r84 r137  
    11unit UMemoryStreamEx;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    5957  end;
    6058
     59
    6160implementation
    6261
     
    261260end;
    262261
    263 procedure TMemoryStreamEx.WriteString(Data:string);
     262procedure TMemoryStreamEx.WriteString(Data: string);
    264263begin
    265264  if Length(Data) > 0 then
     
    314313constructor TThreadMemoryStreamEx.Create;
    315314begin
    316   inherited Create;
     315  inherited;
    317316  Lock := TCriticalSection.Create;
    318317end;
     
    321320begin
    322321  Lock.Free;
    323   inherited Destroy;
     322  inherited;
    324323end;
    325324
  • trunk/Packages/CoolWeb/Common/UXmlClasses.pas

    r84 r137  
    11unit UXmlClasses;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
    64
    7 uses Classes, SysUtils, StrUtils, SpecializedList,
    8   SpecializedDictionary;
     5uses
     6  Classes, SysUtils, StrUtils, SpecializedList, SpecializedDictionary;
    97
    108type
     
    5048    property AsString: string read GetAsString;
    5149  end;
     50
    5251
    5352implementation
  • trunk/Packages/CoolWeb/LazIDEReg.pas

    r132 r137  
    11unit LazIDEReg;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
     
    97
    108type
    11    { TFileDescWebPage }
     9  { TFileDescWebPage }
    1210
    1311  TFileDescWebPage = class(TFileDescPascalUnitWithResource)
     
    2725    function CreateStartFiles(AProject: TLazProject): TModalResult; override;
    2826  end;
    29 
    3027
    3128resourcestring
     
    158155end;
    159156
    160 
    161157end.
    162158
  • trunk/Packages/CoolWeb/Modules/UPageList.pas

    r84 r137  
    11unit UPageList;
    2 
    3 {$mode delphi}
    42
    53interface
  • trunk/Packages/CoolWeb/Modules/UWebUser.pas

    r132 r137  
    11unit UWebUser;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    4846  end;
    4947
     48
    5049implementation
    5150
  • trunk/Packages/CoolWeb/Network/UTCPServer.pas

    r114 r137  
    11unit UTCPServer;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    6866      write FOnClientConnect;
    6967  end;
     68
    7069
    7170implementation
  • trunk/Packages/CoolWeb/Persistence/USqlDatabase.pas

    r103 r137  
    11unit USqlDatabase;
    22
    3 {$mode Delphi}{$H+}
    4 
    5 // Modified: 2010-12-24
     3// Modified: 2022-09-08
    64
    75interface
    86
    97uses
    10   SysUtils, Classes, Dialogs, mysql50, TypInfo,
    11   SpecializedDictionary, SpecializedList;
     8  SysUtils, Classes, Dialogs, mysql50, TypInfo, SpecializedDictionary,
     9  SpecializedList;
    1210
    1311type
     
    6159    procedure CreateColumn(Table, ColumnName: string; ColumnType: TTypeKind);
    6260    procedure Query(DbRows: TDbRows; Data: string);
    63     procedure Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = '1');
    64     procedure Delete(ATable: string; Condition: string = '1';
     61    procedure Select(DbRows: TDbRows; ATable: string; Filter: string = '*';
     62      Condition: string = '');
     63    procedure Delete(ATable: string; Condition: string = '';
    6564      Schema: string = '');
    6665    procedure Insert(ATable: string; Data: TDictionaryStringString;
    6766      Schema: string = '');
    6867    procedure Update(ATable: string; Data: TDictionaryStringString;
    69       Condition: string = '1'; Schema: string = '');
     68      Condition: string = ''; Schema: string = '');
    7069    procedure Replace(ATable: string; Data: TDictionaryStringString;
    7170      Schema: string = '');
     
    10099
    101100uses
    102   DateUtils, Math;
     101  DateUtils;
    103102
    104103resourcestring
     
    184183  Rows: TDbRows;
    185184begin
    186 //  mySQLClient1.Connect;
    187185  FSession := mysql_init(FSession);
    188 //  FSession.charset := 'latin2';
    189186  NewSession := mysql_real_connect(FSession, PChar(HostName), PChar(UserName),
    190187    PChar(Password), PChar(Database), FPort, nil, CLIENT_LONG_PASSWORD + CLIENT_CONNECT_WITH_DB);
     
    250247
    251248  DbResult := mysql_store_result(FSession);
    252   if Assigned(DbResult) then begin
    253     DbRows.Count := mysql_num_rows(DbResult);
    254     for I := 0 to DbRows.Count - 1 do begin
    255       DbRow := mysql_fetch_row(DbResult);
    256       DbRows[I] := TDictionaryStringString.Create;
    257       with DbRows[I] do begin
    258         for II := 0 to mysql_num_fields(DbResult) - 1 do begin
    259           Add(mysql_fetch_field_direct(DbResult, II)^.Name,
    260             PChar((DbRow + II)^));
     249  try
     250    if Assigned(DbResult) then begin
     251      DbRows.Count := mysql_num_rows(DbResult);
     252      for I := 0 to DbRows.Count - 1 do begin
     253        DbRow := mysql_fetch_row(DbResult);
     254        DbRows[I] := TDictionaryStringString.Create;
     255        with DbRows[I] do begin
     256          for II := 0 to mysql_num_fields(DbResult) - 1 do begin
     257            Add(mysql_fetch_field_direct(DbResult, II)^.Name,
     258              PChar((DbRow + II)^));
    261259          end;
    262260        end;
    263261      end;
    264   end;
    265   mysql_free_result(DbResult);
     262    end;
     263  finally
     264    mysql_free_result(DbResult);
     265  end;
    266266end;
    267267
     
    296296end;
    297297
    298 procedure TSqlDatabase.Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = '1');
     298procedure TSqlDatabase.Select(DbRows: TDbRows; ATable: string; Filter: string = '*'; Condition: string = '');
     299var
     300  QueryText: string;
    299301begin
    300302  LastUsedTable := ATable;
    301   Query(DbRows, 'SELECT ' + Filter + ' FROM `' + ATable + '` WHERE ' + Condition);
     303  QueryText := 'SELECT ' + Filter + ' FROM `' + ATable + '`';
     304  if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition;
     305  Query(DbRows, QueryText);
    302306end;
    303307
    304308procedure TSqlDatabase.Update(ATable: string; Data: TDictionaryStringString;
    305   Condition: string = '1'; Schema: string = '');
    306 var
     309  Condition: string = ''; Schema: string = '');
     310var
     311  QueryText: string;
    307312  DbValues: string;
    308313  Value: string;
     
    322327    DbResult := TDbRows.Create;
    323328    if Schema <> '' then Schema := '`' + Schema + '`.';
    324     Query(DbResult, 'UPDATE ' + Schema + '`' + ATable + '` SET ' + DbValues + ' WHERE ' + Condition);
     329    QueryText := 'UPDATE ' + Schema + '`' + ATable + '` SET ' + DbValues;
     330    if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition;
     331    Query(DbResult, QueryText);
    325332  finally
    326333    DbResult.Free;
     
    333340end;
    334341
    335 procedure TSqlDatabase.Delete(ATable: string; Condition: string = '1';
     342procedure TSqlDatabase.Delete(ATable: string; Condition: string = '';
    336343  Schema: string = '');
    337344var
     345  QueryText: string;
    338346  DbResult: TDbRows;
    339347begin
     
    342350    DbResult := TDbRows.Create;
    343351    if Schema <> '' then Schema := '`' + Schema + '`.';
    344     Query(DbResult, 'DELETE FROM ' + Schema + '`' + ATable + '` WHERE ' + Condition);
     352    QueryText := 'DELETE FROM ' + Schema + '`' + ATable + '`';
     353    if Condition <> '' then QueryText := QueryText + ' WHERE ' + Condition;
     354    Query(DbResult, QueryText);
    345355  finally
    346356    DbResult.Free;
     
    497507end.
    498508
    499 
  • trunk/Packages/CoolWeb/WebServer/UHTTPServer.pas

    r130 r137  
    11unit UHTTPServer;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    419417procedure THTTPSessionStorage.Load(HandlerData: THTTPHandlerData);
    420418begin
    421 
    422419end;
    423420
    424421procedure THTTPSessionStorage.Save(HandlerData: THTTPHandlerData);
    425422begin
    426 
    427423end;
    428424
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerCGI.pas

    r100 r137  
    11unit UHTTPServerCGI;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    2119  end;
    2220
     21procedure Register;
    2322
    24 procedure Register;
    2523
    2624implementation
     
    3331  RegisterComponents('CoolWeb', [THTTPServerCGI]);
    3432end;
    35 
    3633
    3734{ THTTPServerCGI }
     
    4643begin
    4744  EnvVars.Free;
    48   inherited Destroy;
     45  inherited;
    4946end;
    5047
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerTCP.pas

    r130 r137  
    11unit UHTTPServerTCP;
    2 
    3 {$mode delphi}
    42
    53interface
     
    141139end;
    142140
    143 
    144141{ THTTPServerTCP }
    145142
  • trunk/Packages/CoolWeb/WebServer/UHTTPServerTurboPower.pas

    r84 r137  
    11unit UHTTPServerTurboPower;
    2 
    3 {$mode delphi}{$H+}
    42
    53interface
     
    3230end;
    3331
    34 
    3532{ THTTPServerTurboPower }
    3633
     
    6259destructor THTTPServerTurboPower.Destroy;
    6360begin
    64   inherited Destroy;
     61  inherited;
    6562end;
    6663
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionFile.pas

    r114 r137  
    11unit UHTTPSessionFile;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    3634procedure Register;
    3735
     36
    3837implementation
    3938
     
    4544  RegisterComponents('CoolWeb', [THTTPSessionStorageFile]);
    4645end;
    47 
    4846
    4947{ THTTPSession }
     
    119117  Sessions.Destroy;
    120118  Lock.Destroy;
    121   inherited Destroy;
     119  inherited;
    122120end;
    123121
  • trunk/Packages/CoolWeb/WebServer/UHTTPSessionMySQL.pas

    r100 r137  
    11unit UHTTPSessionMySQL;
    2 
    3 {$mode Delphi}{$H+}
    42
    53interface
     
    3735procedure Register;
    3836
     37
    3938implementation
    4039
     
    4342  RegisterComponents('CoolWeb', [THTTPSessionStorageMySQL]);
    4443end;
    45 
    4644
    4745{ THTTPSession }
     
    138136  Sessions.Free;
    139137  Lock.Free;
    140   inherited Destroy;
     138  inherited;
    141139end;
    142140
  • trunk/Packages/CoolWeb/WebServer/UTurboPowerForm.pas

    r84 r137  
    11unit UTurboPowerForm;
    2 
    3 {$mode delphi}
    42
    53interface
     
    3533  FormWebBrowser: TFormWebBrowser;
    3634
     35
    3736implementation
    3837
     
    5150end;
    5251
    53 initialization
    54 
    5552end.
    5653
  • trunk/Packages/CoolWeb/WebServer/UWebApp.pas

    r132 r137  
    11unit UWebApp;
    22
    3 {$mode Delphi}{$H+}
    4 
    53interface
    64
    75uses
    8   Classes, SysUtils, UWebPage, UHTTPSessionFile,
    9   UHTTPServer, Forms, FileUtil, fgl;
     6  Classes, SysUtils, UWebPage, UHTTPSessionFile, UHTTPServer, Forms, FileUtil,
     7  Generics.Collections;
    108
    119type
     
    2220  { TPageList }
    2321
    24   TPageList = class(TFPGObjectList<TRegistredPage>)
     22  TPageList = class(TObjectList<TRegistredPage>)
    2523    RootDir: string;
    2624    function FindByPage(Page: TWebPage): TRegistredPage;
     
    221219end;
    222220
    223 
    224 initialization
    225 
    226 finalization
    227 
    228221end.
    229222
  • trunk/Packages/CoolWeb/WebServer/UWebPage.pas

    r84 r137  
    11unit UWebPage;
    2 
    3 {$mode objfpc}{$H+}
    42
    53interface
     
    119  TOnProduceEvent = procedure(HandlerData: THTTPHandlerData) of object;
    1210
    13 
    1411  { TWebPage }
    1512
     
    1815    FCaption: string;
    1916    FOnProduce: TOnProduceEvent;
     17    FRaw: Boolean;
    2018  published
     19    property Raw: Boolean read FRaw write FRaw;
    2120    property Caption: string read FCaption write FCaption;
    2221    property OnProduce: TOnProduceEvent read FOnProduce write FOnProduce;
    2322  end;
    24 
    2523
    2624  TWebPageClass = class of TWebPage;
Note: See TracChangeset for help on using the changeset viewer.