r48979 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48978‎ | r48979 | r48980 >
Date:02:52, 29 March 2009
Author:nad
Status:deferred
Tags:
Comment:
bug fix: pipes in fields breaking recordtables
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -243,7 +243,7 @@
244244 foreach ( array_keys( $this->types ) as $k ) {
245245 $v = isset( $posted[$k] ) ? ( $this->types[$k] == 'bool' ? 'yes' : $posted[$k] ) : '';
246246 if ( !preg_match( "|\s*\|\s*$k\s*=|", $text ) ) $text .= "\n|$k=|\n"; # Treat non-existent fields as existing but empty
247 - $i = preg_match( "|\s*\|\s*$k\s*=\s*(.*?)\s*(?=[\|\}])|si", $text, $m );
 247+ $i = preg_match( "|^\s*\|\s*$k\s*=\s*(.*?)\s*(?=^\s*[\|\}])|sm", $text, $m );
248248 if ( $v && !( $i && eregi( $v, $m[1] ) ) ) $match = false;
249249 $r[$k] = isset( $m[1] ) ? $m[1] : '';
250250 }
@@ -342,8 +342,14 @@
343343 # Render this row
344344 if ( $template ) {
345345 $text = '{'.'{'."$template|title=$col|created=$tsc|modified=$tsm";
 346+ foreach ( array_keys( $this->types ) as $col ) {
 347+ $v = isset( $r[$col] ) ? $r[$col] : '';
 348+ $text .= "|$col=$v";
 349+ }
346350 $text .= '}}';
347 - $table .= $parser->parse( $text, $special, $options, true, true )->getText();
 351+ $text = $parser->parse( $text, $special, $options, true, true )->getText();
 352+ $text = preg_replace( "|&lt;(/?td.*?)&gt;|", "<$1>", $text );
 353+ $table .= "$text\n";
348354 }
349355 else {
350356 $row = array(
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.6.0, 2009-03-22' );
 15+define( 'RECORDADMIN_VERSION', '0.6.1, 2009-03-29' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log