r51681 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51680‎ | r51681 | r51682 >
Date:05:42, 10 June 2009
Author:tstarling
Status:deferred
Tags:
Comment:
Backported r50477, r50541, r50898, r50900, recent changes from trunk including security fixes.
Modified paths:
  • /branches/REL1_15/extensions/Widgets (modified) (history)
  • /branches/REL1_15/extensions/Widgets/Widgets.php (modified) (history)

Diff [purge]

Index: branches/REL1_15/extensions/Widgets/Widgets.php
@@ -7,29 +7,44 @@
88 * @version $Id: Widgets.php 15 2008-06-25 21:22:40Z sergey.chernyshev $
99 */
1010
 11+if ( !defined( 'MEDIAWIKI' ) ) {
 12+ echo "This file is not a valid entry point.";
 13+ exit( 1 );
 14+}
 15+
1116 $wgExtensionCredits['parserhook'][] = array(
1217 'name' => 'Widgets',
1318 'description' => 'Allows wiki administrators to add free-form widgets to wiki by just editing pages within Widget namespace. Originally developed for [http://www.ardorado.com Ardorado.com]',
14 - 'version' => '0.8.5',
 19+ 'version' => '0.8.6',
1520 'author' => '[http://www.sergeychernyshev.com Sergey Chernyshev] (for [http://www.semanticcommunities.com Semantic Communities LLC.])',
1621 'url' => 'http://www.mediawiki.org/wiki/Extension:Widgets'
1722 );
1823
 24+/**
 25+ * Set this to the index of the Widget namespace
 26+ */
 27+if ( !defined( 'NS_WIDGET' ) ) {
 28+ define( 'NS_WIDGET', 274 );
 29+}
 30+if ( !defined( 'NS_WIDGET_TALK' ) ) {
 31+ define( 'NS_WIDGET_TALK', NS_WIDGET + 1 );
 32+} elseif ( NS_WIDGET_TALK != NS_WIDGET + 1 ) {
 33+ throw new MWException( 'Configuration error. Do not define NS_WIDGET_TALK, it is automatically set based on NS_WIDGET.' );
 34+}
 35+
1936 // Initialize Smarty
 37+require dirname(__FILE__)."/smarty/Smarty.class.php";
2038
21 -require "$IP/extensions/Widgets/smarty/Smarty.class.php";
22 -
2339 // Parser function registration
24 -$wgExtensionFunctions[] = 'widgetParserFunctions';
 40+$wgExtensionFunctions[] = 'widgetNamespacesInit';
2541 $wgHooks['LanguageGetMagic'][] = 'widgetLanguageGetMagic';
 42+$wgHooks['ParserFirstCallInit'][] = 'widgetParserFunctions';
2643
27 -// Init Widget namespaces
28 -widgetNamespacesInit();
 44+function widgetParserFunctions( &$parser )
 45+{
 46+ $parser->setFunctionHook('widget', 'renderWidget');
2947
30 -function widgetParserFunctions()
31 -{
32 - global $wgParser;
33 - $wgParser->setFunctionHook('widget', 'renderWidget');
 48+ return true;
3449 }
3550
3651 function widgetLanguageGetMagic( &$magicWords, $langCode = "en" )
@@ -162,16 +177,9 @@
163178 }
164179
165180 function widgetNamespacesInit() {
166 - global $widgetNamespaceIndex, $wgExtraNamespaces, $wgNamespacesWithSubpages,
 181+ global $wgExtraNamespaces, $wgNamespacesWithSubpages,
167182 $wgGroupPermissions, $wgNamespaceProtection;
168183
169 - if (!isset($widgetNamespaceIndex)) {
170 - $widgetNamespaceIndex = 274;
171 - }
172 -
173 - define('NS_WIDGET', $widgetNamespaceIndex);
174 - define('NS_WIDGET_TALK', $widgetNamespaceIndex+1);
175 -
176184 // Register namespace identifiers
177185 if (!is_array($wgExtraNamespaces)) { $wgExtraNamespaces=array(); }
178186 $wgExtraNamespaces = $wgExtraNamespaces + array(NS_WIDGET => 'Widget', NS_WIDGET_TALK => 'Widget_talk');
Property changes on: branches/REL1_15/extensions/Widgets
___________________________________________________________________
Name: svn:mergeinfo
179187 + /trunk/extensions/Widgets:50477,50541,50898,50900

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r50477* Fix register_globals inclusion vulnerability...tstarling12:31, 11 May 2009
r50541Hook needs to return true.sergeychernyshev04:33, 13 May 2009
r50898Fixed a problem with namespace configuration.sergeychernyshev17:32, 22 May 2009
r50900Release 0.8.6 - some important security fixes by Tim Starling.sergeychernyshev17:39, 22 May 2009

Status & tagging log