Changeset 888
- Timestamp:
- Nov 24, 2020, 10:58:56 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/Chat/irc_bot.php
r887 r888 5 5 class IRCBot 6 6 { 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; 14 14 15 15 function __construct() -
trunk/Modules/EmailQueue/EmailQueue.php
r887 r888 78 78 } 79 79 80 function AddItem( $To, $Subject, $Content, $From, $AttachmentFileId = '')80 function AddItem(string $To, string $Subject, string $Content, string $From, string $AttachmentFileId = ''): void 81 81 { 82 82 $Values = array('To' => $To, -
trunk/Modules/Finance/Bill.php
r887 r888 6 6 public bool $Checked = false; 7 7 8 function GenerateHTML() 8 function GenerateHTML(): string 9 9 { 10 10 return ''; 11 11 } 12 12 13 function SaveToFile(string $FileName) 13 function SaveToFile(string $FileName): void 14 14 { 15 15 $PdfData = $this->HtmlToPdf($this->GenerateHTML()); -
trunk/Modules/Finance/Finance.php
r887 r888 22 22 class Finance extends Model 23 23 { 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; 42 42 43 43 function LoadMonthParameters(int $Period = 1) // 0 - now, 1 - next month … … 83 83 } 84 84 85 function CreateFinanceYear( $Year)85 function CreateFinanceYear(int $Year) 86 86 { 87 87 $StartTime = mktime(0, 0, 0, 1, 1, $Year); … … 100 100 } 101 101 102 function GetFinanceYear(int $Year) 102 function GetFinanceYear(int $Year): array 103 103 { 104 104 if ($Year == 0) … … 121 121 } 122 122 123 function GetNextDocumentLineNumber(string $Id, int $FinanceYear = 0) 123 function GetNextDocumentLineNumber(string $Id, int $FinanceYear = 0): string 124 124 { 125 125 $FinanceYear = $this->GetFinanceYear($FinanceYear); -
trunk/Modules/Finance/Import.php
r887 r888 128 128 } 129 129 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 131 131 { 132 132 $Year = date('Y', $Time); -
trunk/Modules/Finance/Trade.php
r887 r888 3 3 class PageFinanceTaxFiling extends Page 4 4 { 5 var$StartEvidence = 0;5 public int $StartEvidence = 0; 6 6 7 7 function __construct(System $System) … … 13 13 } 14 14 15 function GetTimePeriodBalance( $StartTime, $EndTime)15 function GetTimePeriodBalance(int $StartTime, int $EndTime): array 16 16 { 17 17 $Balance = array(); … … 73 73 } 74 74 75 function ShowAnnualBalance() 75 function ShowAnnualBalance(): string 76 76 { 77 77 $Output = '<table style="font-size: smaller;" class="WideTable">'; … … 109 109 } 110 110 111 function ShowMonthlyBalance() 111 function ShowMonthlyBalance(): string 112 112 { 113 113 $Output = '<table class="WideTable" style="font-size: smaller;">'; … … 151 151 } 152 152 153 function ShowIncomes() 153 function ShowIncomes(): string 154 154 { 155 155 $Table = array('Ne', 'Ano'); … … 190 190 } 191 191 192 function ShowExpenses() 192 function ShowExpenses(): string 193 193 { 194 194 $Table = array('Ne', 'Ano'); … … 231 231 } 232 232 233 function ShowClaims() 233 function ShowClaims(): string 234 234 { 235 235 $Table = array('Ne', 'Ano'); … … 262 262 } 263 263 264 function ShowLiabilities() 264 function ShowLiabilities(): string 265 265 { 266 266 $Table = array('Ne', 'Ano'); … … 294 294 } 295 295 296 function ShowSubjectList() 296 function ShowSubjectList(): string 297 297 { 298 298 $Output = '<strong>Seznam subjektů</strong>'; … … 327 327 } 328 328 329 function ShowSmallAssets() 329 function ShowSmallAssets(): string 330 330 { 331 331 $Output = '<strong>Drobný majetek</strong>'; … … 343 343 } 344 344 345 function ShowSubjectAccount() 345 function ShowSubjectAccount(): string 346 346 { 347 347 $Finance = &ModuleFinance::Cast($this->System->GetModule('Finance'))->Finance; … … 408 408 } 409 409 410 function ShowDefault() 410 function ShowDefault(): string 411 411 { 412 412 $Output = '<strong>Celkové přehledy</strong><br/>'; … … 486 486 } 487 487 488 function ShowFinanceYears() 488 function ShowFinanceYears(): string 489 489 { 490 490 $Output = 'Roky: '; … … 499 499 { 500 500 $TimeDue = $Time + 15 * 24 * 3600; // 15 dnů 501 502 501 } 503 502 -
trunk/Modules/Finance/UserState.php
r887 r888 11 11 } 12 12 13 function ShowFinanceOperation( $Subject)13 function ShowFinanceOperation(int $Subject): string 14 14 { 15 15 $UserOperationTableQuery = '((SELECT `Text`, `Time`, `Value`, `File`, `BillCode`, NULL AS `PeriodFrom`, NULL AS `PeriodTo`, `DocumentLineCode`.`Name` AS `BillName` '. -
trunk/Modules/FinanceBankAPI/FioAPI.php
r887 r888 5 5 include('GPC.php'); 6 6 7 function RemoveComma( $Text)7 function RemoveComma(string $Text): string 8 8 { 9 9 if ((mb_strlen($Text) >= 2) and ($Text[0] == '"') and (mb_substr($Text, -1, 1) == '"')) return mb_substr($Text, 1, -1); … … 13 13 class FioAPI 14 14 { 15 var$Token;16 var$Encoding;17 var$Format;15 public string $Token; 16 public string $Encoding; 17 public string $Format; 18 18 19 19 function __construct() -
trunk/Modules/IS/IS.php
r887 r888 845 845 class ModuleIS extends AppModule 846 846 { 847 var$DashboardItems;847 public array $DashboardItems; 848 848 849 849 function __construct(System $System) -
trunk/Modules/Log/Log.php
r887 r888 67 67 $Count = 100; 68 68 69 $Output = '';70 69 $Items = array(); 71 70 if (array_key_exists('type', $_GET)) $Where = ' WHERE `Type` = "'.($_GET['type'] * 1).'"'; -
trunk/Modules/Map/MapAPI.php
r887 r888 18 18 public int $Zoom; 19 19 public string $Key; 20 var$OnClickObject;20 public $OnClickObject; 21 21 public string $MarkerText; 22 22 public array $Markers; -
trunk/Modules/Meals/Meals.php
r887 r888 3 3 class PageEatingPlace extends Page 4 4 { 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ů 9 9 10 10 function __construct(System $System) -
trunk/Modules/Meteostation/Meteostation.php
r887 r888 21 21 class MeteoStation extends Model 22 22 { 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; 27 27 28 28 function DownloadData(): void … … 54 54 } 55 55 56 function CreateImage( $FileName): void56 function CreateImage(string $FileName): void 57 57 { 58 58 $Image = new Image(); … … 79 79 class ModuleMeteoStation extends AppModule 80 80 { 81 var $Data;82 83 81 function __construct(System $System) 84 82 { -
trunk/Modules/NetworkConfig/NetworkConfig.php
r887 r888 3 3 class ModuleNetworkConfig extends AppModule 4 4 { 5 var$ConfigItems;5 public array $ConfigItems; 6 6 7 7 function __construct(System $System) -
trunk/Modules/NetworkConfigAirOS/Generators/SSHClient.php
r874 r888 3 3 class SSHClient 4 4 { 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; 12 12 13 13 function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '') … … 22 22 } 23 23 24 function Execute( $Commands)24 function Execute(string $Commands): array 25 25 { 26 26 $Commands = trim($Commands); … … 37 37 $Output = array(); 38 38 exec($Command, $Output); 39 } else $Output = '';39 } else $Output = array(); 40 40 if ($this->Debug) print_r($Output); 41 41 return $Output; -
trunk/Modules/NetworkConfigRouterOS/Routerboard.php
r887 r888 3 3 class Routerboard 4 4 { 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; 13 13 14 14 function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '') … … 19 19 } 20 20 21 function Execute( array$Commands): array21 function Execute($Commands): array 22 22 { 23 23 $Output = array(); … … 75 75 if (count($ResultLineParts) > 1) 76 76 { 77 if ($ResultLineParts[1] {0}== '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes77 if ($ResultLineParts[1][0] == '"') $ResultLineParts[1] = substr($ResultLineParts[1], 1, -1); // Remove quotes 78 78 $List[substr($ResultLineParts[0], 0, -1)] = $ResultLineParts[1]; 79 79 } else $List[substr($ResultLineParts[0], 0, -1)] = ''; … … 116 116 } 117 117 118 function ListGetPrint( $Path, $Properties,$Conditions = array()): array118 function ListGetPrint(array $Path, array $Properties, array $Conditions = array()): array 119 119 { 120 120 $ConditionList = ''; -
trunk/Modules/NetworkConfigRouterOS/Routerboard2.php
r887 r888 5 5 class Routerboard extends SSH 6 6 { 7 var$Methods = array(7 public array $Methods = array( 8 8 'kex' => 'diffie-hellman-group1-sha1', 9 9 'client_to_server' => array('crypt' => '3des-cbc', 'comp' => 'none'), … … 11 11 ); 12 12 13 function Execute( $Commands): array13 function Execute(array $Commands): array 14 14 { 15 15 if (is_array($Commands)) $Commands = implode(';', $Commands); -
trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php
r887 r888 3 3 class RouterosAPI 4 4 { 5 var$ErrorNo; // Variable for storing connection error number, if any6 var$ErrorStr; // Variable for storing connection error text, if any7 var$Attempts; // Connection attempt count8 var$Connected; // Connection state9 var$Delay; // Delay between connection attempts in seconds10 var$Port; // Port to connect to11 var$Timeout; // Connection attempt timeout and data read timeout12 var$Socket; // Variable for storing socket resource13 var$Debug;14 var$SSL; // If SSL API connection is used. You need also change port to 87295 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 15 15 16 16 function __construct() -
trunk/Modules/NetworkConfigRouterOS/SSH.php
r874 r888 3 3 class SSH 4 4 { 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; 9 9 10 10 function __construct($HostName = 'localhost', $UserName = 'admin', $Password = '') … … 13 13 $this->UserName = $UserName; 14 14 $this->Password = $Password; 15 $this->Methods = array(); 15 16 } 16 17 17 function Execute( $Commands)18 function Execute(array $Commands): array 18 19 { 19 20 echo($Commands); -
trunk/Modules/NetworkShare/SharePage.php
r887 r888 3 3 class SharePage extends Page 4 4 { 5 var$Dependencies = array('Log');6 var$MaxNesting = 20; // Maximální vnoření7 var$Promene = array( // Automatické zapamatování proměnných5 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 8 8 'keyword' => '', 9 9 'file_type' => 0, … … 25 25 } 26 26 27 function ShowTime() 27 function ShowTime(): string 28 28 { 29 29 return date("H:i:s")."<br />\n"; … … 40 40 41 41 // Najde cestu ke keřenu 42 function PlnaCesta($Row) 42 function PlnaCesta($Row): string 43 43 { 44 44 // Vyhledání cesty … … 60 60 61 61 // Převede velikost v bajtech na odpovídající jednotky 62 function PrevedVelikost($Velikost) 62 function PrevedVelikost($Velikost): string 63 63 { 64 64 $Jednotky = array('B','kB','MB','GB','TB','PB','EB'); -
trunk/Modules/NetworkTopology/NetworkTopology.php
r887 r888 3 3 class PageNetworkTopology extends Page 4 4 { 5 var$TopHostName = 'NIX-ROUTER';5 public string $TopHostName = 'NIX-ROUTER'; 6 6 7 7 function __construct(System $System) … … 23 23 } 24 24 25 function ShowImage() 25 function ShowImage(): string 26 26 { 27 27 $this->SimplePage = true; … … 117 117 } 118 118 119 function ShowOverview() 119 function ShowOverview(): string 120 120 { 121 121 $Output = '<img src="topologie.png"><br/> -
trunk/Modules/TimeMeasure/Graph.php
r887 r888 3 3 class PageGraph extends Page 4 4 { 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; 10 10 11 11 function __construct(System $System) -
trunk/Modules/TimeMeasure/Measure.php
r874 r888 3 3 class Measure extends Model 4 4 { 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 15 15 { 16 16 $Result = $this->Database->select('Measure', '*', 'Id='.$Id); … … 28 28 } 29 29 30 function StatTableName( $Level)30 function StatTableName(int $Level): string 31 31 { 32 32 if ($Level == 0) return 'Data'; … … 419 419 // Load measures 420 420 $Measures = array(); 421 $Result = $ Database->select('Measure', '*');421 $Result = $this->Database->select('Measure', '*'); 422 422 while ($Row = $Result->fetch_assoc()) 423 423 { 424 $Measure s = new Measure();424 $Measure = new Measure($this->System); 425 425 $Measure->Load($Row['Id']); 426 426 } -
trunk/Packages/Common/BigInt.php
r870 r888 9 9 // First byte is MSB and last byte is LSB 10 10 11 function BigIntNew($BitWidth) 11 function BigIntNew($BitWidth): string 12 12 { 13 13 return str_repeat(chr(0), $BitWidth >> 3); 14 14 } 15 15 16 function BigIntNewAs($A) 16 function BigIntNewAs($A): string 17 17 { 18 18 return str_repeat(chr(0), strlen($A)); 19 19 } 20 20 21 function BigIntCheck( $A, $B)21 function BigIntCheck(string $A, string $B): void 22 22 { 23 23 if (strlen($A) != strlen($B)) … … 25 25 } 26 26 27 function BigIntAdd( $A, $B)27 function BigIntAdd(string $A, string $B): string 28 28 { 29 29 BigIntCheck($A, $B); … … 40 40 } 41 41 42 function BigIntSub( $A, $B)42 function BigIntSub(string $A, string $B): string 43 43 { 44 44 BigIntCheck($A, $B); … … 55 55 } 56 56 57 function BigIntInc( $A)57 function BigIntInc(string $A): string 58 58 { 59 59 $Result = BigIntNewAs($A); … … 69 69 } 70 70 71 function BigIntDec( $A)71 function BigIntDec(string $A): string 72 72 { 73 73 $Result = BigIntNewAs($A); … … 83 83 } 84 84 85 function BigIntNeg( $A)85 function BigIntNeg(string $A): string 86 86 { 87 87 return BigIntInc(BigIntNot($A)); 88 88 } 89 89 90 function BigIntIsNeg( $A)90 function BigIntIsNeg(string $A): string 91 91 { 92 92 return ord($A[0]) & 0x80; 93 93 } 94 94 95 function BigIntEqual( $A, $B)95 function BigIntEqual(string $A, string $B): bool 96 96 { 97 97 return $A == $B; // Simple string comparison 98 98 } 99 99 100 function BigIntNotEqual( $A, $B)100 function BigIntNotEqual(string $A, string $B): bool 101 101 { 102 102 return $A != $B; // Simple string comparison 103 103 } 104 104 105 function BigIntGreater( $A, $B)105 function BigIntGreater(string $A, string $B): bool 106 106 { 107 107 return BigIntIsNeg(BigIntSub($B, $A)); 108 108 } 109 109 110 function BigIntGreaterOrEqual( $A, $B)110 function BigIntGreaterOrEqual(string $A, string $B): bool 111 111 { 112 112 return BigIntIsNeg(BigIntSub($B, $A)) or BigIntEqual($A, $B); 113 113 } 114 114 115 function BigIntLesser( $A, $B)115 function BigIntLesser(string $A, string $B): bool 116 116 { 117 117 return BigIntIsNeg(BigIntSub($A, $B)); 118 118 } 119 119 120 function BigIntLesserOrEqual( $A, $B)120 function BigIntLesserOrEqual(string $A, string $B): bool 121 121 { 122 122 return BigIntIsNeg(BigIntSub($A, $B)) or BigIntEqual($A, $B); 123 123 } 124 124 125 function BigIntMul( $A, $B)126 { 127 BigIntCheck($A, $B); 128 $Result = BigIntNewAs($A); 129 while (BigIntGreater($B, BigIntNew ()))125 function BigIntMul(string $A, string $B): string 126 { 127 BigIntCheck($A, $B); 128 $Result = BigIntNewAs($A); 129 while (BigIntGreater($B, BigIntNewAs($A))) 130 130 { 131 131 $Result = BigIntAdd($Result, $A); … … 135 135 } 136 136 137 function BigIntDiv( $A, $B)137 function BigIntDiv(string $A, string $B): string 138 138 { 139 139 BigIntCheck($A, $B); … … 147 147 } 148 148 149 function BigIntMod( $A, $B)149 function BigIntMod(string $A, string $B): string 150 150 { 151 151 BigIntCheck($A, $B); … … 159 159 } 160 160 161 function BigIntAnd( $A, $B)161 function BigIntAnd(string $A, string $B): string 162 162 { 163 163 BigIntCheck($A, $B); … … 170 170 } 171 171 172 function BigIntOr( $A, $B)172 function BigIntOr(string $A, string $B): string 173 173 { 174 174 BigIntCheck($A, $B); … … 181 181 } 182 182 183 function BigIntXor( $A, $B)183 function BigIntXor(string $A, string $B): string 184 184 { 185 185 BigIntCheck($A, $B); … … 192 192 } 193 193 194 function BigIntNot( $A)194 function BigIntNot(string $A): string 195 195 { 196 196 $Result = BigIntNewAs($A); … … 202 202 } 203 203 204 function BigIntShl1( $A)204 function BigIntShl1(string $A): string 205 205 { 206 206 $Result = BigIntNewAs($A); … … 213 213 } 214 214 215 function BigIntShl( $A, $B)215 function BigIntShl(string $A, string $B): string 216 216 { 217 217 BigIntCheck($A, $B); … … 224 224 } 225 225 226 function BigIntShr1( $A)226 function BigIntShr1(string $A): string 227 227 { 228 228 $Result = BigIntNewAs($A); … … 235 235 } 236 236 237 function BigIntShr( $A, $B)237 function BigIntShr(string $A, string $B): string 238 238 { 239 239 BigIntCheck($A, $B); … … 246 246 } 247 247 248 function BigIntToHex( $A)248 function BigIntToHex(string $A): string 249 249 { 250 250 $Result = ''; … … 256 256 } 257 257 258 function HexToBigInt( $A, $BitWidth)258 function HexToBigInt(string $A, int $BitWidth): string 259 259 { 260 260 $Result = BigIntNew($BitWidth); … … 275 275 } 276 276 277 function BigIntToBin( $A)277 function BigIntToBin(string $A): string 278 278 { 279 279 $Result = ''; … … 285 285 } 286 286 287 function BinToBigInt( $A, $BitWidth)287 function BinToBigInt(string $A, int $BitWidth): string 288 288 { 289 289 $Result = BigIntNew($BitWidth); … … 305 305 } 306 306 307 function BigIntToInt( $A)307 function BigIntToInt(string $A): int 308 308 { 309 309 // 32-bit int support … … 311 311 } 312 312 313 function IntToBigInt( $A, $BitWidth)313 function IntToBigInt(int $A, int $BitWidth): string 314 314 { 315 315 $Result = BigIntNew($BitWidth); … … 322 322 } 323 323 324 function BigIntToDec( $A)324 function BigIntToDec(string $A): string 325 325 { 326 326 $BitWidth = strlen($A) << 3; … … 335 335 } 336 336 337 function DecToBigInt( $A, $BitWidth)337 function DecToBigInt(string $A, int $BitWidth): string 338 338 { 339 339 $Result = BigIntNew($BitWidth); … … 342 342 { 343 343 $Result = BigIntMul($Result, IntToBigInt(10, $BitWidth)); 344 $Result = BigIntAdd($Result, IntToBigInt(intval($A[$I] , $BitWidth)));344 $Result = BigIntAdd($Result, IntToBigInt(intval($A[$I]), $BitWidth)); 345 345 $I++; 346 346 } -
trunk/Packages/Common/Config.php
r874 r888 3 3 class Config 4 4 { 5 var$Data;5 public array $Data; 6 6 7 7 function __construct() … … 10 10 } 11 11 12 function ReadValue( $Name)12 function ReadValue(string $Name) 13 13 { 14 14 if (!is_array($Name)) $Name = explode('/', $Name); … … 22 22 } 23 23 24 function WriteValue( $Name, $Value)24 function WriteValue(string $Name, $Value) 25 25 { 26 26 if (!is_array($Name)) $Name = explode('/', $Name); … … 34 34 } 35 35 36 function LoadFromFile( $FileName)36 function LoadFromFile(string $FileName): void 37 37 { 38 38 $ConfigData = array(); … … 40 40 foreach ($this->Data as $Index => $Item) 41 41 { 42 if (array_key_exi ts($Index, $ConfigData))42 if (array_key_exists($Index, $ConfigData)) 43 43 $this->Data[$Index] = $ConfigData[$Index]; 44 44 } 45 45 } 46 46 47 function SaveToFile( $FileName)47 function SaveToFile(string $FileName): void 48 48 { 49 49 file_put_contents($FileName, "<?php \n\n\$ConfigData = ".var_export($this->Data, true).";\n"); 50 50 } 51 51 52 function GetAsArray() 52 function GetAsArray(): array 53 53 { 54 54 return $this->Data; -
trunk/Packages/Common/Database.php
r887 r888 12 12 class DatabaseResult 13 13 { 14 var$PDOStatement;14 public PDOStatement $PDOStatement; 15 15 public int $num_rows = 0; 16 16 -
trunk/Packages/Common/Generics.php
r887 r888 3 3 class GenericList 4 4 { 5 var$Items = array();5 public array $Items = array(); 6 6 7 7 function Add($Item): void -
trunk/Packages/Common/NetworkAddress.php
r874 r888 5 5 class NetworkAddressIPv4 6 6 { 7 var$Address;8 var$Prefix;7 public int $Address; 8 public int $Prefix; 9 9 10 10 function __construct() … … 14 14 } 15 15 16 function GetNetMask() 16 function GetNetMask(): int 17 17 { 18 18 return ((1 << IPV4_BIT_WIDTH) - 1) ^ ((1 << (IPV4_BIT_WIDTH - $this->Prefix)) - 1); 19 19 } 20 20 21 function AddressToString() 21 function AddressToString(): string 22 22 { 23 23 return implode('.', array(($this->Address >> 24) & 255, ($this->Address >> 16) & 255, ($this->Address >> 8) & 255, ($this->Address & 255))); 24 24 } 25 25 26 function AddressFromString( $Value)26 function AddressFromString(string $Value): void 27 27 { 28 28 $Parts = explode('.', $Value); … … 30 30 } 31 31 32 function GetRange() 32 function GetRange(): array 33 33 { 34 34 $From = new NetworkAddressIPv4(); … … 42 42 } 43 43 44 function ChangePrefix( $NewPrefix)44 function ChangePrefix(int $NewPrefix): void 45 45 { 46 46 $this->Prefix = $NewPrefix; … … 50 50 } 51 51 52 function Contain( $Address)52 function Contain(NetworkAddressIPv4 $Address): bool 53 53 { 54 54 $UpperNetmask = $this->GetNetMask(); … … 63 63 class NetworkAddressIPv6 64 64 { 65 var$Address;66 var$Prefix;65 public string $Address; 66 public int $Prefix; 67 67 68 68 function __construct() … … 72 72 } 73 73 74 function GetNetMask() 74 function GetNetMask(): string 75 75 { 76 76 return Int128Xor(Int128Sub(Int128Shl(IntToInt128(1), IntToInt128(IPV6_BIT_WIDTH)), IntToInt128(1)), … … 78 78 } 79 79 80 function AddressToString() 80 function AddressToString(): string 81 81 { 82 82 return inet_ntop($this->Address); 83 83 } 84 84 85 function AddressFromString( $Value)85 function AddressFromString(string $Value) 86 86 { 87 87 $this->Address = inet_pton($Value); 88 88 } 89 89 90 function ChangePrefix( $NewPrefix)90 function ChangePrefix(int $NewPrefix): void 91 91 { 92 92 $this->Prefix = $NewPrefix; … … 96 96 } 97 97 98 function GetOctets() 98 function GetOctets(): array 99 99 { 100 100 $Result = array(); … … 109 109 } 110 110 111 function EncodeMAC( $MAC)111 function EncodeMAC(string $MAC): void 112 112 { 113 113 $MAC = explode(':', $MAC); … … 124 124 } 125 125 126 function Contain( $Address)126 function Contain(NetworkAddressIPv6 $Address): bool 127 127 { 128 128 $UpperNetmask = $this->GetNetMask(); -
trunk/Packages/Common/Page.php
r887 r888 7 7 public string $ParentClass; 8 8 public bool $ClearPage; 9 var$OnSystemMessage;9 public $OnSystemMessage; 10 10 public string $Load; 11 11 public string $Unload; -
trunk/Packages/Common/Process.php
r874 r888 3 3 class Process 4 4 { 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 11 11 function __construct() 12 12 { … … 17 17 $this->WorkingDir = null; 18 18 } 19 20 function Start() 19 20 function Start(): void 21 21 { 22 22 if (!$this->IsRunning()) … … 28 28 ); 29 29 30 $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes, 30 $this->Handle = proc_open($this->Command, $DescriptorSpec, $this->Pipes, 31 31 $this->WorkingDir, $this->Environment); 32 32 stream_set_blocking($this->Pipes[0], FALSE); … … 35 35 } 36 36 } 37 38 function Stop() 37 38 function Stop(): void 39 39 { 40 if ($this->IsRunning()) 40 if ($this->IsRunning()) 41 41 { 42 42 proc_close($this->Handle); … … 44 44 } 45 45 } 46 47 function IsRunning() 46 47 function IsRunning(): bool 48 48 { 49 49 return is_resource($this->Handle); -
trunk/Packages/Common/Table.php
r887 r888 3 3 class Control 4 4 { 5 var$Name;5 public string $Name; 6 6 7 7 function Show(): string -
trunk/Packages/Common/UTF8.php
r887 r888 526 526 } 527 527 528 function ToUTF8string ($String, string $Charset = 'iso2'): string528 function ToUTF8string(string $String, string $Charset = 'iso2'): string 529 529 { 530 530 $Result = ''; -
trunk/Packages/Common/Update.php
r887 r888 18 18 } 19 19 20 function GetDbVersion() 20 function GetDbVersion(): string 21 21 { 22 22 $DbResult = $this->Database->select($this->VersionTable, '*', 'Id=1'); … … 25 25 } 26 26 27 function IsInstalled() 27 function IsInstalled(): bool 28 28 { 29 29 $DbResult = $this->Database->query('SHOW TABLES LIKE "'.$this->VersionTable.'"'); … … 31 31 } 32 32 33 function IsUpToDate() 33 function IsUpToDate(): bool 34 34 { 35 35 return $this->Revision <= $this->GetDbVersion(); 36 36 } 37 37 38 function Upgrade() 38 function Upgrade(): string 39 39 { 40 40 $DbRevision = $this->GetDbVersion(); … … 58 58 } 59 59 60 function Install() 60 function Install(): void 61 61 { 62 62 $InstallMethod = $this->InstallMethod; … … 64 64 } 65 65 66 function Uninstall() 66 function Uninstall(): void 67 67 { 68 69 68 } 70 69 71 function InsertSampleData() 70 function InsertSampleData(): void 72 71 { 73 72 $InstallMethod = $this->InsertSampleDataMethod;
Note:
See TracChangeset
for help on using the changeset viewer.