Skip to content

Commit

Permalink
Concurrent removal of topics detected and action stopped second half …
Browse files Browse the repository at this point in the history
…of [Bug 4910]

Signed-off-by: emanuele <emanuele45@gmail.com>
  • Loading branch information
emanuele45 committed May 13, 2012
1 parent 4cbf0dd commit 97538cb
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
29 changes: 29 additions & 0 deletions Sources/RemoveTopic.php
Expand Up @@ -48,6 +48,8 @@ function RemoveTopic2()
if (empty($topic))
redirectexit();

removeDeleteConcurrence();

$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, ms.subject, t.approved
FROM {db_prefix}topics AS t
Expand Down Expand Up @@ -95,6 +97,8 @@ function DeleteMessage()
if (empty($topic) && isset($_REQUEST['topic']))
$topic = (int) $_REQUEST['topic'];

removeDeleteConcurrence();

$request = $smcFunc['db_query']('', '
SELECT t.id_member_started, m.id_member, m.subject, m.poster_time, m.approved
FROM {db_prefix}topics AS t
Expand Down Expand Up @@ -1458,4 +1462,29 @@ function mergePosts($msgs = array(), $from_topic, $target_topic)
updateLastMessages(array($from_board, $target_board));
}

function removeDeleteConcurrence()
{
global $modSettings, $board, $topic, $smcFunc, $scripturl, $context;

// No recycle no need to go further
if (empty($modSettings['recycle_enable']) || empty($modSettings['recycle_board']))
return false;

// If it's confirmed go on and delete (from recycle)
if (isset($_GET['confirm_delete']))
return true;

if (empty($board))
return false;

if ($modSettings['recycle_board'] != $board)
return true;
elseif (isset($_REQUEST['msg']))
$confirm_url = $scripturl . '?action=deletemsg;confirm_delete;topic=' . $context['current_topic'] . '.0;msg=' . $_REQUEST['msg'] . ';' . $context['session_var'] . '=' . $context['session_id'];
else
$confirm_url = $scripturl . '?action=removetopic2;confirm_delete;topic=' . $context['current_topic'] . '.0;' . $context['session_var'] . '=' . $context['session_id'];

fatal_lang_error('post_already_deleted', false, array($confirm_url));
}

?>
1 change: 1 addition & 0 deletions Themes/default/languages/Errors.english.php
Expand Up @@ -189,6 +189,7 @@
$txt['ban_trigger_already_exists'] = 'This ban trigger (%1$s) already exists in %2$s.';

$txt['recycle_no_valid_board'] = 'No valid board selected for recycled topics';
$txt['post_already_deleted'] = 'The topic or message has already been moved to the recycle board. Are you sure you want to delete it completely?<br />If so follow <a href="%1$s">this link</a>';

$txt['login_threshold_fail'] = 'Sorry, you are out of login chances. Please come back and try again later.';
$txt['login_threshold_brute_fail'] = 'Sorry, but you\'ve reached your login attempts threshold. Please wait 30 seconds and try again later.';
Expand Down

0 comments on commit 97538cb

Please sign in to comment.