phpBB

Code Changes

File: phpbb/content_visibility.php

  Unmodified   Added   Modified   Removed
Line 144Line 144
	*/
public function is_visible($mode, $forum_id, $data)
{

	*/
public function is_visible($mode, $forum_id, $data)
{

		$is_visible = $this->auth->acl_get('m_approve', $forum_id) || $data[$mode . '_visibility'] == ITEM_APPROVED;








		$visibility = $data[$mode . '_visibility'];
$poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
$is_visible = ($visibility == ITEM_APPROVED) ||
($this->config['display_unapproved_posts'] &&
($this->user->data['user_id'] != ANONYMOUS) &&
($visibility == ITEM_UNAPPROVED || $visibility == ITEM_REAPPROVE) &&
($this->user->data['user_id'] == $data[$poster_key])) ||
$this->auth->acl_get('m_approve', $forum_id);


/**
* Allow changing the result of calling is_visible


/**
* Allow changing the result of calling is_visible

Line 216Line 223
		}
else
{

		}
else
{

			$where_sql .= $table_alias . $mode . '_visibility = ' . ITEM_APPROVED;
}

			$visibility_query = $table_alias . $mode . '_visibility = ';






 
			$where_sql .= '(' . $visibility_query . ITEM_APPROVED . ')';
if ($this->config['display_unapproved_posts'] && ($this->user->data['user_id'] != ANONYMOUS))
{
$poster_key = ($mode === 'topic') ? 'topic_poster' : 'poster_id';
$where_sql .= ' OR ((' . $visibility_query . ITEM_UNAPPROVED . ' OR ' . $visibility_query . ITEM_REAPPROVE .')';
$where_sql .= ' AND ' . $table_alias . $poster_key . ' = ' . ((int) $this->user->data['user_id']) . ')';
}
}

		return '(' . $where_sql . ')';
}


		return '(' . $where_sql . ')';
}


Line 486Line 500
		{
$postcounts[$num_posts][] = $poster_id;
}

		{
$postcounts[$num_posts][] = $poster_id;
}

 

$postcount_change = 0;


// Update users postcounts
foreach ($postcounts as $num_posts => $poster_ids)
{
if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED)))
{


// Update users postcounts
foreach ($postcounts as $num_posts => $poster_ids)
{
if (in_array($visibility, array(ITEM_REAPPROVE, ITEM_DELETED)))
{

 
				$postcount_change -= $num_posts;


				$sql = 'UPDATE ' . $this->users_table . '
SET user_posts = 0
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '

				$sql = 'UPDATE ' . $this->users_table . '
SET user_posts = 0
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids) . '

Line 506Line 524
			}
else
{

			}
else
{

 
				$postcount_change += $num_posts;


				$sql = 'UPDATE ' . $this->users_table . '
SET user_posts = user_posts + ' . $num_posts . '
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
$this->db->sql_query($sql);
}

				$sql = 'UPDATE ' . $this->users_table . '
SET user_posts = user_posts + ' . $num_posts . '
WHERE ' . $this->db->sql_in_set('user_id', $poster_ids);
$this->db->sql_query($sql);
}

 
		}

if ($postcount_change != 0)
{
$this->config->increment('num_posts', $postcount_change, false);

		}

$update_topic_postcount = true;

		}

$update_topic_postcount = true;

Line 804Line 829
	* Add post to topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic

	* Add post to topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic

	* @param &$sql_data		array	Populated with the SQL changes, may be empty at call time

	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)

	* @return null
*/
public function add_post_to_statistic($data, &$sql_data)

	* @return null
*/
public function add_post_to_statistic($data, &$sql_data)

Line 825Line 850
	* Remove post from topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic

	* Remove post from topic and forum statistics
*
* @param $data array Contains information from the topics table about given topic

	* @param &$sql_data		array	Populated with the SQL changes, may be empty at call time

	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)

	* @return null
*/
public function remove_post_from_statistic($data, &$sql_data)

	* @return null
*/
public function remove_post_from_statistic($data, &$sql_data)

Line 858Line 883
	* Remove topic from forum statistics
*
* @param $data array Post and topic data

	* Remove topic from forum statistics
*
* @param $data array Post and topic data

	* @param &$sql_data		array	Populated with the SQL changes, may be empty at call time

	* @param $sql_data		array	Populated with the SQL changes, may be empty at call time (by reference)

	* @return null
*/
public function remove_topic_from_statistic($data, &$sql_data)

	* @return null
*/
public function remove_topic_from_statistic($data, &$sql_data)