Changeset 957 for trunk


Ignore:
Timestamp:
Sep 22, 2023, 11:55:38 PM (15 months ago)
Author:
chronos
Message:
  • Added: Store request URL into Log table.
  • Fixed: Some warnings for invalid inputs.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/BaseView.php

    r929 r957  
    7575    '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->Encoding.'" />'.
    7676    '<script type="text/javascript" src="'.$this->System->Link('/style/').$this->Style.'/global.js"></script>'.
    77     '<title>'.$Path.' - '.$this->System->Config['Web']['Title'].'</title>';
     77    '<title>'.$Path.' - '.Core::Cast($this->System)->Config['Web']['Title'].'</title>';
    7878
    7979    // Show page headers
    8080    $Bar = '';
    81     foreach ($this->System->PageHeaders as $Item)
     81    foreach (Core::Cast($this->System)->PageHeaders as $Item)
    8282      $Output .= call_user_func($Item);
    8383
     
    8888      $Output .= '<div class="MainTitle"><span class="MenuItem"><strong>Navigace :: </strong> '.$Navigation.'</span><div class="MenuItem2">';
    8989      $Bar = '';
    90       foreach ($this->System->Bars['Top'] as $BarItem)
     90      foreach (Core::Cast($this->System)->Bars['Top'] as $BarItem)
    9191        $Bar .= call_user_func($BarItem);
    9292      if (trim($Bar) != '') $Output .= $Bar;
     
    101101    global $Revision, $ReleaseTime;
    102102
    103     $Time = round(GetMicrotime() - $this->System->ScriptTimeStart, 2);
     103    $Time = round(GetMicrotime() - Core::Cast($this->System)->ScriptTimeStart, 2);
    104104    $Output = '';
    105105    if ($this->BasicHTML == false)
    106106    {
    107107      $Output .= '<div id="Footer">'.
    108       '<i>| Správa webu: '.$this->System->Config['Web']['Admin'].' | e-mail: '.$this->System->Config['Web']['AdminEmail'].' | '.
     108      '<i>| Správa webu: '.Core::Cast($this->System)->Config['Web']['Admin'].' | e-mail: '.Core::Cast($this->System)->Config['Web']['AdminEmail'].' | '.
    109109      ' Verze: '.$Revision.' ('.Core::Cast($this->System)->HumanDate($ReleaseTime).') |';
    110110      if ($this->ShowRuntimeInfo == true) $Output .= ' Doba generování: '.$Time.' s / '.ini_get('max_execution_time').
     
    118118  function GetOutput(Page $Page): string
    119119  {
    120     $Page->OnSystemMessage = array($this->System->BaseView, 'SystemMessage');
     120    $Page->OnSystemMessage = array(Core::Cast($this->System)->BaseView, 'SystemMessage');
    121121
    122122    $Output = $Page->Show();
  • trunk/Application/UpdateTrace.php

    r953 r957  
    22372237{
    22382238  $Manager->Execute('ALTER TABLE `News` ADD `Intranet` INT NOT NULL DEFAULT "0" AFTER `Link`;');
     2239}
     2240
     2241function UpdateTo957(UpdateManager $Manager): void
     2242{
     2243  $Manager->Execute('ALTER TABLE `Log` ADD `URL` VARCHAR(255) NOT NULL AFTER `IPAddress`;');
    22392244}
    22402245
     
    23512356      939 => array('Revision' => 948, 'Function' => 'UpdateTo948'),
    23522357      948 => array('Revision' => 953, 'Function' => 'UpdateTo953'),
     2358      953 => array('Revision' => 957, 'Function' => 'UpdateTo957'),
    23532359    );
    23542360  }
  • trunk/Application/Version.php

    r956 r957  
    11<?php
    22
    3 $Revision = 956; // Subversion revision
    4 $DatabaseRevision = 953; // SQL structure revision
    5 $ReleaseTime = strtotime('2023-09-04');
     3$Revision = 957; // Subversion revision
     4$DatabaseRevision = 957; // SQL structure revision
     5$ReleaseTime = strtotime('2023-09-22');
  • trunk/Common/Global.php

    r953 r957  
    398398}
    399399
    400 function ExeceuteNoError(callable $Function): void
     400function ExecuteNoError(callable $Function): void
    401401{
    402402  try
     
    404404    $LastErrorReporting = error_reporting();
    405405    error_reporting(0);
    406     $function();
     406    $Function();
    407407  }
    408408  finally
  • trunk/Install/deb/debian/conf/Config.php

    r918 r957  
    3333$Config['Web']['ItemsPerPage'] = '50';
    3434$Config['Web']['VisiblePagingItems'] = '20';
    35 $Config['Web']['FormatHTML'] = '0';
    3635$Config['Web']['ShowSQLError'] = '0';
    3736$Config['Web']['ShowSQLQuery'] = false;
  • trunk/Modules/Error/Error.php

    r899 r957  
    2222  function DoStart(): void
    2323  {
    24     $this->ErrorHandler->ShowError = $this->System->Config['Web']['ShowPHPError'];
     24    $this->ErrorHandler->ShowError = Core::Cast($this->System)->Config['Web']['ShowPHPError'];
    2525    $this->ErrorHandler->OnError = array(array($this, 'DoOnError'));
    2626    $this->ErrorHandler->Start();
  • trunk/Modules/Log/Log.php

    r949 r957  
    3636  }
    3737
     38  function GetRequestURI(): string
     39  {
     40    if (array_key_exists('REQUEST_URI', $_SERVER)) return $_SERVER['REQUEST_URI'];
     41      else return $_SERVER['PHP_SELF'];
     42  }
     43
    3844  function NewRecord(string $Module, string $Operation, string $Value = ''): void
    3945  {
     
    4652    $this->Database->insert('Log', array('Time' => 'NOW()',
    4753      'User' => $UserId, 'Module' => $Module,
    48       'Operation' => $Operation, 'Value' => $Value, 'IPAddress' => $IPAddress));
     54      'Operation' => $Operation, 'Value' => $Value, 'IPAddress' => $IPAddress, 'URL' => $this->GetRequestURI()));
    4955  }
    5056
  • trunk/Modules/News/NewsPage.php

    r955 r957  
    2424    {
    2525      $Category = $this->GetCategory();
    26       if (array_key_exists('id', $_GET)) $Id = $_GET['id'] * 1;
     26      if (array_key_exists('id', $_GET) and is_integer($_GET['id'])) $Id = $_GET['id'] * 1;
    2727        else return $Output .= 'Položka nenalezena.';
    2828      $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '.
     
    6767    if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id']))
    6868    {
    69       $this->System->PageHeaders[] = array($this, 'GetPageHeader');
     69      Core::Cast($this->System)->PageHeaders[] = array($this, 'GetPageHeader');
    7070      $Output = '<strong>Vložení nové aktuality:</strong><br />';
    7171      // TODO: Static reference to dynamic category item
     
    170170        if ($Row['Intranet'] == 1) $IntranetChecked = ' checked="1"';
    171171          else $IntranetChecked = 0;
    172         $this->System->PageHeaders[] = array($this, 'GetPageHeader');
     172          Core::Cast($this->System)->PageHeaders[] = array($this, 'GetPageHeader');
    173173        $Output .= '<strong>Editace aktuality v kategorii '.$Category['Caption'].':</strong><br />';
    174174        $Output .= '<form action="?action=update" method="post">'.
     
    296296  {
    297297    $Category = array('Id' => 1); // Default category
    298     if (array_key_exists('category', $_GET)) $Category['Id'] = $_GET['category'] * 1;
    299     if (array_key_exists('category', $_POST)) $Category['Id'] = $_POST['category'] * 1;
     298    if (array_key_exists('category', $_GET) and is_integer($_GET['category'])) $Category['Id'] = $_GET['category'] * 1;
     299    if (array_key_exists('category', $_POST) and is_integer($_POST['category'])) $Category['Id'] = $_POST['category'] * 1;
    300300    //if (is_null($Category)) throw new Exception('Kategorie neurčena');
    301301    else
     
    311311  {
    312312    $Output = '';
    313     if (array_key_exists('action',$_GET)) $Action = $_GET['action'];
     313    if (array_key_exists('action', $_GET)) $Action = $_GET['action'];
    314314      else $Action = '';
    315315    if ($Action == 'view') $Output .= $this->ShowView();
     
    361361        if (substr($Index, 0, 8) == 'category') $Select .= '-'.substr($Index, 8);
    362362      }
    363       $Select = $this->System->Config['Web']['RootFolder'].'/aktuality/rss/?select='.substr($Select, 1);
     363      $Select = Core::Cast($this->System)->Config['Web']['RootFolder'].'/aktuality/rss/?select='.substr($Select, 1);
    364364      $Output = 'Výsledný RSS kanál: <a href="'.$Select.'">'.$Select.'</a>';
    365365    } else
     
    412412      foreach ($Parts as $Part)
    413413      {
    414         $Where .= 'OR (`Category`='.($Part * 1).')';
     414        if (is_integer($Part)) $Where .= 'OR (`Category`='.($Part * 1).')';
    415415      }
    416416      $Where = substr($Where, 2);
     
    474474      $Items[] = array(
    475475        'Title' => $Categories[$Row['Category']].' - '.$Row['Title'],
    476         'Link' => 'https://'.$this->System->Config['Web']['Host'].'/aktuality/?category='.$Row['Category'],
     476        'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].'/aktuality/?category='.$Row['Category'],
    477477        'Description' => $Row['Content'].' ('.$Author.')'.$EnclosuresText,
    478478        'Time' => $Row['UnixTime'],
     
    481481
    482482    $RSS = new RSS();
    483     $RSS->Title = $this->System->Config['Web']['Title'].' - Aktuality';
    484     $RSS->Link = 'https://'.$this->System->Config['Web']['Host'].'/';
    485     $RSS->Description = 'Aktuality '.$this->System->Config['Web']['Description'];
    486     $RSS->WebmasterEmail = $this->System->Config['Web']['AdminEmail'];
     483    $RSS->Title = Core::Cast($this->System)->Config['Web']['Title'].' - Aktuality';
     484    $RSS->Link = 'https://'.Core::Cast($this->System)->Config['Web']['Host'].'/';
     485    $RSS->Description = 'Aktuality '.Core::Cast($this->System)->Config['Web']['Description'];
     486    $RSS->WebmasterEmail = Core::Cast($this->System)->Config['Web']['AdminEmail'];
    487487    $RSS->Items = $Items;
    488488    return $RSS->Generate();
Note: See TracChangeset for help on using the changeset viewer.