mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-05 16:27:38 +02:00
[feature/soft-delete] Lay the groundwork for a soft-delete feature
So far, I've added no new functionality. The biggest change here is adjusting the DB column names to "visibility" rather than "approved". Some things here are pretty likely to change, for example the name and location of the topic_visibility class. Happy birthday phpBB :) PHPBB3-9657
This commit is contained in:
committed by
Joas Schilling
parent
1128ff1e58
commit
b8c55291ed
@@ -249,7 +249,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// find out in which forums the user is allowed to view approved posts
|
||||
/* // find out in which forums the user is allowed to view approved posts
|
||||
if ($auth->acl_get('m_approve'))
|
||||
{
|
||||
$m_approve_fid_ary = array(-1);
|
||||
@@ -265,6 +265,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
$m_approve_fid_ary = array();
|
||||
$m_approve_fid_sql = ' AND p.post_approved = 1';
|
||||
}
|
||||
*/
|
||||
$m_approve_fid_sql = ' AND ' . topic_visibility::get_visibility_sql_global('post', $ex_fid_ary, 'p.');
|
||||
|
||||
if ($reset_search_forum)
|
||||
{
|
||||
@@ -523,17 +525,17 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
|
||||
// make sure that some arrays are always in the same order
|
||||
sort($ex_fid_ary);
|
||||
sort($m_approve_fid_ary);
|
||||
// @TODO sort($m_approve_fid_ary);
|
||||
sort($author_id_ary);
|
||||
|
||||
if (!empty($search->search_query))
|
||||
{
|
||||
$total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
$total_match_count = $search->keyword_search($show_results, $search_fields, $search_terms, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
}
|
||||
else if (sizeof($author_id_ary))
|
||||
{
|
||||
$firstpost_only = ($search_fields === 'firstpost' || $search_fields == 'titleonly') ? true : false;
|
||||
$total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_ary, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
$total_match_count = $search->author_search($show_results, $firstpost_only, $sort_by_sql, $sort_key, $sort_dir, $sort_days, $ex_fid_ary, $m_approve_fid_sql, $topic_id, $author_id_ary, $sql_author_match, $id_ary, $start, $per_page);
|
||||
}
|
||||
|
||||
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
|
||||
@@ -548,7 +550,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
{
|
||||
$sql_where .= $db->sql_in_set(($show_results == 'posts') ? 'p.post_id' : 't.topic_id', $id_ary);
|
||||
$sql_where .= (sizeof($ex_fid_ary)) ? ' AND (' . $db->sql_in_set('f.forum_id', $ex_fid_ary, true) . ' OR f.forum_id IS NULL)' : '';
|
||||
$sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_approved', 'p.forum_id'), array('t.topic_approved', 't.forum_id'), $m_approve_fid_sql);
|
||||
$sql_where .= ($show_results == 'posts') ? $m_approve_fid_sql : str_replace(array('p.post_visibility', 'p.forum_id'), array('t.topic_visibility', 't.forum_id'), $m_approve_fid_sql);
|
||||
}
|
||||
|
||||
if ($show_results == 'posts')
|
||||
@@ -882,8 +884,9 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
|
||||
$unread_topic = (isset($topic_tracking_info[$forum_id][$row['topic_id']]) && $row['topic_last_post_time'] > $topic_tracking_info[$forum_id][$row['topic_id']]) ? true : false;
|
||||
|
||||
$topic_unapproved = (!$row['topic_approved'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
||||
$posts_unapproved = ($row['topic_approved'] && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
||||
$topic_unapproved = ($row['topic_visibility'] == ITEM_UNAPPROVED && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
||||
$posts_unapproved = ($row['topic_visibility'] == ITEM_APPROVED && $row['topic_replies'] < $row['topic_replies_real'] && $auth->acl_get('m_approve', $forum_id)) ? true : false;
|
||||
$topic_deleted = ($row['topic_visibility'] == ITEM_DELETED) ? true : false;
|
||||
$u_mcp_queue = ($topic_unapproved || $posts_unapproved) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=' . (($topic_unapproved) ? 'approve_details' : 'unapproved_posts') . "&t=$result_topic_id", true, $user->session_id) : '';
|
||||
|
||||
$row['topic_title'] = preg_replace('#(?!<.*)(?<!\w)(' . $hilit . ')(?!\w|[^<>]*(?:</s(?:cript|tyle))?>)#is', '<span class="posthilit">$1</span>', $row['topic_title']);
|
||||
@@ -911,6 +914,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
'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', $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*/) : '',
|
||||
|
||||
'S_TOPIC_TYPE' => $row['topic_type'],
|
||||
'S_USER_POSTED' => (!empty($row['topic_posted'])) ? true : false,
|
||||
@@ -919,6 +923,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||
'S_TOPIC_REPORTED' => (!empty($row['topic_reported']) && $auth->acl_get('m_report', $forum_id)) ? true : false,
|
||||
'S_TOPIC_UNAPPROVED' => $topic_unapproved,
|
||||
'S_POSTS_UNAPPROVED' => $posts_unapproved,
|
||||
'S_TOPIC_DELETED' => $topic_deleted,
|
||||
|
||||
'U_LAST_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params . '&p=' . $row['topic_last_post_id']) . '#p' . $row['topic_last_post_id'],
|
||||
'U_LAST_POST_AUTHOR' => get_username_string('profile', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']),
|
||||
|
Reference in New Issue
Block a user