Changeset 891 for trunk/Modules/Forum


Ignore:
Timestamp:
Jan 13, 2023, 12:40:34 AM (2 years ago)
Author:
chronos
Message:
  • Fixed: HTML BBCode parser not supported for newer PHP 8.1. Replaced by simpler solution.
File:
1 edited

Legend:

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

    r888 r891  
    4040  function ShowBox()
    4141  {
    42     $Parser = new HTML_BBCodeParser2(array('filters' => array('Basic', 'Extended',
    43       'Images', 'Links', 'Lists', 'Email')));
    4442    $Count = 20;
    4543    $Output = '<strong><a href="'.$this->System->Link('/forum/').'">'.T('Last forum posts').':</a></strong>';
     
    5856        '<td><a href="'.$this->System->Link('/forum/?Thread='.$DbRow['Thread']).'">'.HumanDate($DbRow['Date']).'</a></td>'.
    5957        '<td><a href="'.$this->System->Link('/user/?user='.$DbRow['UserId']).'">'.$DbRow['UserName'].'</a></td>'.
    60         '<td>'.$Parser->qparse(htmlspecialchars($DbRow['Text'])).'</td>'.
     58        '<td>'.ShowBBcodes(htmlspecialchars($DbRow['Text'])).'</td>'.
    6159        '</tr>';
    6260    }
     
    7472    if (array_key_exists('a', $_POST)) $Action = $_POST['a'];
    7573      else if (array_key_exists('a', $_GET)) $Action = $_GET['a'];
    76        else $Action = '';
     74      else $Action = '';
    7775    if (array_key_exists('Edit', $_GET)) {
    7876      if (array_key_exists('text', $_POST))
    7977        $Output .= $this->Edit();
    8078      $Output .= $this->ShowEditForm();
    81 
    8279    } else
    8380    if (array_key_exists('search', $_GET))
     
    10198  {
    10299    $Output = '';
    103     $Text = $_POST['text'];
    104     $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']);
     100    $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']);
    105101    $Output .= ShowMessage(T('Text edited.'));
    106102    return $Output;
     
    132128  function ShowSearchForum()
    133129  {
    134     $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email')));
    135     $Count = 20;
    136130    $Output = '';
    137131
     
    153147      $Output .= '<div><a href="'.$this->System->Link('/forum/?Thread='.$Line['Thread']).'">'.
    154148      htmlspecialchars($Line['ThreadName']).'</a><br /><strong>'.$Line['UserName'].
    155       '</strong> ('.HumanDate($Line['Date']).'): '.$parser->qparse(htmlspecialchars($Line['Text'])).'</div> ';
     149      '</strong> ('.HumanDate($Line['Date']).'): '.ShowBBcodes(htmlspecialchars($Line['Text'])).'</div> ';
    156150    $Output .= '</div>'.$PageList['Output'];
    157151    return $Output;
     
    181175    $Output = '';
    182176
    183     $Parser = new HTML_BBCodeParser2(array('filters' => array('Basic', 'Extended', 'Images', 'Links', 'Lists', 'Email')));
    184 
    185177    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
    186178    else if (!array_key_exists('search', $_SESSION)) $_SESSION['search'] = '';
     
    212204        $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
    213205      } else $edit = '';
    214       $Text = str_replace("\n", '<br />', $Parser->qparse(htmlspecialchars($Line['Text'])));
     206      $Text = str_replace("\n", '<br />', ShowBBcodes(htmlspecialchars($Line['Text'])));
    215207      $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).
    216208        ')</span><strong>'.$Line['UserName'].'</strong>: '.$Text.'  </div> ';
     
    306298  function ShowRSS()
    307299  {
    308     $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email')));
    309 
    310300    $Items = array();
    311301    $TitleLength = 50;
     
    322312        'Title' => htmlspecialchars($DbRow['ThreadText']).' - '.$DbRow['UserName'].': ',
    323313        'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/?Thread='.$DbRow['Thread']),
    324         'Description' => $parser->qparse(htmlspecialchars($DbRow['Text'])),
     314        'Description' => ShowBBcodes(htmlspecialchars($DbRow['Text'])),
    325315        'Time' => $DbRow['UnixDate'],
    326316      );
Note: See TracChangeset for help on using the changeset viewer.