Index: trunk/extensions/RSS/RSSHooks.php |
— | — | @@ -20,8 +20,17 @@ |
21 | 21 | * @param $frame Frame parser context |
22 | 22 | */ |
23 | 23 | static function renderRss( $input, $args, $parser, $frame ) { |
24 | | - global $wgRSSCacheAge, $wgRSSCacheCompare; |
| 24 | + global $wgRSSCacheAge, $wgRSSCacheCompare, $wgRSSNamespaces; |
25 | 25 | |
| 26 | + if ( $wgRSSNamespaces !== null && is_array($wgRSSNamespaces) ) { |
| 27 | + $ns = $parser->getTitle()->getNamespace(); |
| 28 | + $checkNS = array_flip($wgRSSNamespaces); |
| 29 | + |
| 30 | + if( !isset( $checkNS[$ns] ) ) { |
| 31 | + return wfMsg( 'rss-ns-permission' ); |
| 32 | + } |
| 33 | + } |
| 34 | + |
26 | 35 | if ( !Http::isValidURI( $input ) ) { |
27 | 36 | return wfMsg( 'rss-invalid-url', htmlspecialchars( $input ) ); |
28 | 37 | } |
Index: trunk/extensions/RSS/RSS.i18n.php |
— | — | @@ -18,6 +18,7 @@ |
19 | 19 | 'rss-fetch-nourl' => 'Fetch called without a URL!', |
20 | 20 | 'rss-invalid-url' => 'Not a valid URL: $1', |
21 | 21 | 'rss-parse-error' => 'Error parsing XML for RSS', |
| 22 | + 'rss-ns-permission' => 'RSS is not allowed in this namespace', |
22 | 23 | 'rss-item' => '{{RSSPost | title = {{{title}}} | link = {{{link}}} | date = {{{date}}} | author = {{{author}}} }}', |
23 | 24 | ); |
24 | 25 | |
Index: trunk/extensions/RSS/RSS.php |
— | — | @@ -51,13 +51,16 @@ |
52 | 52 | |
53 | 53 | $wgRSSCacheAge = 3600; // one hour |
54 | 54 | $wgRSSCacheCompare = false; // Check cached content, if available, against remote. |
55 | | - // $wgRSSCacheCompare should be set to false or a timeout |
56 | | - // (less than $wgRSSCacheAge) after which a comparison will |
57 | | - // be made. |
58 | | -$wgRSSFetchTimeout = 5; // 5 second timeout |
| 55 | + // $wgRSSCacheCompare should be set to false or a timeout |
| 56 | + // (less than $wgRSSCacheAge) after which a comparison will |
| 57 | + // be made. |
| 58 | +$wgRSSFetchTimeout = 5; // 5 second timeout |
| 59 | +$wgRSSNamespaces = null; // Ignore the RSS tag in all but the namespaces listed here. |
| 60 | + // null (the default) means the <rss> tag can be used |
| 61 | + // anywhere. |
59 | 62 | |
60 | 63 | // Agent to use for fetching feeds |
61 | | -$wgRSSUserAgent = 'MediaWikiRSS/0.01 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension'; |
| 64 | +$wgRSSUserAgent = 'MediaWikiRSS/0.02 (+http://www.mediawiki.org/wiki/Extension:RSS) / MediaWiki RSS extension'; |
62 | 65 | |
63 | 66 | // Proxy server to use for fetching feeds |
64 | 67 | $wgRSSProxy = false; |