r67636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67635‎ | r67636 | r67637 >
Date:16:35, 8 June 2010
Author:platonides
Status:deferred
Tags:
Comment:
r67627#c7076 suggestion of SpecialPage::getTitleFor + stylize.php
Modified paths:
  • /trunk/extensions/EmailPage/EmailPage.i18n.php (modified) (history)
  • /trunk/extensions/EmailPage/EmailPage.php (modified) (history)
  • /trunk/extensions/EmailPage/EmailPage_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EmailPage/EmailPage.php
@@ -52,8 +52,8 @@
5353
5454 function wfEmailPageToolboxLink() {
5555 global $wgTitle, $wgUser, $wgEmailPageGroup;
56 - if ( is_object( $wgTitle ) && ( empty($wgEmailPageGroup) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) {
57 - $url = htmlspecialchars( Title::makeTitle( NS_SPECIAL, 'EmailPage' )->getLocalURL( array('ea-title' => $wgTitle->getPrefixedText() ) ) );
 56+ if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) {
 57+ $url = htmlspecialchars( SpecialPage::getTitleFor( 'EmailPage' )->getLocalURL( array( 'ea-title' => $wgTitle->getPrefixedText() ) ) );
5858 echo( "<li><a href=\"$url\">" . wfMsg( 'emailpage' ) . "</a></li>" );
5959 }
6060 return true;
@@ -62,7 +62,7 @@
6363 function wfEmailPageActionLink( $skin, &$actions ) {
6464 global $wgTitle, $wgUser, $wgEmailPageGroup;
6565 if ( is_object( $wgTitle ) && ( empty( $wgEmailPageGroup ) || in_array( $wgEmailPageGroup, $wgUser->getEffectiveGroups() ) ) ) {
66 - $url = Title::makeTitle( NS_SPECIAL, 'EmailPage' )->getLocalURL( array('ea-title' => $wgTitle->getPrefixedText() ) );
 66+ $url = SpecialPage::getTitleFor( 'EmailPage' )->getLocalURL( array( 'ea-title' => $wgTitle->getPrefixedText() ) );
6767 $actions['email'] = array( 'text' => wfMsg( 'email' ), 'class' => false, 'href' => $url );
6868 }
6969 return true;
Index: trunk/extensions/EmailPage/EmailPage_body.php
@@ -29,7 +29,7 @@
3030 global $wgOut, $wgUser, $wgRequest, $wgParser, $wgEmailPageContactsCat, $wgGroupPermissions, $wgSitename,
3131 $wgRecordAdminCategory, $wgEmailPageCss, $wgEmailPageAllowAllUsers;
3232
33 - $db = wfGetDB(DB_SLAVE);
 33+ $db = wfGetDB( DB_SLAVE );
3434 $param = str_replace( '_', ' ', $param );
3535 wfLoadExtensionMessages( 'EmailPage' );
3636 $this->setHeaders();
@@ -70,7 +70,7 @@
7171 $res = $db->select(
7272 'categorylinks',
7373 'cl_from',
74 - 'cl_to = '.$db->addQuotes( $wgEmailPageContactsCat ),
 74+ 'cl_to = ' . $db->addQuotes( $wgEmailPageContactsCat ),
7575 __METHOD__,
7676 array( 'ORDER BY' => 'cl_sortkey' )
7777 );
@@ -148,9 +148,9 @@
149149 $wgOut->addHTML( "</fieldset>" );
150150
151151 # Submit buttons & hidden values
152 - $wgOut->addHTML(Xml::element( 'input', array( 'type' => 'submit', 'name' => 'ea-send', 'value' => wfMsg( 'ea-send' ) ) ) . '&#160;' );
153 - $wgOut->addHTML(Xml::element( 'input', array( 'type' => 'submit', 'name' => 'ea-show', 'value' => wfMsg( 'ea-show' ) ) ) );
154 - $wgOut->addHTML(Xml::element( 'input', array( 'type' => 'hidden', 'name' => 'ea-title', 'value' => $this->title ) ) );
 152+ $wgOut->addHTML( Xml::element( 'input', array( 'type' => 'submit', 'name' => 'ea-send', 'value' => wfMsg( 'ea-send' ) ) ) . '&#160;' );
 153+ $wgOut->addHTML( Xml::element( 'input', array( 'type' => 'submit', 'name' => 'ea-show', 'value' => wfMsg( 'ea-show' ) ) ) );
 154+ $wgOut->addHTML( Xml::element( 'input', array( 'type' => 'hidden', 'name' => 'ea-title', 'value' => $this->title ) ) );
155155
156156 $wgOut->addHTML( "</form>" );
157157
@@ -182,7 +182,7 @@
183183 $res = $db->select(
184184 'categorylinks',
185185 'cl_from',
186 - 'cl_to = '.$db->addQuotes( $this->cat ),
 186+ 'cl_to = ' . $db->addQuotes( $this->cat ),
187187 __METHOD__,
188188 array( 'ORDER BY' => 'cl_sortkey' )
189189 );
@@ -213,12 +213,12 @@
214214 if ( $this->textonly == '' ) {
215215
216216 # Parse the wikitext using absolute URL's for local page links
217 - $tmp = array($wgArticlePath, $wgScriptPath, $wgScript);
218 - $wgArticlePath = $wgServer.$wgArticlePath;
219 - $wgScriptPath = $wgServer.$wgScriptPath;
220 - $wgScript = $wgServer.$wgScript;
221 - $message = $wgParser->parse($message, $title, $opt, true, true)->getText();
222 - list($wgArticlePath,$wgScriptPath,$wgScript) = $tmp;
 217+ $tmp = array( $wgArticlePath, $wgScriptPath, $wgScript );
 218+ $wgArticlePath = $wgServer . $wgArticlePath;
 219+ $wgScriptPath = $wgServer . $wgScriptPath;
 220+ $wgScript = $wgServer . $wgScript;
 221+ $message = $wgParser->parse( $message, $title, $opt, true, true )->getText();
 222+ list( $wgArticlePath, $wgScriptPath, $wgScript ) = $tmp;
223223
224224 # Get CSS content if any
225225 if ( $this->css ) {
Index: trunk/extensions/EmailPage/EmailPage.i18n.php
@@ -127,7 +127,7 @@
128128 'ea-nopage' => "Bitte gebe eine Seite zum Versenden an, bspw. \"[[Special:EmailPage/{{MediaWiki:Mainpage-url}}]]\".",
129129 'ea-norecipients' => "Es sind keine E-Mail-Adressen zum Versenden vorhanden!",
130130 'ea-listrecipients' => '=== {{PLURAL:$1|Empfänger|$1 Empfänger}} ===',
131 - 'ea-error'=> "'''Fehler beim Versenden von Seite [[$1]]:''' ''$2''",
 131+ 'ea-error' => "'''Fehler beim Versenden von Seite [[$1]]:''' ''$2''",
132132 'ea-denied' => 'E-Mail-Versand wurde aufgrund fehlender Berechtigung unterbunden.',
133133 'ea-sent' => "Seite [[$1]] wurde erfolgreich von [[User:$3|$3]] an '''$2''' {{PLURAL:$2|Empfänger|Empfänger}} versandt.",
134134 'ea-selectrecipients' => 'Empfänger auswählen',
@@ -155,7 +155,7 @@
156156 'ea-nopage' => "Bitte geben Sie eine Seite zum Versenden an, bspw. \"[[Special:EmailPage/{{MediaWiki:Mainpage-url}}]]\".",
157157 'ea-norecipients' => "Es sind keine E-Mail-Adressen zum Versenden vorhanden!",
158158 'ea-listrecipients' => '=== {{PLURAL:$1|Empfänger|$1 Empfänger}} ===',
159 - 'ea-error'=> "'''Fehler beim Versenden von Seite [[$1]]:''' ''$2''",
 159+ 'ea-error' => "'''Fehler beim Versenden von Seite [[$1]]:''' ''$2''",
160160 'ea-denied' => 'E-Mail-Versand wurde aufgrund fehlender Berechtigung unterbunden.',
161161 'ea-sent' => "Seite [[$1]] wurde erfolgreich von [[User:$3|$3]] an '''$2''' {{PLURAL:$2|Empfänger|Empfänger}} versandt.",
162162 'ea-selectrecipients' => 'Empfänger auswählen',

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r67627Fix entity error and potential injection.platonides15:17, 8 June 2010

Status & tagging log