Преглед изворни кода

! Hooks which passed variables which could potentially be changed must be passed by reference in order to actually work their damn magic

Signed-off-by: John Rayes <[email protected]>
John Rayes пре 12 година
родитељ
комит
56ea24e6c0
1 измењених фајлова са 8 додато и 8 уклоњено
  1. 8 8
      Sources/Search.php

+ 8 - 8
Sources/Search.php

@@ -275,7 +275,7 @@ function PlushSearch2()
 		'sticky' => 'MAX(t.is_sticky)',
 		'sticky' => 'MAX(t.is_sticky)',
 	);
 	);
 
 
-	call_integration_hook('integrate_search_weights', array($weight_factors));
+	call_integration_hook('integrate_search_weights', array(&$weight_factors));
 
 
 	$weight = array();
 	$weight = array();
 	$weight_total = 0;
 	$weight_total = 0;
@@ -574,7 +574,7 @@ function PlushSearch2()
 		'num_replies',
 		'num_replies',
 		'id_msg',
 		'id_msg',
 	);
 	);
-	call_integration_hook('integrate_search_sort_columns', array($sort_columns));
+	call_integration_hook('integrate_search_sort_columns', array(&$sort_columns));
 	if (empty($search_params['sort']) && !empty($_REQUEST['sort']))
 	if (empty($search_params['sort']) && !empty($_REQUEST['sort']))
 		list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, '');
 		list ($search_params['sort'], $search_params['sort_dir']) = array_pad(explode('|', $_REQUEST['sort']), 2, '');
 	$search_params['sort'] = !empty($search_params['sort']) && in_array($search_params['sort'], $sort_columns) ? $search_params['sort'] : 'relevance';
 	$search_params['sort'] = !empty($search_params['sort']) && in_array($search_params['sort'], $sort_columns) ? $search_params['sort'] : 'relevance';
@@ -589,7 +589,7 @@ function PlushSearch2()
 	$recentMsg = $modSettings['maxMsgID'] - $minMsg;
 	$recentMsg = $modSettings['maxMsgID'] - $minMsg;
 
 
 	// *** Parse the search query
 	// *** Parse the search query
-	call_integration_hook('integrate_search_params', array($search_params));
+	call_integration_hook('integrate_search_params', array(&$search_params));
 
 
 	/*
 	/*
 	 * Unfortunately, searching for words like this is going to be slow, so we're blacklisting them.
 	 * Unfortunately, searching for words like this is going to be slow, so we're blacklisting them.
@@ -598,7 +598,7 @@ function PlushSearch2()
 	 * @todo Maybe only blacklist if they are the only word, or "any" is used?
 	 * @todo Maybe only blacklist if they are the only word, or "any" is used?
 	 */
 	 */
 	$blacklisted_words = array('img', 'url', 'quote', 'www', 'http', 'the', 'is', 'it', 'are', 'if');
 	$blacklisted_words = array('img', 'url', 'quote', 'www', 'http', 'the', 'is', 'it', 'are', 'if');
-	call_integration_hook('integrate_search_blacklisted_words', array($blacklisted_words));
+	call_integration_hook('integrate_search_blacklisted_words', array(&$blacklisted_words));
 
 
 	// What are we searching for?
 	// What are we searching for?
 	if (empty($search_params['search']))
 	if (empty($search_params['search']))
@@ -1071,7 +1071,7 @@ function PlushSearch2()
 							$subject_query_params['excluded_phrases_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
 							$subject_query_params['excluded_phrases_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
 						}
 						}
 					}
 					}
-					call_integration_hook('integrate_subject_only_search_query', array($subject_query, $subject_query_params));
+					call_integration_hook('integrate_subject_only_search_query', array(&$subject_query, &$subject_query_params));
 
 
 					$relevance = '1000 * (';
 					$relevance = '1000 * (';
 					foreach ($weight_factors as $type => $value)
 					foreach ($weight_factors as $type => $value)
@@ -1316,7 +1316,7 @@ function PlushSearch2()
 								$subject_query['params']['exclude_phrase_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
 								$subject_query['params']['exclude_phrase_' . $count++] = empty($modSettings['search_match_words']) || $no_regexp ? '%' . strtr($phrase, array('_' => '\\_', '%' => '\\%')) . '%' : '[[:<:]]' . addcslashes(preg_replace(array('/([\[\]$.+*?|{}()])/'), array('[$1]'), $phrase), '\\\'') . '[[:>:]]';
 							}
 							}
 						}
 						}
-						call_integration_hook('integrate_subject_search_query', array($subject_query));
+						call_integration_hook('integrate_subject_search_query', array(&$subject_query));
 
 
 						// Nothing to search for?
 						// Nothing to search for?
 						if (empty($subject_query['where']))
 						if (empty($subject_query['where']))
@@ -1534,7 +1534,7 @@ function PlushSearch2()
 						$main_query['parameters']['board_query'] = $boardQuery;
 						$main_query['parameters']['board_query'] = $boardQuery;
 					}
 					}
 				}
 				}
-				call_integration_hook('integrate_main_search_query', array($main_query));
+				call_integration_hook('integrate_main_search_query', array(&$main_query));
 
 
 				// Did we either get some indexed results, or otherwise did not do an indexed query?
 				// Did we either get some indexed results, or otherwise did not do an indexed query?
 				if (!empty($indexedResults) || !$searchAPI->supportsMethod('indexedWordQuery', $query_params))
 				if (!empty($indexedResults) || !$searchAPI->supportsMethod('indexedWordQuery', $query_params))
@@ -2094,7 +2094,7 @@ function prepareSearchContext($reset = false)
 	);
 	);
 	$counter++;
 	$counter++;
 
 
-	call_integration_hook('integrate_search_message_context', array($counter, $output));
+	call_integration_hook('integrate_search_message_context', array($counter, &$output));
 
 
 	return $output;
 	return $output;
 }
 }