Changeset 816 for trunk/Modules/News/RSS.php
- Timestamp:
- Feb 22, 2015, 11:20:50 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Modules/News/RSS.php
r609 r816 3 3 function GenerateRSS($Data) 4 4 { 5 5 global $Config; 6 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 7 $Result = '<?xml version="1.0" encoding="'.$Config['Web']['Charset'].'" ?>'."\n". //<? 8 '<rss version="2.0">'."\n". 9 " <channel>\n". 10 " <title>".$Data['Title']."</title>\n". 11 " <link>".$Data['Link']."</link>\n". 12 " <description>".$Data['Description']."</description>\n". 13 " <language>cs</language>\n". 14 " <webMaster>".$Data['WebmasterEmail']."</webMaster>\n". 15 " <pubDate>".date('r')."</pubDate>\n". 16 " <ttl>20</ttl>\n"; 17 foreach($Data['Items'] as $Item) 18 { 19 $Result .= " <item>\n". 20 ' <title>'.htmlspecialchars($Item['Title'])."</title>\n". 21 ' <description>'.htmlspecialchars($Item['Description'])."</description>\n". 22 ' <pubDate>'.date('r',$Item['Time'])."</pubDate>\n". 23 ' <link>'.$Item['Link']."</link>\n". 24 " </item>\n"; 25 } 26 $Result .= " </channel>\n". 27 "</rss>"; 28 return($Result); 29 29 } 30 30 31 31 class PageRSS extends Page 32 32 { 33 34 { 35 36 37 38 39 40 41 42 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if($this->System->User->Licence($Channel['Permission']) or 45 46 47 48 49 50 51 52 53 33 function Show() 34 { 35 $this->RawPage = true; 36 37 if(array_key_exists('channel', $_GET)) $ChannelName = $_GET['channel']; 38 else $ChannelName = ''; 39 if(array_key_exists('token', $_GET)) $Token = $_GET['token']; 40 else $Token = ''; 41 if(array_key_exists($ChannelName, $this->System->ModuleManager->Modules['News']->RSSChannels)) 42 { 43 $Channel = $this->System->ModuleManager->Modules['News']->RSSChannels[$ChannelName]; 44 if($this->System->User->Licence($Channel['Permission']) or 45 $this->System->User->CheckToken($Channel['Permission'], $Token)) 46 { 47 if(is_string($Channel['Callback'][0])) 48 { 49 $Class = new $Channel['Callback'][0]($this->System); 50 $Output = $Class->$Channel['Callback'][1](); 51 } else $Output = call_user_func($Channel['Callback']); 52 } else $Output = T('Access denied'); 53 } else $Output = 'Nezadán žádný kanál'; 54 54 return($Output); 55 55 } 56 56 }
Note:
See TracChangeset
for help on using the changeset viewer.