Changeset 964


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

Legend:

Unmodified
Added
Removed
  • trunk/Application/Version.php

    r963 r964  
    11<?php
    22
    3 $Revision = 963; // Subversion revision
     3$Revision = 964; // Subversion revision
    44$DatabaseRevision = 957; // SQL structure revision
    55$ReleaseTime = strtotime('2024-02-03');
  • trunk/Modules/News/News.php

    r953 r964  
    2727    $this->Description = 'News and news groups management';
    2828    $this->Dependencies = array(ModuleUser::GetName(), ModuleLog::GetName(), ModuleFile::GetName());
    29     $this->SupportedModules = array('Search');
    3029    $this->Models = array(NewsCategory::GetClassName(), News::GetClassName());
    3130  }
     
    3736    $this->System->RegisterPage(['aktuality', 'rss'], 'PageNewsRss');
    3837    $this->System->RegisterPage(['aktuality', 'aktualizace'], 'PageNewsUpdate');
    39     $this->System->FormManager->RegisterClass('News', array(
     38    Core::Cast($this->System)->FormManager->RegisterClass('News', array(
    4039      'Title' => 'Aktualita',
    4140      'Table' => 'News',
     
    5453      ),
    5554    ));
    56     $this->System->FormManager->RegisterClass('NewsCategory', array(
     55    Core::Cast($this->System)->FormManager->RegisterClass('NewsCategory', array(
    5756      'Title' => 'Kategorie aktualit',
    5857      'Table' => 'NewsCategory',
     
    6665      ),
    6766    ));
    68     $this->System->FormManager->RegisterFormType('TNewsCategory', array(
     67    Core::Cast($this->System)->FormManager->RegisterFormType('TNewsCategory', array(
    6968      'Type' => 'Reference',
    7069      'Table' => 'NewsCategory',
     
    7372      'Filter' => '1',
    7473    ));
    75     $this->System->FormManager->RegisterFormType('TNewsList', array(
     74    Core::Cast($this->System)->FormManager->RegisterFormType('TNewsList', array(
    7675      'Type' => 'ManyToOne',
    7776      'Table' => 'News',
     
    153152    {
    154153      $this->NewsSetting[] = array('CategoryId' => $NewsCategory['Id'], 'Index' => $I, 'Enabled' => 1,
    155         'ItemCount' => $this->System->Config['Web']['News']['Count'], 'DaysAgo' => $this->System->Config['Web']['News']['DaysAgo'], 'Group' => $NewsCategory['Group']);
     154        'ItemCount' => Core::Cast($this->System)->Config['Web']['News']['Count'], 'DaysAgo' =>
     155        Core::Cast($this->System)->Config['Web']['News']['DaysAgo'], 'Group' => $NewsCategory['Group']);
    156156      $I++;
    157157    }
     
    160160    {
    161161      $NewsSettingCookie = unserialize($_COOKIE['NewsSetting']);
    162       foreach ($this->NewsSetting as $Index => $this->NewSetting)
     162      foreach ($this->NewsSetting as $Index => $this->NewsSetting)
    163163      {
    164164        if (array_key_exists($Index, $NewsSettingCookie))
    165           $this->NewsSetting[$Index] = array_merge($this->NewSetting, $NewsSettingCookie[$Index]);
     165          $this->NewsSetting[$Index] = array_merge($this->NewsSetting, $NewsSettingCookie[$Index]);
    166166      }
    167167    }
  • 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.