Changeset 902


Ignore:
Timestamp:
Feb 15, 2025, 9:29:56 AM (7 days ago)
Author:
chronos
Message:
  • Fixed: Showing date from null values.
  • Fixed_ Forum id validity check.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r900 r902  
    77
    88$Version = '1.0';
    9 $Revision = 900; // Subversion revision
     9$Revision = 902; // Subversion revision
    1010$DatabaseRevision = 900; // Database structure revision
    11 $ReleaseDate = strtotime('2024-04-10');
     11$ReleaseDate = strtotime('2025-02-15');
  • trunk/Modules/Forum/Forum.php

    r900 r902  
    190190    } else $SearchQuery = '';
    191191
    192     $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.($_GET['Thread']*1).' LIMIT 1');
    193     if ($DbResult->num_rows > 0)
    194     {
    195     $Thread = $DbResult->fetch_assoc();
    196     $Output .= '<h3>'.htmlspecialchars($Thread['Text']).'</h3>';
    197 
    198     $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumText` WHERE `Thread` = '.($_GET['Thread']*1).' '.$SearchQuery);
    199     $DbRow = $DbResult->fetch_row();
    200     $PageList = GetPageList($DbRow[0]);
    201 
    202     $Output .= $PageList['Output'];
    203     $Output .= '<div class="shoutbox">';
    204     $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.
    205       ($_GET['Thread'] * 1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    206     while ($Line = $DbResult->fetch_assoc())
    207     {
    208       if ($User->Id == $Line['User'])
     192    $ThreadId = 0;
     193    if (TryGetUrlParameterInt('Thread', $ThreadId))
     194    {
     195      $DbResult = $this->System->Database->query('SELECT * FROM `ForumThread` WHERE ID='.$ThreadId.' LIMIT 1');
     196      if ($DbResult->num_rows > 0)
    209197      {
    210         $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
    211       } else $edit = '';
    212       $Text = str_replace("\n", '<br />', ShowBBcodes(htmlspecialchars($Line['Text'])));
    213       $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).
    214         ')</span><strong>'.$Line['UserName'].'</strong>: '.$Text.'  </div> ';
    215     }
    216     $Output .= '</div>'.$PageList['Output'];
    217     } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     198        $Thread = $DbResult->fetch_assoc();
     199        $Output .= '<h3>'.htmlspecialchars($Thread['Text']).'</h3>';
     200
     201        $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `ForumText` WHERE `Thread` = '.$ThreadId.' '.$SearchQuery);
     202        $DbRow = $DbResult->fetch_row();
     203        $PageList = GetPageList($DbRow[0]);
     204
     205        $Output .= $PageList['Output'];
     206        $Output .= '<div class="shoutbox">';
     207        $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.
     208          $ThreadId.' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
     209        while ($Line = $DbResult->fetch_assoc())
     210        {
     211          if ($User->Id == $Line['User'])
     212          {
     213            $Edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
     214          } else $Edit = '';
     215          $Text = str_replace("\n", '<br />', ShowBBcodes(htmlspecialchars($Line['Text'])));
     216          $Output .= '<div><span style="float:right;">'.$Edit.' ('.HumanDate($Line['Date']).
     217            ')</span><strong>'.$Line['UserName'].'</strong>: '.$Text.'  </div> ';
     218        }
     219        $Output .= '</div>'.$PageList['Output'];
     220      } else $Output .= ShowMessage(T('Item not found'), MESSAGE_CRITICAL);
     221    } else $Output .= ShowMessage(T('Id not found'), MESSAGE_CRITICAL);
    218222    return $Output;
    219223  }
  • trunk/Modules/Wiki/Wiki.php

    r893 r902  
    2525    {
    2626      $DbRow = $DbResult->fetch_assoc();
    27       if (array_key_exists('ver', $_GET))
    28       {
    29         $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$_GET['ver']*1);
     27      $Ver = 0;
     28      if (TryGetUrlParameterInt('ver', $Ver))
     29      { 
     30        $DbResult2 = $this->Database->select('WikiPageContent', '*', 'Page='.$DbRow['Id'].' AND Id='.$Ver);
    3031        if ($DbResult2->num_rows > 0)
    3132        {
  • trunk/includes/Global.php

    r901 r902  
    311311$Moderators = array('Překladatel', 'Moderátor', 'Administrátor');
    312312
    313 function HumanDate(string $SQLDateTime): string
    314 {
    315   if ($SQLDateTime == '') return '&nbsp;';
     313function HumanDate(?string $SQLDateTime): string
     314{
     315  if (($SQLDateTime == NULL) or ($SQLDateTime == '')) return '&nbsp;';
    316316  $DateTimeParts = explode(' ', $SQLDateTime);
    317317  if ($DateTimeParts[0] != '0000-00-00')
     
    322322}
    323323
    324 function HumanDateTime(string $SQLDateTime): string
    325 {
    326   if ($SQLDateTime == '') return '&nbsp;';
     324function HumanDateTime(?string $SQLDateTime): string
     325{
     326  if (($SQLDateTime == NULL) or ($SQLDateTime == '')) return '&nbsp;';
    327327  $DateTimeParts = explode(' ', $SQLDateTime);
    328328  if ($DateTimeParts[0] != '0000-00-00' and $SQLDateTime <> '')
     
    430430function LoadCommandLineParameters(): void
    431431{
    432   if (!array_key_exists('REMOTE_ADDR', $_SERVER))
     432  if (!array_key_exists('REMOTE_ADDR', $_SERVER) && is_array($_SERVER['argv']))
    433433  {
    434434    foreach ($_SERVER['argv'] as $Parameter)
Note: See TracChangeset for help on using the changeset viewer.