r36473 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36472‎ | r36473 | r36474 >
Date:18:13, 19 June 2008
Author:brion
Status:old
Tags:
Comment:
* escape your HTML output
* no need to call a fancy Xml::blah function for hardcoded </table>
* don't bother checking for MEDIAWIKI when not needed -- variable definitions are harmless code
* do check for MEDIAWIKI when we'll spew errors without it
Modified paths:
  • /trunk/extensions/InterwikiList/InterwikiList.php (modified) (history)
  • /trunk/extensions/InterwikiList/InterwikiList_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/InterwikiList/InterwikiList_body.php
@@ -2,6 +2,11 @@
33
44 // Class definition for Extension:InterwikiList
55
 6+// Suppress fatal error about SpecialPage class not found if called as entry point
 7+if ( !defined('MEDIAWIKI') ) {
 8+ die( '' );
 9+}
 10+
611 class InterwikiList extends SpecialPage {
712
813 /**
@@ -37,12 +42,12 @@
3843
3944 while ( $row = $dbr->fetchObject( $results ) ) {
4045 $text .= " <tr>
41 - <td>" . $row->iw_prefix . "</td>
42 - <td>" . $row->iw_url . "</td>
 46+ <td>" . htmlspecialchars( $row->iw_prefix ) . "</td>
 47+ <td>" . htmlspecialchars( $row->iw_url ) . "</td>
4348 </tr>\n";
4449 }
45 - $text .= Xml::closeElement( 'table' );
46 - $dbr->freeResult ( $results );
 50+ $text .= "</table>\n";
 51+ $dbr->freeResult( $results );
4752
4853 return $text;
4954 }
Index: trunk/extensions/InterwikiList/InterwikiList.php
@@ -12,11 +12,6 @@
1313 * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
1414 */
1515
16 -// Not a valid entry point, skip unless MEDIAWIKI is defined
17 -if ( !defined('MEDIAWIKI') ) {
18 - die( "NOT A VALID ENTRY" );
19 -}
20 -
2116 $wgExtensionCredits['specialpage'][] = array(
2217 'name' => 'Interwiki List',
2318 'version' => '0.2',

Status & tagging log