Browse Source

Safety first, declare an empty array before using it if it was not previously declared before
Also add instances debug stuff to Profile.php

Signed-off-by: Suki <[email protected]>

Suki 10 years ago
parent
commit
add6a3121c
3 changed files with 23 additions and 1 deletions
  1. 5 0
      Sources/Admin.php
  2. 12 0
      Sources/Profile.php
  3. 6 1
      Sources/Subs.php

+ 5 - 0
Sources/Admin.php

@@ -495,7 +495,12 @@ function AdminMain()
 
 			// Add another one to the list.
 			if ($db_show_debug === true)
+			{
+				if (!isset($context['debug']['instances']))
+					$context['debug']['instances'] = array();
+
 				$context['debug']['instances'][$admin_include_data['class']] = $admin_include_data['class'];
+			}
 		}
 
 		$call = array($context['instances'][$admin_include_data['class']], $admin_include_data['function']);

+ 12 - 0
Sources/Profile.php

@@ -27,6 +27,7 @@ function ModifyProfile($post_errors = array())
 {
 	global $txt, $scripturl, $user_info, $context, $sourcedir, $user_profile, $cur_profile;
 	global $modSettings, $memberContext, $profile_vars, $post_errors, $user_settings;
+	global $db_show_debug;
 
 	// Don't reload this as we may have processed error strings.
 	if (empty($post_errors))
@@ -728,8 +729,19 @@ function ModifyProfile($post_errors = array())
 	{
 		// Is there an instance already? nope? then create it!
 		if (empty($context['instances'][$profile_include_data['class']]) || !($context['instances'][$profile_include_data['class']] instanceof $profile_include_data['class']))
+		{
 			$context['instances'][$profile_include_data['class']] = new $profile_include_data['class'];
 
+			// Add another one to the list.
+			if ($db_show_debug === true)
+			{
+				if (!isset($context['debug']['instances']))
+					$context['debug']['instances'] = array();
+
+				$context['debug']['instances'][$profile_include_data['class']] = $profile_include_data['class'];
+			}
+		}
+
 		$call = array($context['instances'][$profile_include_data['class']], $profile_include_data['function']);
 	}
 

+ 6 - 1
Sources/Subs.php

@@ -3992,7 +3992,7 @@ function setupMenuContext()
 	{
 		$context['menu_buttons']['moderate']['title'] .= ' <span class="amt">' . $total_mod_reports . '</span>';
 	}
-	
+
 }
 
 /**
@@ -4234,7 +4234,12 @@ function call_hook_helper($string)
 
 				// Add another one to the list.
 				if ($db_show_debug === true)
+				{
+					if (!isset($context['debug']['instances']))
+						$context['debug']['instances'] = array();
+
 					$context['debug']['instances'][$class] = $class;
+				}
 			}
 
 			return array($context['instances'][$class], $method);