r27517 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r27516‎ | r27517 | r27518 >
Date:07:15, 15 November 2007
Author:nickj
Status:old
Tags:
Comment:
Whitespace, wgExtensionCredits, removing array from $wgHooks lines.
Modified paths:
  • /trunk/extensions/CommentSpammer/CommentSpammer.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CommentSpammer/CommentSpammer.php
@@ -14,6 +14,12 @@
1515 }
1616
1717 $wgExtensionFunctions[] = 'efCommentSpammer';
 18+$wgExtensionCredits['other'][] = array(
 19+ 'name' => 'CommentSpammer',
 20+ 'author' => 'Nick Jenkins',
 21+ 'url' => 'http://www.mediawiki.org/wiki/Extension:CommentSpammer',
 22+ 'description' => 'Rejects edits from suspected comment spammers on a DNS blacklist.',
 23+);
1824
1925 function efCommentSpammer() {
2026 global $wgMessageCache;
@@ -25,7 +31,7 @@
2632 /**
2733 * Add the hook on which we trigger.
2834 */
29 -$wgHooks['EditFilter'][] = array( 'HoneyPotCommentSpammer::commentSpammerHook' );
 35+$wgHooks['EditFilter'][] = 'HoneyPotCommentSpammer::commentSpammerHook';
3036
3137 /**
3238 * Another log type, 'cSpammer', is added, if logging has been enabled, and appropriate
@@ -37,7 +43,7 @@
3844 $wgLogTypes[] = 'cSpammer';
3945 $wgLogHeaders['cSpammer'] = 'cspammerlogpagetext';
4046 $wgLogNames['cSpammer'] = 'cspammer-log-page';
41 - $wgHooks['LogLine'][] = array( 'HoneyPotCommentSpammer::showLogLine' );
 47+ $wgHooks['LogLine'][] = 'HoneyPotCommentSpammer::showLogLine';
4248 }
4349
4450 /**
@@ -48,8 +54,8 @@
4955 class HoneyPotCommentSpammer {
5056
5157 /**
52 - * Class constants that relate to: http://www.projecthoneypot.org/httpbl_api.php
53 - */
 58+ * Class constants that relate to: http://www.projecthoneypot.org/httpbl_api.php
 59+ */
5460 const HONEY_POT_DNSBL = 'dnsbl.httpbl.org';
5561 const HONEY_POT_NO_ERROR = 127; // The "everything is a-okay" response code that we want to see.
5662 const MAX_STALENESS = 14; // Number of days since this IP last spammed before we forgive.
@@ -57,10 +63,10 @@
5864 const COMMENT_SPAMMER_CODE = 4; // The code for a comment spammer.
5965
6066 /**
61 - * Determines whether the specified IP address corresponds to a known active comment spammer.
62 - * @param string $ip_addr A IP address string like '87.101.244.10'
63 - * @return boolean True for spammer, false for non-spammer or if get unexpected results.
64 - */
 67+ * Determines whether the specified IP address corresponds to a known active comment spammer.
 68+ * @param string $ip_addr A IP address string like '87.101.244.10'
 69+ * @return boolean True for spammer, false for non-spammer or if get unexpected results.
 70+ */
6571 public static function isCommentSpammer( $ip_addr = null ) {
6672 // logged in users are assumed to not be comment spammers.
6773 global $wgUser;
@@ -145,14 +151,14 @@
146152 }
147153
148154 /**
149 - * Determines whether the specified IP address corresponds to a known active comment spammer, and if
150 - * so denies the edit and outputs a message to this effect.
151 - * // @param EditPage $editPage EditPage object for page modification.
152 - * // @param string $textbox The text the user submitted. (param not used)
153 - * // @param string $section The section the user modified. (param not used)
154 - * // @param string $hookError Return value for error about why the edit was rejected, if applicable. (param not used)
155 - * @return boolean True for allowing the edit, false for denying the edit.
156 - */
 155+ * Determines whether the specified IP address corresponds to a known active comment spammer, and if
 156+ * so denies the edit and outputs a message to this effect.
 157+ * // @param EditPage $editPage EditPage object for page modification.
 158+ * // @param string $textbox The text the user submitted. (param not used)
 159+ * // @param string $section The section the user modified. (param not used)
 160+ * // @param string $hookError Return value for error about why the edit was rejected, if applicable. (param not used)
 161+ * @return boolean True for allowing the edit, false for denying the edit.
 162+ */
157163 public static function commentSpammerHook( /* $editPage = null, $textbox = '', $section = '', & $hookError = '' */ ) {
158164 $spammer = self::isCommentSpammer( );
159165 if( $spammer ) {
@@ -163,10 +169,10 @@
164170 }
165171
166172 /**
167 - * Gets the blacklist DNS response for the specified IP address.
168 - * @param string $ip_addr A IP address string like '87.101.244.10'
169 - * @return array DNS data as an array.
170 - */
 173+ * Gets the blacklist DNS response for the specified IP address.
 174+ * @param string $ip_addr A IP address string like '87.101.244.10'
 175+ * @return array DNS data as an array.
 176+ */
171177 private static function getDnsResults( $ip_addr ) {
172178 global $wgHoneyPotKey;
173179
@@ -184,11 +190,11 @@
185191 }
186192
187193 /**
188 - * Determines whether the DNS results indicate a spammer or not.
189 - * @param array $result DNS data as an array.
190 - * @param array $params Return array built with the response values from the DNS result.
191 - * @return boolean True for spammer, false for non-spammer, or if get unexpected results.
192 - */
 194+ * Determines whether the DNS results indicate a spammer or not.
 195+ * @param array $result DNS data as an array.
 196+ * @param array $params Return array built with the response values from the DNS result.
 197+ * @return boolean True for spammer, false for non-spammer, or if get unexpected results.
 198+ */
193199 private static function resultsSaySpammer( $result, & $params ) {
194200 //wfDebug( __METHOD__ . ": Entering\n" );
195201 // if there was anything wrong with the data we got, assume they're
@@ -238,4 +244,4 @@
239245
240246 }
241247
242 -?>
\ No newline at end of file
 248+?>

Status & tagging log