Index: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.i18n.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for FeedsFromPrivateWikis extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Raimond Spekking |
| 9 | + * @copyright © 2011 Raimond Spekking for Wikimedia Deutschland e.V. |
| 10 | + * @license GNU General Public Licence 2.0 or later |
| 11 | + */ |
| 12 | + |
| 13 | +$messages = array(); |
| 14 | + |
| 15 | +/** English |
| 16 | + * @author Raimond Spekking |
| 17 | + */ |
| 18 | +$messages['en'] = array( |
| 19 | + 'feedsfromprivatewikis-desc' => 'Adds possibilty to get feeds from private wikis', |
| 20 | +); |
| 21 | + |
Property changes on: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.i18n.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 22 | + native |
Index: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.php |
— | — | @@ -0,0 +1,33 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Setup for FeedsFromPrivateWikis extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + * @author Raimond Spekking |
| 9 | + * @copyright © 2011 Raimond Spekking for Wikimedia Deutschland e.V. |
| 10 | + * @licence GNU General Public Licence 2.0 or later |
| 11 | + */ |
| 12 | + |
| 13 | +if( !defined( 'MEDIAWIKI' ) ) { |
| 14 | + echo( "This file is an extension to the MediaWiki software and cannot be used standalone.\n" ); |
| 15 | + die( 1 ); |
| 16 | +} |
| 17 | + |
| 18 | +// Extension credits that will show up on Special:Version |
| 19 | +$wgExtensionCredits['specialpage'][] = array( |
| 20 | + 'path' => __FILE__, |
| 21 | + 'name' => 'FeedsFromPrivateWikis', |
| 22 | + 'version' => '0.1', |
| 23 | + 'author' => 'Raimond Spekking', |
| 24 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:FeedsFromPrivateWikis', |
| 25 | + 'descriptionmsg' => 'feedsfromprivatewikis-desc', |
| 26 | +); |
| 27 | + |
| 28 | +$dir = dirname( __FILE__ ) . '/'; |
| 29 | +$wgExtensionMessagesFiles['FeedsFromPrivateWikis'] = $dir . 'FeedsFromPrivateWikis.i18n.php'; |
| 30 | + |
| 31 | +$wgAutoloadClasses['FeedsFromPrivateWikis'] = $dir . 'FeedsFromPrivateWikis.hooks.php'; |
| 32 | + |
| 33 | +$wgHooks['userCan'][] = 'FeedsFromPrivateWikis::efUserCan'; |
| 34 | + |
Property changes on: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 35 | + native |
Index: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.hooks.php |
— | — | @@ -0,0 +1,28 @@ |
| 2 | +<?php |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) { |
| 4 | + die(); |
| 5 | +} |
| 6 | + |
| 7 | +class FeedsFromPrivateWikis { |
| 8 | + |
| 9 | + static function efUserCan( &$title, &$user, $action, &$result ) { |
| 10 | + global $wgRequest; |
| 11 | + $feed = $wgRequest->getText( 'feed' ); |
| 12 | + |
| 13 | + if ( $action != 'read' || $feed != 'atom' ) { |
| 14 | + return true; |
| 15 | + } |
| 16 | + |
| 17 | + $username = $wgRequest->getText( 'username' ); |
| 18 | + $key = $wgRequest->getText( 'key' ); |
| 19 | + $editor = User::newFromName( $username ); |
| 20 | + $result = null; |
| 21 | + if ( $editor ) { |
| 22 | + if ( $key == $editor->getOption( 'watchlisttoken' ) ) { |
| 23 | + $result = true; |
| 24 | + } |
| 25 | + } |
| 26 | + |
| 27 | + return false; |
| 28 | + } |
| 29 | +} |
Property changes on: trunk/extensions/FeedsFromPrivateWikis/FeedsFromPrivateWikis.hooks.php |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 30 | + native |
Index: trunk/extensions/FeedsFromPrivateWikis/README |
— | — | @@ -0,0 +1,15 @@ |
| 2 | +This extensions provides the possibility to get an atom feed from private wikis. |
| 3 | + |
| 4 | +It uses the user specific watchlist token defined in Special:Preferences, section "Watchlist". |
| 5 | + |
| 6 | +http://link.to.your.wiki/index.php/Special:RecentChanges?feed=atom&username=foo&key=bar |
| 7 | + |
| 8 | +Other actions are not allowed with this combination of username and key. |
| 9 | + |
| 10 | +foo = Username |
| 11 | +bar = Watchlist token |
| 12 | + |
| 13 | +== to do == |
| 14 | +1. Modify the atom link in Special:RecentChanges to make it more user friendly |
| 15 | +2. Expand this technique to the other feeds: Page history, Special:NewPages, |
| 16 | + Special:Contributions etc. |
Property changes on: trunk/extensions/FeedsFromPrivateWikis/README |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 17 | + native |