Changeset 915


Ignore:
Timestamp:
Dec 7, 2021, 9:56:09 PM (3 years ago)
Author:
chronos
Message:
  • Fixed: Various PHP 8.0 related fixes.
Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/BaseView.php

    r912 r915  
    55class BaseView extends View
    66{
    7   var $TimeStart;
    87  public bool $FormatHTML = false;
    98  public bool $ShowRuntimeInfo = false;
     
    2423    $this->Encoding = 'utf-8';
    2524    $this->Style = 'new';
    26 
    27     // TODO: Move to external code
    28     if (isset($this->System->Config['Web']['FormatHTML']))
    29       $this->FormatHTML = $this->System->Config['Web']['FormatHTML'];
    30     if (isset($this->System->Config['Web']['ShowRuntimeInfo']))
    31       $this->ShowRuntimeInfo = $this->System->Config['Web']['ShowRuntimeInfo'];
    32     if (isset($this->System->Config['Web']['Charset']))
    33       $this->Encoding = $this->System->Config['Web']['Charset'];
    34     if (isset($this->System->Config['Web']['Style']))
    35       $this->Style = $this->System->Config['Web']['Style'];
    3625  }
    3726
     
    11099  function ShowFooter(): string
    111100  {
    112     global $ScriptTimeStart, $Revision, $ReleaseTime;
     101    global $Revision, $ReleaseTime;
    113102
    114     $Time = round(GetMicrotime() - $ScriptTimeStart, 2);
     103    $Time = round(GetMicrotime() - $this->System->ScriptTimeStart, 2);
    115104    $Output = '';
    116105    if ($this->BasicHTML == false)
  • trunk/Application/Core.php

    r912 r915  
    2626  public LocaleManager $LocaleManager;
    2727  public array $LinkLocaleExceptions;
     28  public float $ScriptTimeStart;
    2829
    2930  function __construct()
     
    5960  {
    6061    $this->BaseView = new BaseView($this);
     62    if (isset($this->Config['Web']['FormatHTML']))
     63      $this->BaseView->FormatHTML = $this->Config['Web']['FormatHTML'];
     64    if (isset($this->Config['Web']['ShowRuntimeInfo']))
     65      $this->BaseView->ShowRuntimeInfo = $this->Config['Web']['ShowRuntimeInfo'];
     66    if (isset($this->Config['Web']['Charset']))
     67      $this->BaseView->Encoding = $this->Config['Web']['Charset'];
     68    if (isset($this->Config['Web']['Style']))
     69      $this->BaseView->Style = $this->Config['Web']['Style'];
    6170
    6271    /* @var $Page Page */
     
    8998  function RunCommon(): void
    9099  {
    91     global $Database, $ScriptTimeStart, $ConfigFileName, $Config, $GlobalLocaleManager;
     100    global $Database, $ConfigFileName, $Config, $GlobalLocaleManager;
    92101
    93102    date_default_timezone_set('Europe/Prague');
    94103    mb_internal_encoding("UTF-8");
    95     $ScriptTimeStart = GetMicrotime();
     104    $this->ScriptTimeStart = GetMicrotime();
    96105
    97106    // SQL injection hack protection
  • trunk/Application/Version.php

    r914 r915  
    11<?php
    22
    3 $Revision = 914; // Subversion revision
     3$Revision = 915; // Subversion revision
    44$DatabaseRevision = 911; // SQL structure revision
    5 $ReleaseTime = strtotime('2021-09-22');
     5$ReleaseTime = strtotime('2021-12-07');
  • trunk/Modules/IS/IS.php

    r914 r915  
    648648      }
    649649    }
    650     echo($UserFilter);
    651650    if ($UserFilter != '')
    652651    {
  • trunk/Modules/NetworkConfigLinux/Generators/DNS.php

    r897 r915  
    159159    $MinimumTime = 10800;
    160160    $TTL = 86400;
    161     $BaseDir = '/var/cache/bind';
     161    if ($this->System->Config['DNS']['BaseDir'])
     162      $BaseDir = $this->System->Config['DNS']['BaseDir'];
     163      else $BaseDir = '/var/cache/bind';
    162164    if (!file_exists($BaseDir)) die('Base directory "'.$BaseDir.'" not exists.');
    163165    $MailServer = 'centrala';
  • trunk/Modules/NetworkConfigRouterOS/Routerboard.php

    r888 r915  
    4444  }
    4545
    46   function ExecuteBatch(string $Commands): string
     46  function ExecuteBatch(string $Commands): array
    4747  {
    4848    $Commands = trim($Commands);
     
    6060      $Output = array();
    6161      exec($Command, $Output);
    62     } else $Output = '';
     62    } else $Output = array();
    6363    if ($this->Debug) print_r($Output);
    6464    return $Output;
     
    140140          if (count($Value) > 1)
    141141          {
    142             if ($Value[1]{0} == '"') $Value[1] = substr($Value[1], 1, -1);
     142            if ($Value[1][0] == '"') $Value[1] = substr($Value[1], 1, -1);
    143143            //if (strlen($Value[1]) > 0)
    144144            $ListItem[$Value[0]] = $Value[1];
  • trunk/Modules/NetworkConfigRouterOS/RouterboardAPI.php

    r888 r915  
    1010  public int $Port;        // Port to connect to
    1111  public int $Timeout;        // Connection attempt timeout and data read timeout
    12   public int $Socket;             // Variable for storing socket resource
     12  public $Socket;             // Variable for storing socket resource
    1313  public bool $Debug;
    1414  public bool $SSL; // If SSL API connection is used. You need also change port to 8729
     
    2323    $this->Debug = false;
    2424    $this->SSL = false;
    25   }
    26 
    27   function EncodeLength(int $Length): int
     25    $this->ErrorNo = 0;
     26    $this->ErrorStr = "";
     27  }
     28
     29  function EncodeLength(int $Length): string
    2830  {
    2931    if ($Length < 0x80)
  • trunk/Modules/NetworkConfigRouterOS/SSH.php

    r888 r915  
    3737          }
    3838            /*
    39             //echo(') '.strlen($Buffer).' '.ord($Buffer{0}).'(');
     39            //echo(') '.strlen($Buffer).' '.ord($Buffer[0]).'(');
    4040            for ($I = 0; $I < strlen($Buffer); $I++)
    4141            {
    42               if (((ord($Buffer{$I}) >= 32) and (ord($Buffer{$I}) <= 128)) or ($Buffer{$I} = "\n") or ($Buffer{$I} = "\r")) echo($Buffer{$I});
    43               if ($Buffer{$I} == '>')
     42              if (((ord($Buffer[$I]) >= 32) and (ord($Buffer[$I]) <= 128)) or ($Buffer[$I] = "\n") or ($Buffer[$I] = "\r")) echo($Buffer[$I]);
     43              if ($Buffer[$I] == '>')
    4444              {
    4545                fwrite($Stream, $Commands."\n\r");
  • trunk/Packages/Common/Error.php

    r887 r915  
    1616  }
    1717
    18   function Start()
     18  function Start(): void
    1919  {
    2020    set_error_handler(array($this, 'ErrorHandler'));
     
    2222  }
    2323
    24   function Stop()
     24  function Stop(): void
    2525  {
    2626    restore_error_handler();
     
    2828  }
    2929
    30   function ErrorHandler($Number, $Message, $FileName, $LineNumber, $Variables)
     30  function ErrorHandler(int $Number, string $Message, string $FileName, int $LineNumber, array $Variables = array()): bool
    3131  {
    3232    $ErrorType = array
     
    6363  }
    6464
    65   function ExceptionHandler(Throwable $Exception)
     65  function ExceptionHandler(Throwable $Exception): void
    6666  {
    6767    $Backtrace = $Exception->getTrace();
     
    8888  }
    8989
    90   function Report($Backtrace)
     90  function Report(array $Backtrace): void
    9191  {
    9292    $Date = date('Y-m-d H:i:s');
Note: See TracChangeset for help on using the changeset viewer.