Changeset 964 for trunk/Modules/News/NewsPage.php
- Timestamp:
- Feb 3, 2024, 11:35:58 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/NewsPage.php
r963 r964 11 11 } 12 12 13 function GetIntranetCondition(): string14 {15 if (IsInternetAddr()) return ' AND (`Intranet`=0)';16 else return '';17 }18 19 13 function ShowView(): string 20 14 { … … 27 21 else return $Output .= 'Položka nenalezena.'; 28 22 $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()); 30 25 if ($DbResult->num_rows > 0) 31 26 { … … 164 159 if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id'])) 165 160 { 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()); 167 163 $Row = $DbResult->fetch_assoc(); 168 164 if (($User->User['Id'] == $Row['User'])) … … 195 191 { 196 192 $_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()); 198 195 if ($DbResult->num_rows > 0) 199 196 { … … 221 218 if ($User->CheckPermission('News', 'Insert', 'Group', $Category['Id'])) 222 219 { 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()); 224 222 $Row = $DbResult->fetch_assoc(); 225 223 if ($User->User['Id'] == $Row['User']) … … 250 248 { 251 249 $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()); 253 252 $RowTotal = $DbResult->fetch_array(); 254 253 $PageMax = $RowTotal[0]; … … 259 258 260 259 $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(). 262 262 ' ORDER BY `News`.`Id` DESC LIMIT '.($Page * $PerPage).','.$PerPage); 263 263 while ($Row = $DbResult->fetch_assoc()) … … 466 466 467 467 // 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); 469 472 while ($Row = $DbResult->fetch_assoc()) 470 473 {
Note:
See TracChangeset
for help on using the changeset viewer.