Ignore:
Timestamp:
Dec 27, 2022, 7:50:23 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Updated Common package to latest version.
  • Modified: Fixes related to PHP 8.x.
File:
1 edited

Legend:

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

    r880 r888  
    11<?php
    22
    3 class ModuleForum extends AppModule
     3class ModuleForum extends Module
    44{
    55  function __construct(System $System)
     
    1414  }
    1515
    16   function DoStart()
    17   {
    18     $this->System->RegisterPage('forum', 'PageForum');
     16  function DoStart(): void
     17  {
     18    $this->System->RegisterPage(['forum'], 'PageForum');
    1919    $this->System->ModuleManager->Modules['News']->RegisterRSS(array(
    2020      'Title' => T('Forum'), 'Channel' => 'forum', 'Callback' => array('PageForum', 'ShowRSS'),
     
    2929      $this->System->Link('/forum/?search='));
    3030
    31     $this->System->RegisterMenuItem(array(
     31    Core::Cast($this->System)->RegisterMenuItem(array(
    3232      'Title' => T('Forum'),
    3333      'Hint' => T('Forum about translation wow'),
     
    6868class PageForum extends Page
    6969{
    70   function Show()
     70  function Show(): string
    7171  {
    7272    $Output = '';
     
    181181    $Output = '';
    182182
    183     $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email')));
     183    $Parser = new HTML_BBCodeParser2(array('filters' => array('Basic', 'Extended', 'Images', 'Links', 'Lists', 'Email')));
    184184
    185185    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     
    205205    $Output .= '<div class="shoutbox">';
    206206    $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.
    207       ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    208     while ($Line = $DbResult->fetch_assoc()) {
     207      ($_GET['Thread'] * 1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
     208    while ($Line = $DbResult->fetch_assoc())
     209    {
    209210      if ($this->System->User->Id == $Line['User'])
     211      {
    210212        $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
    211       else $edit = '';
     213      } else $edit = '';
     214      $Text = str_replace("\n", '<br />', $Parser->qparse(htmlspecialchars($Line['Text'])));
    212215      $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).
    213         ')</span><strong>'.$Line['UserName'].'</strong>: '.str_replace("\n", '<br />',
    214         $parser->qparse(htmlspecialchars($Line['Text']))).'  </div> ';
     216        ')</span><strong>'.$Line['UserName'].'</strong>: '.$Text.'  </div> ';
    215217    }
    216218    $Output .= '</div>'.$PageList['Output'];
     
    243245    if ($this->System->User->Licence(LICENCE_USER))
    244246    {
    245         $Output .= '<form action="?" method="post">'.
    246             '<fieldset><legend>'.T('New thread').'</legend>'.
    247             T('User').': ';
    248         if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     247      $Output .= '<form action="?" method="post">'.
     248        '<fieldset><legend>'.T('New thread').'</legend>'.T('User').': ';
     249      if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    249250        else $Output .= '<input type="text" name="user" /><br />';
    250251      $Output .= T('Name of thread').': <br />'.
Note: See TracChangeset for help on using the changeset viewer.