Ignore:
Timestamp:
Jan 17, 2016, 8:15:03 PM (8 years ago)
Author:
chronos
Message:
  • Added: List of latest forum posts on front page.
File:
1 edited

Legend:

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

    r846 r850  
    3535      'Icon' => '',
    3636    ), 17);
     37  }
     38
     39  function ShowBox()
     40  {
     41    $Parser = new HTML_BBCodeParser2(array('filters' => array('Basic', 'Extended',
     42      'Images', 'Links', 'Lists', 'Email')));
     43    $Count = 20;
     44    $Output = '<strong><a href="'.$this->System->Link('/forum/').'">'.T('Last forum posts').':</a></strong>';
     45
     46    $Query = 'SELECT `ForumText`.`Text`, `ForumText`.`Date`, `User`.`Name` AS `UserName`, '.
     47      '`User`.`Id` AS `UserId`, `ForumText`.`Thread` '.
     48      'FROM `ForumText` '.
     49      'JOIN `User` ON `User`.`Id` = `ForumText`.`User` '.
     50      'ORDER BY `Date` DESC LIMIT '.$Count;
     51    $DbResult = $this->Database->query($Query);
     52    $Output .= '<table class="MiniTable"><tr><th>'.T('Date').'</th><th>'.T('User').'</th><th>'.T('Post').'</th></tr>';
     53    while($DbRow = $DbResult->fetch_assoc())
     54    {
     55      $Output .= '<tr>'.
     56        '<td><a href="'.$this->System->Link('/forum/?Thread='.$DbRow['Thread']).'">'.HumanDate($DbRow['Date']).'</a></td>'.
     57        '<td><a href="'.$this->System->Link('/user/?user='.$DbRow['UserId']).'">'.$DbRow['UserName'].'</a></td>'.
     58        '<td>'.$Parser->qparse($DbRow['Text']).'</td>'.
     59        '</tr>';
     60    }
     61    $Output .= '</table>';
     62    return($Output);
    3763  }
    3864}
     
    7399  {
    74100    $Output = '';
    75 
    76101    $Text = $_POST['text'];
    77 
    78102    $DbResult = $this->System->Database->query('UPDATE `ForumText` SET `Text`="'.$_POST['text'].'" WHERE `User` = '.$this->System->User->Id.' AND `ID` = '.$_GET['Edit']);
    79 
    80103    $Output .= ShowMessage(T('Text edited.'));
    81 
    82 
    83104    return ($Output);
    84105  }
     
    178199    $Output .= $PageList['Output'];
    179200    $Output .= '<div class="shoutbox">';
    180     $DbResult = $this->System->Database->query('SELECT * FROM `ForumText`  WHERE `Thread` = '.
     201    $DbResult = $this->System->Database->query('SELECT * FROM `ForumText` WHERE `Thread` = '.
    181202      ($_GET['Thread']*1).' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    182203    while($Line = $DbResult->fetch_assoc()) {
    183204      if ($this->System->User->Id == $Line['User'])
    184         $edit = '<a href="?Edit='.$Line['ID'].'">editovat</a>';
     205        $edit = '<a href="?Edit='.$Line['ID'].'">'.T('edit').'</a>';
    185206      else $edit = '';
    186207      $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).
     
    197218    if($this->System->User->Licence(LICENCE_USER))
    198219    {
    199         $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'.
    200             '<fieldset><legend>'.T('New Forum Message').'</legend>'.
    201             T('User').': ';
    202         if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     220      $Output .= '<form action="?Thread='.$_GET['Thread'].'" method="post">'.
     221        '<fieldset><legend>'.T('New Forum Message').'</legend>'.
     222        T('User').': ';
     223      if($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
    203224        else $Output .= '<input type="text" name="user" /><br />';
    204         $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.
    205       '<textarea onkeydown="ResizeTextArea(this)" name="text" cols="80"></textarea> <br/>'.
    206       '<input type="hidden" name="a" value="add2"/>'.
    207       '<input type="submit" value="'.T('Send').'" /><br /></fieldset>'.
    208       '</form>';
     225      $Output .= T('Message text').': ('.T('You can use').' <a href="http://www.bbcode.org/reference.php">'.T('BB code').'</a>)<br/>'.
     226        '<textarea onkeydown="ResizeTextArea(this)" name="text" cols="80"></textarea> <br/>'.
     227        '<input type="hidden" name="a" value="add2"/>'.
     228        '<input type="submit" value="'.T('Send').'" /><br /></fieldset>'.
     229        '</form>';
    209230    } else $Output .= ShowMessage(T('You have to be registered for adding message.'), MESSAGE_CRITICAL);
    210231    return($Output);
Note: See TracChangeset for help on using the changeset viewer.