Index: trunk/extensions/EmailPage/EmailPage.php |
— | — | @@ -10,36 +10,35 @@ |
11 | 11 | * @copyright © 2007 Aran Dunkley |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
| 14 | +if( !defined( 'MEDIAWIKI' ) ) die( "Not an entry point." ); |
14 | 15 | |
15 | | -if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' ); |
| 16 | +define( 'EMAILPAGE_VERSION', "1.3.6, 2010-09-21" ); |
16 | 17 | |
17 | | -define( 'EMAILPAGE_VERSION', '1.3.5, 2010-09-17' ); |
18 | | - |
19 | | -$wgEmailPageGroup = 'sysop'; # Users must belong to this group to send emails (empty string means anyone can send) |
20 | | -$wgEmailPageContactsCat = ''; # This specifies the name of a category containing categories of contact pages |
21 | | -$wgEmailPageCss = 'EmailPage.css'; # A minimal CSS page to embed in the email (eg. monobook/main.css without portlets, actions etc) |
22 | | -$wgEmailPageAllowRemoteAddr = array( '127.0.0.1' ); # Allow anonymous sending from these addresses |
| 18 | +$wgEmailPageGroup = "sysop"; # Users must belong to this group to send emails (empty string means anyone can send) |
| 19 | +$wgEmailPageContactsCat = ""; # This specifies the name of a category containing categories of contact pages |
| 20 | +$wgEmailPageCss = "EmailPage.css"; # A minimal CSS page to embed in the email (eg. monobook/main.css without portlets, actions etc) |
| 21 | +$wgEmailPageAllowRemoteAddr = array( "127.0.0.1" ); # Allow anonymous sending from these addresses |
23 | 22 | $wgEmailPageAllowAllUsers = false; # Whether to allow sending to all users (the "user" group) |
24 | 23 | $wgEmailPageToolboxLink = true; # Add a link to the sidebar toolbox? |
25 | 24 | $wgEmailPageActionLink = true; # Add a link to the actions links? |
26 | | -$wgPhpMailerClass = dirname( __FILE__ ) . '/phpMailer_v2.1.0beta2/class.phpmailer.php'; # From http://phpmailer.sourceforge.net/ |
| 25 | +$wgPhpMailerClass = dirname( __FILE__ ) . "/phpMailer_v2.1.0beta2/class.phpmailer.php"; # From http://phpmailer.sourceforge.net/ |
27 | 26 | |
28 | | -if ( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true; |
| 27 | +if( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true; |
29 | 28 | |
30 | | -if ( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR']; |
| 29 | +if( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR']; |
31 | 30 | |
32 | 31 | $dir = dirname( __FILE__ ) . '/'; |
33 | | -$wgAutoloadClasses['SpecialEmailPage'] = $dir . 'EmailPage_body.php'; |
34 | | -$wgExtensionMessagesFiles['EmailPage'] = $dir . 'EmailPage.i18n.php'; |
35 | | -$wgExtensionAliasesFiles['EmailPage'] = $dir . 'EmailPage.alias.php'; |
36 | | -$wgSpecialPages['EmailPage'] = 'SpecialEmailPage'; |
| 32 | +$wgAutoloadClasses['SpecialEmailPage'] = $dir . "EmailPage_body.php"; |
| 33 | +$wgExtensionMessagesFiles['EmailPage'] = $dir . "EmailPage.i18n.php"; |
| 34 | +$wgExtensionAliasesFiles['EmailPage'] = $dir . "EmailPage.alias.php"; |
| 35 | +$wgSpecialPages['EmailPage'] = "SpecialEmailPage"; |
37 | 36 | |
38 | 37 | $wgExtensionCredits['specialpage'][] = array( |
39 | 38 | 'path' => __FILE__, |
40 | | - 'name' => 'EmailPage', |
41 | | - 'author' => '[http://www.organicdesign.co.nz/nad User:Nad]', |
42 | | - 'descriptionmsg' => 'ea-desc', |
43 | | - 'url' => 'http://www.mediawiki.org/wiki/Extension:EmailPage', |
| 39 | + 'name' => "EmailPage", |
| 40 | + 'author' => "[http://www.organicdesign.co.nz/nad User:Nad]", |
| 41 | + 'descriptionmsg' => "ea-desc", |
| 42 | + 'url' => "http://www.mediawiki.org/wiki/Extension:EmailPage", |
44 | 43 | 'version' => EMAILPAGE_VERSION |
45 | 44 | ); |
46 | 45 | |
— | — | @@ -48,7 +47,10 @@ |
49 | 48 | |
50 | 49 | # Add toolbox and action links |
51 | 50 | if ( $wgEmailPageToolboxLink ) $wgHooks['SkinTemplateToolboxEnd'][] = 'wfEmailPageToolboxLink'; |
52 | | -if ( $wgEmailPageActionLink ) $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink'; |
| 51 | +if ( $wgEmailPageActionLink ) { |
| 52 | + $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink'; |
| 53 | + $wgHooks['SkinTemplateNavigation'][] = 'wfEmailPageActionLinkVector'; |
| 54 | +} |
53 | 55 | |
54 | 56 | function wfEmailPageToolboxLink() { |
55 | 57 | global $wgTitle, $wgUser, $wgEmailPageGroup; |
— | — | @@ -67,3 +69,12 @@ |
68 | 70 | } |
69 | 71 | return true; |
70 | 72 | } |
| 73 | + |
| 74 | +function wfEmailPageActionLinkVector( $skin, &$actions ) { |
| 75 | + global $wgTitle, $wgUser, $wgEmailPageGroup; |
| 76 | + if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) { |
| 77 | + $url = SpecialPage::getTitleFor( 'EmailPage' )->getLocalURL( array( 'ea-title' => $wgTitle->getPrefixedText() ) ); |
| 78 | + $actions['views']['email'] = array( 'text' => wfMsg( 'email' ), 'class' => false, 'href' => $url ); |
| 79 | + } |
| 80 | + return true; |
| 81 | +} |