Browse Source

Merge pull request #324 from emanuele45/backward_compat

Backward compat
Joshua Dickerson 12 years ago
parent
commit
f45ef9ab42

+ 4 - 1
Sources/Display.php

@@ -1164,7 +1164,10 @@ function Display()
 		$context['mod_buttons'][] = array('text' => 'restore_topic', 'image' => '', 'lang' => true, 'url' => $scripturl . '?action=restoretopic;topics=' . $context['current_topic'] . ';' . $context['session_var'] . '=' . $context['session_id']);
 
 	// Allow adding new mod buttons easily.
-	call_integration_hook('integrate_display_buttons');
+	// Note: $context['normal_buttons'] and $context['mod_buttons'] are added for backward compatibility with 2.0, but are deprecated and should not be used
+	call_integration_hook('integrate_display_buttons', array(&$context['normal_buttons']));
+	// Note: integrate_mod_buttons is no more necessary and deprecated, but is kept for backward compatibility with 2.0
+	call_integration_hook('integrate_mod_buttons', array(&$context['mod_buttons']));
 }
 
 /**

+ 1 - 1
Sources/ManageServer.php

@@ -617,7 +617,7 @@ function prepareDBSettingContext(&$config_vars)
 				'size' => !empty($config_var[2]) && !is_array($config_var[2]) ? $config_var[2] : (in_array($config_var[0], array('int', 'float')) ? 6 : 0),
 				'data' => array(),
 				'name' => $config_var[1],
-				'value' => isset($modSettings[$config_var[1]]) ? ($config_var[0] == 'select' ? $modSettings[$config_var[1]] : htmlspecialchars($modSettings[$config_var[1]])) : (in_array($config_var[0], array('int', 'float')) ? 0 : ''),
+				'value' => isset($modSettings[$config_var[1]]) ? ($config_var[0] == 'select' ? $modSettings[$config_var[1]] : htmlspecialchars($modSettings[$config_var[1]])) : (in_array($config_var[0], array('int', 'float')) ? 0 : (!empty($config_var['multiple']) ? serialize(array()) : '')),
 				'disabled' => false,
 				'invalid' => !empty($config_var['invalid']),
 				'javascript' => '',

+ 2 - 1
Sources/MessageIndex.php

@@ -661,7 +661,8 @@ function MessageIndex()
 	);
 
 	// Allow adding new buttons easily.
-	call_integration_hook('integrate_messageindex_buttons');
+	// Note: $context['normal_buttons'] is added for backward compatibility with 2.0, but is deprecated and should not be used
+	call_integration_hook('integrate_messageindex_buttons', array(&$context['normal_buttons']));
 }
 
 /**

+ 1 - 1
Sources/ModerationCenter.php

@@ -1137,7 +1137,7 @@ function ViewWatchedUsers()
 			$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
 		// Nada, zip, etc...
 		else
-			$approve_query = ' AND 0';
+			$approve_query = ' AND 1=0';
 	}
 
 	require_once($sourcedir . '/Subs-List.php');

+ 2 - 2
Sources/PostModeration.php

@@ -72,7 +72,7 @@ function UnapprovedPosts()
 		$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
 	// Nada, zip, etc...
 	else
-		$approve_query = ' AND 0';
+		$approve_query = ' AND 1=0';
 
 	// We also need to know where we can delete topics and/or replies to.
 	if ($context['current_view'] == 'topics')
@@ -322,7 +322,7 @@ function UnapprovedAttachments()
 	elseif (!empty($approve_boards))
 		$approve_query = ' AND m.id_board IN (' . implode(',', $approve_boards) . ')';
 	else
-		$approve_query = ' AND 0';
+		$approve_query = ' AND 1=0';
 
 	// Get together the array of things to act on, if any.
 	$attachments = array();

+ 2 - 2
Sources/Search.php

@@ -1095,8 +1095,8 @@ function PlushSearch2()
 					foreach ($weight_factors as $type => $value)
 					{
 						$relevance .= $weight[$type];
-						if (!empty($value['search']))
-							$relevance .= ' * ' . $value['search'];
+						if (!empty($value['results']))
+							$relevance .= ' * ' . $value['results'];
 						$relevance .= ' + ';
 					}
 					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';

+ 2 - 1
Sources/Subs-Editor.php

@@ -1656,7 +1656,8 @@ function create_control_richedit($editorOptions)
 		);
 
 		// Allow mods to modify BBC buttons.
-		call_integration_hook('integrate_bbc_buttons');
+		// Note: pass the array here is not necessary and is deprecated, but it is ketp for backward compatibility with 2.0
+		call_integration_hook('integrate_bbc_buttons', array(&$context['bbc_tags']));
 
 		// Show the toggle?
 		if (empty($modSettings['disable_wysiwyg']))