Vergleich inc/datahandlers/post.php - 1.6.10 - 1.6.11

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 146Zeile 146
		$post = &$this->data;
$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);

		$post = &$this->data;
$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);

 
		$subject = utf8_handle_4byte_string($subject);


// Are we editing an existing thread or post?
if($this->method == "update" && $post['pid'])


// Are we editing an existing thread or post?
if($this->method == "update" && $post['pid'])

Zeile 239Zeile 240

$post = &$this->data;
$post['message'] = trim_blank_chrs($post['message']);


$post = &$this->data;
$post['message'] = trim_blank_chrs($post['message']);

 
		$post['message'] = utf8_handle_4byte_string($post['message']);


// Do we even have a message at all?
if(my_strlen($post['message']) == 0)


// Do we even have a message at all?
if(my_strlen($post['message']) == 0)

Zeile 297Zeile 299
			{
return true;
}

			{
return true;
}

			



			// Fetch the user information for this post - used to check their last post date.
$user = get_user($post['uid']);


			// Fetch the user information for this post - used to check their last post date.
$user = get_user($post['uid']);


Zeile 320Zeile 322
		// All is well that ends well - return true.
return true;
}

		// All is well that ends well - return true.
return true;
}

	



	function verify_post_merge($simple_mode=false)
{
global $mybb, $db, $session;

	function verify_post_merge($simple_mode=false)
{
global $mybb, $db, $session;

		



		$post = &$this->data;

		$post = &$this->data;

		



		// Are we starting a new thread?
if(!$post['tid'])

		// Are we starting a new thread?
if(!$post['tid'])

		{
return true;
}


		{
return true;
}


		// Are we even turned on?
if(empty($mybb->settings['postmergemins']))
{
return true;
}

		// Are we even turned on?
if(empty($mybb->settings['postmergemins']))
{
return true;
}

		



		// Assign a default separator if none is specified
if(trim($mybb->settings['postmergesep']) == "")
{
$mybb->settings['postmergesep'] = "[hr]";
}

		// Assign a default separator if none is specified
if(trim($mybb->settings['postmergesep']) == "")
{
$mybb->settings['postmergesep'] = "[hr]";
}

		



		// Check to see if this person is in a usergroup that is excluded
if(trim($mybb->settings['postmergeuignore']) != "")

		// Check to see if this person is in a usergroup that is excluded
if(trim($mybb->settings['postmergeuignore']) != "")

		{

		{

			$gids = explode(',', $mybb->settings['postmergeuignore']);
$gids = array_map('intval', $gids);

			$gids = explode(',', $mybb->settings['postmergeuignore']);
$gids = array_map('intval', $gids);

			





			$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);
if(count(array_intersect($user_usergroups, $gids)) > 0)
{
return true;

			$user_usergroups = explode(',', $mybb->user['usergroup'].",".$mybb->user['additionalgroups']);
if(count(array_intersect($user_usergroups, $gids)) > 0)
{
return true;

			}			

			}

		}

		}

		



		// Select the lastpost and fid information for this thread
$query = $db->simple_select("threads", "lastpost,fid", "lastposteruid='".$post['uid']."' AND tid='".$post['tid']."'", array('limit' => '1'));
$thread = $db->fetch_array($query);

		// Select the lastpost and fid information for this thread
$query = $db->simple_select("threads", "lastpost,fid", "lastposteruid='".$post['uid']."' AND tid='".$post['tid']."'", array('limit' => '1'));
$thread = $db->fetch_array($query);

		



		// Check to see if the same author has posted within the merge post time limit
if((intval($mybb->settings['postmergemins']) != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > (intval($mybb->settings['postmergemins'])*60))
{
return true;
}

		// Check to see if the same author has posted within the merge post time limit
if((intval($mybb->settings['postmergemins']) != 0 && trim($mybb->settings['postmergemins']) != "") && (TIME_NOW-$thread['lastpost']) > (intval($mybb->settings['postmergemins'])*60))
{
return true;
}

		



		if(strstr($mybb->settings['postmergefignore'], ','))
{
$fids = explode(',', $mybb->settings['postmergefignore']);

		if(strstr($mybb->settings['postmergefignore'], ','))
{
$fids = explode(',', $mybb->settings['postmergefignore']);

Zeile 376Zeile 378
			{
$fid[] = intval($forumid);
}

			{
$fid[] = intval($forumid);
}

			



			if(in_array($thread['fid'], $fid))
{
return true;
}

			if(in_array($thread['fid'], $fid))
{
return true;
}

			
}


}

		else if(trim($mybb->settings['postmergefignore']) != "" && $thread['fid'] == intval($mybb->settings['postmergefignore']))

		else if(trim($mybb->settings['postmergefignore']) != "" && $thread['fid'] == intval($mybb->settings['postmergefignore']))

		{

		{

			return true;

			return true;

		}


		}


		if($simple_mode == true)
{
return false;
}

		if($simple_mode == true)
{
return false;
}

		



		if($post['uid'])
{
$user_check = "uid='".$post['uid']."'";

		if($post['uid'])
{
$user_check = "uid='".$post['uid']."'";

Zeile 401Zeile 403
		{
$user_check = "ipaddress='".$db->escape_string($session->ipaddress)."'";
}

		{
$user_check = "ipaddress='".$db->escape_string($session->ipaddress)."'";
}

		



		$query = $db->simple_select("posts", "pid,message,visible", "{$user_check} AND tid='".$post['tid']."' AND dateline='".$thread['lastpost']."'", array('order_by' => 'pid', 'order_dir' => 'DESC', 'limit' => 1));
return $db->fetch_array($query);
}

		$query = $db->simple_select("posts", "pid,message,visible", "{$user_check} AND tid='".$post['tid']."' AND dateline='".$thread['lastpost']."'", array('order_by' => 'pid', 'order_dir' => 'DESC', 'limit' => 1));
return $db->fetch_array($query);
}





	/**
* Verifies the image count.
*
* @return boolean True when valid, false when not valid.
*/
function verify_image_count()

	/**
* Verifies the image count.
*
* @return boolean True when valid, false when not valid.
*/
function verify_image_count()

	{
global $mybb, $db;


	{
global $mybb, $db;


		$post = &$this->data;

// Get the permissions of the user who is making this post or thread

		$post = &$this->data;

// Get the permissions of the user who is making this post or thread

Zeile 464Zeile 466
			}
}
}

			}
}
}

	



	/**
* Verifies the video count.
*

	/**
* Verifies the video count.
*

Zeile 473Zeile 475
	function verify_video_count()
{
global $mybb, $db;

	function verify_video_count()
{
global $mybb, $db;


$post = &$this->data;



$post = &$this->data;


		// Get the permissions of the user who is making this post or thread
$permissions = user_permissions($post['uid']);


		// Get the permissions of the user who is making this post or thread
$permissions = user_permissions($post['uid']);


Zeile 483Zeile 485
		if($post['savedraft'] != 1 && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)
{
// And count the number of video tags in the message.

		if($post['savedraft'] != 1 && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)
{
// And count the number of video tags in the message.

			$video_count = substr_count($post['message'], "[video]");

			$video_count = substr_count($post['message'], "[video=");

			if($video_count > $mybb->settings['maxpostvideos'])
{
// Throw back a message if over the count with the number of images as well as the maximum number of images per post.
$this->set_error("too_many_videos", array(1 => $video_count, 2 => $mybb->settings['maxpostvideos']));
return false;

			if($video_count > $mybb->settings['maxpostvideos'])
{
// Throw back a message if over the count with the number of images as well as the maximum number of images per post.
$this->set_error("too_many_videos", array(1 => $video_count, 2 => $mybb->settings['maxpostvideos']));
return false;

			}
}
}

			}
}
}


/**
* Verify the reply-to post.


/**
* Verify the reply-to post.

Zeile 550Zeile 552
		if(!$post['icon'] || $post['icon'] < 0)
{
$post['icon'] = 0;

		if(!$post['icon'] || $post['icon'] < 0)
{
$post['icon'] = 0;

		}
return true;

		}
return true;

	}

/**

	}

/**

Zeile 569Zeile 571
			$dateline = TIME_NOW;
}
}

			$dateline = TIME_NOW;
}
}

	



	/**
* Verify thread prefix.

	/**
* Verify thread prefix.

	 * 

	 *

	 * @return boolean True when valid, false when not valid.
*/
function verify_prefix()
{
$prefix = &$this->data['prefix'];

	 * @return boolean True when valid, false when not valid.
*/
function verify_prefix()
{
$prefix = &$this->data['prefix'];

		



		// If a valid prefix isn't supplied, don't assign one.
if(!$prefix || $prefix < 1)
{
$prefix = 0;
}

		// If a valid prefix isn't supplied, don't assign one.
if(!$prefix || $prefix < 1)
{
$prefix = 0;
}

		



		return true;
}


		return true;
}


Zeile 599Zeile 601

$post = &$this->data;
$time = TIME_NOW;


$post = &$this->data;
$time = TIME_NOW;

		



		$this->action = "post";

		$this->action = "post";

		



		if($this->method != "update" && !$post['savedraft'])
{
$this->verify_post_flooding();

		if($this->method != "update" && !$post['savedraft'])
{
$this->verify_post_flooding();

Zeile 681Zeile 683
		{
die("The post is not valid.");
}

		{
die("The post is not valid.");
}

		



		// Fetch the thread
$thread = get_thread($post['tid']);

// This post is being saved as a draft.
if($post['savedraft'])

		// Fetch the thread
$thread = get_thread($post['tid']);

// This post is being saved as a draft.
if($post['savedraft'])

		{

		{

			$visible = -2;
}

			$visible = -2;
}

		



		// Otherwise this post is being made now and we have a bit to do.
else
{

		// Otherwise this post is being made now and we have a bit to do.
else
{

Zeile 698Zeile 700
			if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
{
switch($post['options']['subscriptionmethod'])

			if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
{
switch($post['options']['subscriptionmethod'])

				{

				{

					case "instant":
$notification = 1;
break;

					case "instant":
$notification = 1;
break;

Zeile 728Zeile 730

// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)


// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)

				{

				{

					$newclosed = "closed=0";
log_moderator_action($modlogdata, $lang->thread_opened);
}

					$newclosed = "closed=0";
log_moderator_action($modlogdata, $lang->thread_opened);
}

Zeile 743Zeile 745
				// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])
{

				// Unstick the thread.
if($modoptions['stickthread'] != 1 && $thread['sticky'])
{

					$newstick = "sticky='0'";					

					$newstick = "sticky='0'";

					log_moderator_action($modlogdata, $lang->thread_unstuck);
}


					log_moderator_action($modlogdata, $lang->thread_unstuck);
}


Zeile 773Zeile 775
			else
{
$visible = 1;

			else
{
$visible = 1;

			}


			}


			// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $post['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;
}
}

			// Are posts from this user being moderated? Change visibility
if($mybb->user['uid'] == $post['uid'] && $mybb->user['moderateposts'] == 1)
{
$visible = 0;
}
}

		



		$post['pid'] = intval($post['pid']);
$post['uid'] = intval($post['uid']);


		$post['pid'] = intval($post['pid']);
$post['uid'] = intval($post['uid']);


Zeile 794Zeile 796
		{
$draft_check = false;
}

		{
$draft_check = false;
}

		



		if($this->method != "update" && $visible == 1)
{
$double_post = $this->verify_post_merge();

		if($this->method != "update" && $visible == 1)
{
$double_post = $this->verify_post_merge();

Zeile 803Zeile 805
			if($double_post !== true && $double_post['visible'] == $visible)
{
$this->pid = $double_post['pid'];

			if($double_post !== true && $double_post['visible'] == $visible)
{
$this->pid = $double_post['pid'];

				



				$post['message'] = $double_post['message'] .= "\n".$mybb->settings['postmergesep']."\n".$post['message'];
$update_query = array(
"message" => $db->escape_string($double_post['message'])

				$post['message'] = $double_post['message'] .= "\n".$mybb->settings['postmergesep']."\n".$post['message'];
$update_query = array(
"message" => $db->escape_string($double_post['message'])

				);

				);

				$update_query['edituid'] = intval($post['uid']);
$update_query['edittime'] = TIME_NOW;
$query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");

				$update_query['edituid'] = intval($post['uid']);
$update_query['edittime'] = TIME_NOW;
$query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");

				



				if($draft_check)

				if($draft_check)

				{

				{

					$db->delete_query("posts", "pid='".$post['pid']."'");

					$db->delete_query("posts", "pid='".$post['pid']."'");

				}

// Assign any uploaded attachments with the specific posthash to the merged post.
$post['posthash'] = $db->escape_string($post['posthash']);

$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");

if($attachmentcount > 0)

				}

if($post['posthash'])







				{

				{

					// Update forum count
update_thread_counters($post['tid'], array('attachmentcount' => "+{$attachmentcount}"));
















					// Assign any uploaded attachments with the specific posthash to the merged post.
$post['posthash'] = $db->escape_string($post['posthash']);

$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='0' AND visible='1' AND posthash='{$post['posthash']}'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");

if($attachmentcount > 0)
{
// Update forum count
update_thread_counters($post['tid'], array('attachmentcount' => "+{$attachmentcount}"));
}

$attachmentassign = array(
"pid" => $double_post['pid'],
"posthash" => ''
);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");

				}

				}

				
$attachmentassign = array(
"pid" => $double_post['pid'],
"posthash" => ''
);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}'");










				// Return the post's pid and whether or not it is visible.
return array(
"pid" => $double_post['pid'],

				// Return the post's pid and whether or not it is visible.
return array(
"pid" => $double_post['pid'],

Zeile 842Zeile 847
				);
}
}

				);
}
}

		



		if($visible == 1 && $thread['visible'] == 1)
{
$now = TIME_NOW;

		if($visible == 1 && $thread['visible'] == 1)
{
$now = TIME_NOW;





			// Yes, the value to the lastpost key in this array has single quotes within double quotes. It's not a bug.
$update_array = array(
'lastpost' => "'{$now}'"

			// Yes, the value to the lastpost key in this array has single quotes within double quotes. It's not a bug.
$update_array = array(
'lastpost' => "'{$now}'"

Zeile 855Zeile 860
			{
$update_array['postnum'] = 'postnum+1';
}

			{
$update_array['postnum'] = 'postnum+1';
}

			



			$db->update_query("users", $update_array, "uid='{$post['uid']}'", 1, true);

			$db->update_query("users", $update_array, "uid='{$post['uid']}'", 1, true);

		}

		}


// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)


// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)

Zeile 869Zeile 874
				"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => intval($post['dateline']),

				"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => intval($post['dateline']),

				"message" => $db->escape_string($post['message']),
"ipaddress" => $db->escape_string($post['ipaddress']),
"longipaddress" => intval(my_ip2long($post['ipaddress'])),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],

				"message" => $db->escape_string($post['message']),
"ipaddress" => $db->escape_string($post['ipaddress']),
"longipaddress" => intval(my_ip2long($post['ipaddress'])),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],

				"visible" => $visible
);


				"visible" => $visible
);


Zeile 905Zeile 910
			$plugins->run_hooks("datahandler_post_insert_post", $this);

$this->pid = $db->insert_query("posts", $this->post_insert_data);

			$plugins->run_hooks("datahandler_post_insert_post", $this);

$this->pid = $db->insert_query("posts", $this->post_insert_data);

		}

		}


// Assign any uploaded attachments with the specific posthash to the newly created post.
if($post['posthash'])


// Assign any uploaded attachments with the specific posthash to the newly created post.
if($post['posthash'])

Zeile 915Zeile 920
				"pid" => $this->pid,
"posthash" => ''
);

				"pid" => $this->pid,
"posthash" => ''
);

			$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}'");

			$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");

		}

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

		}

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

Zeile 923Zeile 928
			$thread = get_thread($post['tid']);
require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new Postparser;

			$thread = get_thread($post['tid']);
require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new Postparser;

			



			$done_users = array();

			$done_users = array();

			



			$subject = $parser->parse_badwords($thread['subject']);
$excerpt = $parser->text_parse_message($post['message'], array('me_username' => $post['username'], 'filter_badwords' => 1, 'safe_html' => 1));
$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

			$subject = $parser->parse_badwords($thread['subject']);
$excerpt = $parser->text_parse_message($post['message'], array('me_username' => $post['username'], 'filter_badwords' => 1, 'safe_html' => 1));
$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

Zeile 946Zeile 951
					continue;
}
$done_users[$subscribedmember['uid']] = 1;

					continue;
}
$done_users[$subscribedmember['uid']] = 1;

				



				$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)

				$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)

				{

				{

				    continue;

				    continue;

				}


				}


				if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid']))
{
// User isn't a moderator or the author of the thread...
continue;
}

				if($thread['uid'] != $subscribedmember['uid'] && $forumpermissions['canonlyviewownthread'] == 1 && !is_moderator($thread['fid'], "", $subscribedmember['uid']))
{
// User isn't a moderator or the author of the thread...
continue;
}

				



				if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
{
$uselang = $subscribedmember['language'];

				if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
{
$uselang = $subscribedmember['language'];

Zeile 993Zeile 998
					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

					$emailmessage = $langcache[$uselang]['email_subscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $subject);

				
$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);


$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);

				$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&amp;", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);
$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),

				$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&amp;", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);
$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),

Zeile 1030Zeile 1035
			// Update the unapproved posts count for the current forum
update_thread_counters($post['tid'], array("replies" => "+1"));
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));

			// Update the unapproved posts count for the current forum
update_thread_counters($post['tid'], array("replies" => "+1"));
update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));

		}


		}


		$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)

		$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)

Zeile 1058Zeile 1063
		$thread = &$this->data;

// Validate all thread assets.

		$thread = &$this->data;

// Validate all thread assets.

		



		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

Zeile 1068Zeile 1073
		{
$this->verify_author();
}

		{
$this->verify_author();
}

		



		if($this->method == "insert" || array_key_exists('prefix', $thread))
{
$this->verify_prefix();

		if($this->method == "insert" || array_key_exists('prefix', $thread))
{
$this->verify_prefix();

Zeile 1287Zeile 1292
			if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
{
$lang->load($this->language_file, true);

			if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
{
$lang->load($this->language_file, true);

				



				$modoptions = $thread['modoptions'];
$modlogdata['fid'] = $this->tid;
$modlogdata['tid'] = $thread['tid'];

				$modoptions = $thread['modoptions'];
$modlogdata['fid'] = $this->tid;
$modlogdata['tid'] = $thread['tid'];

Zeile 1345Zeile 1350
						$db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true);
}
}

						$db->update_query("users", $update_query, "uid='{$thread['uid']}'", 1, true);
}
}

				



				if(!$forum['lastpost'])
{
$forum['lastpost'] = 0;
}

				if(!$forum['lastpost'])
{
$forum['lastpost'] = 0;
}

				



				$done_users = array();

				$done_users = array();

				



				// Queue up any forum subscription notices to users who are subscribed to this forum.
$excerpt = my_substr($thread['message'], 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

				// Queue up any forum subscription notices to users who are subscribed to this forum.
$excerpt = my_substr($thread['message'], 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

				



				// Parse badwords
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

				// Parse badwords
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

Zeile 1378Zeile 1383
						continue;
}
$done_users[$subscribedmember['uid']] = 1;

						continue;
}
$done_users[$subscribedmember['uid']] = 1;

					



					$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{

					$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{

Zeile 1426Zeile 1431
						$emailmessage = $langcache[$uselang]['email_forumsubscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $forum['name']);

						$emailmessage = $langcache[$uselang]['email_forumsubscription'];
}
$emailsubject = $lang->sprintf($emailsubject, $forum['name']);

					



					$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid'], $post_code);
$new_email = array(

					$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $thread['username'], $forum['name'], $mybb->settings['bbname'], $thread['subject'], $excerpt, $mybb->settings['bburl'], get_thread_link($this->tid), $thread['fid'], $post_code);
$new_email = array(

Zeile 1456Zeile 1461
				"pid" => $this->pid,
"posthash" => ''
);

				"pid" => $this->pid,
"posthash" => ''
);

			$db->update_query("attachments", $attachmentassign, "posthash='{$thread['posthash']}'");

			$db->update_query("attachments", $attachmentassign, "posthash='{$thread['posthash']}' AND pid='0'");

		}

		}

		



		if($visible == 1)
{
update_thread_data($this->tid);

		if($visible == 1)
{
update_thread_data($this->tid);

Zeile 1470Zeile 1475
			update_thread_counters($this->tid, array("replies" => 0));
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
}

			update_thread_counters($this->tid, array("replies" => 0));
update_forum_counters($thread['fid'], array("unapprovedthreads" => "+1", "unapprovedposts" => "+1"));
}

		



		$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)

		$query = $db->simple_select("attachments", "COUNT(aid) AS attachmentcount", "pid='{$this->pid}' AND visible='1'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");
if($attachmentcount > 0)

Zeile 1483Zeile 1488
			"pid" => $this->pid,
"tid" => $this->tid,
"visible" => $visible

			"pid" => $this->pid,
"tid" => $this->tid,
"visible" => $visible

		);

		);

	}

	}





	/**
* Updates a post that is already in the database.
*

	/**
* Updates a post that is already in the database.
*

Zeile 1502Zeile 1507
		if(count($this->get_errors()) > 0)
{
die("The post is not valid.");

		if(count($this->get_errors()) > 0)
{
die("The post is not valid.");

		}


		}


		$post = &$this->data;

$post['pid'] = intval($post['pid']);

		$post = &$this->data;

$post['pid'] = intval($post['pid']);

		



		$existing_post = get_post($post['pid']);
$post['tid'] = $existing_post['tid'];
$post['fid'] = $existing_post['fid'];

		$existing_post = get_post($post['pid']);
$post['tid'] = $existing_post['tid'];
$post['fid'] = $existing_post['fid'];

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


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


// Decide on the visibility of this post.
if(isset($post['visible']) && $post['visible'] != $existing_post['visible'])


// Decide on the visibility of this post.
if(isset($post['visible']) && $post['visible'] != $existing_post['visible'])

Zeile 1524Zeile 1529
                    update_thread_data($existing_post['tid']);
update_thread_counters($existing_post['tid'], array('replies' => '-1', 'unapprovedposts' => '+1'));
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1', 'unapprovedposts' => '+1'));

                    update_thread_data($existing_post['tid']);
update_thread_counters($existing_post['tid'], array('replies' => '-1', 'unapprovedposts' => '+1'));
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '+1', 'unapprovedposts' => '+1'));

                    



                    // Subtract from the users post count

                    // Subtract from the users post count

                    // Update the post count if this forum allows post counts to be tracked

                    // Update the post count if this forum allows post counts to be tracked

                    if($forum['usepostcounts'] != 0)
{
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'");

                    if($forum['usepostcounts'] != 0)
{
$db->write_query("UPDATE ".TABLE_PREFIX."users SET postnum=postnum-1 WHERE uid='{$existing_post['uid']}'");

Zeile 1541Zeile 1546
                    update_thread_data($existing_post['tid']);
update_thread_counters($existing_post['tid'], array('replies' => '+1', 'unapprovedposts' => '-1'));
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1', 'unapprovedposts' => '-1'));

                    update_thread_data($existing_post['tid']);
update_thread_counters($existing_post['tid'], array('replies' => '+1', 'unapprovedposts' => '-1'));
update_forum_counters($existing_post['fid'], array('unapprovedthreads' => '-1', 'unapprovedposts' => '-1'));

                    



                    // Update the post count if this forum allows post counts to be tracked
if($forum['usepostcounts'] != 0)
{

                    // Update the post count if this forum allows post counts to be tracked
if($forum['usepostcounts'] != 0)
{

Zeile 1577Zeile 1582
		{
$first_post = false;
}

		{
$first_post = false;
}

		



		if($existing_post['visible'] == 0)

		if($existing_post['visible'] == 0)

		{

		{

			$visible = 0;
}

			$visible = 0;
}

		



		// Update the thread details that might have been changed first.
if($first_post)

		// Update the thread details that might have been changed first.
if($first_post)

		{			

		{

			$this->tid = $post['tid'];

$this->thread_update_data['visible'] = $visible;

			$this->tid = $post['tid'];

$this->thread_update_data['visible'] = $visible;

			



			if(isset($post['prefix']))

			if(isset($post['prefix']))

			{

			{

				$this->thread_update_data['prefix'] = intval($post['prefix']);

				$this->thread_update_data['prefix'] = intval($post['prefix']);

			}

			}


if(isset($post['subject']))
{
$this->thread_update_data['subject'] = $db->escape_string($post['subject']);


if(isset($post['subject']))
{
$this->thread_update_data['subject'] = $db->escape_string($post['subject']);

			}


			}


			if(isset($post['icon']))
{
$this->thread_update_data['icon'] = intval($post['icon']);

			if(isset($post['icon']))
{
$this->thread_update_data['icon'] = intval($post['icon']);

Zeile 1609Zeile 1614
				$plugins->run_hooks("datahandler_post_update_thread", $this);

$db->update_query("threads", $this->thread_update_data, "tid='".intval($post['tid'])."'");

				$plugins->run_hooks("datahandler_post_update_thread", $this);

$db->update_query("threads", $this->thread_update_data, "tid='".intval($post['tid'])."'");

			}
}


			}
}


		// Prepare array for post updating.

$this->pid = $post['pid'];

		// Prepare array for post updating.

$this->pid = $post['pid'];

Zeile 1651Zeile 1656
		}

$this->post_update_data['visible'] = $visible;

		}

$this->post_update_data['visible'] = $visible;

		



		$plugins->run_hooks("datahandler_post_update", $this);

$db->update_query("posts", $this->post_update_data, "pid='".intval($post['pid'])."'");

		$plugins->run_hooks("datahandler_post_update", $this);

$db->update_query("posts", $this->post_update_data, "pid='".intval($post['pid'])."'");