r60808 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r60807‎ | r60808 | r60809 >
Date:21:31, 7 January 2010
Author:yaron
Status:deferred
Tags:
Comment:
Added more checking for 'value_labels'
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_FormInputs.inc (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_FormInputs.inc
@@ -160,7 +160,7 @@
161161 $text .= " <option value=\"$possible_value\"";
162162 if ($possible_value == $cur_value) {$text .= " selected=\"selected\""; }
163163 $text .= ">";
164 - if (array_key_exists('value_labels', $other_args) && array_key_exists($possible_value, $other_args['value_labels']))
 164+ if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels']))
165165 $text .= htmlspecialchars($other_args['value_labels'][$possible_value]);
166166 else
167167 $text .= $possible_value;
@@ -220,7 +220,7 @@
221221 $text .= " <option value=\"$possible_value\"";
222222 if (in_array($possible_value, $cur_values)) {$text .= " selected"; }
223223 $text .= ">";
224 - if (array_key_exists('value_labels', $other_args) && array_key_exists($possible_value, $other_args['value_labels']))
 224+ if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels']))
225225 $text .= htmlspecialchars($other_args['value_labels'][$possible_value]);
226226 else
227227 $text .= $possible_value;
@@ -264,7 +264,7 @@
265265 foreach ($possible_values as $key => $possible_value) {
266266 $cur_input_name = $input_name . "[" . $key . "]";
267267 $checked_text = (in_array($possible_value, $cur_values)) ? 'checked="checked"' : "";
268 - if (array_key_exists('value_labels', $other_args) && array_key_exists($possible_value, $other_args['value_labels']))
 268+ if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels']))
269269 $label = htmlspecialchars($other_args['value_labels'][$possible_value]);
270270 else
271271 $label = $possible_value;
@@ -613,7 +613,7 @@
614614 $text .= ' checked="checked"';
615615 $check_set = true;
616616 }
617 - if (array_key_exists('value_labels', $other_args) && array_key_exists($possible_value, $other_args['value_labels']))
 617+ if (array_key_exists('value_labels', $other_args) && is_array($other_args['value_labels']) && array_key_exists($possible_value, $other_args['value_labels']))
618618 $label = htmlspecialchars($other_args['value_labels'][$possible_value]);
619619 else
620620 $label = $possible_value;

Status & tagging log