Vergleich inc/datahandlers/post.php - 1.8.9 - 1.8.14

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 138Zeile 138
			$post['username'] = $user['username'];
}
// if the uid is 0 verify the username

			$post['username'] = $user['username'];
}
// if the uid is 0 verify the username

		else if($post['uid'] == 0 && $post['username'] != $lang->guest)

		else if($post['uid'] == 0 && $post['username'] != '')

		{
// Set up user handler
require_once MYBB_ROOT."inc/datahandlers/user.php";

		{
// Set up user handler
require_once MYBB_ROOT."inc/datahandlers/user.php";

Zeile 160Zeile 160
				$this->errors = array_merge($this->errors, $userhandler->get_errors());
return false;
}

				$this->errors = array_merge($this->errors, $userhandler->get_errors());
return false;
}

		}

// After all of this, if we still don't have a username, force the username as "Guest" (Note, this is not translatable as it is always a fallback)
if(!$post['username'])
{
$post['username'] = "Guest";

 
		}

return true;

		}

return true;

Zeile 192Zeile 186
				return false;
}
elseif(my_strlen($subject) == 0)

				return false;
}
elseif(my_strlen($subject) == 0)

			{
$thread = get_thread($post['tid']);
$subject = "RE: ".$thread['subject'];
}
}


			{
$thread = get_thread($post['tid']);
$subject = "RE: ".$thread['subject'];
}
}


		// This is a new post
else if($this->action == "post")

		// This is a new post
else if($this->action == "post")

		{
if(my_strlen($subject) == 0)
{

		{
if(my_strlen($subject) == 0)
{

				$thread = get_thread($post['tid']);
$subject = "RE: ".$thread['subject'];

				$thread = get_thread($post['tid']);
$subject = "RE: ".$thread['subject'];

			}

			}

		}

// This is a new thread and we require that a subject is present.

		}

// This is a new thread and we require that a subject is present.

Zeile 214Zeile 208
			if(my_strlen($subject) == 0)
{
$this->set_error("missing_subject");

			if(my_strlen($subject) == 0)
{
$this->set_error("missing_subject");

				return false;
}
}


				return false;
}
}


		// If post is reply and begins with "RE: ", remove 4 from subject length.
$subject_length = my_strlen($subject);
if($this->action == "post")

		// If post is reply and begins with "RE: ", remove 4 from subject length.
$subject_length = my_strlen($subject);
if($this->action == "post")

		{

		{

			$position_re = my_strpos($subject, "RE: ");
if($position_re !== false && $position_re == 0)
{
$subject_length = $subject_length - 4;
}

			$position_re = my_strpos($subject, "RE: ");
if($position_re !== false && $position_re == 0)
{
$subject_length = $subject_length - 4;
}

		}

		}


if($subject_length > 85)
{


if($subject_length > 85)
{

Zeile 242Zeile 236

/**
* Verifies a post message.


/**
* Verifies a post message.

	 *

	 *

	 * @return bool
*/
function verify_message()

	 * @return bool
*/
function verify_message()

Zeile 290Zeile 284
			else if(my_strlen($post['message']) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid']))
{
$this->set_error("message_too_short", array($mybb->settings['minmessagelength']));

			else if(my_strlen($post['message']) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid']))
{
$this->set_error("message_too_short", array($mybb->settings['minmessagelength']));

				return false;
}
}

				return false;
}
}

		return true;
}


		return true;
}


Zeile 342Zeile 336
				if($time_to_wait == 1)
{
$this->set_error("post_flooding_one_second");

				if($time_to_wait == 1)
{
$this->set_error("post_flooding_one_second");

				}

				}

				else
{
$this->set_error("post_flooding", array($time_to_wait));

				else
{
$this->set_error("post_flooding", array($time_to_wait));

Zeile 369Zeile 363
		if(empty($post['tid']))
{
return true;

		if(empty($post['tid']))
{
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

		}

// Assign a default separator if none is specified

Zeile 395Zeile 389

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


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

		{
return true;

		{
return true;

		}

if($mybb->settings['postmergefignore'] == -1)

		}

if($mybb->settings['postmergefignore'] == -1)

Zeile 446Zeile 440
	* @return boolean True when valid, false when not valid.
*/
function verify_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 494Zeile 488
			{
// 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_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));

			{
// 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_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));

				return false;
}
}

return true;
}

				return false;
}
}

return true;
}


/**
* Verifies the video count.


/**
* Verifies the video count.

Zeile 509Zeile 503
	function verify_video_count()
{
global $mybb, $db;

	function verify_video_count()
{
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 525Zeile 519
				// 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;

				// 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;

			}

			}

		}

return true;

		}

return true;

Zeile 575Zeile 569

/**
* Verify the post icon.


/**
* Verify the post icon.

	*
* @return boolean True when valid, false when not valid.

	*
* @return boolean True when valid, false when not valid.

	*/
function verify_post_icon()

	*/
function verify_post_icon()

	{

	{

		global $cache;

$post = &$this->data;

$posticons_cache = $cache->read("posticons");

		global $cache;

$post = &$this->data;

$posticons_cache = $cache->read("posticons");





		// If we don't have a post icon assign it as 0.
if(empty($post['icon']) || !isset($posticons_cache[$post['icon']]))
{

		// If we don't have a post icon assign it as 0.
if(empty($post['icon']) || !isset($posticons_cache[$post['icon']]))
{

Zeile 600Zeile 594
	* @return boolean True when valid, false when not valid.
*/
function verify_dateline()

	* @return boolean True when valid, false when not valid.
*/
function verify_dateline()

	{

	{

		$dateline = &$this->data['dateline'];

// The date has to be numeric and > 0.

		$dateline = &$this->data['dateline'];

// The date has to be numeric and > 0.

Zeile 609Zeile 603
			$dateline = TIME_NOW;
}
}

			$dateline = TIME_NOW;
}
}





	/**
* Verify thread prefix.
*

	/**
* Verify thread prefix.
*

Zeile 621Zeile 615

// If a valid prefix isn't supplied, don't assign one.
if(empty($prefix))


// If a valid prefix isn't supplied, don't assign one.
if(empty($prefix))

		{

		{

			$prefix = 0;
}
else

			$prefix = 0;
}
else

		{

		{

			if(!empty($this->data['tid']))

			if(!empty($this->data['tid']))

			{

			{

				// Fetch the thread
$thread = get_thread($this->data['tid']);

				// Fetch the thread
$thread = get_thread($this->data['tid']);

			}

			}


$prefix_cache = build_prefixes($prefix);



$prefix_cache = build_prefixes($prefix);


Zeile 642Zeile 636
			if($prefix_cache['groups'] != "-1")
{
if(!empty($this->data['edit_uid']))

			if($prefix_cache['groups'] != "-1")
{
if(!empty($this->data['edit_uid']))

				{

				{

					// Post is being edited
$user = get_user($this->data['edit_uid']);

					// Post is being edited
$user = get_user($this->data['edit_uid']);

				}

				}

				else
{
$user = get_user($this->data['uid']);

				else
{
$user = get_user($this->data['uid']);

				}


				}


				if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
{
$this->set_error('invalid_prefix');

				if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))
{
$this->set_error('invalid_prefix');

Zeile 777Zeile 771
		}

if($this->method == "insert" || array_key_exists('message', $post))

		}

if($this->method == "insert" || array_key_exists('message', $post))

		{
$this->verify_message();
$this->verify_image_count();
$this->verify_video_count();
}


		{
$this->verify_message();
$this->verify_image_count();
$this->verify_video_count();
}


		if($this->method == "insert" || array_key_exists('dateline', $post))
{
$this->verify_dateline();

		if($this->method == "insert" || array_key_exists('dateline', $post))
{
$this->verify_dateline();

		}

		}


if($this->method == "insert" || array_key_exists('replyto', $post))


if($this->method == "insert" || array_key_exists('replyto', $post))

		{

		{

			$this->verify_reply_to();

			$this->verify_reply_to();

		}


		}


		if($this->method == "insert" || array_key_exists('icon', $post))
{
$this->verify_post_icon();
}

if($this->method == "insert" || array_key_exists('options', $post))

		if($this->method == "insert" || array_key_exists('icon', $post))
{
$this->verify_post_icon();
}

if($this->method == "insert" || array_key_exists('options', $post))

		{

		{

			$this->verify_options();
}

if($this->method == "update" && $this->first_post)
{
$this->verify_prefix();

			$this->verify_options();
}

if($this->method == "update" && $this->first_post)
{
$this->verify_prefix();

		}

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

		}

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


// We are done validating, return.
$this->set_validated(true);


// We are done validating, return.
$this->set_validated(true);

Zeile 859Zeile 853
		{
// Automatic subscription to the thread
if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)

		{
// Automatic subscription to the thread
if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)

			{

			{

				switch($post['options']['subscriptionmethod'])
{
case "pm":

				switch($post['options']['subscriptionmethod'])
{
case "pm":

Zeile 885Zeile 879
				$modoptions = $post['modoptions'];
$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];

				$modoptions = $post['modoptions'];
$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];





				$modoptions_update = array();

// Close the thread.

				$modoptions_update = array();

// Close the thread.

				if(!empty($modoptions['closethread']) && $thread['closed'] != 1)

				if(!empty($modoptions['closethread']) && $thread['closed'] != 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid']))

				{
$modoptions_update['closed'] = $closed = 1;
log_moderator_action($modlogdata, $lang->thread_closed);
}

// Open the thread.

				{
$modoptions_update['closed'] = $closed = 1;
log_moderator_action($modlogdata, $lang->thread_closed);
}

// Open the thread.

				if(empty($modoptions['closethread']) && $thread['closed'] == 1)

				if(empty($modoptions['closethread']) && $thread['closed'] == 1 && is_moderator($post['fid'], "canopenclosethreads", $post['uid']))

				{
$modoptions_update['closed'] = $closed = 0;
log_moderator_action($modlogdata, $lang->thread_opened);
}

// Stick the thread.

				{
$modoptions_update['closed'] = $closed = 0;
log_moderator_action($modlogdata, $lang->thread_opened);
}

// Stick the thread.

				if(!empty($modoptions['stickthread']) && $thread['sticky'] != 1)

				if(!empty($modoptions['stickthread']) && $thread['sticky'] != 1 && is_moderator($post['fid'], "canstickunstickthreads", $post['uid']))

				{
$modoptions_update['sticky'] = 1;
log_moderator_action($modlogdata, $lang->thread_stuck);
}

// Unstick the thread.

				{
$modoptions_update['sticky'] = 1;
log_moderator_action($modlogdata, $lang->thread_stuck);
}

// Unstick the thread.

				if(empty($modoptions['stickthread']) && $thread['sticky'] == 1)

				if(empty($modoptions['stickthread']) && $thread['sticky'] == 1 && is_moderator($post['fid'], "canstickunstickthreads", $post['uid']))

				{
$modoptions_update['sticky'] = 0;
log_moderator_action($modlogdata, $lang->thread_unstuck);

				{
$modoptions_update['sticky'] = 0;
log_moderator_action($modlogdata, $lang->thread_unstuck);

				}


				}


				// Execute moderation options.
if($modoptions_update)
{

				// Execute moderation options.
if($modoptions_update)
{

Zeile 991Zeile 985

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


$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

					if($attachmentcount > 0)
{
// Update forum count

Zeile 1011Zeile 1005
					"visible" => $visible,
"merge" => true
);

					"visible" => $visible,
"merge" => true
);





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

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





				return $this->return_values;

				return $this->return_values;

			}
}

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

			}
}

if($visible == 1)

		{
$now = TIME_NOW;

		{
$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}'"
);

			if($forum['usepostcounts'] != 0)

			if($forum['usepostcounts'] != 0 && $thread['visible'] == 1)

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

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

Zeile 1044Zeile 1038
				"uid" => $post['uid'],
"username" => $db->escape_string($post['username']),
"dateline" => (int)$post['dateline'],

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

				"message" => $db->escape_string($post['message']),

				"message" => $db->escape_string($post['message']),

				"ipaddress" => $db->escape_binary($post['ipaddress']),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],

				"ipaddress" => $db->escape_binary($post['ipaddress']),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],

Zeile 1094Zeile 1088
		$thread_update = array();
if($visible == 1 && $thread['visible'] == 1)
{

		$thread_update = array();
if($visible == 1 && $thread['visible'] == 1)
{

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

 
			require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new Postparser;


			require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new Postparser;


Zeile 1147Zeile 1140
				{
// User isn't a moderator or the author of the thread...
continue;

				{
// User isn't a moderator or the author of the thread...
continue;

				}


				}


				if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
{
$uselang = $subscribedmember['language'];
}
elseif($mybb->settings['orig_bblanguage'])

				if($subscribedmember['language'] != '' && $lang->language_exists($subscribedmember['language']))
{
$uselang = $subscribedmember['language'];
}
elseif($mybb->settings['orig_bblanguage'])

				{

				{

					$uselang = $mybb->settings['orig_bblanguage'];

					$uselang = $mybb->settings['orig_bblanguage'];

				}
else

				}
else

				{
$uselang = "english";

				{
$uselang = "english";

				}

				}


if($uselang == $mybb->settings['bblanguage'])
{


if($uselang == $mybb->settings['bblanguage'])
{

Zeile 1168Zeile 1161
					{
$emailsubject = $lang->emailsubject_subscription;
$emailmessage = $lang->email_subscription;

					{
$emailsubject = $lang->emailsubject_subscription;
$emailmessage = $lang->email_subscription;

 
					}

// If the poster is unregistered and hasn't set a username, call them Guest
if(!$post['uid'] && !$post['username'])
{
$post['username'] = htmlspecialchars_uni($lang->guest);

					}
}
else
{

					}
}
else
{

					if($subscribedmember['notification'] == 1)



if(($subscribedmember['notification'] == 1 && !isset($langcache[$uselang]['emailsubject_subscription'])) || !isset($langcache[$uselang]['guest']))

					{

					{

						if(!isset($langcache[$uselang]['emailsubject_subscription']))




						$userlang = new MyLanguage;
$userlang->set_path(MYBB_ROOT."inc/languages");
$userlang->set_language($uselang);
if($subscribedmember['notification'] == 1)

						{

						{

							$userlang = new MyLanguage;
$userlang->set_path(MYBB_ROOT."inc/languages");
$userlang->set_language($uselang);

 
							$userlang->load("messages");
$langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription;
$langcache[$uselang]['email_subscription'] = $userlang->email_subscription;

							$userlang->load("messages");
$langcache[$uselang]['emailsubject_subscription'] = $userlang->emailsubject_subscription;
$langcache[$uselang]['email_subscription'] = $userlang->email_subscription;

							unset($userlang);

 
						}

						}

 
						$userlang->load("global");

$langcache[$uselang]['guest'] = $userlang->guest;
unset($userlang);
}
if($subscribedmember['notification'] == 1)
{

						$emailsubject = $langcache[$uselang]['emailsubject_subscription'];
$emailmessage = $langcache[$uselang]['email_subscription'];

						$emailsubject = $langcache[$uselang]['emailsubject_subscription'];
$emailmessage = $langcache[$uselang]['email_subscription'];

 
					}

// If the poster is unregistered and hasn't set a username, call them Guest
if(!$post['uid'] && !$post['username'])
{
$post['username'] = $langcache[$uselang]['guest'];

					}
}


					}
}


Zeile 1195Zeile 1207

$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'], $post_code);


$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'], $post_code);

					$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

					$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',
"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

					);
$db->insert_query("mailqueue", $new_email);
unset($userlang);

					);
$db->insert_query("mailqueue", $new_email);
unset($userlang);

Zeile 1226Zeile 1238
			if(isset($queued_email) && $queued_email == 1)
{
$cache->update_mailqueue();

			if(isset($queued_email) && $queued_email == 1)
{
$cache->update_mailqueue();

			}

			}


$thread_update = array('replies' => '+1');



$thread_update = array('replies' => '+1');


			// Update forum count

			// Update counters

			update_last_post($post['tid']);
update_forum_counters($post['fid'], array("posts" => "+1"));
update_forum_lastpost($thread['fid']);

			update_last_post($post['tid']);
update_forum_counters($post['fid'], array("posts" => "+1"));
update_forum_lastpost($thread['fid']);

Zeile 1254Zeile 1266
			// Update the unapproved posts count for the current forum
$thread_update = array('replies' => '+1');
update_forum_counters($post['fid'], array("deletedposts" => "+1"));

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

 
		}

// Update last poster
if($visible == 1 && $thread['visible'] != 1)
{
update_last_post($post['tid']);

		}

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

		}

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

Zeile 1329Zeile 1347
		if($this->method == "insert" || array_key_exists('options', $thread))
{
$this->verify_options();

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

		}


		}


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

// We are done validating, return.

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

// We are done validating, return.

Zeile 1356Zeile 1374

// Yes, validating is required.
if(!$this->get_validated())


// Yes, validating is required.
if(!$this->get_validated())

		{

		{

			die("The thread needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)
{
die("The thread is not valid.");

			die("The thread needs to be validated before inserting it into the DB.");
}
if(count($this->get_errors()) > 0)
{
die("The thread is not valid.");

		}

$thread = &$this->data;


		}

$thread = &$this->data;


		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);

		// Fetch the forum this thread is being made in
$forum = get_forum($thread['fid']);





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

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

		{

		{

			$visible = -2;
}


			$visible = -2;
}


Zeile 1381Zeile 1399
			$forumpermissions = forum_permissions($thread['fid'], $thread['uid']);
// Decide on the visibility of this post.
if($forumpermissions['modthreads'] == 1 && !is_moderator($thread['fid'], "", $thread['uid']))

			$forumpermissions = forum_permissions($thread['fid'], $thread['uid']);
// Decide on the visibility of this post.
if($forumpermissions['modthreads'] == 1 && !is_moderator($thread['fid'], "", $thread['uid']))

			{
$visible = 0;

			{
$visible = 0;

			}
else
{

			}
else
{

Zeile 1394Zeile 1412
			{
$visible = 0;
}

			{
$visible = 0;
}

		}


		}


		// Have a post ID but not a thread ID - fetch thread ID
if(!empty($thread['pid']) && !$thread['tid'])

		// Have a post ID but not a thread ID - fetch thread ID
if(!empty($thread['pid']) && !$thread['tid'])

		{

		{

			$query = $db->simple_select("posts", "tid", "pid='{$thread['pid']}");
$thread['tid'] = $db->fetch_field($query, "tid");
}

			$query = $db->simple_select("posts", "tid", "pid='{$thread['pid']}");
$thread['tid'] = $db->fetch_field($query, "tid");
}

Zeile 1407Zeile 1425
		{
$query = $db->simple_select("posts", "pid", "pid='{$thread['pid']}' AND uid='{$thread['uid']}' AND visible='-2'");
$draft_check = $db->fetch_field($query, "pid");

		{
$query = $db->simple_select("posts", "pid", "pid='{$thread['pid']}' AND uid='{$thread['uid']}' AND visible='-2'");
$draft_check = $db->fetch_field($query, "pid");

		}

		}

		else

		else

		{

		{

			$draft_check = false;
}

			$draft_check = false;
}





		// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)
{
$this->thread_insert_data = array(

		// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)
{
$this->thread_insert_data = array(

				"subject" => $db->escape_string($thread['subject']),

				"subject" => $db->escape_string($thread['subject']),

				"icon" => (int)$thread['icon'],
"username" => $db->escape_string($thread['username']),
"dateline" => (int)$thread['dateline'],

				"icon" => (int)$thread['icon'],
"username" => $db->escape_string($thread['username']),
"dateline" => (int)$thread['dateline'],

Zeile 1429Zeile 1447
			$plugins->run_hooks("datahandler_post_insert_thread", $this);

$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");

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

$db->update_query("threads", $this->thread_insert_data, "tid='{$thread['tid']}'");


$this->post_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => (int)$thread['icon'],
"username" => $db->escape_string($thread['username']),


$this->post_insert_data = array(
"subject" => $db->escape_string($thread['subject']),
"icon" => (int)$thread['icon'],
"username" => $db->escape_string($thread['username']),

				"dateline" => (int)$thread['dateline'],
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),

				"dateline" => (int)$thread['dateline'],
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),

Zeile 1510Zeile 1528
						break;
default:
$notification = 0;

						break;
default:
$notification = 0;

				}

				}


require_once MYBB_ROOT."inc/functions_user.php";
add_subscribed_thread($this->tid, $notification, $thread['uid']);


require_once MYBB_ROOT."inc/functions_user.php";
add_subscribed_thread($this->tid, $notification, $thread['uid']);

Zeile 1531Zeile 1549
				$modoptions_update = array();

// Close the thread.

				$modoptions_update = array();

// Close the thread.

				if(!empty($modoptions['closethread']))

				if(!empty($modoptions['closethread']) && is_moderator($thread['fid'], "canopenclosethreads", $thread['uid']))

				{
$modoptions_update['closed'] = 1;
log_moderator_action($modlogdata, $lang->thread_closed);
}

// Stick the thread.

				{
$modoptions_update['closed'] = 1;
log_moderator_action($modlogdata, $lang->thread_closed);
}

// Stick the thread.

				if(!empty($modoptions['stickthread']))

				if(!empty($modoptions['stickthread']) && is_moderator($thread['fid'], "canstickunstickthreads", $thread['uid']))

				{
$modoptions_update['sticky'] = 1;
log_moderator_action($modlogdata, $lang->thread_stuck);

				{
$modoptions_update['sticky'] = 1;
log_moderator_action($modlogdata, $lang->thread_stuck);

Zeile 1615Zeile 1633

$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;
}


Zeile 1643Zeile 1661
					{
$emailsubject = $lang->emailsubject_forumsubscription;
$emailmessage = $lang->email_forumsubscription;

					{
$emailsubject = $lang->emailsubject_forumsubscription;
$emailmessage = $lang->email_forumsubscription;

 

// If the poster is unregistered and hasn't set a username, call them Guest
if(!$thread['uid'] && !$thread['username'])
{
$thread['username'] = htmlspecialchars_uni($lang->guest);
}

					}
else
{

					}
else
{

Zeile 1652Zeile 1676
							$userlang->set_path(MYBB_ROOT."inc/languages");
$userlang->set_language($uselang);
$userlang->load("messages");

							$userlang->set_path(MYBB_ROOT."inc/languages");
$userlang->set_language($uselang);
$userlang->load("messages");

 
							$userlang->load("global");

							$langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription;
$langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription;

							$langcache[$uselang]['emailsubject_forumsubscription'] = $userlang->emailsubject_forumsubscription;
$langcache[$uselang]['email_forumsubscription'] = $userlang->email_forumsubscription;

 
							$langcache[$uselang]['guest'] = $userlang->guest;

							unset($userlang);
}
$emailsubject = $langcache[$uselang]['emailsubject_forumsubscription'];
$emailmessage = $langcache[$uselang]['email_forumsubscription'];

							unset($userlang);
}
$emailsubject = $langcache[$uselang]['emailsubject_forumsubscription'];
$emailmessage = $langcache[$uselang]['email_forumsubscription'];

 

// If the poster is unregistered and hasn't set a username, call them Guest
if(!$thread['uid'] && !$thread['username'])
{
$thread['username'] = $langcache[$uselang]['guest'];
}

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


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


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

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

		}


		}


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

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

Zeile 1795Zeile 1827
			if(isset($post['icon']))
{
$this->thread_update_data['icon'] = (int)$post['icon'];

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

			}

			}

			if(count($this->thread_update_data) > 0)
{
$plugins->run_hooks("datahandler_post_update_thread", $this);

			if(count($this->thread_update_data) > 0)
{
$plugins->run_hooks("datahandler_post_update_thread", $this);





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

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

		}

		}


// Prepare array for post updating.


// Prepare array for post updating.





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

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

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

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

		}

		}


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


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

		{

		{

			$this->post_update_data['message'] = $db->escape_string($post['message']);
}

if(isset($post['editreason']) && trim($post['editreason']) != '')
{
$this->post_update_data['editreason'] = $db->escape_string(trim($post['editreason']));

			$this->post_update_data['message'] = $db->escape_string($post['message']);
}

if(isset($post['editreason']) && trim($post['editreason']) != '')
{
$this->post_update_data['editreason'] = $db->escape_string(trim($post['editreason']));

 
		}
elseif($post['editreason'] == '')
{
$this->post_update_data['editreason'] = '';

		}

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

		}

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