Changeset 765 for trunk/Modules


Ignore:
Timestamp:
Jan 27, 2014, 10:01:33 PM (11 years ago)
Author:
chronos
Message:
  • Added: Config parameter Description which is used for general web description included in meta section of HTML page and usable by modules.
  • Fixed: Error in RSS channels if no items loaded.
  • Modified: Log real last URI instead on script name in online users list in database.
  • Fixed: Serialization error in Database class if exception was raised.
  • Modified: Items in RSS channel of forum links to exact forum topics.
Location:
trunk/Modules
Files:
6 edited

Legend:

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

    r762 r765  
    130130                $Output .= '</div>'.$PageList['Output'];
    131131                return($Output);
    132 
    133         return($Output);
    134132  }
    135133
     
    177175                $Output .= $PageList['Output'];
    178176                $Output .= '<div class="shoutbox">';
    179                 $DbResult = $this->System->Database->query('SELECT * FROM `ForumText`  WHERE `Thread` = '.$_GET['Thread'].' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
     177                $DbResult = $this->System->Database->query('SELECT * FROM `ForumText`  WHERE `Thread` = '.
     178                  $_GET['Thread'].' '.$SearchQuery.' ORDER BY `ID` DESC '.$PageList['SQLLimit']);
    180179                while($Line = $DbResult->fetch_assoc()) {
    181180                        if ($this->System->User->Id == $Line['User'])
    182181        $edit = '<a href="?Edit='.$Line['ID'].'">editovat</a>';
    183182      else $edit = '';
    184       $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).')</span><strong>'.$Line['UserName'].'</strong>: '.str_replace("\n", '<br />',$parser->qparse($Line['Text'])).'  </div> ';
     183      $Output .= '<div><span style="float:right;">'.$edit.' ('.HumanDate($Line['Date']).
     184        ')</span><strong>'.$Line['UserName'].'</strong>: '.str_replace("\n", '<br />',$parser->qparse($Line['Text'])).'  </div> ';
    185185    }
    186186                $Output .= '</div>'.$PageList['Output'];
     
    269269        function ShowRSS()
    270270        {
     271    $parser = new HTML_BBCodeParser2(array('filters' => array('Basic','Extended','Images','Links','Lists','Email')));
     272
     273    $Items = array();
    271274          $TitleLength = 50;
    272275          mb_internal_encoding('utf-8');
    273           $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `UnixDate`, `User`, `UserName`, `Text`, ( SELECT `Text`  FROM `ForumThread` WHERE  `ID` = `ForumText`.`Thread`) as `Thread`  FROM `ForumText`  ORDER BY `ID` DESC LIMIT 20');
     276          $DbResult = $this->Database->query('SELECT `ID`, UNIX_TIMESTAMP(`Date`) AS `UnixDate`, '.
     277      '`User`, `UserName`, `Text`, ( SELECT `Text` FROM `ForumThread` '.
     278      'WHERE `ID` = `ForumText`.`Thread`) AS `Thread` FROM `ForumText` ORDER BY `ID` DESC LIMIT 20');
    274279          while($DbRow = $DbResult->fetch_assoc())
    275280          {
     
    278283            $Items[] = array
    279284            (
    280                 'Title' =>  $DbRow['Thread'].' - '.$DbRow['UserName'].': ',
    281                 'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    282                 'Description' => $DbRow['Text'],
    283                 'Time' => $DbRow['UnixDate'],
     285              'Title' =>  $DbRow['Thread'].' - '.$DbRow['UserName'].': ',
     286              'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/?Thread='.$DbRow['ID']),
     287              'Description' => $parser->qparse($DbRow['Text']),
     288              'Time' => $DbRow['UnixDate'],
    284289            );
    285290          }
    286291          $Output = GenerateRSS(array
    287               (
    288                   'Title' => 'WoW překlad - Fórum',
    289                   'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    290                   'Description' => 'Překlad textů WoW',
    291                   'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
    292                   'Items' => $Items,
    293               ));
    294            return($Output);
     292          (
     293            'Title' => $this->System->Config['Web']['Title'].' - '.T('Forum'),
     294            'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/forum/'),
     295            'Description' => $this->System->Config['Web']['Description'],
     296      'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
     297      'Items' => $Items,
     298    ));
     299    return($Output);
    295300        }
    296301}
  • trunk/Modules/Log/Log.php

    r636 r765  
    2222        $this->System->RegisterPage('log.php', 'PageLog');
    2323        $this->System->ModuleManager->Modules['Error']->OnError[] = array($this, 'DoAddItem');
    24         $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => 'Záznamy',
     24        $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Logs'),
    2525          'Channel' => 'log', 'Callback' => array('PageLog', 'ShowRSS'), 'Permission' => LICENCE_ADMIN));
    2626  } 
     
    103103    $Output .= GenerateRSS(array
    104104    (
    105       'Title' => $this->System->Config['Web']['Title'],
     105      'Title' => $this->System->Config['Web']['Title'].' - '.T('Logs'),
    106106      'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    107       'Description' => $this->System->Config['Web']['Title'],
     107      'Description' => $this->System->Config['Web']['Description'],
    108108      'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
    109109      'Items' => $Items,
  • trunk/Modules/News/News.php

    r637 r765  
    2222        $this->System->RegisterPage('news', 'PageNews');
    2323        $this->System->RegisterPage('rss', 'PageRSS');
    24         $this->RegisterRSS(array('Title' => T('System changes'), 'Channel' => 'news',
     24        $this->RegisterRSS(array('Title' => T('News'), 'Channel' => 'news',
    2525          'Callback' => array('PageNews', 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS));
    2626  }
     
    127127        function ShowRSS()
    128128        {
    129          $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, '.
    130            '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text` '.
    131            'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
    132          while($DbRow = $DbResult->fetch_assoc())
    133          {
    134           $Items[] = array
     129                $Items = array();
     130    $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`News`.`Time`) AS `UnixTime`, '.
     131            '`News`.`Title`, `News`.`Time`, `User`.`Name`, `News`.`Text` '.
     132            'FROM `News` JOIN `User` ON `User`.`ID` = `News`.`User` ORDER BY `Time` DESC LIMIT 10');
     133          while($DbRow = $DbResult->fetch_assoc())
     134          {
     135           $Items[] = array
     136           (
     137             'Title' => $DbRow['Title'],
     138             'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/'),
     139             'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')',
     140             'Time' => $DbRow['UnixTime'],
     141           );
     142          }
     143          $Output = GenerateRSS(array
    135144          (
    136             'Title' => $DbRow['Title'],
    137             'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    138             'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')',
    139             'Time' => $DbRow['UnixTime'],
    140           );
    141          }
    142          $Output = GenerateRSS(array
    143            (
    144              'Title' => 'WoW překlad - '.T('System changes'),
    145              'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    146              'Description' => 'Překlad textů WoW',
    147              'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
    148              'Items' => $Items,
    149            ));
    150            return($Output);     
     145            'Title' => $this->System->Config['Web']['Title'].' - '.T('System changes'),
     146            'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/'),
     147            'Description' => $this->System->Config['Web']['Description'],
     148            'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
     149            'Items' => $Items,
     150          ));
     151          return($Output);       
    151152        }
    152153}
  • trunk/Modules/ShoutBox/ShoutBox.php

    r637 r765  
    1818        $this->System->RegisterPage('shoutbox', 'PageShoutBox');
    1919        $this->System->ModuleManager->Modules['News']->RegisterRSS(array(
    20           'Title' => 'Kecátko', 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'),
     20          'Title' => T('Shoutbox'), 'Channel' => 'shoutbox', 'Callback' => array('PageShoutBox', 'ShowRSS'),
    2121          'Permission' => LICENCE_ANONYMOUS));           
    2222    if(array_key_exists('Search', $this->System->ModuleManager->Modules))
     
    138138        function ShowRSS()
    139139        {
     140                $Items = array();
    140141          $TitleLength = 50;
    141142          mb_internal_encoding('utf-8');
     
    148149            (
    149150                'Title' => $DbRow['UserName'].': '.$Title,
    150                 'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
     151                'Link' =>  'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
    151152                'Description' => $DbRow['Text'],
    152153                'Time' => $DbRow['UnixDate'],
     
    154155          }
    155156          $Output = GenerateRSS(array
    156               (
    157                   'Title' => 'WoW překlad - Shoutbox',
    158                   'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    159                   'Description' => 'Překlad textů WoW',
    160                   'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
    161                   'Items' => $Items,
    162               ));
    163            return($Output);
     157    (
     158      'Title' => $this->System->Config['Web']['Title'].' - '.T('Shoutbox'),
     159      'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
     160      'Description' => $this->System->Config['Web']['Description'],
     161      'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
     162      'Items' => $Items,
     163    ));
     164    return($Output);
    164165        }
    165166}
  • trunk/Modules/Translation/Translation.php

    r725 r765  
    2929        $this->System->RegisterPage('progress', 'PageProgress');
    3030    $this->System->RegisterPage('TranslationList.php', 'PageTranslationList');
    31     $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => 'Poslední překlady',
     31    $this->System->ModuleManager->Modules['News']->RegisterRSS(array('Title' => T('Last translations'),
    3232      'Channel' => 'translation', 'Callback' => array($this, 'ShowRSS'), 'Permission' => LICENCE_ANONYMOUS));
    3333    $this->System->RegisterMenuItem(array(
     
    5959  function ShowRSS()
    6060  {
     61        $Items = array();
    6162    $DbResult = $this->Database->query('SELECT UNIX_TIMESTAMP(`Date`) AS `Date`, `User`.`Name` AS `UserName`, `Text` FROM `Log` '.
    6263    'JOIN `User` ON `User`.`ID` = `Log`.`User` WHERE `Type` = 1 ORDER BY `Date` DESC LIMIT 100');
     
    6566      $Items[] = array
    6667      (
    67           'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),
    68           'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    69           'Description' => $DbRow['Text'],
    70           'Time' => $DbRow['Date'],
     68        'Title' => strip_tags($DbRow['Text'].' ('.$DbRow['UserName'].')'),
     69        'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
     70        'Description' => $DbRow['Text'],
     71        'Time' => $DbRow['Date'],
    7172      );
    7273    }
    7374    $Output = GenerateRSS(array
    74         (
    75             'Title' => 'WoW překlad - Poslední překlady',
    76             'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
    77             'Description' => 'Překlad textů WoW',
    78             'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
    79             'Items' => $Items,
    80                 ));
     75    (
     76      'Title' => $this->System->Config['Web']['Title'].' - '.T('Last translations'),
     77      'Link' => 'http://'.$this->System->Config['Web']['Host'].$this->System->Link('/'),
     78      'Description' => $this->System->Config['Web']['Description'],
     79      'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
     80      'Items' => $Items,
     81                ));
    8182    return($Output);
    8283  }
  • trunk/Modules/User/User.php

    r725 r765  
    227227      'User' => null, 'LoginTime' => 'NOW()', 'ActivityTime' => 'NOW()',
    228228      'IpAddress' => GetRemoteAddress(), 'HostName' => gethostbyaddr(GetRemoteAddress()),
    229       'ScriptName' => $_SERVER['PHP_SELF']));
     229      'ScriptName' => $_SERVER['REQUEST_URI']));
    230230     
    231231    // Logged permanently?
Note: See TracChangeset for help on using the changeset viewer.