Vergleich inc/class_moderation.php - 1.8.6 - 1.8.18

  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 1841Zeile 1839
						'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 1930
				// 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 2020
					{
++$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 2108
		{
// 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 2127
		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 2151
					$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 2172
						"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 2253Zeile 2250
				);
}


				);
}


			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 2289
				");
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)