mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
[ticket/9657] Use the service instead of the static class
PHPBB3-9657
This commit is contained in:
parent
9f89cb4cfb
commit
9aed758c13
19 changed files with 102 additions and 63 deletions
|
@ -23,6 +23,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.forums:
|
feed.forums:
|
||||||
|
@ -35,6 +36,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.news:
|
feed.news:
|
||||||
|
@ -47,6 +49,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.overall:
|
feed.overall:
|
||||||
|
@ -59,6 +62,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topic:
|
feed.topic:
|
||||||
|
@ -71,6 +75,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topics:
|
feed.topics:
|
||||||
|
@ -83,6 +88,7 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
||||||
feed.topics_active:
|
feed.topics_active:
|
||||||
|
@ -95,4 +101,5 @@ services:
|
||||||
- @cache.driver
|
- @cache.driver
|
||||||
- @user
|
- @user
|
||||||
- @auth
|
- @auth
|
||||||
|
- @content.visibility
|
||||||
- %core.php_ext%
|
- %core.php_ext%
|
||||||
|
|
|
@ -80,10 +80,11 @@ abstract class phpbb_feed_base
|
||||||
* @param phpbb_cache_driver_interface $cache Cache object
|
* @param phpbb_cache_driver_interface $cache Cache object
|
||||||
* @param phpbb_user $user User object
|
* @param phpbb_user $user User object
|
||||||
* @param phpbb_auth $auth Auth object
|
* @param phpbb_auth $auth Auth object
|
||||||
|
* @param phpbb_content_visibility $content_visibility Auth object
|
||||||
* @param string $phpEx php file extension
|
* @param string $phpEx php file extension
|
||||||
* @return null
|
* @return null
|
||||||
*/
|
*/
|
||||||
function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $phpEx)
|
function __construct(phpbb_feed_helper $helper, phpbb_config $config, phpbb_db_driver $db, phpbb_cache_driver_interface $cache, phpbb_user $user, phpbb_auth $auth, $content_visibility, $phpEx)
|
||||||
{
|
{
|
||||||
$this->config = $config;
|
$this->config = $config;
|
||||||
$this->helper = $helper;
|
$this->helper = $helper;
|
||||||
|
@ -91,6 +92,7 @@ abstract class phpbb_feed_base
|
||||||
$this->cache = $cache;
|
$this->cache = $cache;
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
$this->auth = $auth;
|
$this->auth = $auth;
|
||||||
|
$this->content_visibility = $content_visibility;
|
||||||
$this->phpEx = $phpEx;
|
$this->phpEx = $phpEx;
|
||||||
|
|
||||||
$this->set_keys();
|
$this->set_keys();
|
||||||
|
|
|
@ -90,7 +90,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
|
|
||||||
function get_sql()
|
function get_sql()
|
||||||
{
|
{
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('topic', $this->forum_id);
|
$sql_visibility = $this->content_visibility->get_visibility_sql('topic', $this->forum_id);
|
||||||
|
|
||||||
// Determine topics with recent activity
|
// Determine topics with recent activity
|
||||||
$sql = 'SELECT topic_id, topic_last_post_time
|
$sql = 'SELECT topic_id, topic_last_post_time
|
||||||
|
@ -116,7 +116,7 @@ class phpbb_feed_forum extends phpbb_feed_post_base
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $this->forum_id, 'p.');
|
$sql_visibility = $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.');
|
||||||
|
|
||||||
$this->sql = array(
|
$this->sql = array(
|
||||||
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
'SELECT' => 'p.post_id, p.topic_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||||
|
|
|
@ -37,7 +37,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||||
$sql = 'SELECT topic_id, topic_last_post_time
|
$sql = 'SELECT topic_id, topic_last_post_time
|
||||||
FROM ' . TOPICS_TABLE . '
|
FROM ' . TOPICS_TABLE . '
|
||||||
WHERE topic_moved_id = 0
|
WHERE topic_moved_id = 0
|
||||||
AND ' . phpbb_content_visibility::get_forums_visibility_sql('topic', $forum_ids) . '
|
AND ' . $this->content_visibility->get_forums_visibility_sql('topic', $forum_ids) . '
|
||||||
ORDER BY topic_last_post_time DESC';
|
ORDER BY topic_last_post_time DESC';
|
||||||
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
$result = $this->db->sql_query_limit($sql, $this->num_items);
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class phpbb_feed_overall extends phpbb_feed_post_base
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', array(), 'p.');
|
$sql_visibility = $this->content_visibility->get_visibility_sql('post', array(), 'p.');
|
||||||
|
|
||||||
// Get the actual data
|
// Get the actual data
|
||||||
$this->sql = array(
|
$this->sql = array(
|
||||||
|
|
|
@ -93,7 +93,7 @@ class phpbb_feed_topic extends phpbb_feed_post_base
|
||||||
|
|
||||||
function get_sql()
|
function get_sql()
|
||||||
{
|
{
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $this->forum_id, 'p.');
|
$sql_visibility = $this->content_visibility->get_visibility_sql('post', $this->forum_id, 'p.');
|
||||||
|
|
||||||
$this->sql = array(
|
$this->sql = array(
|
||||||
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
'SELECT' => 'p.post_id, p.post_time, p.post_edit_time, p.post_visibility, p.post_subject, p.post_text, p.bbcode_bitfield, p.bbcode_uid, p.enable_bbcode, p.enable_smilies, p.enable_magic_url, ' .
|
||||||
|
|
|
@ -51,7 +51,7 @@ abstract class phpbb_feed_topic_base extends phpbb_feed_base
|
||||||
{
|
{
|
||||||
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
$item_row['statistics'] = $this->user->lang['POSTED'] . ' ' . $this->user->lang['POST_BY_AUTHOR'] . ' ' . $this->user_viewprofile($row)
|
||||||
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
. ' ' . $this->separator_stats . ' ' . $this->user->format_date($row[$this->get('published')])
|
||||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . phpbb_content_visibility::get_count('topic_posts', $row, $row['forum_id']) - 1
|
. ' ' . $this->separator_stats . ' ' . $this->user->lang['REPLIES'] . ' ' . $this->content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1
|
||||||
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
|
. ' ' . $this->separator_stats . ' ' . $this->user->lang['VIEWS'] . ' ' . $row['topic_views']
|
||||||
. (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
|
. (($this->is_moderator_approve_forum($row['forum_id']) && $row['topic_posts_unapproved']) ? ' ' . $this->separator_stats . ' ' . $this->user->lang['POSTS_UNAPPROVED'] : '');
|
||||||
}
|
}
|
||||||
|
|
|
@ -1974,7 +1974,7 @@ function get_unread_topics($user_id = false, $sql_extra = '', $sql_sort = '', $s
|
||||||
*/
|
*/
|
||||||
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
|
function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_time = false, $mark_time_forum = false)
|
||||||
{
|
{
|
||||||
global $db, $tracking_topics, $user, $config, $auth, $request;
|
global $db, $tracking_topics, $user, $config, $auth, $request, $phpbb_container;
|
||||||
|
|
||||||
// Determine the users last forum mark time if not given.
|
// Determine the users last forum mark time if not given.
|
||||||
if ($mark_time_forum === false)
|
if ($mark_time_forum === false)
|
||||||
|
@ -1999,7 +1999,8 @@ function update_forum_tracking_info($forum_id, $forum_last_post_time, $f_mark_ti
|
||||||
|
|
||||||
// Handle update of unapproved topics info.
|
// Handle update of unapproved topics info.
|
||||||
// Only update for moderators having m_approve permission for the forum.
|
// Only update for moderators having m_approve permission for the forum.
|
||||||
$sql_update_unapproved = phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.');
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
$sql_update_unapproved = $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||||
$sql_update_unapproved = ($sql_update_unapproved) ? ' AND ' . $sql_update_unapproved : '';
|
$sql_update_unapproved = ($sql_update_unapproved) ? ' AND ' . $sql_update_unapproved : '';
|
||||||
|
|
||||||
// Check the forum for any left unread topics.
|
// Check the forum for any left unread topics.
|
||||||
|
|
|
@ -22,7 +22,7 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
{
|
{
|
||||||
global $db, $auth, $user, $template;
|
global $db, $auth, $user, $template;
|
||||||
global $phpbb_root_path, $phpEx, $config;
|
global $phpbb_root_path, $phpEx, $config;
|
||||||
global $request, $phpbb_dispatcher;
|
global $request, $phpbb_dispatcher, $phpbb_container;
|
||||||
|
|
||||||
$forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();
|
$forum_rows = $subforums = $forum_ids = $forum_ids_moderator = $forum_moderators = $active_forum_ary = array();
|
||||||
$parent_id = $visible_forums = 0;
|
$parent_id = $visible_forums = 0;
|
||||||
|
@ -149,6 +149,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
$forum_tracking_info = array();
|
$forum_tracking_info = array();
|
||||||
$branch_root_id = $root_data['forum_id'];
|
$branch_root_id = $root_data['forum_id'];
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
@ -215,8 +217,8 @@ function display_forums($root_data = '', $display_moderators = true, $return_mod
|
||||||
|
|
||||||
// Count the difference of real to public topics, so we can display an information to moderators
|
// Count the difference of real to public topics, so we can display an information to moderators
|
||||||
$row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0;
|
$row['forum_id_unapproved_topics'] = ($auth->acl_get('m_approve', $forum_id) && $row['forum_topics_unapproved']) ? $forum_id : 0;
|
||||||
$row['forum_posts'] = phpbb_content_visibility::get_count('forum_posts', $row, $forum_id);
|
$row['forum_posts'] = $phpbb_content_visibility->get_count('forum_posts', $row, $forum_id);
|
||||||
$row['forum_topics'] = phpbb_content_visibility::get_count('forum_topics', $row, $forum_id);
|
$row['forum_topics'] = $phpbb_content_visibility->get_count('forum_topics', $row, $forum_id);
|
||||||
|
|
||||||
// Display active topics from this forum?
|
// Display active topics from this forum?
|
||||||
if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS))
|
if ($show_active && $row['forum_type'] == FORUM_POST && $auth->acl_get('f_read', $forum_id) && ($row['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS))
|
||||||
|
@ -1006,7 +1008,7 @@ function display_reasons($reason_id = 0)
|
||||||
function display_user_activity(&$userdata)
|
function display_user_activity(&$userdata)
|
||||||
{
|
{
|
||||||
global $auth, $template, $db, $user;
|
global $auth, $template, $db, $user;
|
||||||
global $phpbb_root_path, $phpEx;
|
global $phpbb_root_path, $phpEx, $phpbb_container;
|
||||||
|
|
||||||
// Do not display user activity for users having more than 5000 posts...
|
// Do not display user activity for users having more than 5000 posts...
|
||||||
if ($userdata['user_posts'] > 5000)
|
if ($userdata['user_posts'] > 5000)
|
||||||
|
@ -1030,12 +1032,14 @@ function display_user_activity(&$userdata)
|
||||||
$active_f_row = $active_t_row = array();
|
$active_f_row = $active_t_row = array();
|
||||||
if (!empty($forum_ary))
|
if (!empty($forum_ary))
|
||||||
{
|
{
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// Obtain active forum
|
// Obtain active forum
|
||||||
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
$sql = 'SELECT forum_id, COUNT(post_id) AS num_posts
|
||||||
FROM ' . POSTS_TABLE . '
|
FROM ' . POSTS_TABLE . '
|
||||||
WHERE poster_id = ' . $userdata['user_id'] . '
|
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||||
AND post_postcount = 1
|
AND post_postcount = 1
|
||||||
AND ' . phpbb_content_visibility::get_forums_visibility_sql('post', $forum_ary) . '
|
AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
|
||||||
GROUP BY forum_id
|
GROUP BY forum_id
|
||||||
ORDER BY num_posts DESC';
|
ORDER BY num_posts DESC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
@ -1057,7 +1061,7 @@ function display_user_activity(&$userdata)
|
||||||
FROM ' . POSTS_TABLE . '
|
FROM ' . POSTS_TABLE . '
|
||||||
WHERE poster_id = ' . $userdata['user_id'] . '
|
WHERE poster_id = ' . $userdata['user_id'] . '
|
||||||
AND post_postcount = 1
|
AND post_postcount = 1
|
||||||
AND ' . phpbb_content_visibility::get_forums_visibility_sql('post', $forum_ary) . '
|
AND ' . $phpbb_content_visibility->get_forums_visibility_sql('post', $forum_ary) . '
|
||||||
GROUP BY topic_id
|
GROUP BY topic_id
|
||||||
ORDER BY num_posts DESC';
|
ORDER BY num_posts DESC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
|
|
@ -982,13 +982,15 @@ function load_drafts($topic_id = 0, $forum_id = 0, $id = 0, $pm_action = '', $ms
|
||||||
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
|
function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id = 0, $show_quote_button = true)
|
||||||
{
|
{
|
||||||
global $user, $auth, $db, $template, $bbcode, $cache;
|
global $user, $auth, $db, $template, $bbcode, $cache;
|
||||||
global $config, $phpbb_root_path, $phpEx;
|
global $config, $phpbb_root_path, $phpEx, $phpbb_container;
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// Go ahead and pull all data for this topic
|
// Go ahead and pull all data for this topic
|
||||||
$sql = 'SELECT p.post_id
|
$sql = 'SELECT p.post_id
|
||||||
FROM ' . POSTS_TABLE . ' p' . "
|
FROM ' . POSTS_TABLE . ' p' . "
|
||||||
WHERE p.topic_id = $topic_id
|
WHERE p.topic_id = $topic_id
|
||||||
AND " . phpbb_content_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') ? " AND p.post_id > $cur_post_id" : '') . '
|
||||||
' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . '
|
' . (($mode == 'post_review_edit') ? " AND p.post_id = $cur_post_id" : '') . '
|
||||||
ORDER BY p.post_time ';
|
ORDER BY p.post_time ';
|
||||||
|
@ -1177,7 +1179,7 @@ function topic_review($topic_id, $forum_id, $mode = 'topic_review', $cur_post_id
|
||||||
*/
|
*/
|
||||||
function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
|
function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $softdelete_reason = '')
|
||||||
{
|
{
|
||||||
global $db, $user, $auth;
|
global $db, $user, $auth, $phpbb_container;
|
||||||
global $config, $phpEx, $phpbb_root_path;
|
global $config, $phpEx, $phpbb_root_path;
|
||||||
|
|
||||||
// Specify our post mode
|
// Specify our post mode
|
||||||
|
@ -1224,10 +1226,12 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// (Soft) delete the post
|
// (Soft) delete the post
|
||||||
if ($is_soft && ($post_mode != 'delete_topic'))
|
if ($is_soft && ($post_mode != 'delete_topic'))
|
||||||
{
|
{
|
||||||
phpbb_content_visibility::set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id));
|
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $post_id, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason, ($data['topic_first_post_id'] == $post_id), ($data['topic_last_post_id'] == $post_id));
|
||||||
}
|
}
|
||||||
else if (!$is_soft)
|
else if (!$is_soft)
|
||||||
{
|
{
|
||||||
|
@ -1264,7 +1268,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
|
||||||
if ($is_soft)
|
if ($is_soft)
|
||||||
{
|
{
|
||||||
$topic_row = array();
|
$topic_row = array();
|
||||||
phpbb_content_visibility::set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason);
|
$phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $forum_id, $user->data['user_id'], time(), $softdelete_reason);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1353,7 +1357,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
|
||||||
$sql = 'SELECT MAX(post_id) as last_post_id
|
$sql = 'SELECT MAX(post_id) as last_post_id
|
||||||
FROM ' . POSTS_TABLE . "
|
FROM ' . POSTS_TABLE . "
|
||||||
WHERE topic_id = $topic_id
|
WHERE topic_id = $topic_id
|
||||||
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id);
|
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
$next_post_id = (int) $db->sql_fetchfield('last_post_id');
|
$next_post_id = (int) $db->sql_fetchfield('last_post_id');
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
@ -1364,7 +1368,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
|
||||||
$sql = 'SELECT post_id
|
$sql = 'SELECT post_id
|
||||||
FROM ' . POSTS_TABLE . "
|
FROM ' . POSTS_TABLE . "
|
||||||
WHERE topic_id = $topic_id
|
WHERE topic_id = $topic_id
|
||||||
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id) . '
|
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id) . '
|
||||||
AND post_time > ' . $data['post_time'] . '
|
AND post_time > ' . $data['post_time'] . '
|
||||||
ORDER BY post_time ASC';
|
ORDER BY post_time ASC';
|
||||||
$result = $db->sql_query_limit($sql, 1);
|
$result = $db->sql_query_limit($sql, 1);
|
||||||
|
@ -1379,7 +1383,7 @@ function delete_post($forum_id, $topic_id, $post_id, &$data, $is_soft = false, $
|
||||||
{
|
{
|
||||||
if ($data['post_visibility'] == ITEM_APPROVED)
|
if ($data['post_visibility'] == ITEM_APPROVED)
|
||||||
{
|
{
|
||||||
phpbb_content_visibility::remove_post_from_statistic($data, $sql_data);
|
$phpbb_content_visibility->remove_post_from_statistic($data, $sql_data);
|
||||||
}
|
}
|
||||||
else if ($data['post_visibility'] == ITEM_UNAPPROVED)
|
else if ($data['post_visibility'] == ITEM_UNAPPROVED)
|
||||||
{
|
{
|
||||||
|
@ -2000,7 +2004,8 @@ function submit_post($mode, $subject, $username, $topic_type, &$poll, &$data, $u
|
||||||
$is_starter = ($post_mode == 'edit_first_post' || $data['post_visibility'] != ITEM_APPROVED);
|
$is_starter = ($post_mode == 'edit_first_post' || $data['post_visibility'] != ITEM_APPROVED);
|
||||||
$is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
|
$is_latest = ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || $data['post_visibility'] != ITEM_APPROVED);
|
||||||
|
|
||||||
phpbb_content_visibility::set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
$phpbb_content_visibility->set_post_visibility($post_visibility, $data['post_id'], $data['topic_id'], $data['forum_id'], $user->data['user_id'], time(), '', $is_starter, $is_latest);
|
||||||
}
|
}
|
||||||
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
|
else if ($post_mode == 'edit_last_post' || $post_mode == 'edit_topic' || ($post_mode == 'edit_first_post' && !$data['topic_replies']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
{
|
{
|
||||||
global $template, $db, $user, $auth, $cache, $module;
|
global $template, $db, $user, $auth, $cache, $module;
|
||||||
global $phpEx, $phpbb_root_path, $config;
|
global $phpEx, $phpbb_root_path, $config;
|
||||||
global $request, $phpbb_dispatcher;
|
global $request, $phpbb_dispatcher, $phpbb_container;
|
||||||
|
|
||||||
$user->add_lang(array('viewtopic', 'viewforum'));
|
$user->add_lang(array('viewtopic', 'viewforum'));
|
||||||
|
|
||||||
|
@ -152,10 +152,12 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
$read_tracking_join = $read_tracking_select = '';
|
$read_tracking_join = $read_tracking_select = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
$sql = 'SELECT t.topic_id
|
$sql = 'SELECT t.topic_id
|
||||||
FROM ' . TOPICS_TABLE . ' t
|
FROM ' . TOPICS_TABLE . ' t
|
||||||
WHERE t.forum_id = ' . $forum_id . '
|
WHERE t.forum_id = ' . $forum_id . '
|
||||||
AND ' . phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.') . "
|
AND ' . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.') . "
|
||||||
$limit_time_sql
|
$limit_time_sql
|
||||||
ORDER BY t.topic_type DESC, $sort_order_sql";
|
ORDER BY t.topic_type DESC, $sort_order_sql";
|
||||||
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
|
$result = $db->sql_query_limit($sql, $topics_per_page, $start);
|
||||||
|
@ -204,7 +206,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
|
|
||||||
$row = &$topic_rows[$topic_id];
|
$row = &$topic_rows[$topic_id];
|
||||||
|
|
||||||
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
|
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
||||||
|
|
||||||
if ($row['topic_status'] == ITEM_MOVED)
|
if ($row['topic_status'] == ITEM_MOVED)
|
||||||
{
|
{
|
||||||
|
@ -249,7 +251,7 @@ function mcp_forum_view($id, $mode, $action, $forum_info)
|
||||||
|
|
||||||
'TOPIC_TYPE' => $topic_type,
|
'TOPIC_TYPE' => $topic_type,
|
||||||
'TOPIC_TITLE' => $topic_title,
|
'TOPIC_TITLE' => $topic_title,
|
||||||
'REPLIES' => phpbb_content_visibility::get_count('topic_posts', $row, $row['forum_id']) - 1,
|
'REPLIES' => $phpbb_content_visibility->get_count('topic_posts', $row, $row['forum_id']) - 1,
|
||||||
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
'LAST_POST_TIME' => $user->format_date($row['topic_last_post_time']),
|
||||||
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
'FIRST_POST_TIME' => $user->format_date($row['topic_time']),
|
||||||
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
|
'LAST_POST_SUBJECT' => $row['topic_last_post_subject'],
|
||||||
|
|
|
@ -654,7 +654,7 @@ function mcp_move_topic($topic_ids)
|
||||||
*/
|
*/
|
||||||
function mcp_restore_topic($topic_ids)
|
function mcp_restore_topic($topic_ids)
|
||||||
{
|
{
|
||||||
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
|
||||||
|
|
||||||
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
|
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_approve')))
|
||||||
{
|
{
|
||||||
|
@ -678,9 +678,10 @@ function mcp_restore_topic($topic_ids)
|
||||||
|
|
||||||
$data = get_topic_data($topic_ids);
|
$data = get_topic_data($topic_ids);
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
foreach ($data as $topic_id => $row)
|
foreach ($data as $topic_id => $row)
|
||||||
{
|
{
|
||||||
$return = phpbb_content_visibility::set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
|
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), '');
|
||||||
if (!empty($return))
|
if (!empty($return))
|
||||||
{
|
{
|
||||||
add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
|
add_log('mod', $row['forum_id'], $topic_id, 'LOG_RESTORE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
|
||||||
|
@ -726,7 +727,7 @@ function mcp_restore_topic($topic_ids)
|
||||||
*/
|
*/
|
||||||
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
|
function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_topic')
|
||||||
{
|
{
|
||||||
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
|
||||||
|
|
||||||
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
|
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_delete')))
|
||||||
{
|
{
|
||||||
|
@ -761,7 +762,8 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
// Only soft delete non-shadow topics
|
// Only soft delete non-shadow topics
|
||||||
if ($is_soft)
|
if ($is_soft)
|
||||||
{
|
{
|
||||||
$return = phpbb_content_visibility::set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
$return = $phpbb_content_visibility->set_topic_visibility(ITEM_DELETED, $topic_id, $row['forum_id'], $user->data['user_id'], time(), $soft_delete_reason);
|
||||||
if (!empty($return))
|
if (!empty($return))
|
||||||
{
|
{
|
||||||
add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
|
add_log('mod', $row['forum_id'], $topic_id, 'LOG_SOFTDELETE_TOPIC', $row['topic_title'], $row['topic_first_poster_name']);
|
||||||
|
@ -854,7 +856,7 @@ function mcp_delete_topic($topic_ids, $is_soft = false, $soft_delete_reason = ''
|
||||||
*/
|
*/
|
||||||
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
|
function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '', $action = 'delete_post')
|
||||||
{
|
{
|
||||||
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request;
|
global $auth, $user, $db, $phpEx, $phpbb_root_path, $request, $phpbb_container;
|
||||||
|
|
||||||
if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete')))
|
if (!check_ids($post_ids, POSTS_TABLE, 'post_id', array('m_softdelete')))
|
||||||
{
|
{
|
||||||
|
@ -910,9 +912,10 @@ function mcp_delete_post($post_ids, $is_soft = false, $soft_delete_reason = '',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
foreach ($topic_info as $topic_id => $topic_data)
|
foreach ($topic_info as $topic_id => $topic_data)
|
||||||
{
|
{
|
||||||
phpbb_content_visibility::set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
|
$phpbb_content_visibility->set_post_visibility(ITEM_DELETED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), $soft_delete_reason, isset($topic_data['first_post']), isset($topic_data['last_post']));
|
||||||
}
|
}
|
||||||
$affected_topics = sizeof($topic_info);
|
$affected_topics = sizeof($topic_info);
|
||||||
// None of the topics is really deleted, so a redirect won't hurt much.
|
// None of the topics is really deleted, so a redirect won't hurt much.
|
||||||
|
|
|
@ -634,9 +634,10 @@ class mcp_queue
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
foreach ($topic_info as $topic_id => $topic_data)
|
foreach ($topic_info as $topic_id => $topic_data)
|
||||||
{
|
{
|
||||||
phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post']));
|
$phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $topic_data['posts'], $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '', isset($topic_data['first_post']), isset($topic_data['last_post']));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof($post_info) >= 1)
|
if (sizeof($post_info) >= 1)
|
||||||
|
@ -759,7 +760,7 @@ class mcp_queue
|
||||||
static public function approve_topics($action, $topic_id_list, $id, $mode)
|
static public function approve_topics($action, $topic_id_list, $id, $mode)
|
||||||
{
|
{
|
||||||
global $db, $template, $user, $config;
|
global $db, $template, $user, $config;
|
||||||
global $phpEx, $phpbb_root_path, $request;
|
global $phpEx, $phpbb_root_path, $request, $phpbb_container;
|
||||||
|
|
||||||
if (!check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
|
if (!check_ids($topic_id_list, TOPICS_TABLE, 'topic_id', array('m_approve')))
|
||||||
{
|
{
|
||||||
|
@ -784,9 +785,10 @@ class mcp_queue
|
||||||
{
|
{
|
||||||
$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;
|
$notify_poster = ($action == 'approve' && isset($_REQUEST['notify_poster'])) ? true : false;
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
foreach ($topic_info as $topic_id => $topic_data)
|
foreach ($topic_info as $topic_id => $topic_data)
|
||||||
{
|
{
|
||||||
phpbb_content_visibility::set_topic_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '');
|
$phpbb_content_visibility->set_topic_visibility(ITEM_APPROVED, $topic_id, $topic_data['forum_id'], $user->data['user_id'], time(), '');
|
||||||
|
|
||||||
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_data['forum_id']}&t={$topic_id}");
|
$topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f={$topic_data['forum_id']}&t={$topic_id}");
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ if (!defined('IN_PHPBB'))
|
||||||
function mcp_topic_view($id, $mode, $action)
|
function mcp_topic_view($id, $mode, $action)
|
||||||
{
|
{
|
||||||
global $phpEx, $phpbb_root_path, $config;
|
global $phpEx, $phpbb_root_path, $config;
|
||||||
global $template, $db, $user, $auth, $cache;
|
global $template, $db, $user, $auth, $cache, $phpbb_container;
|
||||||
|
|
||||||
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
|
$url = append_sid("{$phpbb_root_path}mcp.$phpEx?" . extra_url());
|
||||||
|
|
||||||
|
@ -112,10 +112,11 @@ function mcp_topic_view($id, $mode, $action)
|
||||||
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
|
mcp_sorting('viewtopic', $sort_days, $sort_key, $sort_dir, $sort_by_sql, $sort_order_sql, $total, $topic_info['forum_id'], $topic_id, $where_sql);
|
||||||
|
|
||||||
$limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
$limit_time_sql = ($sort_days) ? 'AND p.post_time >= ' . (time() - ($sort_days * 86400)) : '';
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
if ($total == -1)
|
if ($total == -1)
|
||||||
{
|
{
|
||||||
$total = phpbb_content_visibility::get_count('topic_posts', $topic_info, $topic_info['forum_id']);
|
$total = $phpbb_content_visibility->get_count('topic_posts', $topic_info, $topic_info['forum_id']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));
|
$posts_per_page = max(0, request_var('posts_per_page', intval($config['posts_per_page'])));
|
||||||
|
@ -139,7 +140,7 @@ function mcp_topic_view($id, $mode, $action)
|
||||||
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
FROM ' . POSTS_TABLE . ' p, ' . USERS_TABLE . ' u
|
||||||
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
|
WHERE ' . (($action == 'reports') ? 'p.post_reported = 1 AND ' : '') . '
|
||||||
p.topic_id = ' . $topic_id . '
|
p.topic_id = ' . $topic_id . '
|
||||||
AND ' . phpbb_content_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 ' .
|
AND p.poster_id = u.user_id ' .
|
||||||
$limit_time_sql . '
|
$limit_time_sql . '
|
||||||
ORDER BY ' . $sort_order_sql;
|
ORDER BY ' . $sort_order_sql;
|
||||||
|
|
|
@ -642,7 +642,7 @@ class ucp_main
|
||||||
*/
|
*/
|
||||||
function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
|
function assign_topiclist($mode = 'subscribed', $forbidden_forum_ary = array())
|
||||||
{
|
{
|
||||||
global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx;
|
global $user, $db, $template, $config, $cache, $auth, $phpbb_root_path, $phpEx, $phpbb_container;
|
||||||
|
|
||||||
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
|
$table = ($mode == 'subscribed') ? TOPICS_WATCH_TABLE : BOOKMARKS_TABLE;
|
||||||
$start = request_var('start', 0);
|
$start = request_var('start', 0);
|
||||||
|
@ -768,6 +768,8 @@ class ucp_main
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
foreach ($topic_list as $topic_id)
|
foreach ($topic_list as $topic_id)
|
||||||
{
|
{
|
||||||
$row = &$rowset[$topic_id];
|
$row = &$rowset[$topic_id];
|
||||||
|
@ -778,7 +780,7 @@ class ucp_main
|
||||||
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
$unread_topic = (isset($topic_tracking_info[$topic_id]) && $row['topic_last_post_time'] > $topic_tracking_info[$topic_id]) ? true : false;
|
||||||
|
|
||||||
// Replies
|
// Replies
|
||||||
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
|
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
||||||
|
|
||||||
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
|
if ($row['topic_status'] == ITEM_MOVED && !empty($row['topic_moved_id']))
|
||||||
{
|
{
|
||||||
|
|
|
@ -502,7 +502,7 @@ function get_post_data($post_ids, $acl_list = false, $read_tracking = false)
|
||||||
*/
|
*/
|
||||||
function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
|
function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
|
||||||
{
|
{
|
||||||
global $auth, $db, $user, $config;
|
global $auth, $db, $user, $config, $phpbb_container;
|
||||||
|
|
||||||
$rowset = array();
|
$rowset = array();
|
||||||
|
|
||||||
|
@ -532,6 +532,8 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
|
||||||
WHERE " . $db->sql_in_set('f.forum_id', $forum_id);
|
WHERE " . $db->sql_in_set('f.forum_id', $forum_id);
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
|
if ($acl_list && !$auth->acl_gets($acl_list, $row['forum_id']))
|
||||||
|
@ -539,7 +541,7 @@ function get_forum_data($forum_id, $acl_list = 'f_list', $read_tracking = false)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$row['forum_topics_approved'] = phpbb_content_visibility::get_count('forum_topics', $row, $row['forum_id']);
|
$row['forum_topics_approved'] = $phpbb_content_visibility->get_count('forum_topics', $row, $row['forum_id']);
|
||||||
|
|
||||||
$rowset[$row['forum_id']] = $row;
|
$rowset[$row['forum_id']] = $row;
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,8 @@ if (in_array($mode, array('post', 'reply', 'quote', 'edit', 'delete')) && !$foru
|
||||||
trigger_error('NO_FORUM');
|
trigger_error('NO_FORUM');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// We need to know some basic information in all cases before we do anything.
|
// We need to know some basic information in all cases before we do anything.
|
||||||
switch ($mode)
|
switch ($mode)
|
||||||
{
|
{
|
||||||
|
@ -128,7 +130,7 @@ switch ($mode)
|
||||||
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
|
||||||
WHERE t.topic_id = $topic_id
|
WHERE t.topic_id = $topic_id
|
||||||
AND f.forum_id = t.forum_id
|
AND f.forum_id = t.forum_id
|
||||||
AND " . phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.');
|
AND " . $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'quote':
|
case 'quote':
|
||||||
|
@ -157,7 +159,7 @@ switch ($mode)
|
||||||
AND t.topic_id = p.topic_id
|
AND t.topic_id = p.topic_id
|
||||||
AND u.user_id = p.poster_id
|
AND u.user_id = p.poster_id
|
||||||
AND f.forum_id = t.forum_id
|
AND f.forum_id = t.forum_id
|
||||||
AND " . phpbb_content_visibility::get_visibility_sql('post', $forum_id, 'p.');
|
AND " . $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'smilies':
|
case 'smilies':
|
||||||
|
@ -304,7 +306,7 @@ switch ($mode)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'soft_delete':
|
case 'soft_delete':
|
||||||
if ($user->data['is_registered'] && phpbb_content_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
|
if ($user->data['is_registered'] && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $post_data['post_edit_locked']))
|
||||||
{
|
{
|
||||||
$is_authed = true;
|
$is_authed = true;
|
||||||
}
|
}
|
||||||
|
@ -931,7 +933,7 @@ if ($submit || $preview || $refresh)
|
||||||
{
|
{
|
||||||
$is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']);
|
$is_first_post = ($post_id == $post_data['topic_first_post_id'] || !$post_data['topic_posts_approved']);
|
||||||
$is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']);
|
$is_last_post = ($post_id == $post_data['topic_last_post_id'] || !$post_data['topic_posts_approved']);
|
||||||
$updated_post_data = phpbb_content_visibility::set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post);
|
$updated_post_data = $phpbb_content_visibility->set_post_visibility(ITEM_APPROVED, $post_id, $post_data['topic_id'], $post_data['forum_id'], $user->data['user_id'], time(), '', $is_first_post, $is_last_post);
|
||||||
|
|
||||||
if (!empty($updated_post_data))
|
if (!empty($updated_post_data))
|
||||||
{
|
{
|
||||||
|
@ -1490,7 +1492,7 @@ $template->assign_vars(array(
|
||||||
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
|
'S_LOCK_POST_CHECKED' => ($lock_post_checked) ? ' checked="checked"' : '',
|
||||||
'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
|
'S_SOFTDELETE_CHECKED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? ' checked="checked"' : '',
|
||||||
'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false,
|
'S_DELETE_REASON' => ($mode == 'edit' && $auth->acl_get('m_softdelete', $forum_id)) ? true : false,
|
||||||
'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && phpbb_content_visibility::can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
|
'S_SOFTDELETE_ALLOWED' => ($mode == 'edit' && $phpbb_content_visibility->can_soft_delete($forum_id, $post_data['poster_id'], $lock_post_checked)) ? true : false,
|
||||||
'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id),
|
'S_RESTORE_ALLOWED' => $auth->acl_get('m_approve', $forum_id),
|
||||||
'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false,
|
'S_IS_DELETED' => ($mode == 'edit' && $post_data['post_visibility'] == ITEM_DELETED) ? true : false,
|
||||||
'S_LINKS_ALLOWED' => $url_status,
|
'S_LINKS_ALLOWED' => $url_status,
|
||||||
|
|
|
@ -119,6 +119,8 @@ $sort_by_text = array('a' => $user->lang['SORT_AUTHOR'], 't' => $user->lang['SOR
|
||||||
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
||||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
|
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param);
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
if ($keywords || $author || $author_id || $search_id || $submit)
|
if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
{
|
{
|
||||||
// clear arrays
|
// clear arrays
|
||||||
|
@ -250,8 +252,8 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
$db->sql_freeresult($result);
|
$db->sql_freeresult($result);
|
||||||
|
|
||||||
// find out in which forums the user is allowed to view posts
|
// find out in which forums the user is allowed to view posts
|
||||||
$m_approve_posts_fid_sql = phpbb_content_visibility::get_global_visibility_sql('post', $ex_fid_ary, 'p.');
|
$m_approve_posts_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('post', $ex_fid_ary, 'p.');
|
||||||
$m_approve_topics_fid_sql = phpbb_content_visibility::get_global_visibility_sql('topic', $ex_fid_ary, 't.');
|
$m_approve_topics_fid_sql = $phpbb_content_visibility->get_global_visibility_sql('topic', $ex_fid_ary, 't.');
|
||||||
|
|
||||||
if ($reset_search_forum)
|
if ($reset_search_forum)
|
||||||
{
|
{
|
||||||
|
@ -860,7 +862,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
|
||||||
$forum_id = $row['forum_id'];
|
$forum_id = $row['forum_id'];
|
||||||
$result_topic_id = $row['topic_id'];
|
$result_topic_id = $row['topic_id'];
|
||||||
$topic_title = censor_text($row['topic_title']);
|
$topic_title = censor_text($row['topic_title']);
|
||||||
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $forum_id) - 1;
|
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $forum_id) - 1;
|
||||||
|
|
||||||
$view_topic_url_params = "f=$forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '');
|
$view_topic_url_params = "f=$forum_id&t=$result_topic_id" . (($u_hilit) ? "&hilit=$u_hilit" : '');
|
||||||
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
|
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", $view_topic_url_params);
|
||||||
|
|
|
@ -246,11 +246,13 @@ $sort_by_sql = array('a' => 't.topic_first_poster_name', 't' => 't.topic_last_po
|
||||||
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
$s_limit_days = $s_sort_key = $s_sort_dir = $u_sort_param = '';
|
||||||
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
|
gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $s_limit_days, $s_sort_key, $s_sort_dir, $u_sort_param, $default_sort_days, $default_sort_key, $default_sort_dir);
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// Limit topics to certain time frame, obtain correct topic count
|
// Limit topics to certain time frame, obtain correct topic count
|
||||||
if ($sort_days)
|
if ($sort_days)
|
||||||
{
|
{
|
||||||
$min_post_time = time() - ($sort_days * 86400);
|
$min_post_time = time() - ($sort_days * 86400);
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('topic', $forum_id);
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('topic', $forum_id);
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
$sql = 'SELECT COUNT(topic_id) AS num_topics
|
||||||
FROM ' . TOPICS_TABLE . "
|
FROM ' . TOPICS_TABLE . "
|
||||||
|
@ -274,7 +276,7 @@ if ($sort_days)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$topics_count = phpbb_content_visibility::get_count('forum_topics', $forum_data, $forum_id);
|
$topics_count = $phpbb_content_visibility->get_count('forum_topics', $forum_data, $forum_id);
|
||||||
$sql_limit_time = '';
|
$sql_limit_time = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +373,7 @@ $sql_array = array(
|
||||||
'LEFT_JOIN' => array(),
|
'LEFT_JOIN' => array(),
|
||||||
);
|
);
|
||||||
|
|
||||||
$sql_approved = phpbb_content_visibility::get_visibility_sql('topic', $forum_id, 't.');
|
$sql_approved = $phpbb_content_visibility->get_visibility_sql('topic', $forum_id, 't.');
|
||||||
$sql_approved = ($sql_approved) ? ' AND ' . $sql_approved : '';
|
$sql_approved = ($sql_approved) ? ' AND ' . $sql_approved : '';
|
||||||
|
|
||||||
if ($user->data['is_registered'])
|
if ($user->data['is_registered'])
|
||||||
|
@ -685,7 +687,7 @@ if (sizeof($topic_list))
|
||||||
$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
|
$s_type_switch_test = ($row['topic_type'] == POST_ANNOUNCE || $row['topic_type'] == POST_GLOBAL) ? 1 : 0;
|
||||||
|
|
||||||
// Replies
|
// Replies
|
||||||
$replies = phpbb_content_visibility::get_count('topic_posts', $row, $topic_forum_id) - 1;
|
$replies = $phpbb_content_visibility->get_count('topic_posts', $row, $topic_forum_id) - 1;
|
||||||
|
|
||||||
if ($row['topic_status'] == ITEM_MOVED)
|
if ($row['topic_status'] == ITEM_MOVED)
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,8 @@ if (!$topic_id && !$post_id)
|
||||||
trigger_error('NO_TOPIC');
|
trigger_error('NO_TOPIC');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$phpbb_content_visibility = $phpbb_container->get('content.visibility');
|
||||||
|
|
||||||
// Find topic id if user requested a newer or older topic
|
// Find topic id if user requested a newer or older topic
|
||||||
if ($view && !$post_id)
|
if ($view && !$post_id)
|
||||||
{
|
{
|
||||||
|
@ -79,7 +81,7 @@ if ($view && !$post_id)
|
||||||
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
|
$topic_tracking_info = get_complete_topic_tracking($forum_id, $topic_id);
|
||||||
|
|
||||||
$topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;
|
$topic_last_read = (isset($topic_tracking_info[$topic_id])) ? $topic_tracking_info[$topic_id] : 0;
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $forum_id);
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
|
||||||
|
|
||||||
$sql = 'SELECT post_id, topic_id, forum_id
|
$sql = 'SELECT post_id, topic_id, forum_id
|
||||||
FROM ' . POSTS_TABLE . "
|
FROM ' . POSTS_TABLE . "
|
||||||
|
@ -133,7 +135,7 @@ if ($view && !$post_id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('topic', $row['forum_id']);
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('topic', $row['forum_id']);
|
||||||
|
|
||||||
$sql = 'SELECT topic_id, forum_id
|
$sql = 'SELECT topic_id, forum_id
|
||||||
FROM ' . TOPICS_TABLE . '
|
FROM ' . TOPICS_TABLE . '
|
||||||
|
@ -275,7 +277,7 @@ if ($post_id)
|
||||||
|
|
||||||
if ($sort_dir == $check_sort)
|
if ($sort_dir == $check_sort)
|
||||||
{
|
{
|
||||||
$topic_data['prev_posts'] = phpbb_content_visibility::get_count('topic_posts', $topic_data, $forum_id) - 1;
|
$topic_data['prev_posts'] = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -284,7 +286,7 @@ if ($post_id)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $forum_id, 'p.');
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.');
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
|
$sql = 'SELECT COUNT(p.post_id) AS prev_posts
|
||||||
FROM ' . POSTS_TABLE . " p
|
FROM ' . POSTS_TABLE . " p
|
||||||
|
@ -309,7 +311,7 @@ if ($post_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
$topic_id = (int) $topic_data['topic_id'];
|
$topic_id = (int) $topic_data['topic_id'];
|
||||||
$topic_replies = phpbb_content_visibility::get_count('topic_posts', $topic_data, $forum_id) - 1;
|
$topic_replies = $phpbb_content_visibility->get_count('topic_posts', $topic_data, $forum_id) - 1;
|
||||||
|
|
||||||
// Check sticky/announcement time limit
|
// Check sticky/announcement time limit
|
||||||
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())
|
if (($topic_data['topic_type'] == POST_STICKY || $topic_data['topic_type'] == POST_ANNOUNCE) && $topic_data['topic_time_limit'] && ($topic_data['topic_time'] + $topic_data['topic_time_limit']) < time())
|
||||||
|
@ -403,7 +405,7 @@ gen_sort_selects($limit_days, $sort_by_text, $sort_days, $sort_key, $sort_dir, $
|
||||||
if ($sort_days)
|
if ($sort_days)
|
||||||
{
|
{
|
||||||
$min_post_time = time() - ($sort_days * 86400);
|
$min_post_time = time() - ($sort_days * 86400);
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $forum_id);
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('post', $forum_id);
|
||||||
|
|
||||||
$sql = 'SELECT COUNT(post_id) AS num_posts
|
$sql = 'SELECT COUNT(post_id) AS num_posts
|
||||||
FROM ' . POSTS_TABLE . "
|
FROM ' . POSTS_TABLE . "
|
||||||
|
@ -944,7 +946,7 @@ $bbcode_bitfield = '';
|
||||||
$i = $i_total = 0;
|
$i = $i_total = 0;
|
||||||
|
|
||||||
// Go ahead and pull all data for this topic
|
// Go ahead and pull all data for this topic
|
||||||
$sql_visibility = phpbb_content_visibility::get_visibility_sql('post', $forum_id, 'p.');
|
$sql_visibility = $phpbb_content_visibility->get_visibility_sql('post', $forum_id, 'p.');
|
||||||
|
|
||||||
$sql = 'SELECT p.post_id
|
$sql = 'SELECT p.post_id
|
||||||
FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . "
|
FROM ' . POSTS_TABLE . ' p' . (($join_user_sql[$sort_key]) ? ', ' . USERS_TABLE . ' u': '') . "
|
||||||
|
|
Loading…
Add table
Reference in a new issue