Ignore:
Timestamp:
Feb 3, 2024, 11:35:58 PM (11 months ago)
Author:
chronos
Message:
  • Fixed: Correct filtering of RSS news.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/News/NewsPage.php

    r963 r964  
    1111  }
    1212
    13   function GetIntranetCondition(): string
    14   {
    15     if (IsInternetAddr()) return ' AND (`Intranet`=0)';
    16       else return '';
    17   }
    18 
    1913  function ShowView(): string
    2014  {
     
    2721        else return $Output .= 'Položka nenalezena.';
    2822      $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '.
    29         'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Id`='.$Id.')'.$this->GetIntranetCondition());
     23        'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Id`='.$Id.')'.
     24        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition());
    3025      if ($DbResult->num_rows > 0)
    3126      {
     
    164159    if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id']))
    165160    {
    166       $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.$this->GetIntranetCondition());
     161      $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.
     162        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition());
    167163      $Row = $DbResult->fetch_assoc();
    168164      if (($User->User['Id'] == $Row['User']))
     
    195191    {
    196192      $_POST['id'] = $_POST['id'] * 1;
    197       $DbResult = $this->Database->select('News', '*', '(`Id`='.$_POST['id'].')'.$this->GetIntranetCondition());
     193      $DbResult = $this->Database->select('News', '*', '(`Id`='.$_POST['id'].')'.
     194        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition());
    198195      if ($DbResult->num_rows > 0)
    199196      {
     
    221218    if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id']))
    222219    {
    223       $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.$this->GetIntranetCondition());
     220      $DbResult = $this->Database->query('SELECT * FROM `News` WHERE (`Id`='.$_GET['id'].')'.
     221        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition());
    224222      $Row = $DbResult->fetch_assoc();
    225223      if ($User->User['Id'] == $Row['User'])
     
    250248    {
    251249      $PerPage = 20;
    252       $DbResult = $this->Database->select('News', 'COUNT(*)', '(`Category`='.$Category['Id'].')'.$this->GetIntranetCondition());
     250      $DbResult = $this->Database->select('News', 'COUNT(*)', '(`Category`='.$Category['Id'].')'.
     251        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition());
    253252      $RowTotal = $DbResult->fetch_array();
    254253      $PageMax = $RowTotal[0];
     
    259258
    260259      $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` '.
    261         'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`Category`='.$Category['Id'].')'.$this->GetIntranetCondition().
     260        'LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`Category`='.$Category['Id'].')'.
     261        ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition().
    262262        ' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage);
    263263      while ($Row = $DbResult->fetch_assoc())
     
    466466
    467467    // Get news from database by selected categories
    468     $DbResult = $this->Database->query('SELECT *, UNIX_TIMESTAMP(`Date`) AS `UnixTime` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE '.$Where.' ORDER BY News.Date DESC LIMIT 0,'.$NewsCount);
     468    $DbResult = $this->Database->query('SELECT *, UNIX_TIMESTAMP(`Date`) AS `UnixTime` FROM `News`'.
     469      ' LEFT JOIN `User` ON `User`.`Id`=`News`.`User`'.
     470      ' WHERE '.$Where.ModuleNews::Cast($this->System->GetModule('News'))->GetIntranetCondition().
     471      ' ORDER BY News.Date DESC LIMIT 0,'.$NewsCount);
    469472    while ($Row = $DbResult->fetch_assoc())
    470473    {
Note: See TracChangeset for help on using the changeset viewer.