r64710 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r64709‎ | r64710 | r64711 >
Date:16:41, 7 April 2010
Author:ialex
Status:deferred
Tags:
Comment:
* Put the special page code in a separate file
* Now using DiffViewHeader hook
* Added alias file
* Coding style fixes
* Some other fixes
Modified paths:
  • /trunk/extensions/SpamDiffTool/SpamDiffTool.alias.php (added) (history)
  • /trunk/extensions/SpamDiffTool/SpamDiffTool.i18n.php (modified) (history)
  • /trunk/extensions/SpamDiffTool/SpamDiffTool.php (modified) (history)
  • /trunk/extensions/SpamDiffTool/SpamDiffTool_body.php (added) (history)

Diff [purge]

Index: trunk/extensions/SpamDiffTool/SpamDiffTool.alias.php
@@ -0,0 +1,16 @@
 2+<?php
 3+/**
 4+ * Aliases for special pages
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+$aliases = array();
 11+
 12+/** English
 13+ * @author IAlex
 14+ */
 15+$aliases['en'] = array(
 16+ 'SpamDiffTool' => array( 'SpamDiffTool' ),
 17+);
Property changes on: trunk/extensions/SpamDiffTool/SpamDiffTool.alias.php
___________________________________________________________________
Name: svn:eol-style
118 + native
Index: trunk/extensions/SpamDiffTool/SpamDiffTool_body.php
@@ -0,0 +1,214 @@
 2+<?php
 3+if ( ! defined( 'MEDIAWIKI' ) )
 4+ die();
 5+
 6+class SpecialSpamDiffTool extends UnlistedSpecialPage {
 7+
 8+ function __construct() {
 9+ parent::__construct( 'SpamDiffTool' );
 10+ }
 11+
 12+ function execute( $par ) {
 13+ global $wgRequest, $wgContLang, $wgOut, $wgUser,
 14+ $wgScript, $wgSpamBlacklistArticle;
 15+
 16+ wfLoadExtensionMessages( 'SpamDiffTool' );
 17+
 18+ $this->setHeaders();
 19+
 20+ // can the user even edit this?
 21+ $sb = Title::newFromText( $wgSpamBlacklistArticle );
 22+ if ( !$sb->userCan( 'edit' ) ) {
 23+ $wgOut->addWikiMsg( 'spamdifftool_cantedit' );
 24+ return;
 25+ }
 26+
 27+ $this->outputHeader();
 28+
 29+ $title = Title::newFromText( $wgRequest->getVal( 'target' ) );
 30+ $diff = $wgRequest->getVal( 'diff2' );
 31+ $rcid = $wgRequest->getVal( 'rcid' );
 32+ $rdfrom = $wgRequest->getVal( 'rdfrom' );
 33+
 34+ // do the processing
 35+ if ( $wgRequest->wasPosted() ) {
 36+ if ( $wgRequest->getCheck( 'confirm' ) ) {
 37+ $a = new Article( $sb );
 38+ $text = '';
 39+ $insert = true;
 40+ // make sure this page exists
 41+ if ( $sb->getArticleID() > 0 ) {
 42+ $text = $a->getContent();
 43+ $insert = false;
 44+ }
 45+
 46+ // insert the before the <pre> at the bottom if there is one
 47+ $i = strrpos( $text, '</pre>' );
 48+ if ( $i !== false ) {
 49+ $text = substr( $text, 0, $i )
 50+ . $wgRequest->getVal( 'newurls' )
 51+ . "\n" . substr( $text, $i );
 52+ } else {
 53+ $text .= "\n" . $wgRequest->getVal( 'newurls' );
 54+ }
 55+ $watch = false;
 56+ if ( $wgUser->getID() > 0 )
 57+ $watch = $wgUser->isWatched( $sb );
 58+ if ( $insert ) {
 59+ $a->insertNewArticle( $text, wfMsgForContent( 'spamdifftool_summary' ), false, $watch );
 60+ } else {
 61+ $a->updateArticle( $text, wfMsgForContent( 'spamdifftool_summary' ), false, $watch );
 62+ }
 63+ $returnto = $wgRequest->getVal( 'returnto' );
 64+ if ( $returnto != null && $returnto != '' )
 65+ $wgOut->redirect( $wgScript . "?" . urldecode( $returnto ) ); // clear the redirect set by updateArticle
 66+ return;
 67+ }
 68+ $vals = $wgRequest->getValues();
 69+ $text = '';
 70+ foreach ( $vals as $key => $value ) {
 71+ if ( strpos( $key, 'http://' ) === 0 ) {
 72+ $url = str_replace( '%2E', '.', $key );
 73+ if ( $value == 'none' ) continue;
 74+ switch ( $value ) {
 75+ case 'domain':
 76+ $url = str_replace( 'http://', '', $url );
 77+ $url = preg_replace( '/(.*[^\/])*\/.*/', '$1', $url ); // trim everything after the slash
 78+ $k = explode( '\.', $url );
 79+ $url = $k[sizeof($k) - 2] . '.' . $k[sizeof($k) - 1];
 80+ $url = str_replace( '.', '\.', $url ); // escape the periods
 81+ break;
 82+ case 'subdomain':
 83+ $url = str_replace( 'http://', '', $url );
 84+ $url = str_replace( '.', '\.', $url ); // escape the periods
 85+ $url = preg_replace( '/^([^\/]*)\/.*/', '$1', $url ); // trim everything after the slash
 86+ break;
 87+ case 'dir':
 88+ $url = str_replace( 'http://', '', $url );
 89+ $url = str_replace( '.', '\.', $url ); // escape the periods
 90+ $url = str_replace( '/', '\/', $url ); // escape the slashes
 91+ break;
 92+ }
 93+ $text .= "$url\n";
 94+ }
 95+ }
 96+ if ( trim( $text ) == '' ) {
 97+ $wgOut->addHTML( wfMsg( 'spamdifftool_notext', $wgScript . "?" . urldecode( $wgRequest->getVal( 'returnto' ) ) ) );
 98+ return;
 99+ }
 100+ $wgOut->addHTML(
 101+ Xml::openElement( 'form', array( 'method' => 'post' ) ) . "\n" .
 102+ Xml::hidden( 'confirm', 'true' ) .
 103+ Xml::hidden( 'newurls', $text ) .
 104+ Xml::hidden( 'returnto', $wgRequest->getVal( 'returnto' ) ) . "\n" .
 105+ wfMsg( 'spamdifftool_confirm',
 106+ 'http://www.mediawiki.org/w/index.php?title=Extension_talk:SpamDiffTool&action=edit&section=new' ) .
 107+ "\n<pre>$text</pre>\n" .
 108+ Xml::closeElement( 'table' ) . "\n" .
 109+ Xml::submitButton( wfMsg( 'spamdifftool_submit_buttom' ) ) . "\n" .
 110+ Xml::closeElement( 'form' )
 111+ );
 112+ return;
 113+ }
 114+
 115+ if ( !$title ) {
 116+ $wgOut->addWikiMsg( 'spamdifftool-no-title' );
 117+ return;
 118+ }
 119+
 120+ if ( !is_null( $diff ) ) {
 121+ # Get the last edit not by this guy
 122+ $current = Revision::newFromTitle( $title );
 123+ $dbw = wfGetDB( DB_MASTER );
 124+ $user = intval( $current->getUser() );
 125+ $user_text = $dbw->addQuotes( $current->getUserText() );
 126+ $s = $dbw->selectRow( 'revision',
 127+ //array( 'min(rev_id)', 'rev_timestamp' ),
 128+ array( 'min(rev_id) as rev_id' ),
 129+ array(
 130+ 'rev_page' => $current->getPage(),
 131+ "rev_user <> {$user} OR rev_user_text <> {$user_text}",
 132+ $diff != "" ? "rev_id < $diff" : '1 = 1', // sure - why not!
 133+ ), __METHOD__,
 134+ array(
 135+ 'USE INDEX' => 'page_timestamp',
 136+ 'ORDER BY' => 'rev_timestamp DESC' )
 137+ );
 138+ if ( $s ) {
 139+ // set oldid
 140+ $oldid = $s->rev_id;
 141+ }
 142+
 143+ // new diff object to extract the revision texts
 144+ if ( $rcid != '' ) {
 145+ $de = new DifferenceEngine( $title, $oldid, $diff, $rcid );
 146+ } else {
 147+ $de = new DifferenceEngine( $title, $oldid, $diff);
 148+ }
 149+
 150+ $de->loadText();
 151+ $otext = $de->mOldtext;
 152+ $ntext = $de->mNewtext;
 153+ $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
 154+ $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
 155+ $diffs = new Diff( $ota, $nta );
 156+
 157+ // iterate over the edits and get all of the changed text
 158+ $text = '';
 159+ foreach ( $diffs->edits as $edit ) {
 160+ if ( $edit->type != 'copy' ) {
 161+ $text .= implode( "\n", $edit->closing ) . "\n";
 162+ }
 163+ }
 164+ } else {
 165+ $a = new Article( $title );
 166+ $text = $a->getContent( true );
 167+ }
 168+
 169+ $matches = array();
 170+ $preg = "/http:\/\/[^] \n'\"]*/";
 171+ preg_match_all( $preg, $text, $matches );
 172+
 173+ if ( !count( $matches[0] ) ) {
 174+ $wgOut->addHTML( wfMsg( 'spamdifftool_no_urls_detected', $wgScript . "?" . urldecode( $wgRequest->getVal( 'returnto' ) ) ) );
 175+ return;
 176+ }
 177+
 178+ $wgOut->addWikiMsg( 'spamdifftool_urls_detected' );
 179+ $wgOut->addInlineStyle( 'td.spam-url-row { border: 1px solid #ccc; }' );
 180+
 181+ $wgOut->addHTML(
 182+ Xml::openElement( 'form', array( 'method' => 'post' ) ) . "\n" .
 183+ Xml::hidden( 'returnto', $wgRequest->getVal( 'returnto' ) ) . "\n" .
 184+ Xml::openElement( 'table', array( 'cellpadding' => 5, 'width' => '100%' ) ) . "\n"
 185+ );
 186+
 187+ $urls = array();
 188+ foreach ( $matches as $match ) {
 189+ foreach ( $match as $url ) {
 190+ if ( isset( $urls[$url] ) ) continue; // avoid dupes
 191+ $urls[$url] = true;
 192+ $name = htmlspecialchars( str_replace( ".", "%2E", $url ) );
 193+ $wgOut->addHTML(
 194+ Xml::tags( 'tr', array(),
 195+ Xml::tags( 'td', array( 'class' => 'spam-url-row' ),
 196+ "<b>$url</b><br />" . wfMsgHtml( 'spamdifftool_block' ) . "&nbsp;&nbsp;" .
 197+ Xml::radioLabel( wfMsg( 'spamdifftool_option_domain'), $name, 'domain', '{$name}-domain', true ) . "\n" .
 198+ Xml::radioLabel( wfMsg( 'spamdifftool_option_subdomain' ), $name, 'subdomain', '{$name}-subdomain' ) . "\n" .
 199+ Xml::radioLabel( wfMsg( 'spamdifftool_option_directory' ), $name, 'dir', '{$name}-dir' ) . "\n" .
 200+ Xml::radioLabel( wfMsg( 'spamdifftool_option_none' ), $name, 'none', '{$name}-none' ) . "\n"
 201+ )
 202+ )
 203+ );
 204+ }
 205+ }
 206+
 207+ $wgOut->addHTML(
 208+ Xml::closeElement( 'table' ) . "\n" .
 209+ Xml::submitButton( wfMsg( 'spamdifftool_submit_buttom' ) ) . "\n" .
 210+ Xml::closeElement( 'form' )
 211+ );
 212+ }
 213+}
 214+
 215+
Property changes on: trunk/extensions/SpamDiffTool/SpamDiffTool_body.php
___________________________________________________________________
Name: svn:eol-style
1216 + native
Index: trunk/extensions/SpamDiffTool/SpamDiffTool.i18n.php
@@ -11,6 +11,7 @@
1212 'spamdifftool' => 'Manage spam blacklist',
1313 'spamdifftool-desc' => 'Provides a basic way of adding new entries to the spam blacklist from diff pages',
1414 'spamdifftool_cantedit' => 'Sorry - you do not have permission to edit the spam blacklist.',
 15+ 'spamdifftool-no-title' => "'''Error:''' no page title was specified.",
1516 'spamdifftool_notext' => 'There is no text to add to the spam blacklist.
1617 Click <a href=\'$1\'>here</a> to continue.',
1718 'spamdifftool_confirm' => 'Confirm that you want to add these entries to the spam blacklist.
Index: trunk/extensions/SpamDiffTool/SpamDiffTool.php
@@ -3,22 +3,17 @@
44 die();
55
66 /**#@+
7 - * An extension that allows users to rate articles.
 7+ * An extension that allows users to rate articles.
88 *
99 * @addtogroup Extensions
1010 *
11 - * @link http://www.mediawiki.org/wiki/SpamDiffTool_Extension Documentation
 11+ * @link http://www.mediawiki.org/wiki/Extension:SpamDiffTool Documentation
1212 *
1313 *
1414 * @author Travis Derouin <travis@wikihow.com>
1515 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1616 */
1717
18 -$wgExtensionFunctions[] = 'wfSpamDiffTool';
19 -$wgSpamBlacklistArticle = "Project:Spam-Blacklist";
20 -
21 -require_once("SpecialPage.php");
22 -
2318 $wgExtensionCredits['other'][] = array(
2419 'path' => __FILE__,
2520 'name' => 'SpamDiffTool',
@@ -27,215 +22,59 @@
2823 'url' => 'http://www.mediawiki.org/wiki/Extension:SpamDiffTool',
2924 );
3025
31 -$dir = dirname(__FILE__) . '/';
 26+$wgSpamBlacklistArticle = "Project:Spam-Blacklist";
 27+
 28+$dir = dirname( __FILE__ ) . '/';
3229 $wgExtensionMessagesFiles['SpamDiffTool'] = $dir . 'SpamDiffTool.i18n.php';
 30+$wgExtensionAliasesFiles['SpamDiffTool'] = $dir . 'SpamDiffTool.alias.php';
3331
34 -function wfSpamDiffTool() {
35 - SpecialPage::AddPage(new UnlistedSpecialPage('SpamDiffTool'));
36 - wfLoadExtensionMessages( 'SpamDiffTool' );
 32+$wgAutoloadClasses['SpecialSpamDiffTool'] = $dir . 'SpamDiffTool_body.php';
 33+$wgSpecialPages['SpamDiffTool'] = 'SpecialSpamDiffTool';
 34+
 35+$wgHooks['DiffViewHeader'][] = 'wfSpamDiffToolOnDiffView';
 36+
 37+function wfSpamDiffToolOnDiffView( $diffEngine, $oldRev, $newRev ) {
 38+ global $wgOut, $wgUser, $wgSpamBlacklistArticle;
 39+
 40+ $sb = Title::newFromDBKey( $wgSpamBlacklistArticle );
 41+ if ( !$sb->userCan( 'edit' ) ) {
 42+ return true;
 43+ }
 44+
 45+ $wgOut->addHTML(
 46+ '<table style="width:100%"><tr><td style="width:50%"></td><td style="width:50%">
 47+ <div style="text-align:center">[' . $wgUser->getSkin()->link(
 48+ SpecialPage::getTitleFor( 'SpamDiffTool' ),
 49+ wfMsgHtml( 'spamdifftool_spam_link_text' ),
 50+ array(),
 51+ array(
 52+ 'target' => $diffEngine->getTitle()->getPrefixedDBkey(),
 53+ 'oldid2' => $oldRev->getId(),
 54+ 'diff2' => $newRev->getId(),
 55+ 'returnto' => $_SERVER['QUERY_STRING']
 56+ ) ) .
 57+ ']</div></td></tr></table>' );
 58+
 59+ return true;
3760 }
3861
39 -function wfSpamDiffLink($title) {
 62+function wfSpamDiffLink( $title ) {
4063 global $wgUser, $wgRequest, $wgSpamBlacklistArticle;
4164 $sk = $wgUser->getSkin();
42 - $sb = Title::newFromDBKey($wgSpamBlacklistArticle);
43 - if (!$sb->userCan( 'edit' )) {
 65+ $sb = Title::newFromDBKey( $wgSpamBlacklistArticle );
 66+ if ( !$sb->userCan( 'edit' ) ) {
4467 return '';
4568 }
46 - $link = '[' . $sk->makeKnownLinkObj( Title::newFromText("SpamDiffTool", NS_SPECIAL), wfMsg('spamdifftool_spam_link_text'),
47 - 'target=' . $title->getPrefixedURL().
48 - '&oldid2=' . $wgRequest->getVal('oldid') .
49 - '&rcid='. $wgRequest->getVal('rcid') .
50 - '&diff2='. $wgRequest->getVal('diff') .
51 - '&returnto=' . urlencode($_SERVER['QUERY_STRING'])
52 - ) .
53 - ']';
 69+ $link = '[' . $sk->makeKnownLinkObj( SpecialPage::getTitleFor( 'SpamDiffTool' ),
 70+ wfMsg( 'spamdifftool_spam_link_text' ),
 71+ 'target=' . $title->getPrefixedURL().
 72+ '&oldid2=' . $wgRequest->getVal( 'oldid' ) .
 73+ '&rcid='. $wgRequest->getVal( 'rcid' ) .
 74+ '&diff2='. $wgRequest->getVal( 'diff' ) .
 75+ '&returnto=' . urlencode( $_SERVER['QUERY_STRING'] )
 76+ ) .
 77+ ']';
5478
5579 return $link;
5680 }
5781
58 -function wfSpecialSpamDiffTool() {
59 - global $wgRequest, $wgContLang, $wgOut, $wgSpamBlacklistArticle, $wgUser, $wgScript;
60 - $title = Title::newFromDBKey($wgRequest->getVal('target'));
61 - $diff = $wgRequest->getVal( 'diff2' );
62 - $rcid = $wgRequest->getVal( 'rcid' );
63 - $rdfrom = $wgRequest->getVal( 'rdfrom' );
64 -
65 -
66 - // can the user even edit this?
67 - $sb = Title::newFromDBKey($wgSpamBlacklistArticle);
68 - if (!$sb->userCan( 'edit' )) {
69 - $wgOut->addHTML(wfMsg('spamdifftool_cantedit'));
70 - return;
71 - }
72 - // do the processing
73 - if ($wgRequest->wasPosted() ) {
74 -
75 - if ($wgRequest->getVal('confirm', null) != null) {
76 - $t = Title::newFromDBKey($wgSpamBlacklistArticle);
77 - $a = new Article(&$t);
78 - $text = "";
79 - $insert = true;
80 - // make sure this page exists
81 - if ($t->getArticleID() > 0) {
82 - $text = $a->getContent();
83 - $insert = false;
84 - }
85 -
86 - // insert the before the <pre> at the bottom if there is one
87 - $i = strrpos($text, "</pre>");
88 - if ($i !== false) {
89 - $text = substr($text, 0, $i)
90 - . $wgRequest->getVal('newurls')
91 - . "\n" . substr($text, $i);
92 - } else {
93 - $text .= "\n" . $wgRequest->getVal('newurls');
94 - }
95 - $watch = false;
96 - if ($wgUser->getID() > 0)
97 - $watch = $wgUser->isWatched($t);
98 - if ($insert) {
99 - $a->insertNewArticle($text, wfMsg('spamdifftool_summary'), false, $watch);
100 - } else {
101 -//print_r($a); exit;
102 - $a->updateArticle($text, wfMsg('spamdifftool_summary'), false, $watch) ;
103 - }
104 - $returnto = $wgRequest->getVal('returnto', null);
105 - if ($returnto != null && $returnto != '')
106 - $wgOut->redirect($wgScript . "?" . urldecode($returnto) ); // clear the redirect set by updateArticle
107 - return;
108 - }
109 - $vals = $wgRequest->getValues();
110 - $text = '';
111 - foreach ($vals as $key=>$value) {
112 - if (strpos($key, "http://") === 0) {
113 - $url = str_replace("%2E", ".", $key);
114 - if ($value == 'none') continue;
115 - switch ($value) {
116 - case 'domain':
117 - $url = str_replace("http://", "", $url);
118 - $url = preg_replace("/(.*[^\/])*\/.*/", "$1", $url); // trim everything after the slash
119 - $k = split('\.', $url);
120 - $url = $k[sizeof($k) - 2] . "." . $k[sizeof($k) - 1];
121 - $url = str_replace(".", "\.", $url); // escape the periods
122 - break;
123 - case 'subdomain':
124 - $url = str_replace("http://", "", $url);
125 - $url = str_replace(".", "\.", $url); // escape the periods
126 - $url = preg_replace("/^([^\/]*)\/.*/", "$1", $url); // trim everything after the slash
127 - break;
128 - case 'dir':
129 - $url = str_replace("http://", "", $url);
130 - $url = str_replace(".", "\.", $url); // escape the periods
131 - $url = str_replace("/", "\/", $url); // escape the slashes
132 - break;
133 - }
134 - $text .= "$url\n";
135 - }
136 - }
137 - if (trim($text) == '') {
138 - $wgOut->addHTML( wfMsg('spamdifftool_notext', $wgScript . "?" . urldecode($wgRequest->getVal('returnto') )));
139 - return;
140 - }
141 - $wgOut->addHTML("<form method=POST>
142 - <input type='hidden' name='confirm' value='true'>
143 - <input type='hidden' name='newurls' value=\"" . htmlspecialchars($text) . "\">
144 - <input type='hidden' name='returnto' value=\"" . htmlspecialchars($wgRequest->getVal('returnto')) . "\">
145 - ");
146 - $wgOut->addHTML(wfMsg('spamdifftool_confirm', 'http://www.mediawiki.org/w/index.php?title=Extension_talk:SpamDiffTool&action=edit&section=new') . "<pre>$text</pre>");
147 - $wgOut->addHTML("</table><input type=submit value=\"" . htmlspecialchars(wfMsg('spamdifftool_submit_buttom')) . "\"></form>");
148 - return;
149 - }
150 - if ( !is_null( $diff ) ) {
151 -
152 - # Get the last edit not by this guy
153 - $current = Revision::newFromTitle( $title );
154 - $dbw = wfGetDB( DB_MASTER );
155 - $user = intval( $current->getUser() );
156 - $user_text = $dbw->addQuotes( $current->getUserText() );
157 - $s = $dbw->selectRow( 'revision',
158 - //array( 'min(rev_id)', 'rev_timestamp' ),
159 - array( 'min(rev_id) as rev_id'),
160 - array(
161 - 'rev_page' => $current->getPage(),
162 - "rev_user <> {$user} OR rev_user_text <> {$user_text}",
163 - $diff != "" ? "rev_id < $diff" : " 1= 1", // sure - why not!
164 - ), $fname,
165 - array(
166 - 'USE INDEX' => 'page_timestamp',
167 - 'ORDER BY' => 'rev_timestamp DESC' )
168 - );
169 - if ($s) {
170 - // set oldid
171 - $oldid = $s->rev_id;
172 - }
173 -
174 - // new diff object to extract the revision texts
175 - if ($rcid != "") {
176 - $de = new DifferenceEngine( $title, $oldid, $diff, $rcid );
177 - } else {
178 - $de = new DifferenceEngine( $title, $oldid, $diff);
179 - }
180 -
181 - $de->loadText();
182 - $otext = $de->mOldtext;
183 - $ntext = $de->mNewtext;
184 - $ota = explode( "\n", $wgContLang->segmentForDiff( $otext ) );
185 - $nta = explode( "\n", $wgContLang->segmentForDiff( $ntext ) );
186 - $diffs = new Diff( $ota, $nta );
187 -
188 - // iterate over the edits and get all of the changed text
189 - foreach ($diffs->edits as $edit) {
190 - if ($edit->type != 'copy') {
191 - $text .= implode("\n", $edit->closing) . "\n";
192 - }
193 - }
194 - } else {
195 - $a = new Article($title);
196 - $text = $a->getContent(true);
197 - }
198 -
199 -//header("Content-type: text/plain;");
200 -$matches = array();
201 -$preg = "/http:\/\/[^] \n'\"]*/";
202 -preg_match_all($preg, $text, $matches);
203 -//exit;
204 - if (sizeof($matches[0]) == 0) {
205 - $wgOut->addHTML( wfMsg('spamdifftool_no_urls_detected', $wgScript . "?" . urldecode($wgRequest->getVal('returnto') )));
206 - return;
207 - }
208 - $wgOut->addHTML("
209 - <form method='POST'>
210 - <input type='hidden' name='returnto' value=\"" . htmlspecialchars($wgRequest->getVal('returnto')) . "\">
211 - <style type='text/css'>
212 - td.spam-url-row {
213 - border: 1px solid #ccc;
214 - }
215 - </style> " . wfMsg('spamdifftool_urls_detected') . "
216 - <br /><br /><table cellpadding='5px' width='100%'>");
217 -
218 - $urls = array();
219 - foreach ($matches as $match) {
220 - foreach ($match as $url) {
221 - if (isset($urls[$url])) continue; // avoid dupes
222 - $urls[$url] = true;
223 - $name = htmlspecialchars(str_replace(".", "%2E", $url));
224 - $wgOut->addHTML("<tr>
225 - <td class='spam-url-row'><b>$url</b><br />
226 - " . wfMsg('spamdifftool_block') . " &nbsp;&nbsp;
227 - <INPUT type='radio' name=\"" . $name . "\" value='domain' checked> " . wfMsg('spamdifftool_option_domain') . "
228 - <INPUT type='radio' name=\"" . $name . "\" value='subdomain'> " . wfMsg('spamdifftool_option_subdomain') . "
229 - <INPUT type='radio' name=\"" . $name . "\" value='dir'>" . wfMsg('spamdifftool_option_directory') . "
230 - <INPUT type='radio' name=\"" . $name . "\" value='none'>" . wfMsg('spamdifftool_option_none') . "
231 - </td>
232 - </tr>
233 - ");
234 - }
235 - }
236 - $wgOut->addHTML("</table><input type=submit value=\"" . htmlspecialchars(wfMsg('spamdifftool_submit_buttom')) . "\"></form>");
237 - // DifferenceEngine directly fetched the revision:
238 - $RevIdFetched = $de->mNewid;
239 - //$de->showDiffPage();
240 -}
241 -
242 -

Follow-up revisions

RevisionCommit summaryAuthorDate
r64711Add support for alias L10n of SpamDiffTool as follow-up to r64710.siebrand17:16, 7 April 2010

Status & tagging log