Vergleich inc/class_moderation.php - 1.8.7 - 1.8.24

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 323Zeile 323
		// Update forum count
update_forum_counters($thread['fid'], $updated_counters);
update_forum_lastpost($thread['fid']);

		// Update forum count
update_forum_counters($thread['fid'], $updated_counters);
update_forum_lastpost($thread['fid']);

 
		mark_reports($tid, 'thread');


$plugins->run_hooks("class_moderation_delete_thread", $tid);



$plugins->run_hooks("class_moderation_delete_thread", $tid);


Zeile 754Zeile 755
	 * @param int $tid Thread ID (Set to 0 if posts from multiple threads are selected)
* @return int ID of the post into which all other posts are merged
*/

	 * @param int $tid Thread ID (Set to 0 if posts from multiple threads are selected)
* @return int ID of the post into which all other posts are merged
*/

	function merge_posts($pids, $tid=0, $sep="new_line")

	function merge_posts($pids=array(), $tid=0, $sep="new_line")

	{
global $db, $plugins;


	{
global $db, $plugins;


Zeile 801Zeile 802
				$fid = $post['fid'];
$mastertid = $post['tid'];
$first = 0;

				$fid = $post['fid'];
$mastertid = $post['tid'];
$first = 0;

 
				$visible = $post['visible'];

			}
else
{

			}
else
{

Zeile 844Zeile 846
					{
--$user_counters[$post['uid']]['num_threads'];
}

					{
--$user_counters[$post['uid']]['num_threads'];
}

 
					$thread_counters[$post['tid']]['attachmentcount'] -= $post['attachmentcount'];

				}
elseif($post['visible'] == 0)
{

				}
elseif($post['visible'] == 0)
{

Zeile 855Zeile 858
					// Subtract 1 deleted post from post's thread
--$thread_counters[$post['tid']]['deletedposts'];
}

					// Subtract 1 deleted post from post's thread
--$thread_counters[$post['tid']]['deletedposts'];
}

				$thread_counters[$post['tid']]['attachmentcount'] -= $post['attachmentcount'];

 

// Subtract 1 post from post's forum
if($post['threadvisible'] == 1 && $post['visible'] == 1)


// Subtract 1 post from post's forum
if($post['threadvisible'] == 1 && $post['visible'] == 1)

Zeile 869Zeile 871
				else
{
--$forum_counters[$post['fid']]['deletedposts'];

				else
{
--$forum_counters[$post['fid']]['deletedposts'];

 
				}

// Add attachment count to thread
if($visible == 1)
{
$thread_counters[$mastertid]['attachmentcount'] += $post['attachmentcount'];

				}
}
}

				}
}
}

Zeile 936Zeile 944
					);
}
++$user_counters[$new_firstpost['uid']]['num_threads'];

					);
}
++$user_counters[$new_firstpost['uid']]['num_threads'];

			}

			}

			update_first_post($thread['tid']);
}


			update_first_post($thread['tid']);
}


Zeile 1044Zeile 1052
				$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);

$query = $db->simple_select('threads', 'tid', "closed='moved|$tid' AND fid='$new_fid'");

				$plugins->run_hooks("class_moderation_move_thread_redirect", $arguments);

$query = $db->simple_select('threads', 'tid', "closed='moved|$tid' AND fid='$new_fid'");

				while($redirect_tid = $db->fetch_field($query, 'tid'))
{
$this->delete_thread($redirect_tid);

				while($redirect_tid = $db->fetch_field($query, 'tid'))
{
$this->delete_thread($redirect_tid);

				}
$changefid = array(
"fid" => $new_fid,

				}
$changefid = array(
"fid" => $new_fid,

Zeile 1397Zeile 1405
		global $db, $mybb, $mergethread, $thread, $plugins, $cache;

$mergetid = (int)$mergetid;

		global $db, $mybb, $mergethread, $thread, $plugins, $cache;

$mergetid = (int)$mergetid;

		$tid = (int)$tid;


		$tid = (int)$tid;


		if(!isset($mergethread['tid']) || $mergethread['tid'] != $mergetid)
{
$mergethread = get_thread($mergetid);

		if(!isset($mergethread['tid']) || $mergethread['tid'] != $mergetid)
{
$mergethread = get_thread($mergetid);

Zeile 1406Zeile 1414
		if(!isset($thread['tid']) || $thread['tid'] != $tid)
{
$thread = get_thread($tid);

		if(!isset($thread['tid']) || $thread['tid'] != $tid)
{
$thread = get_thread($tid);

		}


		}


		if(!$mergethread || !$thread)
{
return false;
}

		if(!$mergethread || !$thread)
{
return false;
}





		$forum_cache = $cache->read('forums');

$threadarray = array();
if(!$thread['poll'] && $mergethread['poll'])

		$forum_cache = $cache->read('forums');

$threadarray = array();
if(!$thread['poll'] && $mergethread['poll'])

		{

		{

			$threadarray['poll'] = $mergethread['poll'];
$sqlarray = array(
"tid" => $tid,

			$threadarray['poll'] = $mergethread['poll'];
$sqlarray = array(
"tid" => $tid,

Zeile 1453Zeile 1461
				elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1)
{
$user_posts[$post['uid']]['postnum'] += $post['postnum'];

				elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1)
{
$user_posts[$post['uid']]['postnum'] += $post['postnum'];

				}
}
}

$sqlarray = array(

				}
}
}

$sqlarray = array(

			"tid" => $tid,
"fid" => $thread['fid'],
"replyto" => 0,

			"tid" => $tid,
"fid" => $thread['fid'],
"replyto" => 0,

Zeile 1498Zeile 1506
 		{
$update_users = array();
foreach($subscriptions[$mergetid] as $user)

 		{
$update_users = array();
foreach($subscriptions[$mergetid] as $user)

			{

			{

				if(!isset($subscriptions[$tid]) || !in_array($user, $subscriptions[$tid]))
{
// User doesn't have a $tid subscription

				if(!isset($subscriptions[$tid]) || !in_array($user, $subscriptions[$tid]))
{
// User doesn't have a $tid subscription

Zeile 1537Zeile 1545
		else
{
++$mergethread['unapprovedposts'];

		else
{
++$mergethread['unapprovedposts'];

		}


		}


		// In some cases the thread we may be merging with may cause us to have a new firstpost if it is an older thread
// Therefore resync the visible field to make sure they're the same if they're not
$query = $db->simple_select("posts", "pid, uid, visible", "tid='{$tid}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));

		// In some cases the thread we may be merging with may cause us to have a new firstpost if it is an older thread
// Therefore resync the visible field to make sure they're the same if they're not
$query = $db->simple_select("posts", "pid, uid, visible", "tid='{$tid}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));

Zeile 1551Zeile 1559
				--$user_posts[$post['uid']]['postnum'];
}
elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1)

				--$user_posts[$post['uid']]['postnum'];
}
elseif($thread['visible'] == 1 && $forum_cache[$thread['fid']]['usepostcounts'] == 1)

			{

			{

				++$user_posts[$post['uid']]['postnum'];

				++$user_posts[$post['uid']]['postnum'];

			}

			}

		}
// Update first post if needed
if($new_firstpost['pid'] != $thread['firstpost'])
{
update_first_post($thread['tid']);

		}
// Update first post if needed
if($new_firstpost['pid'] != $thread['firstpost'])
{
update_first_post($thread['tid']);

		}

// Subtract merged thread from user counter
if($mergethread['visible'] == 1 && $forum_cache[$mergethread['fid']]['usethreadcounts'] == 1)
{
if(!isset($user_posts[$mergethread['uid']]['threadnum']))
{
$user_posts[$mergethread['uid']]['threadnum'] = 0;
}
--$user_posts[$mergethread['uid']]['threadnum'];

 
		}

// Update thread count if thread has a new firstpost and is visible

		}

// Update thread count if thread has a new firstpost and is visible

Zeile 1751Zeile 1749
			"replies" => "+{$mergethread['replies']}",
"attachmentcount" => "+{$mergethread['attachmentcount']}",
"unapprovedposts" => "+{$mergethread['unapprovedposts']}",

			"replies" => "+{$mergethread['replies']}",
"attachmentcount" => "+{$mergethread['attachmentcount']}",
"unapprovedposts" => "+{$mergethread['unapprovedposts']}",

			"deletedposts" => "+{$mergethread['unapprovedposts']}",

 
			"deletedposts" => "+{$mergethread['deletedposts']}"
);
update_thread_counters($tid, $updated_stats);

			"deletedposts" => "+{$mergethread['deletedposts']}"
);
update_thread_counters($tid, $updated_stats);

Zeile 1841Zeile 1838
						'threadnum' => 0
);
}

						'threadnum' => 0
);
}

				// Subtract thread from old thread opener
--$user_counters[$newthread['uid']]['threadnum'];

				++$user_counters[$newthread['uid']]['threadnum'];


			}
elseif($visible == -1)
{

			}
elseif($visible == -1)
{

Zeile 1933Zeile 1929
				// Unapproved post
// Subtract 1 from the old thread's unapproved posts
--$thread_counters[$post['tid']]['unapprovedposts'];

				// Unapproved post
// Subtract 1 from the old thread's unapproved posts
--$thread_counters[$post['tid']]['unapprovedposts'];

			}
elseif($post['visible'] == -1)
{

			}
elseif($post['visible'] == -1)
{

				// Soft deleted post
// Subtract 1 from the old thread's deleted posts
--$thread_counters[$post['tid']]['deletedposts'];

				// Soft deleted post
// Subtract 1 from the old thread's deleted posts
--$thread_counters[$post['tid']]['deletedposts'];

Zeile 2023Zeile 2019
					{
++$thread_counters[$post['tid']]['unapprovedposts'];
++$forum_counters[$post['fid']]['unapprovedposts'];

					{
++$thread_counters[$post['tid']]['unapprovedposts'];
++$forum_counters[$post['fid']]['unapprovedposts'];

					}

					}

				}

// Update user thread counter if thread opener changes

				}

// Update user thread counter if thread opener changes

Zeile 2111Zeile 2107
		{
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['replies'];

		{
// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['replies'];

		}

		}

		elseif($destination_tid == 0 && $newthread['visible'] == 0)

		elseif($destination_tid == 0 && $newthread['visible'] == 0)

		{

		{

			// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['unapprovedposts'];
}
elseif($destination_tid == 0 && $newthread['visible'] == -1)

			// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['unapprovedposts'];
}
elseif($destination_tid == 0 && $newthread['visible'] == -1)

		{

		{

			// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['deletedposts'];
}

			// If splitting into a new thread, subtract one from the thread's reply count to compensate for the original post
--$thread_counters[$newtid]['deletedposts'];
}





		$arguments = array("pids" => $pids, "tid" => $tid, "moveto" => $moveto, "newsubject" => $newsubject, "destination_tid" => $destination_tid);
$plugins->run_hooks("class_moderation_split_posts", $arguments);


		$arguments = array("pids" => $pids, "tid" => $tid, "moveto" => $moveto, "newsubject" => $newsubject, "destination_tid" => $destination_tid);
$plugins->run_hooks("class_moderation_split_posts", $arguments);


Zeile 2130Zeile 2126
		if(!empty($user_counters))
{
foreach($user_counters as $uid => $counters)

		if(!empty($user_counters))
{
foreach($user_counters as $uid => $counters)

			{
foreach($counters as $key => $counter)
{
if($counter >= 0)

			{
foreach($counters as $key => $counter)
{
if($counter >= 0)

					{
$counters[$key] = "+{$counter}"; // add the addition operator for query
}

					{
$counters[$key] = "+{$counter}"; // add the addition operator for query
}

Zeile 2154Zeile 2150
					$newthread = $db->fetch_array($query);
$sqlarray = array(
"subject" => $newsubject,

					$newthread = $db->fetch_array($query);
$sqlarray = array(
"subject" => $newsubject,

						"replyto" => 0
);

						"replyto" => 0
);

					$db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'");
}
else

					$db->update_query("posts", $sqlarray, "pid='{$newthread['pid']}'");
}
else

Zeile 2175Zeile 2171
						"replyto" => 0
);
$db->update_query("posts", $sqlarray, "pid='{$oldthread['pid']}'");

						"replyto" => 0
);
$db->update_query("posts", $sqlarray, "pid='{$oldthread['pid']}'");

				}

foreach($counters as $key => $counter)

				}

foreach($counters as $key => $counter)

				{
if($counter >= 0)
{

				{
if($counter >= 0)
{

Zeile 2215Zeile 2211
	 * @param array $tids Thread IDs
* @param int $moveto Destination forum
* @return boolean

	 * @param array $tids Thread IDs
* @param int $moveto Destination forum
* @return boolean

 
	 *
* @deprecated Iterate over move_thread instead

	 */
function move_threads($tids, $moveto)
{

	 */
function move_threads($tids, $moveto)
{

Zeile 2253Zeile 2251
				);
}


				);
}


			if(!isset($user_counters[$thread['uid']]['num_threads']))

			if(!isset($user_counters[$thread['uid']]))

			{

			{

				$user_counters[$thread['uid']]['num_threads'] = 0;




				$user_counters[$thread['uid']] = array(
'num_posts' => 0,
'num_threads' => 0
);

			}

if($thread['visible'] == 1)

			}

if($thread['visible'] == 1)

Zeile 2289Zeile 2290
				");
while($posters = $db->fetch_array($query1))
{

				");
while($posters = $db->fetch_array($query1))
{

					if(!isset($user_counters[$posters['uid']]['num_posts']))

					if(!isset($user_counters[$posters['uid']]))

					{

					{

						$user_counters[$posters['uid']]['num_posts'] = 0;




						$user_counters[$posters['uid']] = array(
'num_posts' => 0,
'num_threads' => 0
);

					}

if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0)

					}

if($newforum['usepostcounts'] != 0 && $forum['usepostcounts'] == 0)