Changeset 902 for trunk/Modules/Forum


Ignore:
Timestamp:
Feb 15, 2025, 9:29:56 AM (2 weeks ago)
Author:
chronos
Message:
  • Fixed: Showing date from null values.
  • Fixed_ Forum id validity check.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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  }
Note: See TracChangeset for help on using the changeset viewer.