r76169 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r76168‎ | r76169 | r76170 >
Date:23:55, 5 November 2010
Author:tparscal
Status:deferred
Tags:
Comment:
Corrected for array-of-strings/string-only injection into a template
Modified paths:
  • /trunk/extensions/HtmlUi/classes/HtmlUiFieldset.php (modified) (history)
  • /trunk/extensions/HtmlUi/classes/HtmlUiForm.php (modified) (history)
  • /trunk/extensions/HtmlUi/classes/HtmlUiFormElementCollection.php (modified) (history)
  • /trunk/extensions/HtmlUi/templates/HtmlUiFieldset.php (modified) (history)
  • /trunk/extensions/HtmlUi/templates/HtmlUiForm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/HtmlUi/classes/HtmlUiFormElementCollection.php
@@ -44,4 +44,12 @@
4545 public function setOption( $option, $value ) {
4646 return isset( $this->options[$option] ) ? $this->options[$option] = $value : null;
4747 }
 48+
 49+ public function renderElements() {
 50+ $elements = array();
 51+ foreach ( $this->elements as $element ) {
 52+ $elements[] = $element->render();
 53+ }
 54+ return $elements;
 55+ }
4856 }
Index: trunk/extensions/HtmlUi/classes/HtmlUiFieldset.php
@@ -24,6 +24,9 @@
2525
2626 public function render() {
2727 $template = new HtmlUiTemplate( 'extensions/HtmlUi/templates/HtmlUiFieldset.php' );
28 - return $template->render( array_merge( array( 'id' => $this->id ), $this->elements ) );
 28+ return $template->render( array(
 29+ 'id' => $this->id,
 30+ 'elements' => $this->renderElements()
 31+ ) );
2932 }
3033 }
Index: trunk/extensions/HtmlUi/classes/HtmlUiForm.php
@@ -15,12 +15,12 @@
1616
1717 public function render() {
1818 $template = new HtmlUiTemplate( 'extensions/HtmlUi/templates/HtmlUiForm.php' );
19 - return $template->render( array_merge(
20 - array( 'attributes' => array(
 19+ return $template->render( array(
 20+ 'attributes' => array(
2121 'action' => $this->options['action'],
2222 'method' => $this->options['method'],
2323 ),
24 - $this->elements
 24+ 'elements' => $this->renderElements()
2525 ) );
2626 }
2727
Index: trunk/extensions/HtmlUi/templates/HtmlUiFieldset.php
@@ -1,5 +1,3 @@
22 <fieldset class="htmlUiFieldset" rel="<?php echo $id ?>">
3 - <?php foreach( $elements as $element ): ?>
4 - <?php echo $element->render(); ?>
5 - <?php endforeach; ?>
 3+ <?php echo implode( self::unescape( $elements ) ) ?>
64 </fieldset>
Index: trunk/extensions/HtmlUi/templates/HtmlUiForm.php
@@ -1,5 +1,3 @@
22 <form class="htmlUiForm"<?php echo self::attributes( $attributes ) ?>>
3 - <?php foreach( $elements as $element ): ?>
4 - <?php echo $element->render(); ?>
5 - <?php endforeach; ?>
 3+ <?php echo implode( self::unescape( $elements ) ) ?>
64 </form>

Status & tagging log