浏览代码

! Handle restoring of messages from the search page a bit more properly, fixes #1043

Signed-off-by: Peter Spicer <[email protected]>
Peter Spicer 11 年之前
父节点
当前提交
dac5294e6b
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      Sources/Search.php

+ 4 - 3
Sources/Search.php

@@ -1840,9 +1840,8 @@ function PlushSearch2()
 	$context['sub_template'] = 'results';
 	$context['page_title'] = $txt['search_results'];
 	$context['get_topics'] = 'prepareSearchContext';
-	$context['can_send_pm'] = allowedTo('pm_send');
-	$context['can_send_email'] = allowedTo('send_email_to_members');
-	$context['can_restore'] = allowedTo('move_any') && !empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] == $board;
+	$context['can_restore_perm'] = allowedTo('move_any') && !empty($modSettings['recycle_enable']);
+	$context['can_restore'] = false; // We won't know until we handle the context later whether we can actually restore...
 
 	$context['jump_to'] = array(
 		'label' => addslashes(un_htmlspecialchars($txt['jump_to'])),
@@ -2068,6 +2067,7 @@ function prepareSearchContext($reset = false)
 			'sticky' => (in_array(0, $boards_can['make_sticky']) || in_array($output['board']['id'], $boards_can['make_sticky'])),
 			'move' => in_array(0, $boards_can['move_any']) || in_array($output['board']['id'], $boards_can['move_any']) || ($started && (in_array(0, $boards_can['move_own']) || in_array($output['board']['id'], $boards_can['move_own']))),
 			'remove' => in_array(0, $boards_can['remove_any']) || in_array($output['board']['id'], $boards_can['remove_any']) || ($started && (in_array(0, $boards_can['remove_own']) || in_array($output['board']['id'], $boards_can['remove_own']))),
+			'restore' => $context['can_restore_perm'] && ($modSettings['recycle_board'] == $output['board']['id']),
 		);
 
 		$context['can_lock'] |= $output['quick_mod']['lock'];
@@ -2075,6 +2075,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_restore'] |= $output['quick_mod']['restore'];
 		$context['can_markread'] = $context['user']['is_logged'];
 
 		$context['qmod_actions'] = array('remove', 'lock', 'sticky', 'move', 'merge', 'restore', 'markread');