Vergleich inc/class_custommoderation.php - 1.2.5 - 1.2.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 3Zeile 3
 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * MyBB 1.2
* Copyright � 2006 MyBB Group, All Rights Reserved
*

 * Website: http://www.mybboard.com
* License: http://www.mybboard.com/eula.html

 * Website: http://www.mybboard.net
* License: http://www.mybboard.net/eula.html

 *
* $Id$
*/

 *
* $Id$
*/

Zeile 16Zeile 16

class CustomModeration extends Moderation
{


class CustomModeration extends Moderation
{

	/**
* The thread IDs and forum IDs to be updated
*/
var $update_tids = array();
var $update_fids = array();


 
	/**
* Get info on a tool
*

	/**
* Get info on a tool
*

Zeile 31Zeile 25
	 * @return mixed Returns tool data (tid, type, name, description) in an array, otherwise boolean false.
*/
function tool_info($tool_id)

	 * @return mixed Returns tool data (tid, type, name, description) in an array, otherwise boolean false.
*/
function tool_info($tool_id)

	{
global $db;


	{
global $db;


		// Get tool info
$query = $db->simple_select(TABLE_PREFIX."modtools", 'tid, type, name, description', 'tid="'.intval($tool_id).'"');

		// Get tool info
$query = $db->simple_select(TABLE_PREFIX."modtools", 'tid, type, name, description', 'tid="'.intval($tool_id).'"');

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

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

		}
else
{

		}
else
{

Zeile 65Zeile 59
		if(!$tool['tid'])
{
return false;

		if(!$tool['tid'])
{
return false;

		}

		}


// Format single tid and pid
if(!is_array($tids))


// Format single tid and pid
if(!is_array($tids))

Zeile 75Zeile 69
		if(!is_array($pids))
{
$pids = array($pids);

		if(!is_array($pids))
{
$pids = array($pids);

		}

		}


// Unserialize custom moderation
$post_options = unserialize($tool['postoptions']);
$thread_options = unserialize($tool['threadoptions']);


// Unserialize custom moderation
$post_options = unserialize($tool['postoptions']);
$thread_options = unserialize($tool['threadoptions']);





		// If the tool type is a post tool, then execute the post moderation
if($tool['type'] == 'p')
{
$this->execute_post_moderation($post_options, $pids, $tids);

		// If the tool type is a post tool, then execute the post moderation
if($tool['type'] == 'p')
{
$this->execute_post_moderation($post_options, $pids, $tids);

		}

		}

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

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


// Update counts
$this->update_counts();

 

// If the thread is deleted, indicate to the calling script to redirect to the forum, and not the nonexistant thread
if($thread_options['deletethread'] == 'yes')


// If the thread is deleted, indicate to the calling script to redirect to the forum, and not the nonexistant thread
if($thread_options['deletethread'] == 'yes')

Zeile 109Zeile 100
	 * @return boolean true
*/
function execute_post_moderation($post_options, $pids, $tid)

	 * @return boolean true
*/
function execute_post_moderation($post_options, $pids, $tid)

	{
global $db, $mybb;


	{
global $db, $mybb;


		if(is_array($tid))
{
$tid = intval($tid[0]); // There's only 1 thread when doing inline post moderation
}

		if(is_array($tid))
{
$tid = intval($tid[0]); // There's only 1 thread when doing inline post moderation
}


$this->update_tids[$tid] = 1;

 

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


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

		$this->update_fids[$thread['fid']] = 1;

 

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


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

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

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

				$this->update_tids[$new_tid] = 1;
$this->update_fids[$post_options['splitposts']] = 1;

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

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

Zeile 196Zeile 182
						"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $post_options['splitpostsaddreply'],

						"uid" => $mybb->user['uid'],
"username" => $mybb->user['username'],
"message" => $post_options['splitpostsaddreply'],

						"ipaddress" => $db->escape_string(get_ip()),
);
// Set up the post options from the input.
$post['options'] = array(

						"ipaddress" => $db->escape_string(get_ip()),
);
// Set up the post options from the input.
$post['options'] = array(

						"signature" => 'yes',
"emailnotify" => 'no',
"disablesmilies" => 'no'

						"signature" => 'yes',
"emailnotify" => 'no',
"disablesmilies" => 'no'

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

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


$this->update_fids[$thread['fid']] = 1;

 

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


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

Zeile 243Zeile 227
			}
}
else

			}
}
else

		{

		{

			if($thread_options['mergethreads'] == 'yes' && count($tids) > 1) // Merge Threads (ugly temp code until find better fix)
{
$tid_list = implode(',', $tids);

			if($thread_options['mergethreads'] == 'yes' && count($tids) > 1) // Merge Threads (ugly temp code until find better fix)
{
$tid_list = implode(',', $tids);

Zeile 257Zeile 241
						$this->merge_threads($last_tid, $tid['tid'], $tid['subject']); // And keep merging them until we get down to one thread. 
}
$last_tid = $tid['tid'];

						$this->merge_threads($last_tid, $tid['tid'], $tid['subject']); // And keep merging them until we get down to one thread. 
}
$last_tid = $tid['tid'];

				}
}

				}
}

			if($thread_options['deletepoll'] == 'yes') // Delete poll
{
foreach($tids as $tid)

			if($thread_options['deletepoll'] == 'yes') // Delete poll
{
foreach($tids as $tid)

Zeile 279Zeile 263
				$this->approve_threads($tids, $thread['fid']);
}
elseif($thread_options['approvethread'] == 'unapprove') // Unapprove thread

				$this->approve_threads($tids, $thread['fid']);
}
elseif($thread_options['approvethread'] == 'unapprove') // Unapprove thread

			{

			{

				$this->unapprove_threads($tids, $thread['fid']);

				$this->unapprove_threads($tids, $thread['fid']);

			}

			}

			elseif($thread_options['approvethread'] == 'toggle') // Toggle thread visibility
{
$this->toggle_thread_visibility($tids, $thread['fid']);

			elseif($thread_options['approvethread'] == 'toggle') // Toggle thread visibility
{
$this->toggle_thread_visibility($tids, $thread['fid']);

			}

			}


if($thread_options['openthread'] == 'open') // Open thread
{
$this->open_threads($tids);


if($thread_options['openthread'] == 'open') // Open thread
{
$this->open_threads($tids);

			}

			}

			elseif($thread_options['openthread'] == 'close') // Close thread
{
$this->close_threads($tids);

			elseif($thread_options['openthread'] == 'close') // Close thread
{
$this->close_threads($tids);

Zeile 311Zeile 295
					}
}
else // Normal move

					}
}
else // Normal move

				{

				{

					$this->move_threads($tids, $thread_options['movethread']);
}

					$this->move_threads($tids, $thread_options['movethread']);
}

				$this->update_fids[$thread_options['movethread']] = 1;

 
			}
if($thread_options['copythread'] > 0 || $thread_options['copythread'] == -2) // Copy thread

			}
if($thread_options['copythread'] > 0 || $thread_options['copythread'] == -2) // Copy thread

			{

			{

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

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

				//var_dump($tids);

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

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

					$this->update_tids[$new_tid] = 1;

 
				}

				}

				$this->update_fids[$thread_options['copythread']] = 1;

 
			}
if(trim($thread_options['newsubject']) != '{subject}') // Update thread subjects

			}
if(trim($thread_options['newsubject']) != '{subject}') // Update thread subjects

			{

			{

				$this->change_thread_subject($tids, $thread_options['newsubject']);
}
if(!empty($thread_options['addreply'])) // Add reply to thread

				$this->change_thread_subject($tids, $thread_options['newsubject']);
}
if(!empty($thread_options['addreply'])) // Add reply to thread

Zeile 374Zeile 354
					}
}
}

					}
}
}

		}
foreach($tids as $tid)
{
$this->update_tids[$tid] = 1;
}
return true;
}

/**
* Update Forum/Thread Counts
*
* @return boolean true
*/
function update_counts()
{
global $db;
foreach($this->update_tids as $tid => $val)
{
update_thread_count($tid);
}
foreach($this->update_fids as $fid => $val)
{
update_forum_count($fid);

 
		}
return true;
}

		}
return true;
}