r62834 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r62833‎ | r62834 | r62835 >
Date:19:28, 22 February 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Changes for 0.5.4
* Small security fixes
* Use of $wgExtensionAssetsPath
Modified paths:
  • /trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php (modified) (history)
  • /trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php (modified) (history)
  • /trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php (modified) (history)
  • /trunk/extensions/SemanticMaps/SemanticMaps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticMaps/FormInputs/SM_FormInput.php
@@ -151,8 +151,8 @@
152152 $centre = MapsGeocodeUtils::attemptToGeocode($this->centre, $this->geoservice, $this->serviceName);
153153 $centre = MapsUtils::getLatLon($centre);
154154
155 - $this->centre_lat = $centre['lat'];
156 - $this->centre_lon = $centre['lon'];
 155+ $this->centre_lat = Xml::escapeJsString( $centre['lat'] );
 156+ $this->centre_lon = Xml::escapeJsString( $centre['lon'] );
157157 }
158158 }
159159
Index: trunk/extensions/SemanticMaps/SemanticMaps.php
@@ -35,10 +35,9 @@
3636
3737 // Only initialize the extension when all dependencies are present.
3838 if (defined( 'Maps_VERSION' ) && defined( 'SMW_VERSION' )) {
39 - define('SM_VERSION', '0.5.4 a2');
 39+ define('SM_VERSION', '0.5.4 a4');
4040
41 - // TODO: try to get out the hardcoded path.
42 - $smgScriptPath = $wgScriptPath . '/extensions/SemanticMaps';
 41+ $smgScriptPath = (isset($wgExtensionAssetsPath) && $wgExtensionAssetsPath ? $wgExtensionAssetsPath : $wgScriptPath . '/extensions') . '/SemanticMaps';
4342 $smgDir = dirname( __FILE__ ) . '/';
4443
4544 $smgStyleVersion = $wgStyleVersion . '-' . SM_VERSION;
Index: trunk/extensions/SemanticMaps/QueryPrinters/SM_MapPrinter.php
@@ -207,14 +207,14 @@
208208 }
209209 }
210210 }
211 -
 211+
212212 foreach ($coords as $coord) {
213213 if (count($coord) == 2) {
214214 list($lat, $lon) = $coord;
215 -
 215+
216216 if (strlen($lat) > 0 && strlen($lon) > 0) {
217217 $icon = $this->getLocationIcon($row);
218 -
 218+
219219 if ($this->template) {
220220 global $wgParser;
221221 $segments = array_merge(
@@ -223,13 +223,19 @@
224224 );
225225 $text = preg_replace('/\n+/m', '<br />', $wgParser->recursiveTagParse('{{' . implode('|', $segments) . '}}'));
226226 }
227 -
228 - $this->m_locations[] = array($lat, $lon, $title, $text, $icon);
 227+
 228+ $this->m_locations[] = array(
 229+ Xml::escapeJsString($lat),
 230+ Xml::escapeJsString($lon),
 231+ Xml::escapeJsString($title),
 232+ Xml::escapeJsString($text),
 233+ Xml::escapeJsString($icon)
 234+ );
229235 }
230236 }
231237 }
232238 }
233 -
 239+
234240 /**
235241 * Get the icon for a row
236242 *
@@ -305,8 +311,8 @@
306312 }
307313 elseif (count($this->m_locations) == 1) {
308314 // If centre is not set and there is exactelly one marker, use it's coordinates.
309 - $this->centre_lat = $this->m_locations[0][0];
310 - $this->centre_lon = $this->m_locations[0][1];
 315+ $this->centre_lat = Xml::escapeJsString( $this->m_locations[0][0] );
 316+ $this->centre_lon = Xml::escapeJsString( $this->m_locations[0][1] );
311317 }
312318 else {
313319 // If centre is not set and there are no results, centre on the default coordinates.
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsQP.php
@@ -83,7 +83,7 @@
8484 $markersString = implode(',', $markerItems);
8585
8686 $this->output .= <<<END
87 -<div id="$this->mapName" class="$this->class" style="$this->style" ></div>
 87+<div id="$this->mapName"></div>
8888 <script type="$wgJsMimeType"> /*<![CDATA[*/
8989 addOnloadHook(
9090 initializeGoogleMap('$this->mapName',
Index: trunk/extensions/SemanticMaps/GoogleMaps/SM_GoogleMapsFormInput.php
@@ -79,7 +79,7 @@
8080 }
8181
8282 $this->output .= "
83 - <div id='".$this->mapName."' class='".$this->class."'></div>
 83+ <div id='".$this->mapName."'></div>
8484
8585 <script type='$wgJsMimeType'>/*<![CDATA[*/
8686 addOnloadHook(

Status & tagging log