Sources/BestAnswer/Actions.php
/**
	 * Marks a message as the best answer of a topic,
	 * Then redirects to the topic.
	 *
	 * @hook integrate_display_topic
	 */
Marks a message as the best answer of a topic,
Then redirects to the topic.


Marks a message as the best answer of a topic Then redirects to the topic .
public static function markBestAnswer()
	{
		global $smcFunc, $context;
		if (empty($_GET['best_answer']) || $_GET['best_answer'] == $context['topicinfo']['id_first_msg'])
			return;
		checkSession('get');
		self::$policy->assertCanMarkBestAnswer();
		$request = $smcFunc['db_query']('', '
			SELECT id_msg, id_member
			FROM {db_prefix}messages
			WHERE id_topic = {int:current_topic}
				AND id_msg = {int:best_answer}',
			array(
				'best_answer' => (int) $_GET['best_answer'],
				'current_topic' => (int) $context['current_topic'],
			)
		);
		list($id_msg, $id_member) = $smcFunc['db_fetch_row']($request);
		$smcFunc['db_free_result']($request);
		if (empty($id_msg))
			return;
		$smcFunc['db_query']('' , '
			UPDATE {db_prefix}topics
			SET id_best_msg = {int:best_answer}
			WHERE id_topic = {int:current_topic}',
			array(
				'best_answer' => (int) $_GET['best_answer'],
				'current_topic' => (int) $context['current_topic'],
			)
		);
		call_integration_hook('integrate_sycho_best_answer', array($id_msg, $id_member));
		redirectexit("topic={$context['current_topic']}");
	}
public static function markBestAnswer ( ) { global $ smcFunc , $ context ; if ( empty ( $ _GET [ 'best_answer' ] ) || $ _GET [ 'best_answer' ] == $ context [ 'topicinfo' ] [ 'id_first_msg' ] ) return ; checkSession ( 'get' ) ; self :: $ policy -> assertCanMarkBestAnswer ( ) ; $ request = $ smcFunc [ 'db_query' ] ( '' , '
			SELECT id_msg, id_member
			FROM {db_prefix}messages
			WHERE id_topic = {int:current_topic}
				AND id_msg = {int:best_answer}' , array ( 'best_answer' => ( int ) $ _GET [ 'best_answer' ] , 'current_topic' => ( int ) $ context [ 'current_topic' ] , ) ) ; list ( $ id_msg , $ id_member ) = $ smcFunc [ 'db_fetch_row' ] ( $ request ) ; $ smcFunc [ 'db_free_result' ] ( $ request ) ; if ( empty ( $ id_msg ) ) return ; $ smcFunc [ 'db_query' ] ( '' , '
			UPDATE {db_prefix}topics
			SET id_best_msg = {int:best_answer}
			WHERE id_topic = {int:current_topic}' , array ( 'best_answer' => ( int ) $ _GET [ 'best_answer' ] , 'current_topic' => ( int ) $ context [ 'current_topic' ] , ) ) ; call_integration_hook ( 'integrate_sycho_best_answer' , array ( $ id_msg , $ id_member ) ) ; redirectexit ( " topic= { $ context [ 'current_topic' ] } " ) ; }
Marks a message as the best answer of a topic,
 Then redirects to the topic.
Marks a message as the best answer of a topic Then redirects to the topic .
// Make sure the msg id supplied actually belongs to this topic // So you're trying to do some sneaky things huh.. well not today. // Integrate with other mods