Index: trunk/extensions/EmailPage/EmailPage_body.php |
— | — | @@ -88,10 +88,14 @@ |
89 | 89 | |
90 | 90 | # Allow selection of a group |
91 | 91 | $groups = "<option />"; |
92 | | - foreach ( array_keys( $wgGroupPermissions ) as $group ) if ( $group != '*' ) { |
| 92 | + foreach ( array_keys( $wgGroupPermissions ) as $group ) if ( $group != '*' && $group != 'user' ) { |
93 | 93 | $selected = $group == $this->group ? ' selected' : ''; |
94 | | - if ( $wgEmailPageAllowAllUsers ) $groups .= "<option$selected>$group</option>"; |
| 94 | + $groups .= "<option$selected>$group</option>"; |
95 | 95 | } |
| 96 | + if ( $wgEmailPageAllowAllUsers ) { |
| 97 | + $selected = 'user' == $this->group ? ' selected' : ''; |
| 98 | + $groups .= "<option$selected value='user'>ALL USERS</option>"; |
| 99 | + } |
96 | 100 | $wgOut->addHTML( "<tr><td>" . wfMsg( 'ea-fromgroup' ) . "</td><td><select name=\"ea-group\">$groups</select></td></tr>\n" ); |
97 | 101 | $wgOut->addHTML( "</table>" ); |
98 | 102 | |
Index: trunk/extensions/EmailPage/EmailPage.php |
— | — | @@ -11,24 +11,24 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -if (!defined('MEDIAWIKI')) die('Not an entry point.'); |
| 15 | +if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' ); |
16 | 16 | |
17 | | -define('EMAILPAGE_VERSION', '1.3.3, 2009-04-19'); |
| 17 | +define( 'EMAILPAGE_VERSION', '1.3.4, 2009-05-04' ); |
18 | 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 |
23 | | -$wgEmailPageAllowAllUsers = false; # Whether to allow sending to all users (the "user" group) |
24 | | -$wgEmailPageToolboxLink = true; # Add a link to the sidebar toolbox? |
25 | | -$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/ |
| 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 |
| 23 | +$wgEmailPageAllowAllUsers = false; # Whether to allow sending to all users (the "user" group) |
| 24 | +$wgEmailPageToolboxLink = true; # Add a link to the sidebar toolbox? |
| 25 | +$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/ |
27 | 27 | |
28 | | -if ($wgEmailPageGroup) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true; |
| 28 | +if ( $wgEmailPageGroup ) $wgGroupPermissions['sysop'][$wgEmailPageGroup] = true; |
29 | 29 | |
30 | | -if (isset($_SERVER['SERVER_ADDR'])) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR']; |
| 30 | +if ( isset( $_SERVER['SERVER_ADDR'] ) ) $wgEmailPageAllowRemoteAddr[] = $_SERVER['SERVER_ADDR']; |
31 | 31 | |
32 | | -$dir = dirname(__FILE__) . '/'; |
| 32 | +$dir = dirname( __FILE__ ) . '/'; |
33 | 33 | $wgAutoloadClasses['SpecialEmailPage'] = $dir . 'EmailPage_body.php'; |
34 | 34 | $wgExtensionMessagesFiles['EmailPage'] = $dir . 'EmailPage.i18n.php'; |
35 | 35 | $wgExtensionAliasesFiles['EmailPage'] = $dir . 'EmailPage.alias.php'; |
— | — | @@ -45,26 +45,26 @@ |
46 | 46 | ); |
47 | 47 | |
48 | 48 | # If form has been posted, include the phpmailer class |
49 | | -if (isset($_REQUEST['ea-send'])) require_once($wgPhpMailerClass); |
| 49 | +if ( isset( $_REQUEST['ea-send'] ) ) require_once( $wgPhpMailerClass ); |
50 | 50 | |
51 | 51 | # Add toolbox and action links |
52 | | -if ($wgEmailPageToolboxLink) $wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfEmailPageToolboxLink'; |
53 | | -if ($wgEmailPageActionLink) $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink'; |
| 52 | +if ( $wgEmailPageToolboxLink ) $wgHooks['MonoBookTemplateToolboxEnd'][] = 'wfEmailPageToolboxLink'; |
| 53 | +if ( $wgEmailPageActionLink ) $wgHooks['SkinTemplateTabs'][] = 'wfEmailPageActionLink'; |
54 | 54 | |
55 | 55 | function wfEmailPageToolboxLink() { |
56 | 56 | global $wgTitle, $wgUser, $wgEmailPageGroup; |
57 | | - if (is_object($wgTitle) && (empty($wgEmailPageGroup) || in_array($wgEmailPageGroup, $wgUser->getEffectiveGroups()))) { |
58 | | - $url = Title::makeTitle(NS_SPECIAL, 'EmailPage')->getLocalURL('ea-title='.$wgTitle->getPrefixedText()); |
59 | | - echo("<li><a href=\"$url\">".wfMsg('emailpage')."</a></li>"); |
60 | | - } |
| 57 | + if ( is_object( $wgTitle ) && ( empty($wgEmailPageGroup) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) { |
| 58 | + $url = Title::makeTitle( NS_SPECIAL, 'EmailPage' )->getLocalURL( 'ea-title='.$wgTitle->getPrefixedText() ); |
| 59 | + echo( "<li><a href=\"$url\">" . wfMsg( 'emailpage' ) . "</a></li>" ); |
| 60 | + } |
61 | 61 | return true; |
62 | 62 | } |
63 | 63 | |
64 | | -function wfEmailPageActionLink(&$skin, &$actions) { |
| 64 | +function wfEmailPageActionLink( &$skin, &$actions ) { |
65 | 65 | global $wgTitle, $wgUser, $wgEmailPageGroup; |
66 | | - if (is_object($wgTitle) && (empty($wgEmailPageGroup) || in_array($wgEmailPageGroup, $wgUser->getEffectiveGroups()))) { |
67 | | - $url = Title::makeTitle(NS_SPECIAL, 'EmailPage')->getLocalURL('ea-title='.$wgTitle->getPrefixedText()); |
68 | | - $actions['email'] = array('text' => wfMsg('email'), 'class' => false, 'href' => $url); |
| 66 | + if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) { |
| 67 | + $url = Title::makeTitle( NS_SPECIAL, 'EmailPage' )->getLocalURL('ea-title='.$wgTitle->getPrefixedText() ); |
| 68 | + $actions['email'] = array( 'text' => wfMsg( 'email' ), 'class' => false, 'href' => $url ); |
69 | 69 | } |
70 | 70 | return true; |
71 | 71 | } |