Ignore:
Timestamp:
Oct 2, 2024, 10:31:47 PM (3 months ago)
Author:
chronos
Message:
  • Fixed: More integer URL parameters checking.
  • Modified: More explicit function types.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/ClientVersion/ClientVersion.php

    r888 r901  
    3939  }
    4040
    41   function ShowItem()
     41  function ShowItem(): string
    4242  {
    43     if (array_key_exists('id', $_GET))
     43    $Id = 0;
     44    if (TryGetUrlParameterInt('id', $Id))
    4445    {
    4546      $YesNo = array('Ne', 'Ano');
    46       $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.($_GET['id']*1));
     47      $DbResult = $this->System->Database->query('SELECT * FROM `ClientVersion` WHERE `Id`='.$Id);
    4748      if ($DbResult->num_rows > 0)
    4849      {
    4950        $Version = $DbResult->fetch_assoc();
    5051
    51       $Output = '<h3>'.T('Client version').'</h3>';
    52       $Output .= '<table class="BaseTable">'.
    53         '<tr><td>'.T('Version').'</td><td>'.$Version['Version'].'</td></tr>'.
    54         '<tr><td>'.T('More information').'</td><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">wowwiki.com'.
    55         '</a></td></tr>'.
    56         '<tr><td>'.T('Build number').'</td><td>'.$Version['BuildNumber'].'</td></tr>'.
    57         '<tr><td>'.T('Release date').'</td><td>'.HumanDate($Version['ReleaseDate']).'</td></tr>'.
    58         '<tr><td>'.T('Title').'</td><td>'.$Version['Title'].'</td></tr>'.
    59         '<tr><td>'.T('Imported').'</td><td>'.$YesNo[$Version['Imported']].'</td></tr>'.
    60         '</table>';
     52        $Output = '<h3>'.T('Client version').'</h3>';
     53        $Output .= '<table class="BaseTable">'.
     54          '<tr><td>'.T('Version').'</td><td>'.$Version['Version'].'</td></tr>'.
     55          '<tr><td>'.T('More information').'</td><td><a href="http://www.wowwiki.com/Patch_'.$Version['Version'].'">wowwiki.com'.
     56          '</a></td></tr>'.
     57          '<tr><td>'.T('Build number').'</td><td>'.$Version['BuildNumber'].'</td></tr>'.
     58          '<tr><td>'.T('Release date').'</td><td>'.HumanDate($Version['ReleaseDate']).'</td></tr>'.
     59          '<tr><td>'.T('Title').'</td><td>'.$Version['Title'].'</td></tr>'.
     60          '<tr><td>'.T('Imported').'</td><td>'.$YesNo[$Version['Imported']].'</td></tr>'.
     61          '</table>';
    6162        $Output .= '<div><a href="?">'.T('All versions list').'</a></div>';
    6263        if ($Version['Imported'])
     64        {
    6365          $Output .= '<div><a href="'.$this->System->Link('/progress/?Version='.
    6466            $Version['Version']).'">'.T('Progress').'</a></div>';
     67        }
    6568      } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
    66     } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     69    } else $Output = ShowMessage(T('Id not valid'), MESSAGE_CRITICAL);
    6770    return $Output;
    6871  }
    6972
    70   function ShowList()
     73  function ShowList(): string
    7174  {
    7275    $this->Title = T('Game version');
Note: See TracChangeset for help on using the changeset viewer.