Vergleich inc/class_moderation.php - 1.8.8 - 1.8.25

  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 1566Zeile 1567
		if($new_firstpost['pid'] != $thread['firstpost'])
{
update_first_post($thread['tid']);

		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 1752Zeile 1743
				"threadnum" => "+{$counters['threadnum']}",
);
update_user_counters($uid, $update_array);

				"threadnum" => "+{$counters['threadnum']}",
);
update_user_counters($uid, $update_array);

		}

		}


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


$updated_stats = array(
"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 1848Zeile 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 1934Zeile 1923

// Subtract 1 from the old thread's replies
--$thread_counters[$post['tid']]['replies'];


// Subtract 1 from the old thread's replies
--$thread_counters[$post['tid']]['replies'];

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

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

			{
// Unapproved post
// Subtract 1 from the old thread's unapproved posts

			{
// Unapproved post
// Subtract 1 from the old thread's unapproved posts

Zeile 1946Zeile 1935
				// 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'];

			}


			}


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

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

			{

			{

				--$forum_counters[$post['fid']]['posts'];

				--$forum_counters[$post['fid']]['posts'];

			}

			}

			elseif($post['threadvisible'] == 0 || ($post['visible'] == 0 && $post['threadvisible'] == 1))
{
--$forum_counters[$post['fid']]['unapprovedposts'];
}
else

			elseif($post['threadvisible'] == 0 || ($post['visible'] == 0 && $post['threadvisible'] == 1))
{
--$forum_counters[$post['fid']]['unapprovedposts'];
}
else

			{

			{

				--$forum_counters[$post['fid']]['deletedposts'];
}


				--$forum_counters[$post['fid']]['deletedposts'];
}


Zeile 1980Zeile 1969
						'threadnum' => 0
);
}

						'threadnum' => 0
);
}





				// Update post counters if visibility changes
if($post['threadvisible'] != $new_firstpost['visible'])
{

				// Update post counters if visibility changes
if($post['threadvisible'] != $new_firstpost['visible'])
{

Zeile 1992Zeile 1981
						if($post['threadvisible'] == 1 && $forum_cache[$post['fid']]['usepostcounts'] == 1)
{
--$user_counters[$new_firstpost['uid']]['postnum'];

						if($post['threadvisible'] == 1 && $forum_cache[$post['fid']]['usepostcounts'] == 1)
{
--$user_counters[$new_firstpost['uid']]['postnum'];

						}

						}

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

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

					{

					{

						--$thread_counters[$post['tid']]['deletedposts'];

						--$thread_counters[$post['tid']]['deletedposts'];

					}

					}

					else
{
--$thread_counters[$post['tid']]['unapprovedposts'];
}
if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1))

					else
{
--$thread_counters[$post['tid']]['unapprovedposts'];
}
if($post['threadvisible'] == 0 || ($new_firstpost['visible'] == 0 && $post['threadvisible'] == 1))

					{

					{

						--$forum_counters[$post['fid']]['unapprovedposts'];
}
else

						--$forum_counters[$post['fid']]['unapprovedposts'];
}
else

Zeile 2025Zeile 2014
					{
++$thread_counters[$post['tid']]['deletedposts'];
++$forum_counters[$post['fid']]['deletedposts'];

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

					}

					}

					else
{
++$thread_counters[$post['tid']]['unapprovedposts'];

					else
{
++$thread_counters[$post['tid']]['unapprovedposts'];

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

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

				}

				}

				update_first_post($newtid);
}


				update_first_post($newtid);
}


Zeile 2082Zeile 2071
					// Moving into a forum that does count post counts
++$user_counters[$post['uid']]['postnum'];
}

					// Moving into a forum that does count post counts
++$user_counters[$post['uid']]['postnum'];
}





				// Add 1 to the new thread's replies
++$thread_counters[$newtid]['replies'];

				// Add 1 to the new thread's replies
++$thread_counters[$newtid]['replies'];

			}

			}

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

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

Zeile 2093Zeile 2082
				++$thread_counters[$newtid]['unapprovedposts'];
}
elseif($post['visible'] == -1)

				++$thread_counters[$newtid]['unapprovedposts'];
}
elseif($post['visible'] == -1)

			{

			{

				// Soft deleted post
// Add 1 to the new thread's deleted posts
++$thread_counters[$newtid]['deletedposts'];

				// Soft deleted post
// Add 1 to the new thread's deleted posts
++$thread_counters[$newtid]['deletedposts'];

Zeile 2115Zeile 2104
		}

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

		}

if($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]['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'];
}

Zeile 2222Zeile 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)
{
global $db, $plugins;

	 */
function move_threads($tids, $moveto)
{
global $db, $plugins;





		// Make sure we only have valid values
$tids = array_map('intval', $tids);

$tid_list = implode(',', $tids);


		// Make sure we only have valid values
$tids = array_map('intval', $tids);

$tid_list = implode(',', $tids);


		$moveto = (int)$moveto;


		$moveto = (int)$moveto;


		$newforum = get_forum($moveto);

if(empty($tids) || !$newforum)
{
return false;
}

		$newforum = get_forum($moveto);

if(empty($tids) || !$newforum)
{
return false;
}





		$total_posts = $total_unapproved_posts = $total_deleted_posts = $total_threads = $total_unapproved_threads = $total_deleted_threads = 0;
$forum_counters = $user_counters = array();
$query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, deletedposts, tid, uid", "tid IN ($tid_list)");

		$total_posts = $total_unapproved_posts = $total_deleted_posts = $total_threads = $total_unapproved_threads = $total_deleted_threads = 0;
$forum_counters = $user_counters = array();
$query = $db->simple_select("threads", "fid, visible, replies, unapprovedposts, deletedposts, tid, uid", "tid IN ($tid_list)");

Zeile 2249Zeile 2240
			$forum = get_forum($thread['fid']);

if(!isset($forum_counters[$thread['fid']]))

			$forum = get_forum($thread['fid']);

if(!isset($forum_counters[$thread['fid']]))

			{

			{

				$forum_counters[$thread['fid']] = array(
'posts' => 0,
'threads' => 0,

				$forum_counters[$thread['fid']] = array(
'posts' => 0,
'threads' => 0,

Zeile 2258Zeile 2249
					'deletedthreads' => 0,
'deletedposts' => 0
);

					'deletedthreads' => 0,
'deletedposts' => 0
);

			}

if(!isset($user_counters[$thread['uid']]['num_threads']))
{
$user_counters[$thread['uid']]['num_threads'] = 0;




			}

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

			}

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

			}

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

Zeile 2278Zeile 2272
				++$total_threads;

if($newforum['usethreadcounts'] == 1 && $forum['usethreadcounts'] == 0)

				++$total_threads;

if($newforum['usethreadcounts'] == 1 && $forum['usethreadcounts'] == 0)

				{

				{

					++$user_counters[$thread['uid']]['num_threads'];
}
else if($newforum['usethreadcounts'] == 0 && $forum['usethreadcounts'] == 1)

					++$user_counters[$thread['uid']]['num_threads'];
}
else if($newforum['usethreadcounts'] == 0 && $forum['usethreadcounts'] == 1)

Zeile 2296Zeile 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)