Changeset 888


Ignore:
Timestamp:
Nov 24, 2020, 10:58:56 AM (3 years ago)
Author:
chronos
Message:
  • Modified: More static types added.
Location:
trunk
Files:
33 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/Chat/irc_bot.php

    r887 r888  
    55class IRCBot
    66{
    7   var $OwnerName = 'Chronosův';
    8   var $Server = "game.zdechov.net";
    9   var $Port = 6667;
    10   var $Channel = "#zdechov";
    11   var $Nick = "History";
    12   var $JokeFileName = "jokes.txt";
    13   var $File;
     7  public string $OwnerName = 'Chronosův';
     8  public string $Server = "game.zdechov.net";
     9  public int $Port = 6667;
     10  public string $Channel = "#zdechov";
     11  public string $Nick = "History";
     12  public string $JokeFileName = "jokes.txt";
     13  public $File;
    1414
    1515  function __construct()
  • trunk/Modules/EmailQueue/EmailQueue.php

    r887 r888  
    7878  }
    7979
    80   function AddItem($To, $Subject, $Content, $From, $AttachmentFileId = '')
     80  function AddItem(string $To, string $Subject, string $Content, string $From, string $AttachmentFileId = ''): void
    8181  {
    8282    $Values = array('To' => $To,
  • trunk/Modules/Finance/Bill.php

    r887 r888  
    66  public bool $Checked = false;
    77
    8   function GenerateHTML()
     8  function GenerateHTML(): string
    99  {
    1010    return '';
    1111  }
    1212
    13   function SaveToFile(string $FileName)
     13  function SaveToFile(string $FileName): void
    1414  {
    1515    $PdfData = $this->HtmlToPdf($this->GenerateHTML());
  • trunk/Modules/Finance/Finance.php

    r887 r888  
    2222class Finance extends Model
    2323{
    24   var $kWh;
    25   var $Internet;
    26   var $Sprava;
    27   var $DatumOdecteni;
    28   var $InternetUsers;
    29   var $SpravaUsers;
    30   var $MaxSpeed;
    31   var $RealMaxSpeed;
    32   var $SpeedReserve;
    33   var $BaseSpeedElement;
    34   var $BaseTariffPrice;
    35   var $TopTariffPrice;
    36   var $TotalPaid;
    37   var $TotalInternetPaid;
    38   var $MainSubject;
    39   var $BillingPeriods;
    40   var $DirectoryId;
    41   var $Rounding;
     24  public string $kWh;
     25  public string $Internet;
     26  public string $Sprava;
     27  public string $DatumOdecteni;
     28  public string $InternetUsers;
     29  public string $SpravaUsers;
     30  public string $MaxSpeed;
     31  public string $RealMaxSpeed;
     32  public string $SpeedReserve;
     33  public string $BaseSpeedElement;
     34  public string $BaseTariffPrice;
     35  public string $TopTariffPrice;
     36  public string $TotalPaid;
     37  public string $TotalInternetPaid;
     38  public string $MainSubject;
     39  public array $BillingPeriods;
     40  public string $DirectoryId;
     41  public string $Rounding;
    4242
    4343  function LoadMonthParameters(int $Period = 1) // 0 - now, 1 - next month
     
    8383  }
    8484
    85   function CreateFinanceYear($Year)
     85  function CreateFinanceYear(int $Year)
    8686  {
    8787    $StartTime = mktime(0, 0, 0, 1, 1, $Year);
     
    100100  }
    101101
    102   function GetFinanceYear(int $Year)
     102  function GetFinanceYear(int $Year): array
    103103  {
    104104    if ($Year == 0)
     
    121121  }
    122122
    123   function GetNextDocumentLineNumber(string $Id, int $FinanceYear = 0)
     123  function GetNextDocumentLineNumber(string $Id, int $FinanceYear = 0): string
    124124  {
    125125          $FinanceYear = $this->GetFinanceYear($FinanceYear);
  • trunk/Modules/Finance/Import.php

    r887 r888  
    128128  }
    129129
    130   function InsertMoney(string $Subject, string $Value, string $Cash, string $Taxable, string $Time, string $Text, array $Group)
     130  function InsertMoney(string $Subject, string $Value, string $Cash, string $Taxable, string $Time, string $Text, array $Group): void
    131131  {
    132132    $Year = date('Y', $Time);
  • trunk/Modules/Finance/Trade.php

    r887 r888  
    33class PageFinanceTaxFiling extends Page
    44{
    5   var $StartEvidence = 0;
     5  public int $StartEvidence = 0;
    66
    77  function __construct(System $System)
     
    1313  }
    1414
    15   function GetTimePeriodBalance($StartTime, $EndTime)
     15  function GetTimePeriodBalance(int $StartTime, int $EndTime): array
    1616  {
    1717    $Balance = array();
     
    7373  }
    7474
    75   function ShowAnnualBalance()
     75  function ShowAnnualBalance(): string
    7676  {
    7777    $Output = '<table style="font-size: smaller;" class="WideTable">';
     
    109109  }
    110110
    111   function ShowMonthlyBalance()
     111  function ShowMonthlyBalance(): string
    112112  {
    113113    $Output = '<table class="WideTable" style="font-size: smaller;">';
     
    151151  }
    152152
    153   function ShowIncomes()
     153  function ShowIncomes(): string
    154154  {
    155155    $Table = array('Ne', 'Ano');
     
    190190  }
    191191
    192   function ShowExpenses()
     192  function ShowExpenses(): string
    193193  {
    194194    $Table = array('Ne', 'Ano');
     
    231231  }
    232232
    233   function ShowClaims()
     233  function ShowClaims(): string
    234234  {
    235235    $Table = array('Ne', 'Ano');
     
    262262  }
    263263
    264   function ShowLiabilities()
     264  function ShowLiabilities(): string
    265265  {
    266266    $Table = array('Ne', 'Ano');
     
    294294  }
    295295
    296   function ShowSubjectList()
     296  function ShowSubjectList(): string
    297297  {
    298298    $Output = '<strong>Seznam subjektů</strong>';
     
    327327  }
    328328
    329   function ShowSmallAssets()
     329  function ShowSmallAssets(): string
    330330  {
    331331    $Output = '<strong>Drobný majetek</strong>';
     
    343343  }
    344344
    345   function ShowSubjectAccount()
     345  function ShowSubjectAccount(): string
    346346  {
    347347    $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance;
     
    408408  }
    409409
    410   function ShowDefault()
     410  function ShowDefault(): string
    411411  {
    412412    $Output = '<strong>Celkové přehledy</strong><br/>';
     
    486486  }
    487487
    488   function ShowFinanceYears()
     488  function ShowFinanceYears(): string
    489489  {
    490490    $Output = 'Roky: ';
     
    499499  {
    500500    $TimeDue = $Time + 15 * 24 * 3600; // 15 dnů
    501 
    502501  }
    503502
  • trunk/Modules/Finance/UserState.php

    r887 r888  
    1111  }
    1212
    13   function ShowFinanceOperation($Subject)
     13  function ShowFinanceOperation(int $Subject): string
    1414  {
    1515    $UserOperationTableQuery = '((SELECT `Text`, `Time`, `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo`, `DocumentLineCode`.`Name` AS `BillName` '.
  • trunk/Modules/FinanceBankAPI/FioAPI.php

    r887 r888  
    55include('GPC.php');
    66
    7 function RemoveComma($Text)
     7function RemoveComma(string $Text): string
    88{
    99  if ((mb_strlen($Text) >= 2) and ($Text[0] == '"') and (mb_substr($Text, -1, 1) == '"')) return mb_substr($Text, 1, -1);
     
    1313class FioAPI
    1414{
    15   var $Token;
    16   var $Encoding;
    17   var $Format;
     15  public string $Token;
     16  public string $Encoding;
     17  public string $Format;
    1818
    1919  function __construct()
  • trunk/Modules/IS/IS.php

    r887 r888  
    845845class ModuleIS extends AppModule
    846846{
    847   var $DashboardItems;
     847  public array $DashboardItems;
    848848
    849849  function __construct(System $System)
  • trunk/Modules/Log/Log.php

    r887 r888  
    6767    $Count = 100;
    6868
    69     $Output = '';
    7069    $Items = array();
    7170    if (array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"';
  • trunk/Modules/Map/MapAPI.php

    r887 r888  
    1818  public int $Zoom;
    1919  public string $Key;
    20   var $OnClickObject;
     20  public $OnClickObject;
    2121  public string $MarkerText;
    2222  public array $Markers;
  • trunk/Modules/Meals/Meals.php

    r887 r888  
    33class PageEatingPlace extends Page
    44{
    5   var $DayNames = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota');
    6   var $DayNamesShort = array('NE', 'PO', 'ÚT', 'ST', 'ČT', 'PÁ', 'SO');
    7   var $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená');
    8   var $DayCount = 20;    // počet dopředu zobrazených dnů
     5  public array $DayNames = array('Neděle', 'Pondělí', 'Úterý', 'Středa', 'Čtvrtek', 'Pátek', 'Sobota');
     6  public array $DayNamesShort = array('NE', 'PO', 'ÚT', 'ST', 'ČT', 'PÁ', 'SO');
     7  public array $Status = array('Nezveřejněno', 'Otevřeno', 'Zavřeno - svátek', 'Zavřeno - dovolená');
     8  public int $DayCount = 20;    // počet dopředu zobrazených dnů
    99
    1010  function __construct(System $System)
  • trunk/Modules/Meteostation/Meteostation.php

    r887 r888  
    2121class MeteoStation extends Model
    2222{
    23   var $Id;
    24   var $Name;
    25   var $Period;
    26   var $URL;
     23  public int $Id;
     24  public string $Name;
     25  public int $Period;
     26  public string $URL;
    2727
    2828  function DownloadData(): void
     
    5454  }
    5555
    56   function CreateImage($FileName): void
     56  function CreateImage(string $FileName): void
    5757  {
    5858    $Image = new Image();
     
    7979class ModuleMeteoStation extends AppModule
    8080{
    81   var $Data;
    82 
    8381  function __construct(System $System)
    8482  {
  • trunk/Modules/NetworkConfig/NetworkConfig.php

    r887 r888  
    33class ModuleNetworkConfig extends AppModule
    44{
    5   var $ConfigItems;
     5  public array $ConfigItems;
    66
    77  function __construct(System $System)
  • trunk/Modules/NetworkConfigAirOS/Generators/SSHClient.php

    r874 r888  
    33class SSHClient
    44{
    5   var $SSHPath;
    6   var $Timeout;
    7   var $HostName;
    8   var $UserName;
    9   var $Password;
    10   var $PrivateKey;
    11   var $Debug;
     5  public string $SSHPath;
     6  public int $Timeout;
     7  public string $HostName;
     8  public string $UserName;
     9  public string $Password;
     10  public string $PrivateKey;
     11  public bool $Debug;
    1212
    1313  function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '')
     
    2222  }
    2323
    24   function Execute($Commands)
     24  function Execute(string $Commands): array
    2525  {
    2626    $Commands = trim($Commands);
     
    3737      $Output = array();
    3838      exec($Command, $Output);
    39     } else $Output = '';
     39    } else $Output = array();
    4040    if ($this->Debug) print_r($Output);
    4141    return $Output;
  • trunk/Modules/NetworkConfigRouterOS/Routerboard.php

    r887 r888  
    33class Routerboard
    44{
    5   var $SSHPath = '/usr/bin/ssh';
    6   var $Timeout = 3;
    7   var $HostName;
    8   var $UserName;
    9   var $Password;
    10   var $PrivateKey = '~/.ssh/id_rsa';
    11   var $MaxBurstLineCount = 100;
    12   var $Debug = false;
     5  public string $SSHPath = '/usr/bin/ssh';
     6  public int $Timeout = 3;
     7  public string $HostName;
     8  public string $UserName;
     9  public string $Password;
     10  public string $PrivateKey = '~/.ssh/id_rsa';
     11  public int $MaxBurstLineCount = 100;
     12  public bool $Debug = false;
    1313
    1414  function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '')
     
    1919  }
    2020
    21   function Execute(array $Commands): array
     21  function Execute($Commands): array
    2222  {
    2323    $Output = array();
     
    7575      if (count($ResultLineParts) > 1)
    7676      {
    77         if ($ResultLineParts[1]{0} == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
     77        if ($ResultLineParts[1][0] == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes
    7878        $List[substr($ResultLineParts[0], 0, -1)] = $ResultLineParts[1];
    7979      } else $List[substr($ResultLineParts[0], 0, -1)] = '';
     
    116116  }
    117117
    118   function ListGetPrint($Path, $Properties, $Conditions = array()): array
     118  function ListGetPrint(array $Path, array $Properties, array $Conditions = array()): array
    119119  {
    120120    $ConditionList = '';
  • trunk/Modules/NetworkConfigRouterOS/Routerboard2.php

    r887 r888  
    55class Routerboard extends SSH
    66{
    7   var $Methods = array(
     7  public array $Methods = array(
    88    'kex' => 'diffie-hellman-group1-sha1',
    99    'client_to_server' => array('crypt' => '3des-cbc', 'comp' => 'none'),
     
    1111  );
    1212
    13   function Execute($Commands): array
     13  function Execute(array $Commands): array
    1414  {
    1515    if (is_array($Commands)) $Commands = implode(';', $Commands);
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r887 r888  
    33class RouterosAPI
    44{
    5   var $ErrorNo;           // Variable for storing connection error number, if any
    6   var $ErrorStr;          // Variable for storing connection error text, if any
    7   var $Attempts;       // Connection attempt count
    8   var $Connected;  // Connection state
    9   var $Delay;          // Delay between connection attempts in seconds
    10   var $Port;        // Port to connect to
    11   var $Timeout;        // Connection attempt timeout and data read timeout
    12   var $Socket;             // Variable for storing socket resource
    13   var $Debug;
    14   var $SSL; // If SSL API connection is used. You need also change port to 8729
     5  public int $ErrorNo;           // Variable for storing connection error number, if any
     6  public string $ErrorStr;          // Variable for storing connection error text, if any
     7  public int $Attempts;       // Connection attempt count
     8  public bool $Connected;  // Connection state
     9  public int $Delay;          // Delay between connection attempts in seconds
     10  public int $Port;        // Port to connect to
     11  public int $Timeout;        // Connection attempt timeout and data read timeout
     12  public int $Socket;             // Variable for storing socket resource
     13  public bool $Debug;
     14  public bool $SSL; // If SSL API connection is used. You need also change port to 8729
    1515
    1616  function __construct()
  • trunk/Modules/NetworkConfigRouterOS/SSH.php

    r874 r888  
    33class SSH
    44{
    5   var $HostName;
    6   var $UserName;
    7   var $Password;
    8   var $Methods;
     5  public string $HostName;
     6  public string $UserName;
     7  public string $Password;
     8  public array $Methods;
    99
    1010  function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '')
     
    1313    $this->UserName = $UserName;
    1414    $this->Password = $Password;
     15    $this->Methods = array();
    1516  }
    1617
    17   function Execute($Commands)
     18  function Execute(array $Commands): array
    1819  {
    1920    echo($Commands);
  • trunk/Modules/NetworkShare/SharePage.php

    r887 r888  
    33class SharePage extends Page
    44{
    5   var $Dependencies = array('Log');
    6   var $MaxNesting = 20; // Maximální vnoření
    7   var $Promene = array( // Automatické zapamatování proměnných
     5  public array $Dependencies = array('Log');
     6  public int $MaxNesting = 20; // Maximální vnoření
     7  public array $Promene = array( // Automatické zapamatování proměnných
    88    'keyword' => '',
    99    'file_type' => 0,
     
    2525  }
    2626
    27   function ShowTime()
     27  function ShowTime(): string
    2828  {
    2929    return date("H:i:s")."<br />\n";
     
    4040
    4141    // Najde cestu ke keřenu
    42   function PlnaCesta($Row)
     42  function PlnaCesta($Row): string
    4343  {
    4444    // Vyhledání cesty
     
    6060
    6161  // Převede velikost v bajtech na odpovídající jednotky
    62   function PrevedVelikost($Velikost)
     62  function PrevedVelikost($Velikost): string
    6363  {
    6464    $Jednotky = array('B','kB','MB','GB','TB','PB','EB');
  • trunk/Modules/NetworkTopology/NetworkTopology.php

    r887 r888  
    33class PageNetworkTopology extends Page
    44{
    5   var $TopHostName = 'NIX-ROUTER';
     5  public string $TopHostName = 'NIX-ROUTER';
    66
    77  function __construct(System $System)
     
    2323  }
    2424
    25   function ShowImage()
     25  function ShowImage(): string
    2626  {
    2727    $this->SimplePage = true;
     
    117117  }
    118118
    119   function ShowOverview()
     119  function ShowOverview(): string
    120120  {
    121121    $Output = '<img src="topologie.png"><br/>
  • trunk/Modules/TimeMeasure/Graph.php

    r887 r888  
    33class PageGraph extends Page
    44{
    5   var $FontSize;
    6   var $FontFileName;
    7   var $ValueToImageHeigthCoefficient;
    8   var $DefaultWidth;
    9   var $DefaultHeight;
     5  public int $FontSize;
     6  public string $FontFileName;
     7  public float $ValueToImageHeigthCoefficient;
     8  public int $DefaultWidth;
     9  public int $DefaultHeight;
    1010
    1111  function __construct(System $System)
  • trunk/Modules/TimeMeasure/Measure.php

    r874 r888  
    33class Measure extends Model
    44{
    5   var $Data;
    6   var $LevelReducing = 5;
    7   var $ReferenceTime = 0;
    8   var $MaxLevel = 4;
    9   var $Differential = 0;
    10   var $Debug = 0;
    11   var $DivisionCount = 500;
    12   var $ValueTypes = array('Min', 'Avg', 'Max');
    13 
    14   function Load($Id)
     5  public array $Data;
     6  public int $LevelReducing = 5;
     7  public int $ReferenceTime = 0;
     8  public int $MaxLevel = 4;
     9  public int $Differential = 0;
     10  public int $Debug = 0;
     11  public int $DivisionCount = 500;
     12  public array $ValueTypes = array('Min', 'Avg', 'Max');
     13
     14  function Load(int $Id): void
    1515  {
    1616    $Result = $this->Database->select('Measure', '*', 'Id='.$Id);
     
    2828  }
    2929
    30   function StatTableName($Level)
     30  function StatTableName(int $Level): string
    3131  {
    3232    if ($Level == 0) return 'Data';
     
    419419    // Load measures
    420420    $Measures = array();
    421     $Result = $Database->select('Measure', '*');
     421    $Result = $this->Database->select('Measure', '*');
    422422    while ($Row = $Result->fetch_assoc())
    423423    {
    424       $Measures = new Measure();
     424      $Measure = new Measure($this->System);
    425425      $Measure->Load($Row['Id']);
    426426    }
  • trunk/Packages/Common/BigInt.php

    r870 r888  
    99// First byte is MSB and last byte is LSB
    1010
    11 function BigIntNew($BitWidth)
     11function BigIntNew($BitWidth): string
    1212{
    1313  return str_repeat(chr(0), $BitWidth >> 3);
    1414}
    1515
    16 function BigIntNewAs($A)
     16function BigIntNewAs($A): string
    1717{
    1818  return str_repeat(chr(0), strlen($A));
    1919}
    2020
    21 function BigIntCheck($A, $B)
     21function BigIntCheck(string $A, string $B): void
    2222{
    2323    if (strlen($A) != strlen($B))
     
    2525}
    2626
    27 function BigIntAdd($A, $B)
     27function BigIntAdd(string $A, string $B): string
    2828{
    2929  BigIntCheck($A, $B);
     
    4040}
    4141
    42 function BigIntSub($A, $B)
     42function BigIntSub(string $A, string $B): string
    4343{
    4444  BigIntCheck($A, $B);
     
    5555}
    5656
    57 function BigIntInc($A)
     57function BigIntInc(string $A): string
    5858{
    5959  $Result = BigIntNewAs($A);
     
    6969}
    7070
    71 function BigIntDec($A)
     71function BigIntDec(string $A): string
    7272{
    7373  $Result = BigIntNewAs($A);
     
    8383}
    8484
    85 function BigIntNeg($A)
     85function BigIntNeg(string $A): string
    8686{
    8787  return BigIntInc(BigIntNot($A));
    8888}
    8989
    90 function BigIntIsNeg($A)
     90function BigIntIsNeg(string $A): string
    9191{
    9292  return ord($A[0]) & 0x80;
    9393}
    9494
    95 function BigIntEqual($A, $B)
     95function BigIntEqual(string $A, string $B): bool
    9696{
    9797  return $A == $B; // Simple string comparison
    9898}
    9999
    100 function BigIntNotEqual($A, $B)
     100function BigIntNotEqual(string $A, string $B): bool
    101101{
    102102  return $A != $B; // Simple string comparison
    103103}
    104104
    105 function BigIntGreater($A, $B)
     105function BigIntGreater(string $A, string $B): bool
    106106{
    107107  return BigIntIsNeg(BigIntSub($B, $A));
    108108}
    109109
    110 function BigIntGreaterOrEqual($A, $B)
     110function BigIntGreaterOrEqual(string $A, string $B): bool
    111111{
    112112  return BigIntIsNeg(BigIntSub($B, $A)) or BigIntEqual($A, $B);
    113113}
    114114
    115 function BigIntLesser($A, $B)
     115function BigIntLesser(string $A, string $B): bool
    116116{
    117117  return BigIntIsNeg(BigIntSub($A, $B));
    118118}
    119119
    120 function BigIntLesserOrEqual($A, $B)
     120function BigIntLesserOrEqual(string $A, string $B): bool
    121121{
    122122  return BigIntIsNeg(BigIntSub($A, $B)) or BigIntEqual($A, $B);
    123123}
    124124
    125 function BigIntMul($A, $B)
    126 {
    127   BigIntCheck($A, $B);
    128   $Result = BigIntNewAs($A);
    129   while (BigIntGreater($B, BigIntNew()))
     125function BigIntMul(string $A, string $B): string
     126{
     127  BigIntCheck($A, $B);
     128  $Result = BigIntNewAs($A);
     129  while (BigIntGreater($B, BigIntNewAs($A)))
    130130  {
    131131    $Result = BigIntAdd($Result, $A);
     
    135135}
    136136
    137 function BigIntDiv($A, $B)
     137function BigIntDiv(string $A, string $B): string
    138138{
    139139  BigIntCheck($A, $B);
     
    147147}
    148148
    149 function BigIntMod($A, $B)
     149function BigIntMod(string $A, string $B): string
    150150{
    151151  BigIntCheck($A, $B);
     
    159159}
    160160
    161 function BigIntAnd($A, $B)
     161function BigIntAnd(string $A, string $B): string
    162162{
    163163  BigIntCheck($A, $B);
     
    170170}
    171171
    172 function BigIntOr($A, $B)
     172function BigIntOr(string $A, string $B): string
    173173{
    174174  BigIntCheck($A, $B);
     
    181181}
    182182
    183 function BigIntXor($A, $B)
     183function BigIntXor(string $A, string $B): string
    184184{
    185185  BigIntCheck($A, $B);
     
    192192}
    193193
    194 function BigIntNot($A)
     194function BigIntNot(string $A): string
    195195{
    196196  $Result = BigIntNewAs($A);
     
    202202}
    203203
    204 function BigIntShl1($A)
     204function BigIntShl1(string $A): string
    205205{
    206206  $Result = BigIntNewAs($A);
     
    213213}
    214214
    215 function BigIntShl($A, $B)
     215function BigIntShl(string $A, string $B): string
    216216{
    217217  BigIntCheck($A, $B);
     
    224224}
    225225
    226 function BigIntShr1($A)
     226function BigIntShr1(string $A): string
    227227{
    228228  $Result = BigIntNewAs($A);
     
    235235}
    236236
    237 function BigIntShr($A, $B)
     237function BigIntShr(string $A, string $B): string
    238238{
    239239  BigIntCheck($A, $B);
     
    246246}
    247247
    248 function BigIntToHex($A)
     248function BigIntToHex(string $A): string
    249249{
    250250  $Result = '';
     
    256256}
    257257
    258 function HexToBigInt($A, $BitWidth)
     258function HexToBigInt(string $A, int $BitWidth): string
    259259{
    260260  $Result = BigIntNew($BitWidth);
     
    275275}
    276276
    277 function BigIntToBin($A)
     277function BigIntToBin(string $A): string
    278278{
    279279  $Result = '';
     
    285285}
    286286
    287 function BinToBigInt($A, $BitWidth)
     287function BinToBigInt(string $A, int $BitWidth): string
    288288{
    289289  $Result = BigIntNew($BitWidth);
     
    305305}
    306306
    307 function BigIntToInt($A)
     307function BigIntToInt(string $A): int
    308308{
    309309  // 32-bit int support
     
    311311}
    312312
    313 function IntToBigInt($A, $BitWidth)
     313function IntToBigInt(int $A, int $BitWidth): string
    314314{
    315315  $Result = BigIntNew($BitWidth);
     
    322322}
    323323
    324 function BigIntToDec($A)
     324function BigIntToDec(string $A): string
    325325{
    326326  $BitWidth = strlen($A) << 3;
     
    335335}
    336336
    337 function DecToBigInt($A, $BitWidth)
     337function DecToBigInt(string $A, int $BitWidth): string
    338338{
    339339  $Result = BigIntNew($BitWidth);
     
    342342  {
    343343    $Result = BigIntMul($Result, IntToBigInt(10, $BitWidth));
    344     $Result = BigIntAdd($Result, IntToBigInt(intval($A[$I], $BitWidth)));
     344    $Result = BigIntAdd($Result, IntToBigInt(intval($A[$I]), $BitWidth));
    345345    $I++;
    346346  }
  • trunk/Packages/Common/Config.php

    r874 r888  
    33class Config
    44{
    5   var $Data;
     5  public array $Data;
    66
    77  function __construct()
     
    1010  }
    1111
    12   function ReadValue($Name)
     12  function ReadValue(string $Name)
    1313  {
    1414    if (!is_array($Name)) $Name = explode('/', $Name);
     
    2222  }
    2323
    24   function WriteValue($Name, $Value)
     24  function WriteValue(string $Name, $Value)
    2525  {
    2626    if (!is_array($Name)) $Name = explode('/', $Name);
     
    3434  }
    3535
    36   function LoadFromFile($FileName)
     36  function LoadFromFile(string $FileName): void
    3737  {
    3838    $ConfigData = array();
     
    4040    foreach ($this->Data as $Index => $Item)
    4141    {
    42       if (array_key_exits($Index, $ConfigData))
     42      if (array_key_exists($Index, $ConfigData))
    4343        $this->Data[$Index] = $ConfigData[$Index];
    4444    }
    4545  }
    4646
    47   function SaveToFile($FileName)
     47  function SaveToFile(string $FileName): void
    4848  {
    4949    file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n");
    5050  }
    5151
    52   function GetAsArray()
     52  function GetAsArray(): array
    5353  {
    5454    return $this->Data;
  • trunk/Packages/Common/Database.php

    r887 r888  
    1212class DatabaseResult
    1313{
    14   var $PDOStatement;
     14  public PDOStatement $PDOStatement;
    1515  public int $num_rows = 0;
    1616
  • trunk/Packages/Common/Generics.php

    r887 r888  
    33class GenericList
    44{
    5   var $Items = array();
     5  public array $Items = array();
    66
    77  function Add($Item): void
  • trunk/Packages/Common/NetworkAddress.php

    r874 r888  
    55class NetworkAddressIPv4
    66{
    7   var $Address;
    8   var $Prefix;
     7  public int $Address;
     8  public int $Prefix;
    99
    1010  function __construct()
     
    1414  }
    1515
    16   function GetNetMask()
     16  function GetNetMask(): int
    1717  {
    1818    return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1);
    1919  }
    2020
    21   function AddressToString()
     21  function AddressToString(): string
    2222  {
    2323    return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255)));
    2424  }
    2525
    26   function AddressFromString($Value)
     26  function AddressFromString(string $Value): void
    2727  {
    2828    $Parts = explode('.', $Value);
     
    3030  }
    3131
    32   function GetRange()
     32  function GetRange(): array
    3333  {
    3434    $From = new NetworkAddressIPv4();
     
    4242  }
    4343
    44   function ChangePrefix($NewPrefix)
     44  function ChangePrefix(int $NewPrefix): void
    4545  {
    4646    $this->Prefix = $NewPrefix;
     
    5050  }
    5151
    52   function Contain($Address)
     52  function Contain(NetworkAddressIPv4 $Address): bool
    5353  {
    5454    $UpperNetmask = $this->GetNetMask();
     
    6363class NetworkAddressIPv6
    6464{
    65   var $Address;
    66   var $Prefix;
     65  public string $Address;
     66  public int $Prefix;
    6767
    6868  function __construct()
     
    7272  }
    7373
    74   function GetNetMask()
     74  function GetNetMask(): string
    7575  {
    7676    return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)),
     
    7878  }
    7979
    80   function AddressToString()
     80  function AddressToString(): string
    8181  {
    8282    return inet_ntop($this->Address);
    8383  }
    8484
    85   function AddressFromString($Value)
     85  function AddressFromString(string $Value)
    8686  {
    8787    $this->Address = inet_pton($Value);
    8888  }
    8989
    90   function ChangePrefix($NewPrefix)
     90  function ChangePrefix(int $NewPrefix): void
    9191  {
    9292    $this->Prefix = $NewPrefix;
     
    9696  }
    9797
    98   function GetOctets()
     98  function GetOctets(): array
    9999  {
    100100    $Result = array();
     
    109109  }
    110110
    111   function EncodeMAC($MAC)
     111  function EncodeMAC(string $MAC): void
    112112  {
    113113    $MAC = explode(':', $MAC);
     
    124124  }
    125125
    126   function Contain($Address)
     126  function Contain(NetworkAddressIPv6 $Address): bool
    127127  {
    128128    $UpperNetmask = $this->GetNetMask();
  • trunk/Packages/Common/Page.php

    r887 r888  
    77  public string $ParentClass;
    88  public bool $ClearPage;
    9   var $OnSystemMessage;
     9  public $OnSystemMessage;
    1010  public string $Load;
    1111  public string $Unload;
  • trunk/Packages/Common/Process.php

    r874 r888  
    33class Process
    44{
    5   var $Command;
    6   var $Handle;
    7   var $Pipes;
    8   var $Environment;
    9   var $WorkingDir;
    10  
     5  public string $Command;
     6  public $Handle;
     7  public array $Pipes;
     8  public array $Environment;
     9  public ?string $WorkingDir;
     10
    1111  function __construct()
    1212  {
     
    1717    $this->WorkingDir = null;
    1818  }
    19  
    20   function Start()
     19
     20  function Start(): void
    2121  {
    2222    if (!$this->IsRunning())
     
    2828      );
    2929
    30       $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes, 
     30      $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes,
    3131        $this->WorkingDir, $this->Environment);
    3232      stream_set_blocking($this->Pipes[0], FALSE);
     
    3535    }
    3636  }
    37  
    38   function Stop()
     37
     38  function Stop(): void
    3939  {
    40     if ($this->IsRunning()) 
     40    if ($this->IsRunning())
    4141    {
    4242      proc_close($this->Handle);
     
    4444    }
    4545  }
    46  
    47   function IsRunning()
     46
     47  function IsRunning(): bool
    4848  {
    4949    return is_resource($this->Handle);
  • trunk/Packages/Common/Table.php

    r887 r888  
    33class Control
    44{
    5   var $Name;
     5  public string $Name;
    66
    77  function Show(): string
  • trunk/Packages/Common/UTF8.php

    r887 r888  
    526526  }
    527527
    528   function ToUTF8string ($String, string $Charset = 'iso2'): string
     528  function ToUTF8string(string $String, string $Charset = 'iso2'): string
    529529  {
    530530    $Result = '';
  • trunk/Packages/Common/Update.php

    r887 r888  
    1818  }
    1919
    20   function GetDbVersion()
     20  function GetDbVersion(): string
    2121  {
    2222    $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1');
     
    2525  }
    2626
    27   function IsInstalled()
     27  function IsInstalled(): bool
    2828  {
    2929    $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"');
     
    3131  }
    3232
    33   function IsUpToDate()
     33  function IsUpToDate(): bool
    3434  {
    3535    return $this->Revision <= $this->GetDbVersion();
    3636  }
    3737
    38   function Upgrade()
     38  function Upgrade(): string
    3939  {
    4040    $DbRevision = $this->GetDbVersion();
     
    5858  }
    5959
    60   function Install()
     60  function Install(): void
    6161  {
    6262    $InstallMethod = $this->InstallMethod;
     
    6464  }
    6565
    66   function Uninstall()
     66  function Uninstall(): void
    6767  {
    68 
    6968  }
    7069
    71   function InsertSampleData()
     70  function InsertSampleData(): void
    7271  {
    7372    $InstallMethod = $this->InsertSampleDataMethod;
Note: See TracChangeset for help on using the changeset viewer.