r69056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69055‎ | r69056 | r69057 >
Date:14:28, 5 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed bug in width and height validation when using % and backward compatibility issue
Modified paths:
  • /trunk/extensions/Maps/Includes/Maps_Mapper.php (modified) (history)
  • /trunk/extensions/Maps/Maps.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Maps/Includes/Maps_Mapper.php
@@ -168,7 +168,7 @@
169169
170170 // Determine the minimum and maximum values.
171171 if ( preg_match( '/^.*%$/', $value ) ) {
172 - if ( count( $egMapsSizeRestrictions[$dimension] >= 4 ) ) {
 172+ if ( count( $egMapsSizeRestrictions[$dimension] ) >= 4 ) {
173173 $min = $egMapsSizeRestrictions[$dimension][2];
174174 $max = $egMapsSizeRestrictions[$dimension][3];
175175 } else {
@@ -183,15 +183,15 @@
184184
185185 // See if the actual value is withing the limits.
186186 $number = preg_replace( '/[^0-9]/', '', $value );
187 - if ( $number < $egMapsSizeRestrictions[$dimension][0] ) {
 187+ if ( $number < $min ) {
188188 if ( $correct ) {
189 - $value = $egMapsSizeRestrictions[$dimension][0];
 189+ $value = $min;
190190 } else {
191191 return false;
192192 }
193 - } else if ( $number > $egMapsSizeRestrictions[$dimension][1] ) {
 193+ } else if ( $number > $max ) {
194194 if ( $correct ) {
195 - $value = $egMapsSizeRestrictions[$dimension][1];
 195+ $value = $max;
196196 } else {
197197 return false;
198198 }
Index: trunk/extensions/Maps/Maps.php
@@ -33,7 +33,7 @@
3434 echo '<b>Warning:</b> You need to have <a href="http://www.mediawiki.org/wiki/Extension:Validator">Validator</a> installed in order to use <a href="http://www.mediawiki.org/wiki/Extension:Maps">Maps</a>.';
3535 }
3636 else {
37 - define( 'Maps_VERSION', '0.6.4 a8' );
 37+ define( 'Maps_VERSION', '0.6.4 a9' );
3838
3939 // The different coordinate notations.
4040 define( 'Maps_COORDS_FLOAT', 'float' );

Status & tagging log