Vergleich inc/class_moderation.php - 1.8.6 - 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 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'];

				}
}
}

				}
}
}





		// Update the message
$mergepost = array(
"message" => $db->escape_string($message),
);
$db->update_query("posts", $mergepost, "pid = '{$masterpid}'");

		// Update the message
$mergepost = array(
"message" => $db->escape_string($message),
);
$db->update_query("posts", $mergepost, "pid = '{$masterpid}'");





		// Delete the extra posts
$db->delete_query("posts", "pid IN({$pidin}) AND pid != '{$masterpid}'");


		// Delete the extra posts
$db->delete_query("posts", "pid IN({$pidin}) AND pid != '{$masterpid}'");


Zeile 891Zeile 899
		// If the first post of a thread is merged out, the first should be updated
$query = $db->simple_select("threads", "tid, uid, fid, visible", "firstpost IN({$pidin}) AND firstpost != '{$masterpid}'");
while($thread = $db->fetch_array($query))

		// If the first post of a thread is merged out, the first should be updated
$query = $db->simple_select("threads", "tid, uid, fid, visible", "firstpost IN({$pidin}) AND firstpost != '{$masterpid}'");
while($thread = $db->fetch_array($query))

		{

		{

			// In some cases the first post of a thread changes
// 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='{$thread['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));

			// In some cases the first post of a thread changes
// 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='{$thread['tid']}'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 1));

Zeile 905Zeile 913
					--$thread_counters[$thread['tid']]['replies'];
}
elseif($new_firstpost['visible'] == -1)

					--$thread_counters[$thread['tid']]['replies'];
}
elseif($new_firstpost['visible'] == -1)

				{

				{

					--$thread_counters[$thread['tid']]['deletedposts'];
}
else

					--$thread_counters[$thread['tid']]['deletedposts'];
}
else

Zeile 913Zeile 921
					--$thread_counters[$thread['tid']]['unapprovedposts'];
}
if($thread['visible'] == 1)

					--$thread_counters[$thread['tid']]['unapprovedposts'];
}
if($thread['visible'] == 1)

				{

				{

					++$thread_counters[$thread['tid']]['replies'];
}
elseif($thread['visible'] == -1)

					++$thread_counters[$thread['tid']]['replies'];
}
elseif($thread['visible'] == -1)

Zeile 955Zeile 963
				);
update_thread_counters($tid, $counters);
update_last_post($tid);

				);
update_thread_counters($tid, $counters);
update_last_post($tid);

			}
}


			}
}


		if(!empty($forum_counters))
{
foreach($forum_counters as $fid => $counters)

		if(!empty($forum_counters))
{
foreach($forum_counters as $fid => $counters)

Zeile 1023Zeile 1031
			$num_posts = $thread['replies']+1;
$num_unapproved_posts = $thread['unapprovedposts'];
$num_deleted_posts = $thread['deletedposts'];

			$num_posts = $thread['replies']+1;
$num_unapproved_posts = $thread['unapprovedposts'];
$num_deleted_posts = $thread['deletedposts'];

		}

		}

		elseif($thread['visible'] == -1)

		elseif($thread['visible'] == -1)

		{

		{

			$num_deleted_threads++;
// Implied forum deleted count for deleted threads
$num_deleted_posts = $thread['replies']+$thread['deletedposts']+$thread['unapprovedposts']+1;

			$num_deleted_threads++;
// Implied forum deleted count for deleted threads
$num_deleted_posts = $thread['replies']+$thread['deletedposts']+$thread['unapprovedposts']+1;

Zeile 1036Zeile 1044
			// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1;
}

			// Implied forum unapproved count for unapproved threads
$num_unapproved_posts = $thread['replies']+$thread['unapprovedposts']+$thread['deletedposts']+1;
}





		switch($method)
{
case "redirect": // move (and leave redirect) thread

		switch($method)
{
case "redirect": // move (and leave redirect) thread

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'))
{

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

					$this->delete_thread($redirect_tid);
}
$changefid = array(

					$this->delete_thread($redirect_tid);
}
$changefid = array(

Zeile 1223Zeile 1231
							'pid' => $pid,
'uid' => $attachment['uid'],
'filename' => $db->escape_string($attachment['filename']),

							'pid' => $pid,
'uid' => $attachment['uid'],
'filename' => $db->escape_string($attachment['filename']),

							'filetype' => $attachment['filetype'],

							'filetype' => $db->escape_string($attachment['filetype']),

							'filesize' => $attachment['filesize'],

							'filesize' => $attachment['filesize'],

							'attachname' => $attachment['attachname'],

							'attachname' => $db->escape_string($attachment['attachname']),

							'downloads' => $attachment['downloads'],
'visible' => $attachment['visible'],

							'downloads' => $attachment['downloads'],
'visible' => $attachment['visible'],

							'thumbnail' => $attachment['thumbnail']

							'thumbnail' => $db->escape_string($attachment['thumbnail'])

						);
$new_aid = $db->insert_query("attachments", $attachment_array);


						);
$new_aid = $db->insert_query("attachments", $attachment_array);


Zeile 1400Zeile 1408
		$tid = (int)$tid;

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

		$tid = (int)$tid;

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

		{

		{

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

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

Zeile 1479Zeile 1487
		$threadarray["numratings"] = $new_numrating;
$threadarray["totalratings"] = $new_threadrating;
$db->update_query("threads", $threadarray, "tid = '{$tid}'");

		$threadarray["numratings"] = $new_numrating;
$threadarray["totalratings"] = $new_threadrating;
$db->update_query("threads", $threadarray, "tid = '{$tid}'");





		// Check if we have a thread subscription already for our new thread
$subscriptions = array();


		// Check if we have a thread subscription already for our new thread
$subscriptions = array();


Zeile 1519Zeile 1527

// Remove source thread subscriptions
$db->delete_query("threadsubscriptions", "tid = '{$mergetid}'");


// Remove source thread subscriptions
$db->delete_query("threadsubscriptions", "tid = '{$mergetid}'");





		$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
$plugins->run_hooks("class_moderation_merge_threads", $arguments);


		$arguments = array("mergetid" => $mergetid, "tid" => $tid, "subject" => $subject);
$plugins->run_hooks("class_moderation_merge_threads", $arguments);


Zeile 1559Zeile 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 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)
{
// Soft deleted post

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

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

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

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)
{
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 2242Zeile 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 2251Zeile 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 2271Zeile 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 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)