Index: trunk/extensions/Redirect/Redirect.i18n.php |
— | — | @@ -0,0 +1,18 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Internationalisation file for the Redirect extension. |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +$messages = array(); |
| 11 | + |
| 12 | +/** English |
| 13 | + * @author Siebrand Mazeland |
| 14 | + */ |
| 15 | +$messages['en'] = array( |
| 16 | + 'redirect-desc' => 'Allows easy configuration of redirects on [[MediaWiki:Redirect-addnewaccount|account creation]] and [[MediaWiki:Redirect-userlogoutcomplete|logout]]', |
| 17 | + 'redirect-addnewaccount' => '', # do not translate or duplicate this message to other languages |
| 18 | + 'redirect-userlogoutcomplete' => '', # do not translate or duplicate this message to other languages |
| 19 | +); |
Property changes on: trunk/extensions/Redirect/Redirect.i18n.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 20 | + native |
Index: trunk/extensions/Redirect/Redirect.php |
— | — | @@ -0,0 +1,34 @@ |
| 2 | +<?php |
| 3 | +if ( !defined( 'MEDIAWIKI' ) ) die(); |
| 4 | +/** |
| 5 | + * An extension for easy customisation of redirects on various events |
| 6 | + * |
| 7 | + * Simple, default scenario: |
| 8 | + * For redirect on account creation: add the title of a local wiki page to [[MediaWiki:Redirect-addnewaccount]] |
| 9 | + * For redirect after logout: add the title of a local wiki page to [[MediaWiki:Redirect-userlogoutcomplete]] |
| 10 | + * |
| 11 | + * This extension is a adaptation of 2 previously published extensions: |
| 12 | + * http://www.mediawiki.org/wiki/Extension:RedirectOnAccountCreation (Public Domain) |
| 13 | + * http://www.mediawiki.org/wiki/Extension:RedirectAfterLogout (Public Domain) |
| 14 | + * |
| 15 | + * @addtogroup Extensions |
| 16 | + * |
| 17 | + * @author Marcel Minke |
| 18 | + * @author Siebrand Mazeland |
| 19 | + * @license Creative Commons Attribution 3.0 Unported (http://creativecommons.org/licenses/by/3.0/) |
| 20 | + */ |
| 21 | + |
| 22 | +$wgExtensionCredits['other'][] = array( |
| 23 | + 'name' => 'Redirect', |
| 24 | + 'version' => '1.0', |
| 25 | + 'author' => array( 'Marcel Minke', 'Siebrand Mazeland' ), |
| 26 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Redirect', |
| 27 | + 'descriptionmsg' => 'redirect-desc', |
| 28 | +); |
| 29 | + |
| 30 | +$dir = dirname( __FILE__ ) . '/'; |
| 31 | +$wgExtensionMessagesFiles['Redirect'] = $dir . 'Redirect.i18n.php'; |
| 32 | +$wgAutoloadClasses['RedirectHooks'] = $dir . 'Redirect.class.php'; |
| 33 | + |
| 34 | +$wgHooks['AddNewAccount'][] = 'RedirectHooks::afterAddNewAccount'; |
| 35 | +$wgHooks['UserLogout'][] = 'RedirectHooks::afterUserLogoutComplete'; |
Property changes on: trunk/extensions/Redirect/Redirect.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 36 | + native |
Index: trunk/extensions/Redirect/Redirect.class.php |
— | — | @@ -0,0 +1,43 @@ |
| 2 | +<?php |
| 3 | +/** |
| 4 | + * Hooks for Redirect extension |
| 5 | + * |
| 6 | + * @file |
| 7 | + * @ingroup Extensions |
| 8 | + */ |
| 9 | + |
| 10 | +class RedirectHooks { |
| 11 | + public static function afterAddNewAccount( $user, $byEmail ) { |
| 12 | + // Do nothing if account creation was by e-mail |
| 13 | + if ( $byEmail ) { |
| 14 | + return true; |
| 15 | + } |
| 16 | + |
| 17 | + return self::addRedirect( 'addnewaccount' ); |
| 18 | + } |
| 19 | + |
| 20 | + public static function afterUserLogoutComplete( &$user ) { |
| 21 | + return self::addRedirect( 'userlogoutcomplete' ); |
| 22 | + } |
| 23 | + |
| 24 | + private static function addRedirect( $hookName ) { |
| 25 | + global $wgOut, $wgServer, $wgScript; |
| 26 | + |
| 27 | + wfLoadExtensionMessages( 'Redirect' ); |
| 28 | + |
| 29 | + $targetPage = wfMsgForContent( 'redirect-' . $hookName ); |
| 30 | + |
| 31 | + // Default for message is empty. Do nothing. |
| 32 | + if ( $targetPage == '' ) { |
| 33 | + return true; |
| 34 | + } |
| 35 | + |
| 36 | + $target = Title::newFromText( $targetPage ); |
| 37 | + |
| 38 | + if ( $target->isKnown() ) { |
| 39 | + $wgOut->redirect( $wgServer . $wgScript . "?title=" . $target ); |
| 40 | + } |
| 41 | + |
| 42 | + return true; |
| 43 | + } |
| 44 | +} |
Property changes on: trunk/extensions/Redirect/Redirect.class.php |
___________________________________________________________________ |
Name: svn:eol-style |
1 | 45 | + native |
Index: trunk/extensions/Configure/CHANGELOG |
— | — | @@ -1,6 +1,9 @@ |
2 | 2 | This file lists changes on this extension. |
3 | 3 | Localisation updates are done on betawiki and aren't listed here. |
4 | 4 | |
| 5 | +0.11.7 - 10 January 2009 |
| 6 | + * Added support for Redirect |
| 7 | + |
5 | 8 | 0.11.6 - 7 January 2009 |
6 | 9 | * Added support for OpenID, NewUserMessage and ReplaceText extensions. |
7 | 10 | * Updated GoogleAdSense extension. |
Index: trunk/extensions/Configure/Configure.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Configure', |
19 | 19 | 'description' => 'Allow authorised users to configure the wiki via a web-based interface', |
20 | 20 | 'descriptionmsg' => 'configure-desc', |
21 | | - 'version' => '0.11.6', |
| 21 | + 'version' => '0.11.7', |
22 | 22 | ); |
23 | 23 | |
24 | 24 | # Configuration part |
Index: trunk/extensions/Configure/Configure.settings-ext.php |
— | — | @@ -928,6 +928,10 @@ |
929 | 929 | |
930 | 930 | // R |
931 | 931 | array( |
| 932 | + 'name' => 'Redirect', |
| 933 | + 'url' => 'http://www.mediawiki.org/wiki/Extension:Redirect', |
| 934 | + ), |
| 935 | + array( |
932 | 936 | 'name' => 'Renameuser', |
933 | 937 | 'file' => 'SpecialRenameuser.php', |
934 | 938 | 'url' => 'http://www.mediawiki.org/wiki/Extension:Renameuser', |
Index: trunk/extensions/Translate/groups/mediawiki-defines.txt |
— | — | @@ -590,6 +590,9 @@ |
591 | 591 | |
592 | 592 | Record Admin |
593 | 593 | |
| 594 | +Redirect |
| 595 | +ignored = redirect-addnewaccount, redirect-userlogincomplete, redirect-userlogoutcomplete |
| 596 | + |
594 | 597 | Refresh Special |
595 | 598 | |
596 | 599 | Regex Block |