Changeset 964
- Timestamp:
- Feb 3, 2024, 11:35:58 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Application/Version.php
r963 r964 1 1 <?php 2 2 3 $Revision = 96 3; // Subversion revision3 $Revision = 964; // Subversion revision 4 4 $DatabaseRevision = 957; // SQL structure revision 5 5 $ReleaseTime = strtotime('2024-02-03'); -
trunk/Modules/News/News.php
r953 r964 27 27 $this->Description = 'News and news groups management'; 28 28 $this->Dependencies = array(ModuleUser::GetName(), ModuleLog::GetName(), ModuleFile::GetName()); 29 $this->SupportedModules = array('Search');30 29 $this->Models = array(NewsCategory::GetClassName(), News::GetClassName()); 31 30 } … … 37 36 $this->System->RegisterPage(['aktuality', 'rss'], 'PageNewsRss'); 38 37 $this->System->RegisterPage(['aktuality', 'aktualizace'], 'PageNewsUpdate'); 39 $this->System->FormManager->RegisterClass('News', array(38 Core::Cast($this->System)->FormManager->RegisterClass('News', array( 40 39 'Title' => 'Aktualita', 41 40 'Table' => 'News', … … 54 53 ), 55 54 )); 56 $this->System->FormManager->RegisterClass('NewsCategory', array(55 Core::Cast($this->System)->FormManager->RegisterClass('NewsCategory', array( 57 56 'Title' => 'Kategorie aktualit', 58 57 'Table' => 'NewsCategory', … … 66 65 ), 67 66 )); 68 $this->System->FormManager->RegisterFormType('TNewsCategory', array(67 Core::Cast($this->System)->FormManager->RegisterFormType('TNewsCategory', array( 69 68 'Type' => 'Reference', 70 69 'Table' => 'NewsCategory', … … 73 72 'Filter' => '1', 74 73 )); 75 $this->System->FormManager->RegisterFormType('TNewsList', array(74 Core::Cast($this->System)->FormManager->RegisterFormType('TNewsList', array( 76 75 'Type' => 'ManyToOne', 77 76 'Table' => 'News', … … 153 152 { 154 153 $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']); 156 156 $I++; 157 157 } … … 160 160 { 161 161 $NewsSettingCookie = unserialize($_COOKIE['NewsSetting']); 162 foreach ($this->NewsSetting as $Index => $this->New Setting)162 foreach ($this->NewsSetting as $Index => $this->NewsSetting) 163 163 { 164 164 if (array_key_exists($Index, $NewsSettingCookie)) 165 $this->NewsSetting[$Index] = array_merge($this->New Setting, $NewsSettingCookie[$Index]);165 $this->NewsSetting[$Index] = array_merge($this->NewsSetting, $NewsSettingCookie[$Index]); 166 166 } 167 167 } -
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.