Changeset 893 for trunk/Modules/News
- Timestamp:
- Mar 6, 2023, 1:48:45 AM (21 months ago)
- Location:
- trunk/Modules/News
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/News.php
r891 r893 5 5 class ModuleNews extends Module 6 6 { 7 var $RSSChannels; 7 public array $RSSChannels; 8 public array $RSSChannelsPos; 8 9 9 10 function __construct(System $System) … … 56 57 function ShowRSSHeader() 57 58 { 59 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 58 60 $Output = ''; 59 61 foreach ($this->RSSChannels as $Channel) 60 62 { 61 if ($ this->System->User->Licence($Channel['Permission']))63 if ($User->Licence($Channel['Permission'])) 62 64 $Output .= ' <link rel="alternate" title="'.$Channel['Title'].'" href="'. 63 65 $this->System->Link('/rss/?channel='.$Channel['Channel']).'" type="application/rss+xml" />'; 64 66 } 65 67 return $Output; … … 84 86 function ShowList() 85 87 { 88 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 86 89 $DbResult = $this->System->Database->query('SELECT COUNT(*) FROM `News`'); 87 90 $DbRow = $DbResult->fetch_row(); … … 89 92 90 93 $Output = '<h3>'.T('News').'</h3>'; 91 if ($ this->System->User->Licence(LICENCE_ADMIN))94 if ($User->Licence(LICENCE_ADMIN)) 92 95 $Output .= ' <a href="?a=add">'.T('Add').'</a>'; 93 96 $Output .= $PageList['Output']; … … 122 125 function ShowAddForm() 123 126 { 124 if ($this->System->User->Licence(LICENCE_ADMIN)) 127 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 128 if ($User->Licence(LICENCE_ADMIN)) 125 129 { 126 130 $Output = '<form action="?" method="POST">'. 127 131 '<fieldset><legend>'.T('New news').'</legend>'. 128 T('User').': '.$ this->System->User->Name.'('.$this->System->User->Id.')<br/> '.132 T('User').': '.$User->Name.'('.$User->Id.')<br/> '. 129 133 T('Title').': <input type="text" name="title" size="40"/><br/>'. 130 134 T('Content').': <textarea rows="8" cols="40" onkeydown="ResizeTextArea(this)" class="textedit" id="Text" name="text"></textarea><br/>'. … … 139 143 function SaveNew() 140 144 { 141 if ($this->System->User->Licence(LICENCE_ADMIN)) 145 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 146 if ($User->Licence(LICENCE_ADMIN)) 142 147 { 143 148 if (array_key_exists('text', $_POST) and array_key_exists('title', $_POST)) 144 149 { 145 150 $querty = 'INSERT INTO `News` (`Title`, `Time` ,`User` ,`Text`) VALUES ( "'.$_POST['title'].'", NOW( ) , '. 146 $ this->System->User->Id.', "'.$_POST['text'].'")';151 $User->Id.', "'.$_POST['text'].'")'; 147 152 $this->System->Database->query($querty); 148 153 $Output = ShowMessage(T('News added')); … … 162 167 while ($DbRow = $DbResult->fetch_assoc()) 163 168 { 164 $Items[] = array165 (166 'Title' => $DbRow['Title'],167 'Link' => 'https://'.$this->System->Config['Web']['Host'].$this->System->Link('/news/?a=item&i='.$DbRow['Id']),168 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')',169 'Time' => $DbRow['UnixTime'],170 );169 $Items[] = array 170 ( 171 'Title' => $DbRow['Title'], 172 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/news/?a=item&i='.$DbRow['Id']), 173 'Description' => $DbRow['Text'].' ('.$DbRow['Name'].')', 174 'Time' => $DbRow['UnixTime'], 175 ); 171 176 } 172 177 $Output = GenerateRSS(array 173 178 ( 174 'Title' => $this->System->Config['Web']['Title'].' - '.T('System changes'),175 'Link' => 'https://'. $this->System->Config['Web']['Host'].$this->System->Link('/news/'),176 'Description' => $this->System->Config['Web']['Description'],177 'WebmasterEmail' => $this->System->Config['Web']['AdminEmail'],179 'Title' => Core::Cast($this->System)->Config['Web']['Title'].' - '.T('System changes'), 180 'Link' => 'https://'.Core::Cast($this->System)->Config['Web']['Host'].$this->System->Link('/news/'), 181 'Description' => Core::Cast($this->System)->Config['Web']['Description'], 182 'WebmasterEmail' => Core::Cast($this->System)->Config['Web']['AdminEmail'], 178 183 'Items' => $Items, 179 184 )); -
trunk/Modules/News/RSS.php
r888 r893 33 33 function Show(): string 34 34 { 35 $User = ModuleUser::Cast($this->System->GetModule('User'))->User; 35 36 $this->RawPage = true; 36 37 … … 42 43 { 43 44 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if ($ this->System->User->Licence($Channel['Permission']) or45 $ this->System->User->CheckToken($Channel['Permission'], $Token))45 if ($User->Licence($Channel['Permission']) or 46 $User->CheckToken($Channel['Permission'], $Token)) 46 47 { 47 48 if (is_string($Channel['Callback'][0]))
Note:
See TracChangeset
for help on using the changeset viewer.