Parcourir la source

Merge pull request #62 from live627/hooks

Hooks
emanuele45 il y a 12 ans
Parent
commit
c61121a06b

+ 8 - 6
Sources/Display.php

@@ -168,7 +168,7 @@ function Display()
 		fatal_lang_error('not_a_topic', false);
 	$topicinfo = $smcFunc['db_fetch_assoc']($request);
 	$smcFunc['db_free_result']($request);
-	
+
 	// Is this a moved topic that we are redirecting to?
 	if (!empty($topicinfo['id_redirect_topic']))
 		redirectexit('topic=' . $topicinfo['id_redirect_topic'] . '.0');
@@ -755,7 +755,7 @@ function Display()
 				'vote_button' => '<input type="' . ($pollinfo['max_votes'] > 1 ? 'checkbox' : 'radio') . '" name="options[]" id="options-' . $i . '" value="' . $i . '" class="input_' . ($pollinfo['max_votes'] > 1 ? 'check' : 'radio') . '" />'
 			);
 		}
-		
+
 		// Build the poll moderation button array.
 		$context['poll_buttons'] = array(
 			'vote' => array('test' => 'allow_return_vote', 'text' => 'poll_return_vote', 'image' => 'poll_options.png', 'lang' => true, 'url' => $scripturl . '?topic=' . $context['current_topic'] . '.' . $context['start']),
@@ -765,7 +765,7 @@ function Display()
 			'edit' => array('test' => 'allow_edit_poll', 'text' => 'poll_edit', 'image' => 'poll_edit.png', 'lang' => true, 'url' => $scripturl . '?action=editpoll;topic=' . $context['current_topic'] . '.' . $context['start']),
 			'remove_poll' => array('test' => 'can_remove_poll', 'text' => 'poll_remove', 'image' => 'admin_remove_poll.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . $txt['poll_remove_warn'] . '\');"', 'url' => $scripturl . '?action=removepoll;topic=' . $context['current_topic'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
 		);
-		
+
 		// Allow mods to add additional buttons here
 		call_integration_hook('integrate_poll_buttons');
 	}
@@ -811,6 +811,8 @@ function Display()
 	$smcFunc['db_free_result']($request);
 	$posters = array_unique($all_posters);
 
+	call_integration_hook('integrate_display_message_list', array($messages, $posters));
+
 	// Guests can't mark topics read or for notifications, just can't sorry.
 	if (!$user_info['is_guest'] && !empty($messages))
 	{
@@ -1110,7 +1112,7 @@ function Display()
 				$context['icons'][count($context['icons']) - 1]['is_last'] = true;
 		}
 	}
-	
+
 	// Build the normal button array.
 	$context['normal_buttons'] = array(
 		'reply' => array('test' => 'can_reply', 'text' => 'reply', 'image' => 'reply.png', 'lang' => true, 'url' => $scripturl . '?action=post;topic=' . $context['current_topic'] . '.' . $context['start'] . ';last_msg=' . $context['topic_last_message'], 'active' => true),
@@ -1120,7 +1122,7 @@ function Display()
 		'send' => array('test' => 'can_send_topic', 'text' => 'send_topic', 'image' => 'sendtopic.png', 'lang' => true, 'url' => $scripturl . '?action=emailuser;sa=sendtopic;topic=' . $context['current_topic'] . '.0'),
 		'print' => array('test' => 'can_print', 'text' => 'print', 'image' => 'print.png', 'lang' => true, 'custom' => 'rel="new_win nofollow"', 'url' => $scripturl . '?action=printpage;topic=' . $context['current_topic'] . '.0'),
 	);
-	
+
 	// Build the mod button array
 	$context['mod_buttons'] = array(
 		'move' => array('test' => 'can_move', 'text' => 'move_topic', 'image' => 'admin_move.png', 'lang' => true, 'url' => $scripturl . '?action=movetopic;current_board=' . $context['current_board'] . ';topic=' . $context['current_topic'] . '.0'),
@@ -1450,7 +1452,7 @@ function Download()
 
 	elseif (isBrowser('ie'))
 		header('Content-Disposition: ' . $disposition . '; filename="' . urlencode(preg_replace('~&#(\d{3,8});~e', '$fixchar(\'$1\')', $utf8name)) . '"');
-	
+
 	else
 		header('Content-Disposition: ' . $disposition . '; filename="' . $utf8name . '"');
 

+ 11 - 4
Sources/MessageIndex.php

@@ -571,7 +571,8 @@ function MessageIndex()
 	// Is Quick Moderation active/needed?
 	if (!empty($options['display_quick_mod']) && !empty($context['topics']))
 	{
-		$context['can_lock'] = allowedTo('lock_any');
+		$context['can_markread'] = $context['user']['is_logged'];
+		$context['can_lopck'] = allowedTo('lock_any');
 		$context['can_sticky'] = allowedTo('make_sticky') && !empty($modSettings['enableStickyTopics']);
 		$context['can_move'] = allowedTo('move_any');
 		$context['can_remove'] = allowedTo('remove_any');
@@ -630,9 +631,15 @@ function MessageIndex()
 			$context['can_quick_mod'] = $context['can_remove'] || $context['can_lock'] || $context['can_sticky'] || $context['can_move'];
 	}
 
+	if (!empty($context['can_quick_mod']) && $options['display_quick_mod'] == 1)
+	{
+		$context['qmod_actions'] = array('approve', 'remove', 'lock', 'sticky', 'move', 'merge', 'restore', 'markread');
+		call_integration_hook('integrate_quick_mod_actions');
+	}
+
 	// If there are children, but no topics and no ability to post topics...
 	$context['no_topic_listing'] = !empty($context['boards']) && empty($context['topics']) && !$context['can_post_new'];
-	
+
 	// Build the message index button array.
 	$context['normal_buttons'] = array(
 		'new_topic' => array('test' => 'can_post_new', 'text' => 'new_topic', 'image' => 'new_topic.png', 'lang' => true, 'url' => $scripturl . '?action=post;board=' . $context['current_board'] . '.0', 'active' => true),
@@ -640,7 +647,7 @@ function MessageIndex()
 		'notify' => array('test' => 'can_mark_notify', 'text' => $context['is_marked_notify'] ? 'unnotify' : 'notify', 'image' => ($context['is_marked_notify'] ? 'un' : ''). 'notify.png', 'lang' => true, 'custom' => 'onclick="return confirm(\'' . ($context['is_marked_notify'] ? $txt['notification_disable_board'] : $txt['notification_enable_board']) . '\');"', 'url' => $scripturl . '?action=notifyboard;sa=' . ($context['is_marked_notify'] ? 'off' : 'on') . ';board=' . $context['current_board'] . '.' . $context['start'] . ';' . $context['session_var'] . '=' . $context['session_id']),
 		'markread' => array('text' => 'mark_read_short', 'image' => 'markread.png', 'lang' => true, 'url' => $scripturl . '?action=markasread;sa=board;board=' . $context['current_board'] . '.0;' . $context['session_var'] . '=' . $context['session_id']),
 	);
-	
+
 	// Allow adding new buttons easily.
 	call_integration_hook('integrate_messageindex_buttons');
 }
@@ -695,7 +702,7 @@ function QuickModeration()
 		 * @todo Ugly. There's no getting around this, is there?
 		 * @todo Maybe just do this on the actions people want to use?
 		 */
-		$boards_can = boardsAllowedTo(array('make_sticky', 'move_any', 'move_own', 'remove_any', 'remove_own', 'lock_any', 'lock_own', 'merge_any', 'approve_posts'));
+		$boards_can = boardsAllowedTo(array('make_sticky', 'move_any', 'move_own', 'remove_any', 'remove_own', 'lock_any', 'lock_own', 'merge_any', 'approve_posts'), true, false);
 
 		$redirect_url = isset($_POST['redirect_url']) ? $_POST['redirect_url'] : (isset($_SESSION['old_url']) ? $_SESSION['old_url'] : '');
 	}

+ 58 - 44
Sources/Search.php

@@ -231,6 +231,8 @@ function PlushSearch1()
 	// Simple or not?
 	$context['simple_search'] = isset($context['search_params']['advanced']) ? empty($context['search_params']['advanced']) : !empty($modSettings['simpleSearch']) && !isset($_REQUEST['advanced']);
 	$context['page_title'] = $txt['set_parameters'];
+
+	call_integration_hook('integrate_search');
 }
 
 /**
@@ -265,17 +267,19 @@ function PlushSearch2()
 	}
 
 	$weight_factors = array(
-		'frequency',
-		'age',
-		'length',
-		'subject',
-		'first_message',
-		'sticky',
+		'frequency' => 'COUNT(*) / (MAX(t.num_replies) + 1)',
+		'age' => 'CASE WHEN MAX(m.id_msg) < {int:min_msg} THEN 0 ELSE (MAX(m.id_msg) - {int:min_msg}) / {int:recent_message} END',
+		'length' => 'CASE WHEN MAX(t.num_replies) < {int:huge_topic_posts} THEN MAX(t.num_replies) / {int:huge_topic_posts} ELSE 1 END',
+		'subject' => '0',
+		'first_message' => 'CASE WHEN MIN(m.id_msg) = MAX(t.id_first_msg) THEN 1 ELSE 0 END',
+		'sticky' => 'MAX(t.is_sticky)',
 	);
 
+	call_integration_hook('integrate_search_weights', array($weight_factors));
+
 	$weight = array();
 	$weight_total = 0;
-	foreach ($weight_factors as $weight_factor)
+	foreach ($weight_factors as $weight_factor => $value)
 	{
 		$weight[$weight_factor] = empty($modSettings['search_weight_' . $weight_factor]) ? 0 : (int) $modSettings['search_weight_' . $weight_factor];
 		$weight_total += $weight[$weight_factor];
@@ -570,6 +574,7 @@ function PlushSearch2()
 		'num_replies',
 		'id_msg',
 	);
+	call_integration_hook('integrate_search_sort_columns', array($sort_columns));
 	if (empty($search_params['sort']) && !empty($_REQUEST['sort']))
 		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';
@@ -584,6 +589,7 @@ function PlushSearch2()
 	$recentMsg = $modSettings['maxMsgID'] - $minMsg;
 
 	// *** Parse the search query
+	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.
@@ -592,6 +598,7 @@ function PlushSearch2()
 	 * @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');
+	call_integration_hook('integrate_search_blacklisted_words', array($blacklisted_words));
 
 	// What are we searching for?
 	if (empty($search_params['search']))
@@ -940,6 +947,7 @@ function PlushSearch2()
 	);
 
 	// *** A last error check
+	call_integration_hook('integrate_search_errors');
 
 	// One or more search errors? Go back to the first search screen.
 	if (!empty($context['search_errors']))
@@ -1063,6 +1071,18 @@ 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), '\\\'') . '[[:>:]]';
 						}
 					}
+					call_integration_hook('integrate_subject_only_search_query', array($subject_query, $subject_query_params));
+
+					$relevance = '1000 * (';
+					foreach ($weight_factors as $type => $value)
+					{
+						$relevance .= $weight[$type];
+						if (!empty($value))
+							$relevance .= ' * ' . $value;
+						$relevance .= ' +
+							';
+					}
+					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
 
 					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_subject',
 						($smcFunc['db_support_ignore'] ? '
@@ -1071,13 +1091,7 @@ function PlushSearch2()
 						SELECT
 							{int:id_search},
 							t.id_topic,
-							1000 * (
-								{int:weight_frequency} / (t.num_replies + 1) +
-								{int:weight_age} * CASE WHEN t.id_first_msg < {int:min_msg} THEN 0 ELSE (t.id_first_msg - {int:min_msg}) / {int:recent_message} END +
-								{int:weight_length} * CASE WHEN t.num_replies < {int:huge_topic_posts} THEN t.num_replies / {int:huge_topic_posts} ELSE 1 END +
-								{int:weight_subject} +
-								{int:weight_sticky} * t.is_sticky
-							) / {int:weight_total} AS relevance,
+							' . $relevance. ',
 							' . (empty($userQuery) ? 't.id_first_msg' : 'm.id_msg') . ',
 							1
 						FROM ' . $subject_query['from'] . (empty($subject_query['inner_join']) ? '' : '
@@ -1090,12 +1104,6 @@ function PlushSearch2()
 						LIMIT ' . ($modSettings['search_max_results'] - $numSubjectResults)),
 						array_merge($subject_query_params, array(
 							'id_search' => $_SESSION['search_cache']['id_search'],
-							'weight_age' => $weight['age'],
-							'weight_frequency' => $weight['frequency'],
-							'weight_length' => $weight['length'],
-							'weight_sticky' => $weight['sticky'],
-							'weight_subject' => $weight['subject'],
-							'weight_total' => $weight_total,
 							'min_msg' => $minMsg,
 							'recent_message' => $recentMsg,
 							'huge_topic_posts' => $humungousTopicPosts,
@@ -1167,14 +1175,7 @@ function PlushSearch2()
 					$main_query['select']['id_msg'] = 'MAX(m.id_msg) AS id_msg';
 					$main_query['select']['num_matches'] = 'COUNT(*) AS num_matches';
 
-					$main_query['weights'] = array(
-						'frequency' => 'COUNT(*) / (MAX(t.num_replies) + 1)',
-						'age' => 'CASE WHEN MAX(m.id_msg) < {int:min_msg} THEN 0 ELSE (MAX(m.id_msg) - {int:min_msg}) / {int:recent_message} END',
-						'length' => 'CASE WHEN MAX(t.num_replies) < {int:huge_topic_posts} THEN MAX(t.num_replies) / {int:huge_topic_posts} ELSE 1 END',
-						'subject' => '0',
-						'first_message' => 'CASE WHEN MIN(m.id_msg) = MAX(t.id_first_msg) THEN 1 ELSE 0 END',
-						'sticky' => 'MAX(t.is_sticky)',
-					);
+					$main_query['weights'] = $weight_factors;
 
 					$main_query['group_by'][] = 't.id_topic';
 				}
@@ -1315,6 +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), '\\\'') . '[[:>:]]';
 							}
 						}
+						call_integration_hook('integrate_subject_search_query', array($subject_query));
 
 						// Nothing to search for?
 						if (empty($subject_query['where']))
@@ -1532,6 +1534,7 @@ function PlushSearch2()
 						$main_query['parameters']['board_query'] = $boardQuery;
 					}
 				}
+				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?
 				if (!empty($indexedResults) || !$searchAPI->supportsMethod('indexedWordQuery', $query_params))
@@ -1540,7 +1543,11 @@ function PlushSearch2()
 					$new_weight_total = 0;
 					foreach ($main_query['weights'] as $type => $value)
 					{
-						$relevance .= $weight[$type] . ' * ' . $value . ' + ';
+						$relevance .= $weight[$type];
+						if (!empty($value))
+							$relevance .= ' * ' . $value;
+						$relevance .= ' +
+							';
 						$new_weight_total += $weight[$type];
 					}
 					$main_query['select']['relevance'] = substr($relevance, 0, -3) . ') / ' . $new_weight_total . ' AS relevance';
@@ -1601,6 +1608,17 @@ function PlushSearch2()
 				// Insert subject-only matches.
 				if ($_SESSION['search_cache']['num_results'] < $modSettings['search_max_results'] && $numSubjectResults !== 0)
 				{
+					$relevance = '1000 * (';
+					foreach ($main_query['weights'] as $type => $value)
+					{
+						$relevance .= $weight[$type];
+						if (!empty($value))
+							$relevance .= ' * ' . $value;
+						$relevance .= ' +
+							';
+					}
+					$relevance = substr($relevance, 0, -3) . ') / ' . $weight_total . ' AS relevance';
+
 					$usedIDs = array_flip(empty($inserts) ? array() : array_keys($inserts));
 					$ignoreRequest = $smcFunc['db_search_query']('insert_log_search_results_sub_only', ($smcFunc['db_support_ignore'] ? ( '
 						INSERT IGNORE INTO {db_prefix}log_search_results
@@ -1608,13 +1626,7 @@ function PlushSearch2()
 						SELECT
 							{int:id_search},
 							t.id_topic,
-							1000 * (
-								{int:weight_frequency} / (t.num_replies + 1) +
-								{int:weight_age} * CASE WHEN t.id_first_msg < {int:min_msg} THEN 0 ELSE (t.id_first_msg - {int:min_msg}) / {int:recent_message} END +
-								{int:weight_length} * CASE WHEN t.num_replies < {int:huge_topic_posts} THEN t.num_replies / {int:huge_topic_posts} ELSE 1 END +
-								{int:weight_subject} +
-								{int:weight_sticky} * t.is_sticky
-							) / {int:weight_total} AS relevance,
+							' . $relevance. ',
 							t.id_first_msg,
 							1
 						FROM {db_prefix}topics AS t
@@ -1624,12 +1636,6 @@ function PlushSearch2()
 						LIMIT ' . ($modSettings['search_max_results'] - $_SESSION['search_cache']['num_results'])),
 						array(
 							'id_search' => $_SESSION['search_cache']['id_search'],
-							'weight_age' => $weight['age'],
-							'weight_frequency' => $weight['frequency'],
-							'weight_length' => $weight['frequency'],
-							'weight_sticky' => $weight['frequency'],
-							'weight_subject' => $weight['frequency'],
-							'weight_total' => $weight_total,
 							'min_msg' => $minMsg,
 							'recent_message' => $recentMsg,
 							'huge_topic_posts' => $humungousTopicPosts,
@@ -1701,12 +1707,12 @@ function PlushSearch2()
 	if (!empty($context['topics']))
 	{
 		// Create an array for the permissions.
-		$boards_can = boardsAllowedTo(array('post_reply_own', 'post_reply_any', 'mark_any_notify', true, false));
+		$boards_can = boardsAllowedTo(array('post_reply_own', 'post_reply_any', 'mark_any_notify'), true, false);
 
 		// How's about some quick moderation?
 		if (!empty($options['display_quick_mod']))
 		{
-			$boards_can = boardsAllowedTo(array('lock_any', 'lock_own', 'make_sticky', 'move_any', 'move_own', 'remove_any', 'remove_own', 'merge_any', true, false));
+			$boards_can = array_merge($boards_can, boardsAllowedTo(array('lock_any', 'lock_own', 'make_sticky', 'move_any', 'move_own', 'remove_any', 'remove_own', 'merge_any'), true, false));
 
 			$context['can_lock'] = in_array(0, $boards_can['lock_any']);
 			$context['can_sticky'] = in_array(0, $boards_can['make_sticky']) && !empty($modSettings['enableStickyTopics']);
@@ -1738,6 +1744,8 @@ function PlushSearch2()
 		if (!empty($posters))
 			loadMemberData(array_unique($posters));
 
+		call_integration_hook('integrate_search_message_list', array($messages, $posters));
+
 		// Get the messages out for the callback - select enough that it can be made to look just like Display.
 		$messages_request = $smcFunc['db_query']('', '
 			SELECT
@@ -2046,6 +2054,7 @@ function prepareSearchContext($reset = false)
 		$context['can_move'] |= $output['quick_mod']['move'];
 		$context['can_remove'] |= $output['quick_mod']['remove'];
 		$context['can_merge'] |= in_array($output['board']['id'], $boards_can['merge_any']);
+		$context['can_markread'] = $context['user']['is_logged'];
 
 		// If we've found a message we can move, and we don't already have it, load the destinations.
 		if ($options['display_quick_mod'] == 1 && !isset($context['move_to_boards']) && $context['can_move'])
@@ -2058,6 +2067,9 @@ function prepareSearchContext($reset = false)
 			);
 			$context['move_to_boards'] = getBoardList($boardListOptions);
 		}
+
+		$context['qmod_actions'] = array('remove', 'lock', 'sticky', 'move', 'merge', 'restore', 'markread');
+		call_integration_hook('integrate_quick_mod_actions_search');
 	}
 
 	foreach ($context['key_words'] as $query)
@@ -2094,6 +2106,8 @@ function prepareSearchContext($reset = false)
 	);
 	$counter++;
 
+	call_integration_hook('integrate_search_message_context', array($counter, $output));
+
 	return $output;
 }
 

+ 4 - 1
Sources/Security.php

@@ -441,6 +441,7 @@ function banPermissions()
 			'remove_own', 'remove_any',
 			'post_unapproved_topics', 'post_unapproved_replies_own', 'post_unapproved_replies_any',
 		);
+		call_integration_hook('integrate_post_ban_permissions', array($denied_permissions));
 		$user_info['permissions'] = array_diff($user_info['permissions'], $denied_permissions);
 	}
 	// Are they absolutely under moderation?
@@ -453,6 +454,7 @@ function banPermissions()
 			'post_reply_any' => 'post_unapproved_replies_any',
 			'post_attachment' => 'post_unapproved_attachments',
 		);
+		call_integration_hook('integrate_warn_permissions', array($permission_change));
 		foreach ($permission_change as $old => $new)
 		{
 			if (!in_array($old, $user_info['permissions']))
@@ -1158,6 +1160,7 @@ function spamProtection($error_type)
 		'reporttm' => $modSettings['spamWaitTime'] * 4,
 		'search' => !empty($modSettings['search_floodcontrol_time']) ? $modSettings['search_floodcontrol_time'] : 1,
 	);
+	call_integration_hook('integrate_spam_protection', array($timeOverrides));
 
 	// Moderators are free...
 	if (!allowedTo('moderate_board'))
@@ -1188,7 +1191,7 @@ function spamProtection($error_type)
 	if ($smcFunc['db_affected_rows']() != 1)
 	{
 		// Spammer!  You only have to wait a *few* seconds!
-		fatal_lang_error($error_type . 'WaitTime_broken', false, array($timeLimit));
+		fatal_lang_error($error_type . '_WaitTime_broken', false, array($timeLimit));
 		return true;
 	}
 

+ 4 - 0
Sources/Subs-Auth.php

@@ -746,6 +746,7 @@ function rebuildModCache()
 		'mb' => $boards_mod,
 		'mq' => $mod_query,
 	);
+	call_integration_hook('integrate_mod_cache');
 
 	$user_info['mod_cache'] = $_SESSION['mc'];
 
@@ -774,6 +775,9 @@ function smf_setcookie($name, $value = '', $expire = 0, $path = '', $domain = ''
 	if ($secure === null)
 		$secure = !empty($modSettings['secureCookies']);
 
+	// Intercept cookie?
+	call_integration_hook('integrate_cookie', array($name, $value, $expire, $path, $domain, $secure, $httponly));
+
 	// This function is pointless if we have PHP >= 5.2.
 	if (version_compare(PHP_VERSION, '5.2', '>='))
 		return setcookie($name, $value, $expire, $path, $domain, $secure, $httponly);

+ 2 - 2
Sources/Subs-List.php

@@ -151,9 +151,9 @@ function createList($listOptions)
 
 			// Allow for basic formatting.
 			if (!empty($column['data']['comma_format']))
-				$cur_data['value'] = comma_format($cur_data['value']);
+				$cur_data['value'] = comma_format($list_item[$column['data']['comma_format']]);
 			elseif (!empty($column['data']['timeformat']))
-				$cur_data['value'] = timeformat($cur_data['value']);
+				$cur_data['value'] = timeformat($list_item[$column['data']['timeformat']]);
 
 			// Set a style class for this column?
 			if (isset($column['data']['class']))

+ 8 - 9
Themes/default/MessageIndex.template.php

@@ -313,15 +313,14 @@ function template_main()
 				<tr class="titlebg">
 					<td colspan="6" align="right">
 						<select class="qaction" name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
-							<option value="">--------</option>', $context['can_remove'] ? '
-							<option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
-							<option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
-							<option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '', $context['can_move'] ? '
-							<option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
-							<option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', $context['can_restore'] ? '
-							<option value="restore">' . $txt['quick_mod_restore'] . '</option>' : '', $context['can_approve'] ? '
-							<option value="approve">' . $txt['quick_mod_approve'] . '</option>' : '', $context['user']['is_logged'] ? '
-							<option value="markread">' . $txt['quick_mod_markread'] . '</option>' : '', '
+							<option value="">--------</option>';
+
+			foreach ($context['qmod_actions'] as $qmod_action)
+				if ($context['can_' . $qmod_action])
+					echo '
+							<option value="' . $qmod_action . '">' . $txt['quick_mod_'  . $qmod_action] . '</option>';
+
+			echo '
 						</select>';
 
 			// Show a list of boards they can move the topic to.

+ 16 - 15
Themes/default/Search.template.php

@@ -68,11 +68,11 @@ function template_main()
 					</dt>
 					<dd>
 						<input type="text" name="search" id="searchfor" ', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />';
-		
+
 		if (empty($modSettings['search_simple_fulltext']))
 			echo '
 				<em class="smalltext">', $txt['search_example'], '</em>';
-				
+
 		echo '
 					</dd>
 
@@ -91,7 +91,7 @@ function template_main()
 					<dd>
 						<input id="userspec" type="text" name="userspec" value="', empty($context['search_params']['userspec']) ? '*' : $context['search_params']['userspec'], '" size="40" class="input_text" />
 					</dd>
-					<dt class="righttext"><label for="sort">', 
+					<dt class="righttext"><label for="sort">',
 						$txt['search_order'], ':</label>
 					</dt>
 					<dd>
@@ -103,7 +103,7 @@ function template_main()
 							<option value="id_msg|asc">', $txt['search_orderby_old_first'], '</option>
 						</select>
 					</dd>
-					<dt class="righttext options">', 
+					<dt class="righttext options">',
 						$txt['search_options'], ':
 					</dt>
 					<dd class="options">
@@ -114,10 +114,10 @@ function template_main()
 							<input type="checkbox" name="subject_only" id="subject_only" value="1"', !empty($context['search_params']['subject_only']) ? ' checked="checked"' : '', ' class="input_check" />
 						</label>
 					</dd>
-					<dt class="righttext between">', 
+					<dt class="righttext between">',
 						$txt['search_post_age'], ':
 					</dt>
-					<dd><label for="minage">', 
+					<dd><label for="minage">',
 						$txt['search_between'], '</label><input type="text" name="minage" id="minage" value="', empty($context['search_params']['minage']) ? '0' : $context['search_params']['minage'], '" size="5" maxlength="4" class="input_text" />&nbsp;<label for="maxage">', $txt['search_and'], '&nbsp;</label><input type="text" name="maxage" id="maxage" value="', empty($context['search_params']['maxage']) ? '9999' : $context['search_params']['maxage'], '" size="5" maxlength="4" class="input_text" /> ', $txt['days_word'], '
 					</dd>
 				</dl>
@@ -260,7 +260,7 @@ function template_results()
 						<input type="text" name="search"', !empty($context['search_params']['search']) ? ' value="' . $context['search_params']['search'] . '"' : '', ' maxlength="', $context['search_string_limit'], '" size="40" class="input_text" />
 					</dd>
 				</dl>
-				
+
 				<input type="submit" name="edit_search" value="', $txt['search_adjust_submit'], '" class="button_submit" />
 				<br class="clear_right" />
 				<input type="hidden" name="searchtype" value="', !empty($context['search_params']['searchtype']) ? $context['search_params']['searchtype'] : 0, '" />
@@ -301,7 +301,7 @@ function template_results()
 				<img src="' . $settings['images_url'] . '/buttons/search.png" alt="?" class="centericon" />&nbsp;', $txt['mlist_search_results'],':&nbsp;',$context['search_params']['search'],'
 			</h3>
 		</div>';
-		
+
 		// was anything even found?
 		if (!empty($context['topics']))
 		echo'
@@ -396,13 +396,14 @@ function template_results()
 			<div class="titlebg2" style="padding: 4px;">
 				<div class="floatright">
 					<select name="qaction"', $context['can_move'] ? ' onchange="this.form.moveItTo.disabled = (this.options[this.selectedIndex].value != \'move\');"' : '', '>
-						<option value="">--------</option>', $context['can_remove'] ? '
-						<option value="remove">' . $txt['quick_mod_remove'] . '</option>' : '', $context['can_lock'] ? '
-						<option value="lock">' . $txt['quick_mod_lock'] . '</option>' : '', $context['can_sticky'] ? '
-						<option value="sticky">' . $txt['quick_mod_sticky'] . '</option>' : '',	$context['can_move'] ? '
-						<option value="move">' . $txt['quick_mod_move'] . ': </option>' : '', $context['can_merge'] ? '
-						<option value="merge">' . $txt['quick_mod_merge'] . '</option>' : '', '
-						<option value="markread">', $txt['quick_mod_markread'], '</option>
+						<option value="">--------</option>';
+
+			foreach ($context['qmod_actions'] as $qmod_action)
+				if ($context['can_' . $qmod_action])
+					echo '
+							<option value="' . $qmod_action . '">' . $txt['quick_mod_'  . $qmod_action] . '</option>';
+
+			echo '
 					</select>';
 
 			if ($context['can_move'])

+ 9 - 9
Themes/default/languages/Errors.english.php

@@ -201,15 +201,15 @@ $txt['who_off'] = 'You cannot access Who\'s Online right now because it is disab
 $txt['merge_create_topic_failed'] = 'Error creating a new topic.';
 $txt['merge_need_more_topics'] = 'Merge topics require at least two topics to merge.';
 
-$txt['postWaitTime_broken'] = 'The last posting from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['registerWaitTime_broken'] = 'You already registered just %1$d seconds ago!';
-$txt['loginWaitTime_broken'] = 'You will have to wait about %1$d seconds to login again, sorry.';
-$txt['pmWaitTime_broken'] = 'The last personal message from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['reporttmWaitTime_broken'] = 'The last topic report from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['sendtopicWaitTime_broken'] = 'The last topic sent from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['sendmailWaitTime_broken'] = 'The last email sent from your IP was less than %1$d seconds ago. Please try again later.';
-$txt['searchWaitTime_broken'] = 'Your last search was less than %1$d seconds ago. Please try again later.';
-$txt['remindWaitTime_broken'] = 'Your last reminder was less than %1$d seconds ago. Please try again later.';
+$txt['post_WaitTime_broken'] = 'The last posting from your IP was less than %1$d seconds ago. Please try again later.';
+$txt['register_WaitTime_broken'] = 'You already registered just %1$d seconds ago!';
+$txt['login_WaitTime_broken'] = 'You will have to wait about %1$d seconds to login again, sorry.';
+$txt['pm_WaitTime_broken'] = 'The last personal message from your IP was less than %1$d seconds ago. Please try again later.';
+$txt['reporttm_WaitTime_broken'] = 'The last topic report from your IP was less than %1$d seconds ago. Please try again later.';
+$txt['sendtopic_WaitTime_broken'] = 'The last topic sent from your IP was less than %1$d seconds ago. Please try again later.';
+$txt['sendmail_WaitTime_broken'] = 'The last email sent from your IP was less than %1$d seconds ago. Please try again later.';
+$txt['search_WaitTime_broken'] = 'Your last search was less than %1$d seconds ago. Please try again later.';
+$txt['remind_WaitTime_broken'] = 'Your last reminder was less than %1$d seconds ago. Please try again later.';
 
 $txt['email_missing_data'] = 'You must enter something in both the subject and message boxes.';