1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-08-07 09:16:55 +02:00

[feature/soft-delete] Rename phpbb_visibility class to phpbb_content_visibility

Rename the class to more accurately reflect what it does.

PHPBB3-9657
This commit is contained in:
Josh Woody
2010-06-30 13:38:49 -05:00
committed by Joas Schilling
parent 6739375135
commit a80cfafdd9
12 changed files with 72 additions and 72 deletions

View File

@@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
* Handle fetching and setting the visibility for topics and posts
* @package phpbb
*/
class phpbb_visibility
class phpbb_content_visibility
{
/**
* Create topic/post visibility SQL for a given forum ID

View File

@@ -993,7 +993,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
$sql = 'SELECT p.post_id
FROM ' . POSTS_TABLE . ' p' . "
WHERE p.topic_id = $topic_id
AND " . phpbb_visibility::get_visibility_sql('post', $forum_id, 'p.') . '
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id, 'p.') . '
' . (($mode == 'post_review') ? " AND p.post_id > $cur_post_id" : '') . '
' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . '
ORDER BY p.post_time ';
@@ -1466,8 +1466,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = 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);
phpbb_content_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_content_visibility::hide_post($forum_id, time(), $sql_data);
}
else
{
@@ -1501,8 +1501,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = 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);
phpbb_content_visibility::set_topic_visibility(POST_DELETED, $topic_id, $forum_id);
phpbb_content_visibility::hide_topic($topic_id, $forum_id, $topic_row, $sql_data);
}
else
{
@@ -1548,8 +1548,8 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false)
case 'delete_last_post':
if ($is_soft)
{
phpbb_visibility::hide_post($forum_id, time(), $sql_data);
phpbb_visibility::set_post_visibility($post_id, $topic_id, $forum_id, false, true);
phpbb_content_visibility::hide_post($forum_id, time(), $sql_data);
phpbb_content_visibility::set_post_visibility($post_id, $topic_id, $forum_id, false, true);
}
else
{
@@ -1576,7 +1576,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false)
$sql = 'SELECT MAX(post_id) as last_post_id
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
AND " . phpbb_visibility::get_visibility_sql('post', $forum_id);
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id);
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
@@ -1589,7 +1589,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false)
$sql = 'SELECT post_id
FROM ' . POSTS_TABLE . "
WHERE topic_id = $topic_id
AND " . phpbb_visibility::get_visibility_sql('post', $forum_id) . '
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id) . '
AND post_time > ' . $data['post_time'] . '
ORDER BY post_time ASC';
$result = $db->sql_query_limit($sql, 1);
@@ -1949,7 +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)
{
phpbb_visibility::hide_topic($data['topic_id'], $data['forum_id'], $topic_row, $sql_data);
phpbb_content_visibility::hide_topic($data['topic_id'], $data['forum_id'], $topic_row, $sql_data);
}
break;
@@ -1960,7 +1960,7 @@ 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);
//phpbb_content_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';

View File

@@ -154,7 +154,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
$sql = 'SELECT t.topic_id
FROM ' . TOPICS_TABLE . ' t
WHERE t.forum_id = ' . $forum_id . '
' . phpbb_visibility::get_visibility_sql('topic', $forum_id, 't.') . "
' . phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.') . "
$limit_time_sql
ORDER BY t.topic_type DESC, $sort_order_sql";
$result = $db->sql_query_limit($sql, $topics_per_page, $start);

View File

@@ -493,7 +493,7 @@ function approve_post($post_id_list, $id, $mode)
{
$notify_poster = (isset($_REQUEST['notify_poster'])) ? true : false;
phpbb_visibility::unhide_posts_topics('approve', $post_info, $post_id_list);
phpbb_content_visibility::unhide_posts_topics('approve', $post_info, $post_id_list);
$messenger = new messenger();

View File

@@ -146,7 +146,7 @@ function mcp_topic_view($id, $mode, $action)
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
p.topic_id = ' . $topic_id . '
AND ' . phpbb_visibility::get_visibility_sql('post', $topic_info['forum_id'], 'p.') . '
AND ' . phpbb_content_visibility::get_visibility_sql('post', $topic_info['forum_id'], 'p.') . '
AND p.poster_id = u.user_id ' .
$limit_time_sql . '
ORDER BY ' . $sort_order_sql;