Browse Source

[svn r14987] Minor - is_array validation in functions.

Julio Montoya 17 years ago
parent
commit
4ee5d3ad80
2 changed files with 18 additions and 7 deletions
  1. 10 3
      main/dropbox/dropbox_functions.inc.php
  2. 8 4
      main/inc/lib/pear/HTML/QuickForm.php

+ 10 - 3
main/dropbox/dropbox_functions.inc.php

@@ -1416,9 +1416,16 @@ function get_total_number_feedback($file_id='')
 */
 */
 function check_number_feedback($key, $array)
 function check_number_feedback($key, $array)
 {
 {
-	if (key_exists($key,$array))
-	{
-		return $array[$key];
+	if (is_array($array))
+	{	
+		if (key_exists($key,$array))
+		{
+			return $array[$key];
+		}
+		else
+		{
+			return 0;
+		}
 	}
 	}
 	else
 	else
 	{
 	{

+ 8 - 4
main/inc/lib/pear/HTML/QuickForm.php

@@ -17,7 +17,7 @@
 // |          Bertrand Mansion <bmansion@mamasam.com>                     |
 // |          Bertrand Mansion <bmansion@mamasam.com>                     |
 // +----------------------------------------------------------------------+
 // +----------------------------------------------------------------------+
 //
 //
-// $Id: QuickForm.php 12272 2007-05-03 14:40:45Z elixir_julian $
+// $Id: QuickForm.php 14987 2008-04-21 17:14:12Z juliomontoya $
 
 
 require_once('PEAR.php');
 require_once('PEAR.php');
 require_once('HTML/Common.php');
 require_once('HTML/Common.php');
@@ -675,9 +675,13 @@ class HTML_QuickForm extends HTML_Common {
                 $this->_elements[$i + 1] =& $this->_elements[$i];
                 $this->_elements[$i + 1] =& $this->_elements[$i];
                 if ($this->_elementIndex[$currentName] == $i) {
                 if ($this->_elementIndex[$currentName] == $i) {
                     $this->_elementIndex[$currentName] = $i + 1;
                     $this->_elementIndex[$currentName] = $i + 1;
-                } else {
-                    $dupIdx = array_search($i, $this->_duplicateIndex[$currentName]);
-                    $this->_duplicateIndex[$currentName][$dupIdx] = $i + 1;
+                } else 
+                {
+                	if (is_array($this->_duplicateIndex[$currentName]))
+                	{
+                    	$dupIdx = array_search($i, $this->_duplicateIndex[$currentName]);
+                    	$this->_duplicateIndex[$currentName][$dupIdx] = $i + 1;
+                	}
                 }
                 }
                 unset($this->_elements[$i]);
                 unset($this->_elements[$i]);
             }
             }