Ignore:
Timestamp:
Mar 6, 2023, 1:48:45 AM (22 months ago)
Author:
chronos
Message:
  • Fixed: Class types casting for better type checking.
  • Fixed: XML direct export.
  • Modified: User class instance moved from Core class to ModuleUser class.
File:
1 edited

Legend:

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

    r891 r893  
    2727  function ShowBox()
    2828  {
     29    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    2930    $Output = '<strong><a href="'.$this->System->Link('/shoutbox/').'">'.T('Shoutbox').':</a></strong>';
    3031
    31     if ($this->System->User->Licence(LICENCE_USER))
     32    if ($User->Licence(LICENCE_USER))
    3233      $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>';
    3334    $Output .= '<div class="box"><div class="shoutbox"><table>';
     
    5657  function ShowList()
    5758  {
     59    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    5860    $Output = '';
    5961    if (array_key_exists('search', $_GET)) $_SESSION['search'] = $_GET['search'];
     
    7173
    7274    $Output .= '<h3>'.T('Shoutbox').'</h3>';
    73     if ($this->System->User->Licence(LICENCE_USER))
     75    if ($User->Licence(LICENCE_USER))
    7476      $Output .= ' <a href="'.$this->System->Link('/shoutbox/?a=add').'">'.T('Add').'</a>';
    7577    $Output .= $PageList['Output'];
     
    8486  function ShowAddForm()
    8587  {
     88    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    8689    $Output = '';
    87     if ($this->System->User->Licence(LICENCE_USER))
     90    if ($User->Licence(LICENCE_USER))
    8891    {
    8992        $Output .= '<form action="?" method="post">'.
    9093            '<fieldset><legend>'.T('New message').'</legend>'.
    9194            'Uživatel: ';
    92         if ($this->System->User->Licence(LICENCE_USER)) $Output .= '<b>'.$this->System->User->Name.'</b><br />';
     95        if ($User->Licence(LICENCE_USER)) $Output .= '<b>'.$User->Name.'</b><br />';
    9396        else $Output .= '<input type="text" name="user" /><br />';
    9497      $Output .= 'Text zprávy: <br/>'.
     
    104107  function AddFinish()
    105108  {
     109    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    106110    $Output = '';
    107     if ($this->System->User->Licence(LICENCE_USER))
     111    if ($User->Licence(LICENCE_USER))
    108112    {
    109113      if (array_key_exists('text', $_POST))
     
    115119          // Protection against mutiple post of same message
    116120          $DbResult = $this->System->Database->query('SELECT `Text` FROM `ShoutBox` WHERE (`User` = "'.
    117               $this->System->User->Id.'") ORDER BY `Date` DESC LIMIT 1');
     121              $User->Id.'") ORDER BY `Date` DESC LIMIT 1');
    118122          if ($DbResult->num_rows > 0)
    119123          {
     
    125129          {
    126130            $this->System->Database->query('INSERT INTO `ShoutBox` ( `User`, `UserName` , `Text` , `Date` , `IP` ) '.
    127                 ' VALUES ('.$this->System->User->Id.', "'.$this->System->User->Name.
     131                ' VALUES ('.$User->Id.', "'.$User->Name.
    128132                '", "'.$Text.'", NOW(), "'.GetRemoteAddress().'")');
    129133            $Output .= ShowMessage('Zpráva vložena.');
     
    139143  function ShowRSS()
    140144  {
     145    $User = ModuleUser::Cast($this->System->GetModule('User'))->User;
    141146    $Items = array();
    142147    $TitleLength = 50;
     
    150155      (
    151156          'Title' => $DbRow['UserName'].': '.$Title,
    152           'Link' =>  'https://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
     157          'Link' =>  'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
    153158          'Description' => $DbRow['Text'],
    154159          'Time' => $DbRow['UnixDate'],
     
    157162    $Output = GenerateRSS(array
    158163    (
    159       'Title' => $this->System->Config['Web']['Title'].' - '.T('Shoutbox'),
    160       'Link' => 'https://'.$this->System->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
    161       'Description' => $this->System->Config['Web']['Description'],
    162       'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],
     164      'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('Shoutbox'),
     165      'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/shoutbox/'),
     166      'Description' => Core::Cast($this->System)->Config['Web']['Description'],
     167      'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'],
    163168      'Items' => $Items,
    164169    ));
Note: See TracChangeset for help on using the changeset viewer.