Vergleich inc/class_custommoderation.php - 1.8.9 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 32Zeile 32
		global $db;

// Get tool info

		global $db;

// Get tool info

		$query = $db->simple_select("modtools", "*", 'tid="'.(int)$tool_id.'"');

		$query = $db->simple_select("modtools", "*", 'tid='.(int)$tool_id);

		$tool = $db->fetch_array($query);
if(!$tool['tid'])
{

		$tool = $db->fetch_array($query);
if(!$tool['tid'])
{

Zeile 57Zeile 57
		global $db;

// Get tool info

		global $db;

// Get tool info

		$query = $db->simple_select("modtools", '*', 'tid="'.(int)$tool_id.'"');

		$query = $db->simple_select("modtools", '*', 'tid='.(int)$tool_id);

		$tool = $db->fetch_array($query);
if(!$tool['tid'])
{

		$tool = $db->fetch_array($query);
if(!$tool['tid'])
{

Zeile 82Zeile 82
		$deleted_thread = 0;
if($tool['type'] == 'p')
{

		$deleted_thread = 0;
if($tool['type'] == 'p')
{

			$deleted_thread = $this->execute_post_moderation($post_options, $pids, $tids);

			$deleted_thread = $this->execute_post_moderation($tids, $post_options, $pids);

		}
// Always execute thead moderation
$this->execute_thread_moderation($thread_options, $tids);

		}
// Always execute thead moderation
$this->execute_thread_moderation($thread_options, $tids);

Zeile 98Zeile 98
	/**
* Execute Inline Post Moderation
*

	/**
* Execute Inline Post Moderation
*

 
	 * @param array|int $tid Thread IDs (in order of dateline ascending). Only the first one will be used

	 * @param array $post_options Moderation information
* @param array $pids Post IDs

	 * @param array $post_options Moderation information
* @param array $pids Post IDs

	 * @param array|int $tid Thread IDs (in order of dateline ascending). Only the first one will be used

	 *

	 * @return boolean true
*/

	 * @return boolean true
*/

	function execute_post_moderation($post_options, $pids, $tid)

	function execute_post_moderation($tid, $post_options=array(), $pids=array())

	{

	{

		global $db, $mybb, $lang;

		global $db, $mybb, $lang, $plugins;


if(is_array($tid))
{


if(is_array($tid))
{

Zeile 113Zeile 114
			// The thread chosen is the first thread in the array of tids.
// It is recommended that this be the tid of the oldest post
}

			// The thread chosen is the first thread in the array of tids.
// It is recommended that this be the tid of the oldest post
}





		// Get the information about thread
$thread = get_thread($tid);

		// Get the information about thread
$thread = get_thread($tid);

 
		$author = get_user($thread['uid']);

$args = array(
'post_options' => &$post_options,
'pids' => &$pids,
'thread' => &$thread,
);

$plugins->run_hooks("class_custommoderation_execute_post_moderation_start", $args);


// If deleting posts, only do that
if($post_options['deleteposts'] == 1)


// If deleting posts, only do that
if($post_options['deleteposts'] == 1)

Zeile 199Zeile 209
					// Enter in a subject if a predefined one does not exist.
$post_options['splitpostsnewsubject'] = "{$lang->split_thread_subject} {$thread['subject']}";
}

					// Enter in a subject if a predefined one does not exist.
$post_options['splitpostsnewsubject'] = "{$lang->split_thread_subject} {$thread['subject']}";
}

				$new_subject = str_ireplace('{subject}', $thread['subject'], $post_options['splitpostsnewsubject']);
$new_tid = $this->split_posts($pids, $tid, $post_options['splitposts'], $new_subject);


















$find = array('{username}', '{author}', '{subject}');
$replace = array($mybb->user['username'], $author['username'], $thread['subject']);

$new_subject = str_ireplace($find, $replace, $post_options['splitpostsnewsubject']);

$args = array(
'post_options' => &$post_options,
'pids' => &$pids,
'thread' => &$thread,
'new_subject' => &$new_subject,
);

$plugins->run_hooks("class_custommoderation_splitposts", $args);

$new_thread_subject = $new_subject;
$new_tid = $this->split_posts($pids, $tid, $post_options['splitposts'], $new_thread_subject);


				if($post_options['splitpostsclose'] == 'close') // Close new thread
{
$this->close_threads($new_tid);
}
if($post_options['splitpostsstick'] == 'stick') // Stick new thread

				if($post_options['splitpostsclose'] == 'close') // Close new thread
{
$this->close_threads($new_tid);
}
if($post_options['splitpostsstick'] == 'stick') // Stick new thread

				{

				{

					$this->stick_threads($new_tid);
}
if($post_options['splitpostsunapprove'] == 'unapprove') // Unapprove new thread

					$this->stick_threads($new_tid);
}
if($post_options['splitpostsunapprove'] == 'unapprove') // Unapprove new thread

Zeile 221Zeile 247
				{
require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");

				{
require_once MYBB_ROOT."inc/datahandlers/post.php";
$posthandler = new PostDataHandler("insert");







$find = array('{username}', '{author}', '{subject}');
$replace = array($mybb->user['username'], $author['username'], $new_thread_subject);


					if(empty($post_options['splitpostsreplysubject']))
{

					if(empty($post_options['splitpostsreplysubject']))
{

						$post_options['splitpostsreplysubject'] = 'RE: '.$new_subject;

						$new_subject = 'RE: '.$new_thread_subject;

					}
else
{

					}
else
{

						$post_options['splitpostsreplysubject'] = str_ireplace('{username}', $mybb->user['username'], $post_options['splitpostsreplysubject']);
$post_options['splitpostsreplysubject'] = str_ireplace('{subject}', $new_subject, $post_options['splitpostsreplysubject']);

						$new_subject = str_ireplace($find, $replace, $post_options['splitpostsreplysubject']);


					}

					}

 

$new_message = str_ireplace($find, $replace, $post_options['splitpostsaddreply']);

$args = array(
'post_options' => &$post_options,
'pids' => &$pids,
'thread' => &$thread,
'new_subject' => &$new_subject,
'new_message' => &$new_message,
);

$plugins->run_hooks("class_custommoderation_splitpostsaddreply", $args);


// Set the post data that came from the input to the $post array.
$post = array(
"tid" => $new_tid,
"fid" => $post_options['splitposts'],


// Set the post data that came from the input to the $post array.
$post = array(
"tid" => $new_tid,
"fid" => $post_options['splitposts'],

						"subject" => $post_options['splitpostsreplysubject'],
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $post_options['splitpostsaddreply'],
"ipaddress" => my_inet_pton(get_ip()),
);
// Set up the post options from the input.
$post['options'] = array(
"signature" => 1,
"emailnotify" => 0,
"disablesmilies" => 0

						"subject" => $new_subject,
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $new_message,
"ipaddress" => my_inet_pton(get_ip()),
);
// Set up the post options from the input.
$post['options'] = array(
"signature" => 1,
"emailnotify" => 0,
"disablesmilies" => 0

					);

$posthandler->set_data($post);

					);

$posthandler->set_data($post);





					if($posthandler->validate_post($post))
{
$posthandler->insert_post($post);

					if($posthandler->validate_post($post))
{
$posthandler->insert_post($post);

Zeile 258Zeile 298
				}
}
}

				}
}
}

 

$args = array(
'post_options' => &$post_options,
'pids' => &$pids,
'thread' => &$thread,
);

$plugins->run_hooks("class_custommoderation_execute_post_moderation_end", $args);


		return true;
}


		return true;
}


Zeile 268Zeile 317
	 * @param array Thread IDs. Only the first one will be used, but it needs to be an array
* @return boolean true
*/

	 * @param array Thread IDs. Only the first one will be used, but it needs to be an array
* @return boolean true
*/

	function execute_thread_moderation($thread_options, $tids)

	function execute_thread_moderation($thread_options=array(), $tids=array())

	{

	{

		global $db, $mybb;


		global $db, $mybb, $plugins;


		$tid = (int)$tids[0]; // Take the first thread to get thread data from
$query = $db->simple_select("threads", 'fid', "tid='$tid'");
$thread = $db->fetch_array($query);

		$tid = (int)$tids[0]; // Take the first thread to get thread data from
$query = $db->simple_select("threads", 'fid', "tid='$tid'");
$thread = $db->fetch_array($query);

 

$args = array(
'thread_options' => &$thread_options,
'tids' => &$tids,
'thread' => &$thread,
);

$plugins->run_hooks("class_custommoderation_execute_thread_moderation_start", $args);


// If deleting threads, only do that
if($thread_options['deletethread'] == 1)


// If deleting threads, only do that
if($thread_options['deletethread'] == 1)

Zeile 341Zeile 398
			elseif($thread_options['softdeletethread'] == 'restore') // Restore thread
{
$this->restore_threads($tids);

			elseif($thread_options['softdeletethread'] == 'restore') // Restore thread
{
$this->restore_threads($tids);

			}

			}

			elseif($thread_options['softdeletethread'] == 'toggle') // Toggle thread visibility
{
$this->toggle_thread_softdelete($tids);

			elseif($thread_options['softdeletethread'] == 'toggle') // Toggle thread visibility
{
$this->toggle_thread_softdelete($tids);

Zeile 385Zeile 442
			if(!empty($thread_options['addreply'])) // Add reply to thread
{
$tid_list = implode(',', $tids);

			if(!empty($thread_options['addreply'])) // Add reply to thread
{
$tid_list = implode(',', $tids);

				$query = $db->simple_select("threads", 'uid, fid, subject, tid, firstpost, closed', "tid IN ($tid_list) AND closed NOT LIKE 'moved|%'");





				$query = $db->query("
SELECT u.uid, u.username, t.fid, t.subject, t.tid, t.firstpost, t.closed FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON t.uid=u.uid
WHERE tid IN ($tid_list) AND closed NOT LIKE 'moved|%'
");

				require_once MYBB_ROOT."inc/datahandlers/post.php";

// Loop threads adding a reply to each one
while($thread = $db->fetch_array($query))
{
$posthandler = new PostDataHandler("insert");

				require_once MYBB_ROOT."inc/datahandlers/post.php";

// Loop threads adding a reply to each one
while($thread = $db->fetch_array($query))
{
$posthandler = new PostDataHandler("insert");

 

$find = array('{username}', '{author}', '{subject}');
$replace = array($mybb->user['username'], $thread['username'], $thread['subject']);


if(empty($thread_options['replysubject']))
{
$new_subject = 'RE: '.$thread['subject'];
}
else


if(empty($thread_options['replysubject']))
{
$new_subject = 'RE: '.$thread['subject'];
}
else

					{
$new_subject = str_ireplace('{username}', $mybb->user['username'], $thread_options['replysubject']);
$new_subject = str_ireplace('{subject}', $thread['subject'], $new_subject);

					{
$new_subject = str_ireplace($find, $replace, $thread_options['replysubject']);


					}

					}

 

$new_message = str_ireplace($find, $replace, $thread_options['addreply']);

$args = array(
'thread_options' => &$thread_options,
'tids' => &$tids,
'thread' => &$thread,
'new_subject' => &$new_subject,
'new_message' => &$new_message,
);

$plugins->run_hooks("class_custommoderation_addreply", $args);


// Set the post data that came from the input to the $post array.
$post = array(


// Set the post data that came from the input to the $post array.
$post = array(

Zeile 411Zeile 486
						"subject" => $new_subject,
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],

						"subject" => $new_subject,
"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],

						"message" => $thread_options['addreply'],

						"message" => $new_message,

						"ipaddress" => my_inet_pton(get_ip()),
);


						"ipaddress" => my_inet_pton(get_ip()),
);


Zeile 438Zeile 513
			if($thread_options['movethread'] > 0 && $thread_options['movethread'] != $thread['fid']) // Move thread
{
if($thread_options['movethreadredirect'] == 1) // Move Thread with redirect

			if($thread_options['movethread'] > 0 && $thread_options['movethread'] != $thread['fid']) // Move thread
{
if($thread_options['movethreadredirect'] == 1) // Move Thread with redirect

				{

				{

					$time = TIME_NOW + ($thread_options['movethreadredirectexpire'] * 86400);
foreach($tids as $tid)
{
$this->move_thread($tid, $thread_options['movethread'], 'redirect', $time);
}

					$time = TIME_NOW + ($thread_options['movethreadredirectexpire'] * 86400);
foreach($tids as $tid)
{
$this->move_thread($tid, $thread_options['movethread'], 'redirect', $time);
}

				}

				}

				else // Normal move
{
$this->move_threads($tids, $thread_options['movethread']);

				else // Normal move
{
$this->move_threads($tids, $thread_options['movethread']);

Zeile 455Zeile 530
				if($thread_options['copythread'] == -2)
{
$thread_options['copythread'] = $thread['fid'];

				if($thread_options['copythread'] == -2)
{
$thread_options['copythread'] = $thread['fid'];

				}
foreach($tids as $tid)

				}
foreach($tids as $tid)

				{
$new_tid = $this->move_thread($tid, $thread_options['copythread'], 'copy');
}

				{
$new_tid = $this->move_thread($tid, $thread_options['copythread'], 'copy');
}

Zeile 478Zeile 553
			$tid_list = implode(',', $tids);

// For each thread, we send a PM to the author

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

// For each thread, we send a PM to the author

			$query = $db->simple_select("threads", 'uid', "tid IN ($tid_list)");
while($uid = $db->fetch_field($query, 'uid'))





			$query = $db->query("
SELECT u.uid, u.username, t.subject FROM ".TABLE_PREFIX."threads t
LEFT JOIN ".TABLE_PREFIX."users u ON t.uid=u.uid
WHERE tid IN ($tid_list)
");
while($thread = $db->fetch_array($query))

			{

			{

 
				$find = array('{username}', '{author}', '{subject}');
$replace = array($mybb->user['username'], $thread['username'], $thread['subject']);

$pm_subject = str_ireplace($find, $replace, $thread_options['pm_subject']);
$pm_message = str_ireplace($find, $replace, $thread_options['pm_message']);

$args = array(
'thread_options' => &$thread_options,
'tids' => &$tids,
'thread' => &$thread,
'pm_subject' => &$pm_subject,
'pm_message' => &$pm_message,
);

$plugins->run_hooks("class_custommoderation_pm", $args);


				// Let's send our PM
$pm = array(

				// Let's send our PM
$pm = array(

					'subject' => $thread_options['pm_subject'],
'message' => $thread_options['pm_message'],
'touid' => $uid

					'subject' => $pm_subject,
'message' => $pm_message,
'touid' => $thread['uid']

				);
send_pm($pm, $mybb->user['uid'], 1);
}
}

				);
send_pm($pm, $mybb->user['uid'], 1);
}
}

 

$args = array(
'thread_options' => &$thread_options,
'tids' => &$tids,
'thread' => &$thread,
);

$plugins->run_hooks("class_custommoderation_execute_thread_moderation_end", $args);

		
return true;
}

		
return true;
}