|
@@ -239,6 +239,8 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
|
|
|
if (is_numeric($topics))
|
|
|
$topics = array($topics);
|
|
|
|
|
|
+ $recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
|
|
|
+
|
|
|
// Decrease the post counts.
|
|
|
if ($decreasePostCount)
|
|
|
{
|
|
@@ -246,14 +248,14 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
|
|
|
SELECT m.id_member, COUNT(*) AS posts
|
|
|
FROM {db_prefix}messages AS m
|
|
|
INNER JOIN {db_prefix}boards AS b ON (b.id_board = m.id_board)
|
|
|
- WHERE m.id_topic IN ({array_int:topics})
|
|
|
- AND m.icon != {string:recycled}
|
|
|
+ WHERE m.id_topic IN ({array_int:topics})' . (!empty($recycle_board) ? '
|
|
|
+ AND m.id_board != {int:recycled_board}' : '') . '
|
|
|
AND b.count_posts = {int:do_count_posts}
|
|
|
AND m.approved = {int:is_approved}
|
|
|
GROUP BY m.id_member',
|
|
|
array(
|
|
|
'do_count_posts' => 0,
|
|
|
- 'recycled' => 'recycled',
|
|
|
+ 'recycled_board' => $recycle_board,
|
|
|
'topics' => $topics,
|
|
|
'is_approved' => 1,
|
|
|
)
|
|
@@ -267,7 +269,7 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
|
|
|
}
|
|
|
|
|
|
// Recycle topics that aren't in the recycle board...
|
|
|
- if (!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 && !$ignoreRecycling)
|
|
|
+ if (!empty($recycle_board) && !$ignoreRecycling)
|
|
|
{
|
|
|
$request = $smcFunc['db_query']('', '
|
|
|
SELECT id_topic, id_board, unapproved_posts, approved
|
|
@@ -276,7 +278,7 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
|
|
|
AND id_board != {int:recycle_board}
|
|
|
LIMIT ' . count($topics),
|
|
|
array(
|
|
|
- 'recycle_board' => $modSettings['recycle_board'],
|
|
|
+ 'recycle_board' => $recycle_board,
|
|
|
'topics' => $topics,
|
|
|
)
|
|
|
);
|
|
@@ -305,17 +307,6 @@ function removeTopics($topics, $decreasePostCount = true, $ignoreRecycling = fal
|
|
|
}
|
|
|
$smcFunc['db_free_result']($request);
|
|
|
|
|
|
- // Mark recycled topics as recycled.
|
|
|
- $smcFunc['db_query']('', '
|
|
|
- UPDATE {db_prefix}messages
|
|
|
- SET icon = {string:recycled}
|
|
|
- WHERE id_topic IN ({array_int:recycle_topics})',
|
|
|
- array(
|
|
|
- 'recycle_topics' => $recycleTopics,
|
|
|
- 'recycled' => 'recycled',
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
// Move the topics to the recycle board.
|
|
|
require_once($sourcedir . '/MoveTopic.php');
|
|
|
moveTopics($recycleTopics, $modSettings['recycle_board']);
|
|
@@ -573,6 +564,8 @@ function removeMessage($message, $decreasePostCount = true)
|
|
|
if (empty($message) || !is_numeric($message))
|
|
|
return false;
|
|
|
|
|
|
+ $recycle_board = !empty($modSettings['recycle_enable']) && !empty($modSettings['recycle_board']) ? (int) $modSettings['recycle_board'] : 0;
|
|
|
+
|
|
|
$request = $smcFunc['db_query']('', '
|
|
|
SELECT
|
|
|
m.id_member, m.icon, m.poster_time, m.subject,' . (empty($modSettings['search_custom_index_config']) ? '' : ' m.body,') . '
|
|
@@ -696,7 +689,7 @@ function removeMessage($message, $decreasePostCount = true)
|
|
|
}
|
|
|
|
|
|
// Deleting a recycled message can not lower anyone's post count.
|
|
|
- if ($row['icon'] == 'recycled')
|
|
|
+ if (!empty($recycle_board) && $row['id_board'] == $recycle_board)
|
|
|
$decreasePostCount = false;
|
|
|
|
|
|
// This is the last post, update the last post on the board.
|
|
@@ -813,14 +806,12 @@ function removeMessage($message, $decreasePostCount = true)
|
|
|
SET
|
|
|
id_topic = {int:id_topic},
|
|
|
id_board = {int:recycle_board},
|
|
|
- icon = {string:recycled},
|
|
|
approved = {int:is_approved}
|
|
|
WHERE id_msg = {int:id_msg}',
|
|
|
array(
|
|
|
'id_topic' => $topicID,
|
|
|
'recycle_board' => $modSettings['recycle_board'],
|
|
|
'id_msg' => $message,
|
|
|
- 'recycled' => 'recycled',
|
|
|
'is_approved' => 1,
|
|
|
)
|
|
|
);
|
|
@@ -1129,18 +1120,6 @@ function RestoreTopic()
|
|
|
$unfound_messages[$msg['id']] = $msg['subject'];
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- // Put the icons back.
|
|
|
- if (!empty($messages))
|
|
|
- $smcFunc['db_query']('', '
|
|
|
- UPDATE {db_prefix}messages
|
|
|
- SET icon = {string:icon}
|
|
|
- WHERE id_msg IN ({array_int:messages})',
|
|
|
- array(
|
|
|
- 'icon' => 'xx',
|
|
|
- 'messages' => $messages,
|
|
|
- )
|
|
|
- );
|
|
|
}
|
|
|
|
|
|
// Now any topics?
|
|
@@ -1175,17 +1154,6 @@ function RestoreTopic()
|
|
|
// Ok we got here so me move them from here to there.
|
|
|
moveTopics($row['id_topic'], $row['id_previous_board']);
|
|
|
|
|
|
- // Lets remove the recycled icon.
|
|
|
- $smcFunc['db_query']('', '
|
|
|
- UPDATE {db_prefix}messages
|
|
|
- SET icon = {string:icon}
|
|
|
- WHERE id_topic = {int:id_topic}',
|
|
|
- array(
|
|
|
- 'icon' => 'xx',
|
|
|
- 'id_topic' => $row['id_topic'],
|
|
|
- )
|
|
|
- );
|
|
|
-
|
|
|
// Lets see if the board that we are returning to has post count enabled.
|
|
|
$request2 = $smcFunc['db_query']('', '
|
|
|
SELECT count_posts
|
|
@@ -1304,12 +1272,10 @@ function mergePosts($msgs = array(), $from_topic, $target_topic)
|
|
|
SET
|
|
|
id_topic = {int:target_topic},
|
|
|
id_board = {int:target_board},
|
|
|
- icon = {string:icon}
|
|
|
WHERE id_msg IN({array_int:msgs})',
|
|
|
array(
|
|
|
'target_topic' => $target_topic,
|
|
|
'target_board' => $target_board,
|
|
|
- 'icon' => $target_board == $modSettings['recycle_board'] ? 'recycled' : 'xx',
|
|
|
'msgs' => $msgs,
|
|
|
)
|
|
|
);
|