aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/includes/class_visibility.php265
-rw-r--r--phpBB/includes/functions_posting.php112
-rw-r--r--phpBB/includes/mcp/info/mcp_queue.php1
-rw-r--r--phpBB/includes/mcp/mcp_queue.php152
-rw-r--r--phpBB/install/schemas/schema_data.sql4
-rw-r--r--phpBB/language/en/acp/common.php2
-rw-r--r--phpBB/language/en/acp/permissions_phpbb.php5
-rw-r--r--phpBB/language/en/mcp.php2
-rw-r--r--phpBB/language/en/posting.php2
-rw-r--r--phpBB/language/en/viewtopic.php2
-rw-r--r--phpBB/mcp.php6
-rw-r--r--phpBB/posting.php51
-rw-r--r--phpBB/styles/prosilver/imageset/icon_topic_deleted.pngbin0 -> 964 bytes
-rw-r--r--phpBB/styles/prosilver/imageset/imageset.cfg117
-rw-r--r--phpBB/styles/prosilver/template/mcp_queue.html5
-rw-r--r--phpBB/styles/prosilver/template/posting_editor.html7
-rw-r--r--phpBB/styles/prosilver/template/viewforum_body.html2
-rw-r--r--phpBB/styles/prosilver/template/viewtopic_body.html2
-rw-r--r--phpBB/viewforum.php3
-rw-r--r--phpBB/viewtopic.php6
20 files changed, 551 insertions, 195 deletions
diff --git a/phpBB/includes/class_visibility.php b/phpBB/includes/class_visibility.php
index 46f188d833..9798e938b1 100644
--- a/phpBB/includes/class_visibility.php
+++ b/phpBB/includes/class_visibility.php
@@ -125,7 +125,6 @@ class phpbb_visibility
// we are adjusting _all_ posts in that topic.
$status = self::set_post_visibility($visibility, false, $topic_id, $forum_id, true, true);
-
return $status;
}
@@ -172,5 +171,267 @@ class phpbb_visibility
update_post_information('forum', $forum_id, false);
}
}
+
+ /**
+ * Can the current logged-in user soft-delete posts?
+ * @param $forum_id - int - the forum ID whose permissions to check
+ * @param $poster_id - int - the poster ID of the post in question
+ * @param $post_locked - bool - is the post locked?
+ * @return bool
+ */
+ public function can_soft_delete($forum_id, $poster_id, $post_locked)
+ {
+ global $auth, $user;
+
+ if ($auth->acl_get('m_softdelete', $forum_id))
+ {
+ return true;
+ }
+ else if ($auth->acl_get('f_softdelete', $forum_id) && $poster_id == $user->data['poster_id'] && !$post_locked)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Can the current logged-in user restore soft-deleted posts?
+ * @param $forum_id - int - the forum ID whose permissions to check
+ * @param $poster_id - int - the poster ID of the post in question
+ * @param $post_locked - bool - is the post locked?
+ * @return bool
+ */
+ public function can_restore($forum_id, $poster_id, $post_locked)
+ {
+ global $auth, $user;
+
+ if ($auth->acl_get('m_restore', $forum_id))
+ {
+ return true;
+ }
+ else if ($auth->acl_get('f_restore', $forum_id) && $poster_id == $user->data['user_id'] && !$post_locked)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * Do the required math to hide a complete topic (going from approved to
+ * unapproved or from approved to deleted)
+ * @param $topic_id - int - the topic to act on
+ * @param $forum_id - int - the forum where the topic resides
+ * @param $topic_row - array - data about the topic, may be empty at call time
+ * @param $sql_data - array - populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function hide_topic($topic_id, $forum_id, &$topic_row, &$sql_data)
+ {
+ global $auth, $config, $db;
+
+ // Do we need to grab some topic informations?
+ if (!sizeof($topic_row))
+ {
+ $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_visibility
+ FROM ' . TOPICS_TABLE . '
+ WHERE topic_id = ' . $topic_id;
+ $result = $db->sql_query($sql);
+ $topic_row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+ }
+
+ // If this is the only post remaining we do not need to decrement topic_replies.
+ // Also do not decrement if first post - then the topic_replies will not be adjusted if approving the topic again.
+
+ // If this is an edited topic or the first post the topic gets completely disapproved later on...
+ $sql_data[FORUMS_TABLE] = 'forum_topics = forum_topics - 1';
+ $sql_data[FORUMS_TABLE] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1);
+
+ set_config_count('num_topics', -1, true);
+ set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true);
+
+ // Only decrement this post, since this is the one non-approved now
+ if ($auth->acl_get('f_postcount', $forum_id))
+ {
+ $sql_data[USERS_TABLE] = 'user_posts = user_posts - 1';
+ }
+ }
+
+ /**
+ * Do the required math to hide a single post (going from approved to
+ * unapproved or from approved to deleted)
+ * Notably, we do _not_ need the post ID to do this operation. We're only changing statistic caches
+ * @param $forum_id - int - the forum where the topic resides
+ * @param $current_time - int - passed for consistency instead of calling time() internally
+ * @param $sql_data - array - populated with the SQL changes, may be empty at call time
+ * @return void
+ */
+ public function hide_post($forum_id, $current_time, &$sql_data)
+ {
+ global $auth, $config, $db;
+
+ $sql_data[TOPICS_TABLE] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time;
+ $sql_data[FORUMS_TABLE] = 'forum_posts = forum_posts - 1';
+
+ set_config_count('num_posts', -1, true);
+
+ if ($auth->acl_get('f_postcount', $forum_id))
+ {
+ $sql_data[USERS_TABLE] = 'user_posts = user_posts - 1';
+ }
+ }
+
+ /**
+ * One function to rule them all ... and unhide posts and topics. This could
+ * reasonably be broken up, I straight copied this code from the mcp_queue.php
+ * file here for global access.
+ * @param $mode - string - member of the set {'approve', 'restore'}
+ * @param $post_info - array - Contains info from post U topics table about
+ * the posts/topics in question
+ * @param $post_id_list - array of ints - the set of posts being worked on
+ */
+ public function unhide_posts_topics($mode, $post_info, $post_id_list)
+ {
+ global $db, $config;
+
+ // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
+ // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
+
+ $total_topics = $total_posts = 0;
+ $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
+ $user_posts_sql = $post_approved_list = array();
+
+ foreach ($post_info as $post_id => $post_data)
+ {
+ if ($post_data['post_visibility'] == ITEM_APPROVED)
+ {
+ $post_approved_list[] = $post_id;
+ continue;
+ }
+
+ $topic_id_list[$post_data['topic_id']] = 1;
+
+ if ($post_data['forum_id'])
+ {
+ $forum_id_list[$post_data['forum_id']] = 1;
+ }
+
+ // User post update (we do not care about topic or post, since user posts are strictly connected to posts)
+ // But we care about forums where post counts get not increased. ;)
+ if ($post_data['post_postcount'])
+ {
+ $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
+ }
+
+ // Topic or Post. ;)
+ if ($post_data['topic_first_post_id'] == $post_id)
+ {
+ if ($post_data['forum_id'])
+ {
+ $total_topics++;
+ }
+ $topic_approve_sql[] = $post_data['topic_id'];
+
+ $approve_log[] = array(
+ 'type' => 'topic',
+ 'post_subject' => $post_data['post_subject'],
+ 'forum_id' => $post_data['forum_id'],
+ 'topic_id' => $post_data['topic_id'],
+ );
+ }
+ else
+ {
+ $approve_log[] = array(
+ 'type' => 'post',
+ 'post_subject' => $post_data['post_subject'],
+ 'forum_id' => $post_data['forum_id'],
+ 'topic_id' => $post_data['topic_id'],
+ );
+ }
+
+ if ($post_data['forum_id'])
+ {
+ $total_posts++;
+
+ // Increment by topic_replies if we approve a topic...
+ // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
+ if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
+ {
+ $total_posts += $post_data['topic_replies'];
+ }
+ }
+
+ $post_approve_sql[] = $post_id;
+ }
+
+ $post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
+ for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
+ {
+ unset($post_info[$post_approved_list[$i]]);
+ }
+
+ if (sizeof($topic_approve_sql))
+ {
+ $sql = 'UPDATE ' . TOPICS_TABLE . '
+ SET topic_visibility = ' . ITEM_APPROVED . '
+ WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql);
+ $db->sql_query($sql);
+ }
+
+ if (sizeof($post_approve_sql))
+ {
+ $sql = 'UPDATE ' . POSTS_TABLE . '
+ SET post_visibility = ' . ITEM_APPROVED . '
+ WHERE ' . $db->sql_in_set('post_id', $post_approve_sql);
+ $db->sql_query($sql);
+ }
+
+ unset($topic_approve_sql, $post_approve_sql);
+
+ foreach ($approve_log as $log_data)
+ {
+ add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_' . strtoupper($mode) . 'D' : 'LOG_POST_' . strtoupper($mode) . 'D', $log_data['post_subject']);
+ }
+
+ if (sizeof($user_posts_sql))
+ {
+ // Try to minimize the query count by merging users with the same post count additions
+ $user_posts_update = array();
+
+ foreach ($user_posts_sql as $user_id => $user_posts)
+ {
+ $user_posts_update[$user_posts][] = $user_id;
+ }
+
+ foreach ($user_posts_update as $user_posts => $user_id_ary)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . '
+ SET user_posts = user_posts + ' . $user_posts . '
+ WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
+ $db->sql_query($sql);
+ }
+ }
+
+ if ($total_topics)
+ {
+ set_config_count('num_topics', $total_topics, true);
+ }
+
+ if ($total_posts)
+ {
+ set_config_count('num_posts', $total_posts, true);
+ }
+
+ if (!function_exists('sync'))
+ {
+ global $phpbb_root_path, $phpEx;
+ include ($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
+ }
+
+ sync('topic', 'topic_id', array_keys($topic_id_list), true);
+ sync('forum', 'forum_id', array_keys($forum_id_list), true, true);
+ unset($topic_id_list, $forum_id_list);
+
+ return true;
+ }
}
-?>
diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php
index 12448ea0ce..b264e35a93 100644
--- a/phpBB/includes/functions_posting.php
+++ b/phpBB/includes/functions_posting.php
@@ -1411,7 +1411,7 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id
/**
* Delete Post
*/
-function delete_post($forum_id, $topic_id, $post_id, &$data)
+function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false)
{
global $db, $user, $auth;
global $config, $phpEx, $phpbb_root_path;
@@ -1422,10 +1422,14 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
{
$post_mode = 'delete_topic';
}
- else if ($data['topic_first_post_id'] == $post_id)
+ else if ($data['topic_first_post_id'] == $post_id && !$is_soft)
{
$post_mode = 'delete_first_post';
}
+ else if ($data['topic_first_post_id'] == $post_id && $is_soft)
+ {
+ $post_mode = 'delete_topic';
+ }
else if ($data['topic_last_post_id'] == $post_id)
{
$post_mode = 'delete_last_post';
@@ -1460,14 +1464,22 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
$db->sql_freeresult($result);
}
- if (!delete_posts('post_id', array($post_id), false, false))
+ if ($is_soft)
+ {
+ phpbb_visibility::set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id));
+ phpbb_visibility::hide_post($forum_id, time(), $sql_data);
+ }
+ else
{
- // Try to delete topic, we may had an previous error causing inconsistency
- if ($post_mode == 'delete_topic')
+ if (!delete_posts('post_id', array($post_id), false, false))
{
- delete_topics('topic_id', array($topic_id), false);
+ // Try to delete topic, we may had an previous error causing inconsistency
+ if ($post_mode == 'delete_topic')
+ {
+ delete_topics('topic_id', array($topic_id), false);
+ }
+ trigger_error('ALREADY_DELETED');
}
- trigger_error('ALREADY_DELETED');
}
$db->sql_transaction('commit');
@@ -1486,17 +1498,31 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
update_post_information('forum', $updated_forum);
}
- delete_topics('topic_id', array($topic_id), false);
+ if ($is_soft)
+ {
+ $topic_row = array();
+ phpbb_visibility::set_topic_visibility(POST_DELETED, $topic_id, $forum_id);
+ phpbb_visibility::hide_topic($topic_id, $forum_id, $topic_row, $sql_data);
+ }
+ else
+ {
+ delete_topics('topic_id', array($topic_id), false);
- $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1';
- $sql_data[FORUMS_TABLE] .= ($data['topic_visibility'] == ITEM_APPROVED) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : '';
- $update_sql = update_post_information('forum', $forum_id, true);
- if (sizeof($update_sql))
- {
- $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
- $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ if ($data['topic_type'] != POST_GLOBAL)
+ {
+ $sql_data[FORUMS_TABLE] .= 'forum_topics_real = forum_topics_real - 1';
+ $sql_data[FORUMS_TABLE] .= ($data['topic_visibility'] == ITEM_APPROVED) ? ', forum_posts = forum_posts - 1, forum_topics = forum_topics - 1' : '';
+ }
+
+ $update_sql = update_post_information('forum', $forum_id, true);
+ if (sizeof($update_sql))
+ {
+ $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
+ $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ }
}
+
break;
case 'delete_first_post':
@@ -1520,19 +1546,27 @@ function delete_post($forum_id, $topic_id, $post_id, &$data)
break;
case 'delete_last_post':
- $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : '';
-
- $update_sql = update_post_information('forum', $forum_id, true);
- if (sizeof($update_sql))
+ if ($is_soft)
{
- $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
- $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ phpbb_visibility::hide_post($forum_id, time(), $sql_data);
+ phpbb_visibility::set_post_visibility($post_id, $topic_id, $forum_id, false, true);
}
+ else
+ {
+ $sql_data[FORUMS_TABLE] = ($data['post_visibility'] == ITEM_APPROVED) ? 'forum_posts = forum_posts - 1' : '';
+
+ $update_sql = update_post_information('forum', $forum_id, true);
+ if (sizeof($update_sql))
+ {
+ $sql_data[FORUMS_TABLE] .= ($sql_data[FORUMS_TABLE]) ? ', ' : '';
+ $sql_data[FORUMS_TABLE] .= implode(', ', $update_sql[$forum_id]);
+ }
- $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : '');
+ $sql_data[TOPICS_TABLE] = 'topic_bumped = 0, topic_bumper = 0, topic_replies_real = topic_replies_real - 1' . (($data['post_visibility'] == ITEM_APPROVED) ? ', topic_replies = topic_replies - 1' : '');
+ }
$update_sql = update_post_information('topic', $topic_id, true);
- if (sizeof($update_sql))
+ if (sizeof($update_sql) && !$is_soft)
{
$sql_data[TOPICS_TABLE] .= ', ' . implode(', ', $update_sql[$topic_id]);
$next_post_id = (int) str_replace('topic_last_post_id = ', '', $update_sql[$topic_id][0]);
@@ -1702,7 +1736,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Mods are able to force approved/unapproved posts. True means the post is approved, false the post is unapproved
if (isset($data['force_approved_state']))
{
- $post_approval = ($data['force_approved_state']) ? 1 : 0;
+ $post_approval = ($data['force_approved_state']) ? ITEM_APPROVED : ITEM_UNAPPROVED;
}
// Start the transaction here
@@ -1915,32 +1949,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Correctly set back the topic replies and forum posts... only if the topic was approved before and now gets disapproved
if (!$post_approval && $data['topic_visibility'] == ITEM_APPROVED)
{
- // Do we need to grab some topic informations?
- if (!sizeof($topic_row))
- {
- $sql = 'SELECT topic_type, topic_replies, topic_replies_real, topic_visibility
- FROM ' . TOPICS_TABLE . '
- WHERE topic_id = ' . $data['topic_id'];
- $result = $db->sql_query($sql);
- $topic_row = $db->sql_fetchrow($result);
- $db->sql_freeresult($result);
- }
-
- // If this is the only post remaining we do not need to decrement topic_replies.
- // Also do not decrement if first post - then the topic_replies will not be adjusted if approving the topic again.
-
- // If this is an edited topic or the first post the topic gets completely disapproved later on...
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_topics = forum_topics - 1';
- $sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - ' . ($topic_row['topic_replies'] + 1);
-
- set_config_count('num_topics', -1, true);
- set_config_count('num_posts', ($topic_row['topic_replies'] + 1) * (-1), true);
-
- // Only decrement this post, since this is the one non-approved now
- if ($auth->acl_get('f_postcount', $data['forum_id']))
- {
- $sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
- }
+ phpbb_visibility::hide_topic($data['topic_id'], $data['forum_id'], $topic_row, $sql_data);
}
break;
@@ -1951,6 +1960,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
// Correctly set back the topic replies and forum posts... but only if the post was approved before.
if (!$post_approval && $data['post_visibility'] == ITEM_APPROVED)
{
+ //phpbb_visibility::hide_post($forum_id, $current_time, $sql_data);
+ // ^^ hide_post SQL is identical, except that it does not include the ['stat'] sub-array
$sql_data[TOPICS_TABLE]['stat'][] = 'topic_replies = topic_replies - 1, topic_last_view_time = ' . $current_time;
$sql_data[FORUMS_TABLE]['stat'][] = 'forum_posts = forum_posts - 1';
@@ -1960,6 +1971,7 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
{
$sql_data[USERS_TABLE]['stat'][] = 'user_posts = user_posts - 1';
}
+
}
break;
diff --git a/phpBB/includes/mcp/info/mcp_queue.php b/phpBB/includes/mcp/info/mcp_queue.php
index 7ad79f9781..31e9cc9af6 100644
--- a/phpBB/includes/mcp/info/mcp_queue.php
+++ b/phpBB/includes/mcp/info/mcp_queue.php
@@ -21,6 +21,7 @@ class mcp_queue_info
'modes' => array(
'unapproved_topics' => array('title' => 'MCP_QUEUE_UNAPPROVED_TOPICS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
'unapproved_posts' => array('title' => 'MCP_QUEUE_UNAPPROVED_POSTS', 'auth' => 'aclf_m_approve', 'cat' => array('MCP_QUEUE')),
+ 'deleted_posts' => array('title' => 'MCP_QUEUE_DELETED_POSTS', 'auth' => 'aclf_m_restore', 'cat' => array('MCP_QUEUE')),
'approve_details' => array('title' => 'MCP_QUEUE_APPROVE_DETAILS', 'auth' => 'acl_m_approve,$id || (!$id && aclf_m_approve)', 'cat' => array('MCP_QUEUE')),
),
);
diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php
index 833f924efc..c19fb9b2b6 100644
--- a/phpBB/includes/mcp/mcp_queue.php
+++ b/phpBB/includes/mcp/mcp_queue.php
@@ -46,6 +46,7 @@ class mcp_queue
{
case 'approve':
case 'disapprove':
+ case 'restore':
include_once($phpbb_root_path . 'includes/functions_messenger.' . $phpEx);
$post_id_list = request_var('post_id_list', array(0));
@@ -59,6 +60,10 @@ class mcp_queue
{
approve_post($post_id_list, 'queue', $mode);
}
+ else if ($action == 'restore')
+ {
+// do something
+ }
else
{
disapprove_post($post_id_list, 'queue', $mode);
@@ -224,6 +229,16 @@ class mcp_queue
case 'unapproved_topics':
case 'unapproved_posts':
+ case 'deleted_posts':
+ if ($mode == 'deleted_posts')
+ {
+ $m_perm = 'm_restore';
+ }
+ else
+ {
+ $m_perm = 'm_approve';
+ }
+
$user->add_lang(array('viewtopic', 'viewforum'));
$topic_id = request_var('t', 0);
@@ -242,7 +257,7 @@ class mcp_queue
$forum_id = $topic_info['forum_id'];
}
- $forum_list_approve = get_forum_list('m_approve', false, true);
+ $forum_list_approve = get_forum_list($m_perm, false, true);
$forum_list_read = array_flip(get_forum_list('f_read', true, true)); // Flipped so we can isset() the forum IDs
// Remove forums we cannot read
@@ -277,7 +292,7 @@ class mcp_queue
}
else
{
- $forum_info = get_forum_data(array($forum_id), 'm_approve');
+ $forum_info = get_forum_data(array($forum_id), $m_perm);
if (!sizeof($forum_info))
{
@@ -304,8 +319,10 @@ class mcp_queue
$forum_names = array();
- if ($mode == 'unapproved_posts')
+ if ($mode == 'unapproved_posts' || $mode == 'deleted_posts')
{
+ $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED;
+
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . ' t' . (($sort_order_sql[0] == 'u') ? ', ' . USERS_TABLE . ' u' : '') . '
WHERE ' . $db->sql_in_set('p.forum_id', $forum_list) . '
@@ -425,13 +442,14 @@ class mcp_queue
// Now display the page
$template->assign_vars(array(
'L_DISPLAY_ITEMS' => ($mode == 'unapproved_posts') ? $user->lang['DISPLAY_POSTS'] : $user->lang['DISPLAY_TOPICS'],
- 'L_EXPLAIN' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN'],
- 'L_TITLE' => ($mode == 'unapproved_posts') ? $user->lang['MCP_QUEUE_UNAPPROVED_POSTS'] : $user->lang['MCP_QUEUE_UNAPPROVED_TOPICS'],
+ 'L_EXPLAIN' => $user->lang['MCP_QUEUE_' . strtoupper($mode) . '_EXPLAIN'],
+ 'L_TITLE' => $user->lang['MCP_QUEUE_' . strtoupper($mode)],
'L_ONLY_TOPIC' => ($topic_id) ? sprintf($user->lang['ONLY_TOPIC'], $topic_info['topic_title']) : '',
'S_FORUM_OPTIONS' => $forum_options,
'S_MCP_ACTION' => build_url(array('t', 'f', 'sd', 'st', 'sk')),
- 'S_TOPICS' => ($mode == 'unapproved_posts') ? false : true,
+ 'S_TOPICS' => ($mode == 'unapproved_topics') ? true : false,
+ 'S_RESTORE' => ($mode == 'deleted_posts') ? true : false,
'PAGE_NUMBER' => phpbb_on_page($template, $user, $base_url, $total, $config['topics_per_page'], $start),
'TOPIC_ID' => $topic_id,
@@ -475,127 +493,7 @@ function approve_post($post_id_list, $id, $mode)
{
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
- // If Topic -> total_topics = total_topics+1, total_posts = total_posts+1, forum_topics = forum_topics+1, forum_posts = forum_posts+1
- // If Post -> total_posts = total_posts+1, forum_posts = forum_posts+1, topic_replies = topic_replies+1
-
- $total_topics = $total_posts = 0;
- $topic_approve_sql = $post_approve_sql = $topic_id_list = $forum_id_list = $approve_log = array();
- $user_posts_sql = $post_approved_list = array();
-
- foreach ($post_info as $post_id => $post_data)
- {
- if ($post_data['post_visibility'] == ITEM_APPROVED)
- {
- $post_approved_list[] = $post_id;
- continue;
- }
-
- $topic_id_list[$post_data['topic_id']] = 1;
- $forum_id_list[$post_data['forum_id']] = 1;
-
- // User post update (we do not care about topic or post, since user posts are strictly connected to posts)
- // But we care about forums where post counts get not increased. ;)
- if ($post_data['post_postcount'])
- {
- $user_posts_sql[$post_data['poster_id']] = (empty($user_posts_sql[$post_data['poster_id']])) ? 1 : $user_posts_sql[$post_data['poster_id']] + 1;
- }
-
- // Topic or Post. ;)
- if ($post_data['topic_first_post_id'] == $post_id)
- {
- $total_topics++;
- $topic_approve_sql[] = $post_data['topic_id'];
-
- $approve_log[] = array(
- 'type' => 'topic',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
- }
- else
- {
- $approve_log[] = array(
- 'type' => 'post',
- 'post_subject' => $post_data['post_subject'],
- 'forum_id' => $post_data['forum_id'],
- 'topic_id' => $post_data['topic_id'],
- );
- }
-
- $total_posts++;
-
- // Increment by topic_replies if we approve a topic...
- // This works because we do not adjust the topic_replies when re-approving a topic after an edit.
- if ($post_data['topic_first_post_id'] == $post_id && $post_data['topic_replies'])
- {
- $total_posts += $post_data['topic_replies'];
- }
-
- $post_approve_sql[] = $post_id;
- }
-
- $post_id_list = array_values(array_diff($post_id_list, $post_approved_list));
- for ($i = 0, $size = sizeof($post_approved_list); $i < $size; $i++)
- {
- unset($post_info[$post_approved_list[$i]]);
- }
-
- if (sizeof($topic_approve_sql))
- {
- $sql = 'UPDATE ' . TOPICS_TABLE . '
- SET topic_visibility = ' . ITEM_APPROVED . '
- WHERE ' . $db->sql_in_set('topic_id', $topic_approve_sql);
- $db->sql_query($sql);
- }
-
- if (sizeof($post_approve_sql))
- {
- $sql = 'UPDATE ' . POSTS_TABLE . '
- SET post_visibility = ' . ITEM_APPROVED . '
- WHERE ' . $db->sql_in_set('post_id', $post_approve_sql);
- $db->sql_query($sql);
- }
-
- unset($topic_approve_sql, $post_approve_sql);
-
- foreach ($approve_log as $log_data)
- {
- add_log('mod', $log_data['forum_id'], $log_data['topic_id'], ($log_data['type'] == 'topic') ? 'LOG_TOPIC_APPROVED' : 'LOG_POST_APPROVED', $log_data['post_subject']);
- }
-
- if (sizeof($user_posts_sql))
- {
- // Try to minimize the query count by merging users with the same post count additions
- $user_posts_update = array();
-
- foreach ($user_posts_sql as $user_id => $user_posts)
- {
- $user_posts_update[$user_posts][] = $user_id;
- }
-
- foreach ($user_posts_update as $user_posts => $user_id_ary)
- {
- $sql = 'UPDATE ' . USERS_TABLE . '
- SET user_posts = user_posts + ' . $user_posts . '
- WHERE ' . $db->sql_in_set('user_id', $user_id_ary);
- $db->sql_query($sql);
- }
- }
-
- if ($total_topics)
- {
- set_config_count('num_topics', $total_topics, true);
- }
-
- if ($total_posts)
- {
- set_config_count('num_posts', $total_posts, true);
- }
-
- sync('topic', 'topic_id', array_keys($topic_id_list), true);
- sync('forum', 'forum_id', array_keys($forum_id_list), true, true);
- unset($topic_id_list, $forum_id_list);
+ phpbb_visibility::unhide_posts_topics('approve', $post_info, $post_id_list);
$messenger = new messenger();
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 938b11388b..e70e3db4d4 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -315,6 +315,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_user_lock', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_vote', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_votechg', 1);
INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_restore', 1);
+INSERT INTO phpbb_acl_options (auth_option, is_local) VALUES ('f_softdelete', 1);
# -- Moderator related auth options
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_', 1, 1);
@@ -329,6 +330,7 @@ INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_move
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_report', 1, 1);
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_split', 1, 1);
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_restore', 1, 1);
+INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_softdelete', 1, 1);
# -- Global moderator auth option (not a local option)
INSERT INTO phpbb_acl_options (auth_option, is_local, is_global) VALUES ('m_ban', 0, 1);
@@ -513,7 +515,7 @@ INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 11, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option NOT IN ('m_ban', 'm_chgposter');
# Simple Moderator (m_)
-INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_edit', 'm_info', 'm_report');
+INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 12, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_delete', 'm_softdelete', 'm_restore', 'm_edit', 'm_info', 'm_report');
# Queue Moderator (m_)
INSERT INTO phpbb_acl_roles_data (role_id, auth_option_id, auth_setting) SELECT 13, auth_option_id, 1 FROM phpbb_acl_options WHERE auth_option LIKE 'm_%' AND auth_option IN ('m_', 'm_approve', 'm_edit');
diff --git a/phpBB/language/en/acp/common.php b/phpBB/language/en/acp/common.php
index 04df897dba..91a35311bc 100644
--- a/phpBB/language/en/acp/common.php
+++ b/phpBB/language/en/acp/common.php
@@ -554,12 +554,14 @@ $lang = array_merge($lang, array(
'LOG_POST_APPROVED' => '<strong>Approved post</strong><br />» %s',
'LOG_POST_DISAPPROVED' => '<strong>Disapproved post “%1$s” with the following reason</strong><br />» %2$s',
'LOG_POST_EDITED' => '<strong>Edited post “%1$s” written by</strong><br />» %2$s',
+ 'LOG_POST_RESTORED' => '<strong>Restored post</strong><br />» %s',
'LOG_REPORT_CLOSED' => '<strong>Closed report</strong><br />» %s',
'LOG_REPORT_DELETED' => '<strong>Deleted report</strong><br />» %s',
'LOG_SPLIT_DESTINATION' => '<strong>Moved split posts</strong><br />» to %s',
'LOG_SPLIT_SOURCE' => '<strong>Split posts</strong><br />» from %s',
'LOG_TOPIC_APPROVED' => '<strong>Approved topic</strong><br />» %s',
+ 'LOG_TOPIC_RESTORED' => '<strong>Restored topic</strong><br />» %s',
'LOG_TOPIC_DISAPPROVED' => '<strong>Disapproved topic “%1$s” with the following reason</strong><br />%2$s',
'LOG_TOPIC_RESYNC' => '<strong>Resynchronised topic counters</strong><br />» %s',
'LOG_TOPIC_TYPE_CHANGED' => '<strong>Changed topic type</strong><br />» %s',
diff --git a/phpBB/language/en/acp/permissions_phpbb.php b/phpBB/language/en/acp/permissions_phpbb.php
index 17649693fa..0a089f9dc1 100644
--- a/phpBB/language/en/acp/permissions_phpbb.php
+++ b/phpBB/language/en/acp/permissions_phpbb.php
@@ -156,6 +156,8 @@ $lang = array_merge($lang, array(
'acl_f_flash' => array('lang' => 'Can use [flash] BBCode tag', 'cat' => 'content'),
'acl_f_edit' => array('lang' => 'Can edit own posts', 'cat' => 'actions'),
+ 'acl_f_softdelete' => array('lang' => 'Can soft delete own posts', 'cat' => 'actions'),
+ 'acl_f_restore' => array('lang' => 'Can restore own posts', 'cat' => 'actions'),
'acl_f_delete' => array('lang' => 'Can delete own posts', 'cat' => 'actions'),
'acl_f_user_lock' => array('lang' => 'Can lock own topics', 'cat' => 'actions'),
'acl_f_bump' => array('lang' => 'Can bump topics', 'cat' => 'actions'),
@@ -177,12 +179,15 @@ $lang = array_merge($lang, array(
'acl_m_approve' => array('lang' => 'Can approve posts', 'cat' => 'post_actions'),
'acl_m_report' => array('lang' => 'Can close and delete reports', 'cat' => 'post_actions'),
'acl_m_chgposter' => array('lang' => 'Can change post author', 'cat' => 'post_actions'),
+ 'acl_m_softdelete' => array('lang' => 'Can soft delete posts', 'cat' => 'post_actions'),
+ 'acl_m_restore' => array('lang' => 'Can restore deleted posts', 'cat' => 'post_actions'),
'acl_m_move' => array('lang' => 'Can move topics', 'cat' => 'topic_actions'),
'acl_m_lock' => array('lang' => 'Can lock topics', 'cat' => 'topic_actions'),
'acl_m_split' => array('lang' => 'Can split topics', 'cat' => 'topic_actions'),
'acl_m_merge' => array('lang' => 'Can merge topics', 'cat' => 'topic_actions'),
+
'acl_m_info' => array('lang' => 'Can view post details', 'cat' => 'misc'),
'acl_m_warn' => array('lang' => 'Can issue warnings<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
'acl_m_ban' => array('lang' => 'Can manage bans<br /><em>This setting is only assigned globally. It is not forum based.</em>', 'cat' => 'misc'), // This moderator setting is only global (and not local)
diff --git a/phpBB/language/en/mcp.php b/phpBB/language/en/mcp.php
index eaa2d7e3a5..175fa72829 100644
--- a/phpBB/language/en/mcp.php
+++ b/phpBB/language/en/mcp.php
@@ -201,6 +201,8 @@ $lang = array_merge($lang, array(
'MCP_QUEUE_UNAPPROVED_POSTS_EXPLAIN' => 'This is a list of all posts which require approving before they will be visible to users.',
'MCP_QUEUE_UNAPPROVED_TOPICS' => 'Topics awaiting approval',
'MCP_QUEUE_UNAPPROVED_TOPICS_EXPLAIN' => 'This is a list of all topics which require approving before they will be visible to users.',
+ 'MCP_QUEUE_DELETED_POSTS' => 'Deleted posts',
+ 'MCP_QUEUE_DELETED_POSTS_EXPLAIN' => 'This is a list of all posts which have been soft deleted. You can restore or permanently delete the posts from this screen.',
'MCP_VIEW_USER' => 'View warnings for a specific user',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 086bd6ffb0..c0edc068dd 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -209,6 +209,8 @@ $lang = array_merge($lang, array(
'SMILIES' => 'Smilies',
'SMILIES_ARE_OFF' => 'Smilies are <em>OFF</em>',
'SMILIES_ARE_ON' => 'Smilies are <em>ON</em>',
+ 'SOFT_DELETE_POST' => 'Soft Delete',
+ 'SOFT_DELETE_POST_EXPLAIN' => 'Soft Deletion can be un-done',
'STICKY_ANNOUNCE_TIME_LIMIT'=> 'Sticky/Announcement time limit',
'STICK_TOPIC_FOR' => 'Stick topic for',
'STICK_TOPIC_FOR_EXPLAIN' => 'Enter 0 or leave blank for a never ending Sticky/Announcement. Please note that this number is relative to the date of the post.',
diff --git a/phpBB/language/en/viewtopic.php b/phpBB/language/en/viewtopic.php
index 278c064fe7..ce66a5b8e2 100644
--- a/phpBB/language/en/viewtopic.php
+++ b/phpBB/language/en/viewtopic.php
@@ -89,6 +89,7 @@ $lang = array_merge($lang, array(
'POLL_ENDED_AT' => 'Poll ended at %s',
'POLL_RUN_TILL' => 'Poll runs till %s',
'POLL_VOTED_OPTION' => 'You voted for this option',
+ 'POST_DELETED_RESTORE' => 'This post has been deleted. It can be restored.',
'PRINT_TOPIC' => 'Print view',
'QUICK_MOD' => 'Quick-mod tools',
@@ -96,6 +97,7 @@ $lang = array_merge($lang, array(
'QUOTE' => 'Quote',
'REPLY_TO_TOPIC' => 'Reply to topic',
+ 'RESTORE' => 'Restore',
'RETURN_POST' => '%sReturn to the post%s',
'SUBMIT_VOTE' => 'Submit vote',
diff --git a/phpBB/mcp.php b/phpBB/mcp.php
index 984925789f..9877c469b9 100644
--- a/phpBB/mcp.php
+++ b/phpBB/mcp.php
@@ -640,6 +640,8 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
break;
case 'unapproved_posts':
+ case 'deleted_posts':
+ $visibility_const = ($mode == 'unapproved_posts') ? ITEM_UNAPPROVED : ITEM_DELETED;
$type = 'posts';
$default_key = 't';
$default_dir = 'd';
@@ -648,7 +650,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
$sql = 'SELECT COUNT(p.post_id) AS total
FROM ' . POSTS_TABLE . ' p, ' . TOPICS_TABLE . " t
$where_sql " . $db->sql_in_set('p.forum_id', ($forum_id) ? array($forum_id) : array_intersect(get_forum_list('f_read'), get_forum_list('m_approve'))) . '
- AND p.post_visibility = ' . ITEM_UNAPPROVED . '
+ AND p.post_visibility = ' . $visibility_const . '
AND t.topic_id = p.topic_id
AND t.topic_first_post_id <> p.post_id';
@@ -796,7 +798,7 @@ function mcp_sorting($mode, &$sort_days, &$sort_key, &$sort_dir, &$sort_by_sql,
'S_SELECT_SORT_DAYS' => $s_limit_days)
);
- if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts')) || $where_sql != 'WHERE')
+ if (($sort_days && $mode != 'viewlogs') || in_array($mode, array('reports', 'unapproved_topics', 'unapproved_posts', 'deleted_posts')) || $where_sql != 'WHERE')
{
$result = $db->sql_query($sql);
$total = (int) $db->sql_fetchfield('total');
diff --git a/phpBB/posting.php b/phpBB/posting.php
index 30b897c068..221d469b4a 100644
--- a/phpBB/posting.php
+++ b/phpBB/posting.php
@@ -38,8 +38,20 @@ $load = (isset($_POST['load'])) ? true : false;
$delete = (isset($_POST['delete'])) ? true : false;
$cancel = (isset($_POST['cancel']) && !isset($_POST['save'])) ? true : false;
-$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview) ? true : false;
-$mode = ($delete && !$preview && !$refresh && $submit) ? 'delete' : request_var('mode', '');
+$refresh = (isset($_POST['add_file']) || isset($_POST['delete_file']) || isset($_POST['cancel_unglobalise']) || $save || $load || $preview);
+$mode = request_var('mode', '');
+
+if ($submit && !$refresh)
+{
+ if (isset($_POST['soft_delete']))
+ {
+ $mode = 'soft_delete';
+ }
+ else if (isset($_POST['delete']))
+ {
+ $mode = 'delete';
+ }
+}
$error = $post_data = array();
$current_time = time();
@@ -93,6 +105,7 @@ switch ($mode)
case 'quote':
case 'edit':
case 'delete':
+ case 'soft_delete':
if (!$post_id)
{
$user->setup('posting');
@@ -168,6 +181,13 @@ if ($auth->acl_get('m_approve', $forum_id) && ((($mode == 'reply' || $mode == 'b
trigger_error(($mode == 'reply' || $mode == 'bump') ? 'TOPIC_UNAPPROVED' : 'POST_UNAPPROVED');
}
+if ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED && !isset($_POST['soft_delete']) && phpbb_visibility::can_restore($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
+{
+ // don't feel that a confirm_box is needed for this
+ // do not return / trigger_error after this because the post content can also be changed
+ phpbb_visibility::unhide_posts_topics('restore', array($post_id => $post_data), array($post_id));
+}
+
if ($mode == 'popup')
{
upload_popup($post_data['forum_style']);
@@ -259,6 +279,13 @@ switch ($mode)
$is_authed = true;
}
break;
+
+ case 'soft_delete':
+ if ($user->data['is_registered'] && $auth->acl_gets('f_softdelete', 'm_softdelete', $forum_id))
+ {
+ $is_authed = true;
+ }
+ break;
}
if (!$is_authed)
@@ -306,9 +333,9 @@ if ($mode == 'edit' && !$auth->acl_get('m_edit', $forum_id))
}
// Handle delete mode...
-if ($mode == 'delete')
+if ($mode == 'delete' || $mode == 'soft_delete')
{
- handle_post_delete($forum_id, $topic_id, $post_id, $post_data);
+ handle_post_delete($forum_id, $topic_id, $post_id, $post_data, ($mode == 'soft_delete'));
return;
}
@@ -1401,6 +1428,10 @@ $template->assign_vars(array(
'S_LOCK_TOPIC_CHECKED' => ($lock_topic_checked) ? ' checked="checked"' : '',
'S_LOCK_POST_ALLOWED' => ($mode == 'edit' && $auth->acl_get('m_edit', $forum_id)) ? true : false,
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
+ 'S_SOFT_DELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
+ 'S_SOFT_DELETE_ALLOWED' => (phpbb_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
+ 'S_RESTORE_ALLOWED' => (phpbb_visibility::can_restore($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
+ 'S_IS_DELETED' => ($post_data['post_visibility'] == POST_DELETED) ? true : false,
'S_LINKS_ALLOWED' => $url_status,
'S_MAGIC_URL_CHECKED' => ($urls_checked) ? ' checked="checked"' : '',
'S_TYPE_TOGGLE' => $topic_type_toggle,
@@ -1494,19 +1525,21 @@ function upload_popup($forum_style = 0)
/**
* Do the various checks required for removing posts as well as removing it
*/
-function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data)
+function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data, $is_soft)
{
global $user, $db, $auth, $config;
global $phpbb_root_path, $phpEx;
+ $perm_check = ($is_soft) ? 'softdelete' : 'delete';
+
// If moderator removing post or user itself removing post, present a confirmation screen
- if ($auth->acl_get('m_delete', $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get('f_delete', $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))
+ if ($auth->acl_get("m_$perm_check", $forum_id) || ($post_data['poster_id'] == $user->data['user_id'] && $user->data['is_registered'] && $auth->acl_get("f_$perm_check", $forum_id) && $post_id == $post_data['topic_last_post_id'] && !$post_data['post_edit_locked'] && ($post_data['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time'])))
{
$s_hidden_fields = build_hidden_fields(array(
'p' => $post_id,
'f' => $forum_id,
- 'mode' => 'delete')
- );
+ 'mode' => ($is_soft) ? 'soft_delete' : 'delete',
+ ));
if (confirm_box(true))
{
@@ -1523,7 +1556,7 @@ function handle_post_delete($forum_id, $topic_id, $post_id, &$post_data)
'post_postcount' => $post_data['post_postcount']
);
- $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data);
+ $next_post_id = delete_post($forum_id, $topic_id, $post_id, $data, $is_soft);
$post_username = ($post_data['poster_id'] == ANONYMOUS && !empty($post_data['post_username'])) ? $post_data['post_username'] : $post_data['username'];
if ($next_post_id === false)
diff --git a/phpBB/styles/prosilver/imageset/icon_topic_deleted.png b/phpBB/styles/prosilver/imageset/icon_topic_deleted.png
new file mode 100644
index 0000000000..e5359030f3
--- /dev/null
+++ b/phpBB/styles/prosilver/imageset/icon_topic_deleted.png
Binary files differ
diff --git a/phpBB/styles/prosilver/imageset/imageset.cfg b/phpBB/styles/prosilver/imageset/imageset.cfg
new file mode 100644
index 0000000000..bfcf357045
--- /dev/null
+++ b/phpBB/styles/prosilver/imageset/imageset.cfg
@@ -0,0 +1,117 @@
+#
+# phpBB Imageset Configuration File
+#
+# @package phpBB3
+# @copyright (c) 2006 phpBB Group
+# @license http://opensource.org/licenses/gpl-license.php GNU Public License
+#
+#
+# At the left is the name, please do not change this
+# At the right the value is entered
+# For on/off options the valid values are on, off, 1, 0, true and false
+#
+# Values get trimmed, if you want to add a space in front or at the end of
+# the value, then enclose the value with single or double quotes.
+# Single and double quotes do not need to be escaped.
+#
+#
+
+# General Information about this style
+name = prosilver
+copyright = &copy; phpBB Group, 2007
+version = 3.0.7
+
+# Images
+img_site_logo = site_logo.gif*52*139
+img_poll_left =
+img_poll_center =
+img_poll_right =
+img_icon_friend =
+img_icon_foe =
+
+img_forum_link = forum_link.gif*27*27
+img_forum_read = forum_read.gif*27*27
+img_forum_read_locked = forum_read_locked.gif*27*27
+img_forum_read_subforum = forum_read_subforum.gif*27*27
+img_forum_unread = forum_unread.gif*27*27
+img_forum_unread_locked = forum_unread_locked.gif*27*27
+img_forum_unread_subforum = forum_unread_subforum.gif*27*27
+
+img_topic_moved = topic_moved.gif*27*27
+
+img_topic_read = topic_read.gif*27*27
+img_topic_read_mine = topic_read_mine.gif*27*27
+img_topic_read_hot = topic_read_hot.gif*27*27
+img_topic_read_hot_mine = topic_read_hot_mine.gif*27*27
+img_topic_read_locked = topic_read_locked.gif*27*27
+img_topic_read_locked_mine = topic_read_locked_mine.gif*27*27
+
+img_topic_unread = topic_unread.gif*27*27
+img_topic_unread_mine = topic_unread_mine.gif*27*27
+img_topic_unread_hot = topic_unread_hot.gif*27*27
+img_topic_unread_hot_mine = topic_unread_hot_mine.gif*27*27
+img_topic_unread_locked = topic_unread_locked.gif*27*27
+img_topic_unread_locked_mine = topic_unread_locked_mine.gif*27*27
+
+img_sticky_read = sticky_read.gif*27*27
+img_sticky_read_mine = sticky_read_mine.gif*27*27
+img_sticky_read_locked = sticky_read_locked.gif*27*27
+img_sticky_read_locked_mine = sticky_read_locked_mine.gif*27*27
+img_sticky_unread = sticky_unread.gif*27*27
+img_sticky_unread_mine = sticky_unread_mine.gif*27*27
+img_sticky_unread_locked = sticky_unread_locked.gif*27*27
+img_sticky_unread_locked_mine = sticky_unread_locked_mine.gif*27*27
+
+img_announce_read = announce_read.gif*27*27
+img_announce_read_mine = announce_read_mine.gif*27*27
+img_announce_read_locked = announce_read_locked.gif*27*27
+img_announce_read_locked_mine = announce_read_locked_mine.gif*27*27
+img_announce_unread = announce_unread.gif*27*27
+img_announce_unread_mine = announce_unread_mine.gif*27*27
+img_announce_unread_locked = announce_unread_locked.gif*27*27
+img_announce_unread_locked_mine = announce_unread_locked_mine.gif*27*27
+
+img_global_read = announce_read.gif*27*27
+img_global_read_mine = announce_read_mine.gif*27*27
+img_global_read_locked = announce_read_locked.gif*27*27
+img_global_read_locked_mine = announce_read_locked_mine.gif*27*27
+img_global_unread = announce_unread.gif*27*27
+img_global_unread_mine = announce_unread_mine.gif*27*27
+img_global_unread_locked = announce_unread_locked.gif*27*27
+img_global_unread_locked_mine = announce_unread_locked_mine.gif*27*27
+
+img_subforum_read = subforum_read.gif*9*11
+img_subforum_unread = subforum_unread.gif*9*11
+
+img_pm_read = topic_read.gif*27*27
+img_pm_unread = topic_unread.gif*27*27
+
+img_icon_back_top = icon_back_top.gif*11*11
+
+img_icon_contact_aim = icon_contact_aim.gif*20*20
+img_icon_contact_email = icon_contact_email.gif*20*20
+img_icon_contact_icq = icon_contact_icq.gif*20*20
+img_icon_contact_jabber = icon_contact_jabber.gif*20*20
+img_icon_contact_msnm = icon_contact_msnm.gif*20*20
+
+img_icon_contact_www = icon_contact_www.gif*20*20
+img_icon_contact_yahoo = icon_contact_yahoo.gif*20*20
+
+img_icon_post_delete = icon_post_delete.gif*20*20
+
+img_icon_post_info = icon_post_info.gif*20*20
+
+img_icon_post_report = icon_post_report.gif*20*20
+img_icon_post_target = icon_post_target.gif*9*11
+img_icon_post_target_unread = icon_post_target_unread.gif*9*11
+
+img_icon_topic_attach = icon_topic_attach.gif*10*7
+img_icon_topic_latest = icon_topic_latest.gif*9*11
+img_icon_topic_newest = icon_topic_newest.gif*9*11
+img_icon_topic_reported = icon_topic_reported.gif*14*16
+img_icon_topic_unapproved = icon_topic_unapproved.gif*14*16
+img_icon_topic_deleted = icon_topic_deleted.png*16*16
+
+img_icon_user_profile =
+
+img_icon_user_warn = icon_user_warn.gif*20*20
diff --git a/phpBB/styles/prosilver/template/mcp_queue.html b/phpBB/styles/prosilver/template/mcp_queue.html
index 93483ae02a..4b48674673 100644
--- a/phpBB/styles/prosilver/template/mcp_queue.html
+++ b/phpBB/styles/prosilver/template/mcp_queue.html
@@ -94,8 +94,13 @@
<!-- IF .postrow -->
<fieldset class="display-actions">
+ <!-- IF S_RESTORE -->
+ <input class="button2" type="submit" name="action[disapprove]" value="{L_DELETE}" />&nbsp;
+ <input class="button1" type="submit" name="action[restore]" value="{L_RESTORE}" />
+ <!-- ELSE -->
<input class="button2" type="submit" name="action[disapprove]" value="{L_DISAPPROVE}" />&nbsp;
<input class="button1" type="submit" name="action[approve]" value="{L_APPROVE}" />
+ <!-- ENDIF -->
<div><a href="#" onclick="marklist('mcp', 'post_id_list', true); return false;">{L_MARK_ALL}</a> :: <a href="#" onclick="marklist('mcp', 'post_id_list', false); return false;">{L_UNMARK_ALL}</a></div>
</fieldset>
<!-- ENDIF -->
diff --git a/phpBB/styles/prosilver/template/posting_editor.html b/phpBB/styles/prosilver/template/posting_editor.html
index 99e518d486..f8fccf2d2f 100644
--- a/phpBB/styles/prosilver/template/posting_editor.html
+++ b/phpBB/styles/prosilver/template/posting_editor.html
@@ -83,6 +83,13 @@
</dl>
<!-- ENDIF -->
+ <!-- IF (S_SOFT_DELETE_ALLOWED and not S_IS_DELETED) or (S_RESTORE_ALLOWED and S_IS_DELETED) -->
+ <dl>
+ <dt><label for="soft_delete">{L_SOFT_DELETE_POST}:</label></dt>
+ <dd><label for="soft_delete"><input type="checkbox" name="soft_delete"{S_SOFT_DELETE_CHECKED} id="soft_delete" /> {L_SOFT_DELETE_POST_EXPLAIN}</label></dd>
+ </dl>
+ <!-- ENDIF -->
+
<!-- IF S_SHOW_TOPIC_ICONS or S_SHOW_PM_ICONS -->
<dl>
<dt><label for="icon">{L_ICON}:</label></dt>
diff --git a/phpBB/styles/prosilver/template/viewforum_body.html b/phpBB/styles/prosilver/template/viewforum_body.html
index 373a172918..7f3703eabb 100644
--- a/phpBB/styles/prosilver/template/viewforum_body.html
+++ b/phpBB/styles/prosilver/template/viewforum_body.html
@@ -144,7 +144,7 @@
<dl class="icon {topicrow.TOPIC_IMG_STYLE}">
<dt<!-- IF topicrow.TOPIC_ICON_IMG and S_TOPIC_ICONS --> style="background-image: url({T_ICONS_PATH}{topicrow.TOPIC_ICON_IMG}); background-repeat: no-repeat;"<!-- ENDIF --> title="{topicrow.TOPIC_FOLDER_IMG_ALT}"><!-- IF topicrow.S_UNREAD_TOPIC --><a href="{topicrow.U_NEWEST_POST}">{NEWEST_POST_IMG}</a> <!-- ENDIF --><a href="{topicrow.U_VIEW_TOPIC}" class="topictitle">{topicrow.TOPIC_TITLE}</a>
<!-- IF topicrow.S_TOPIC_UNAPPROVED or topicrow.S_POSTS_UNAPPROVED --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.UNAPPROVED_IMG}</a> <!-- ENDIF -->
- <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><br />
+ <!-- IF topicrow.S_TOPIC_REPORTED --><a href="{topicrow.U_MCP_REPORT}">{REPORTED_IMG}</a><!-- ENDIF --><!-- IF topicrow.DELETED_IMG --><a href="{topicrow.U_MCP_QUEUE}">{topicrow.DELETED_IMG}</a><!-- ENDIF --><br />
<!-- IF .topicrow.pagination -->
<div class="pagination">
<ul>
diff --git a/phpBB/styles/prosilver/template/viewtopic_body.html b/phpBB/styles/prosilver/template/viewtopic_body.html
index 4534dc5bcc..0c4a7df7f4 100644
--- a/phpBB/styles/prosilver/template/viewtopic_body.html
+++ b/phpBB/styles/prosilver/template/viewtopic_body.html
@@ -138,6 +138,7 @@
<h3 <!-- IF postrow.S_FIRST_ROW -->class="first"<!-- ENDIF -->><!-- IF postrow.POST_ICON_IMG --><img src="{T_ICONS_PATH}{postrow.POST_ICON_IMG}" width="{postrow.POST_ICON_IMG_WIDTH}" height="{postrow.POST_ICON_IMG_HEIGHT}" alt="" /> <!-- ENDIF --><a href="#p{postrow.POST_ID}">{postrow.POST_SUBJECT}</a></h3>
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> &raquo; {postrow.POST_DATE} </p>
+<<<<<<< HEAD
<!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
<form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}" data-ajax="post_approve">
<p class="rules">
@@ -148,6 +149,7 @@
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
{S_FORM_TOKEN}
<br /><!-- ENDIF -->
+ <!-- IF postrow.S_POST_DELETED -->{DELETED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_DELETED_RESTORE}</strong></a><br /><!-- ENDIF -->
<!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
</p>
</form>
diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php
index c775d33631..2efd865702 100644
--- a/phpBB/viewforum.php
+++ b/phpBB/viewforum.php
@@ -687,6 +687,7 @@ if (sizeof($topic_list))
$topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $row['forum_id']));
$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $row['forum_id']));
+ // @TODO: Make this work for cases where some posts within a topic are deleted.
$topic_deleted = ($row['topic_visibility'] == ITEM_DELETED);
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&amp;mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&amp;t=$topic_id", true, $user->session_id) : '';
@@ -720,7 +721,7 @@ if (sizeof($topic_list))
'TOPIC_ICON_IMG_HEIGHT' => (!empty($icons[$row['icon_id']])) ? $icons[$row['icon_id']]['height'] : '',
'ATTACH_ICON_IMG' => ($auth->acl_get('u_download') && $auth->acl_get('f_download', $row['forum_id']) && $row['topic_attachment']) ? $user->img('icon_topic_attach', $user->lang['TOTAL_ATTACHMENTS']) : '',
'UNAPPROVED_IMG' => ($topic_unapproved || $posts_unapproved) ? $user->img('icon_topic_unapproved', ($topic_unapproved) ? 'TOPIC_UNAPPROVED' : 'POSTS_UNAPPROVED') : '',
- 'DELETED_IMG' => ($topic_deleted) ? $user->img(/*TODO*/) : '',
+ 'DELETED_IMG' => ($topic_deleted) ? $user->img('icon_topic_deleted', 'POSTS_DELETED') : '',
'S_TOPIC_TYPE' => $row['topic_type'],
'S_USER_POSTED' => (isset($row['topic_posted']) && $row['topic_posted']) ? true : false,
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index b6c47211f7..e5a7f64cad 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -277,7 +277,7 @@ if ($post_id)
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
FROM ' . POSTS_TABLE . " p
WHERE p.topic_id = {$topic_data['topic_id']}
- " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p');
+ " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p.');
if ($sort_dir == 'd')
{
@@ -615,6 +615,7 @@ $template->assign_vars(array(
'REPLY_IMG' => ($topic_data['forum_status'] == ITEM_LOCKED || $topic_data['topic_status'] == ITEM_LOCKED) ? $user->img('button_topic_locked', 'TOPIC_LOCKED') : $user->img('button_topic_reply', 'REPLY_TO_TOPIC'),
'EDIT_IMG' => $user->img('icon_post_edit', 'EDIT_POST'),
'DELETE_IMG' => $user->img('icon_post_delete', 'DELETE_POST'),
+ 'DELETED_IMG' => $user->img('icon_topic_deleted', 'POST_DELETED_RESTORE'),
'INFO_IMG' => $user->img('icon_post_info', 'VIEW_INFO'),
'PROFILE_IMG' => $user->img('icon_user_profile', 'READ_PROFILE'),
'SEARCH_IMG' => $user->img('icon_user_search', 'SEARCH_USER_POSTS'),
@@ -1611,7 +1612,8 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_HAS_ATTACHMENTS' => (!empty($attachments[$row['post_id']])) ? true : false,
'S_MULTIPLE_ATTACHMENTS' => !empty($attachments[$row['post_id']]) && sizeof($attachments[$row['post_id']]) > 1,
- 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_APPROVED) ? false : true,
+ 'S_POST_UNAPPROVED' => ($row['post_visibility'] == ITEM_UNAPPROVED) ? true : false,
+ 'S_POST_DELETED' => ($row['post_visibility'] == ITEM_DELETED) ? true : false,
'S_POST_REPORTED' => ($row['post_reported'] && $auth->acl_get('m_report', $forum_id)) ? true : false,
'S_DISPLAY_NOTICE' => $display_notice && $row['post_attachment'],
'S_FRIEND' => ($row['friend']) ? true : false,