Ignore:
Timestamp:
Aug 11, 2023, 11:17:28 AM (9 months ago)
Author:
chronos
Message:
  • Added: News can be set as intranet only.
File:
1 edited

Legend:

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

    r938 r953  
    1616  public int $NewsCountPerCategory = 3;
    1717  public string $UploadedFilesFolder = 'files/news/';
     18  public array $NewsSetting;
    1819
    1920  function __construct(System $System)
     
    8687  }
    8788
     89  function GetIntranetCondition(): string
     90  {
     91    if (IsInternetAddr()) return ' AND (`Intranet`=0)';
     92      else return '';
     93  }
     94
    8895  function ShowNews(string $Category, int $ItemCount, int $DaysAgo): string
    8996  {
     
    97104      $Output .= ' <a href="aktuality/?action=add&amp;category='.$Category.'">Přidat</a>';
    98105    $Output .= '</div></div><div class="Content">';
    99     $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User` WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`) ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount);
     106    $DbResult = $this->Database->query('SELECT `News`.*, `User`.`Name` FROM `News` LEFT JOIN `User` ON `User`.`Id`=`News`.`User`'.
     107      ' WHERE (`News`.`Category`='.$Category.') AND (DATE_SUB(NOW(), INTERVAL '.$DaysAgo.' DAY) < `News`.`Date`)'.$this->GetIntranetCondition().
     108      ' ORDER BY `News`.`Date` DESC LIMIT 0,'.$ItemCount);
    100109
    101110    $Index = 0;
     
    162171  {
    163172    $Output = '';
    164 
     173   
    165174    $this->LoadSettingsFromCookies();
    166175
Note: See TracChangeset for help on using the changeset viewer.