Vergleich inc/datahandlers/post.php - 1.8.7 - 1.8.20

  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 153Zeile 153
				$this->errors = array_merge($this->errors, $userhandler->get_errors());
return false;
}

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

			



			if($userhandler->verify_username_exists())
{
// username is in use
$this->errors = array_merge($this->errors, $userhandler->get_errors());
return false;
}

			if($userhandler->verify_username_exists())
{
// username is in use
$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;
}





	/**
* Verifies a post subject.
*

	/**
* Verifies a post subject.
*

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

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





		if($this->method == "update" && $post['pid'])
{
// If this is the first post there needs to be a subject, else make it the default one.

		if($this->method == "update" && $post['pid'])
{
// If this is the first post there needs to be a subject, else make it the default one.

Zeile 233Zeile 227
		{
// Subject is too long
$this->set_error('subject_too_long', my_strlen($subject));

		{
// Subject is too long
$this->set_error('subject_too_long', my_strlen($subject));

			return false;
}


			return false;
}


		// Subject is valid - return true.
return true;
}

		// Subject is valid - return true.
return true;
}

Zeile 247Zeile 241
	 */
function verify_message()
{

	 */
function verify_message()
{

		global $mybb;

		global $db, $mybb;


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


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

Zeile 258Zeile 252
			$this->set_error("missing_message");
return false;
}

			$this->set_error("missing_message");
return false;
}


// If this board has a maximum message length check if we're over it. Use strlen because SQL limits are in bytes
else if(strlen($post['message']) > $mybb->settings['maxmessagelength'] && $mybb->settings['maxmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid']))
{
$this->set_error("message_too_long", array($mybb->settings['maxmessagelength'], strlen($post['message'])));
return false;
}

// And if we've got a minimum message length do we meet that requirement too?

 
		else
{

		else
{

 
			$limit = (int)$mybb->settings['maxmessagelength'];
$dblimit = 0;

// If database is mysql or mysqli check field type and set max database limit
if(stripos($db->type, 'my') !== false)
{
$fields = $db->show_fields_from("posts");
$type = $fields[array_search('message', array_column($fields, 'Field'))]['Type'];
switch(strtolower($type))
{
case 'longtext':
$dblimit = 4294967295;
break;
case 'mediumtext':
$dblimit = 16777215;
break;
case 'text':
default:
$dblimit = 65535;
break;
}
}

if($limit > 0 || $dblimit > 0)
{
$is_moderator = is_moderator($post['fid'], "", $post['uid']);
// Consider minimum in user defined and database limit other than 0
if($limit > 0 && $dblimit > 0)
{
$limit = $is_moderator ? $dblimit : min($limit, $dblimit);
}
else
{
$limit = max($limit, $dblimit);
}

if(strlen($post['message']) > $limit && (!$is_moderator || $limit == $dblimit))
{
$this->set_error("message_too_long", array($limit, strlen($post['message'])));
return false;
}
}


			if(!isset($post['fid']))
{
$post['fid'] = 0;

			if(!isset($post['fid']))
{
$post['fid'] = 0;

			}


			}


			if(!$mybb->settings['mycodemessagelength'])
{
// Check to see of the text is full of MyCode
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

			if(!$mybb->settings['mycodemessagelength'])
{
// Check to see of the text is full of MyCode
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;





				$message = $parser->text_parse_message($post['message']);

if(my_strlen($message) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid']))

				$message = $parser->text_parse_message($post['message']);

if(my_strlen($message) < $mybb->settings['minmessagelength'] && $mybb->settings['minmessagelength'] > 0 && !is_moderator($post['fid'], "", $post['uid']))

Zeile 290Zeile 319
			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 371
				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 367Zeile 396

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


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

		{
return true;
}


		{
return true;
}


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

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

		{
return true;
}


		{
return true;
}


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

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

		{

		{

			$mybb->settings['postmergesep'] = "[hr]";

			$mybb->settings['postmergesep'] = "[hr]";

		}


		}


		// Check to see if this person is in a usergroup that is excluded
if(is_member($mybb->settings['postmergeuignore'], $post['uid']))
{
return true;
}

		// Check to see if this person is in a usergroup that is excluded
if(is_member($mybb->settings['postmergeuignore'], $post['uid']))
{
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(((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))
{

Zeile 442Zeile 471

/**
* Verifies the image count.


/**
* Verifies the image count.

	*

	*

	* @return boolean True when valid, false when not valid.
*/
function verify_image_count()
{
global $mybb, $db;

	* @return boolean True when valid, false when not valid.
*/
function verify_image_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 467Zeile 496
		{
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

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





			// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],

			// Parse the message.
$parser_options = array(
"allow_html" => $forum['allowhtml'],

Zeile 478Zeile 507
			);

if($post['options']['disablesmilies'] != 1)

			);

if($post['options']['disablesmilies'] != 1)

			{

			{

				$parser_options['allow_smilies'] = $forum['allowsmilies'];
}
else

				$parser_options['allow_smilies'] = $forum['allowsmilies'];
}
else

Zeile 491Zeile 520
			// And count the number of image tags in the message.
$image_count = substr_count($image_check, "<img");
if($image_count > $mybb->settings['maxpostimages'])

			// And count the number of image tags in the message.
$image_count = substr_count($image_check, "<img");
if($image_count > $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.

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

				$this->set_error("too_many_images", array(1 => $image_count, 2 => $mybb->settings['maxpostimages']));
return false;
}

Zeile 511Zeile 540
		global $mybb, $db;

$post = &$this->data;

		global $mybb, $db;

$post = &$this->data;





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

// Check if this post contains more videos than the forum allows
if((!isset($post['savedraft']) || $post['savedraft'] != 1) && $mybb->settings['maxpostvideos'] != 0 && $permissions['cancp'] != 1)

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

// Check if this post contains more videos than the forum allows
if((!isset($post['savedraft']) || $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=");
if($video_count > $mybb->settings['maxpostvideos'])

			// And count the number of video tags in the message.
$video_count = substr_count($post['message'], "[video=");
if($video_count > $mybb->settings['maxpostvideos'])

Zeile 568Zeile 597
			$query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options);
$reply_to = $db->fetch_array($query);
$post['replyto'] = $reply_to['pid'];

			$query = $db->simple_select("posts", "pid", "tid='{$post['tid']}'", $options);
$reply_to = $db->fetch_array($query);
$post['replyto'] = $reply_to['pid'];

		}

return true;
}

/**

		}

return true;
}

/**

	* Verify the post icon.
*
* @return boolean True when valid, false when not valid.

	* Verify the post icon.
*
* @return boolean True when valid, false when not valid.

Zeile 625Zeile 654
			$prefix = 0;
}
else

			$prefix = 0;
}
else

		{

		{

			if(!empty($this->data['tid']))
{
// Fetch the thread

			if(!empty($this->data['tid']))
{
// Fetch the thread

Zeile 676Zeile 705
		if($forum['requireprefix'] == 1)
{
$num_prefixes = false;

		if($forum['requireprefix'] == 1)
{
$num_prefixes = false;





			// Go through each of our prefixes and decide if there are any possible prefixes to use.
if(!empty($this->data['edit_uid']))
{

			// Go through each of our prefixes and decide if there are any possible prefixes to use.
if(!empty($this->data['edit_uid']))
{

Zeile 777Zeile 806
		}

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_message();
$this->verify_image_count();

			$this->verify_video_count();

			$this->verify_video_count();

		}


		}


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

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

		{

		{

			$this->verify_dateline();

			$this->verify_dateline();

		}

		}


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


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

		}

		}


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


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

Zeile 819Zeile 848
		else
{
return true;

		else
{
return true;

		}

		}

	}

/**

	}

/**

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

$closed = $thread['closed'];

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

$closed = $thread['closed'];





		// This post is being saved as a draft.
if($post['savedraft'])
{
$visible = -2;
}

		// This post is being saved as a draft.
if($post['savedraft'])
{
$visible = -2;
}





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

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

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

			if($post['uid'] > 0)

			{

			{

				switch($post['options']['subscriptionmethod'])


				require_once MYBB_ROOT."inc/functions_user.php";
if($post['options']['subscriptionmethod'] == "")

				{

				{

					case "pm":
$notification = 2;
break;
case "email":
$notification = 1;
break;
default:
$notification = 0;









					remove_subscribed_thread($post['tid'], $post['uid']);
}
else
{
switch($post['options']['subscriptionmethod'])
{
case "pm":
$notification = 2;
break;
case "email":
$notification = 1;
break;
default:
$notification = 0;
}
add_subscribed_thread($post['tid'], $notification, $post['uid']);

				}

				}


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

 
			}

// Perform any selected moderation tools.
$ismod = is_moderator($post['fid'], "", $post['uid']);

			}

// Perform any selected moderation tools.
$ismod = is_moderator($post['fid'], "", $post['uid']);

			if($ismod)

			if($ismod && isset($post['modoptions']))

			{
$lang->load($this->language_file, true);


			{
$lang->load($this->language_file, true);


Zeile 886Zeile 921
				$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];


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


				if(!isset($modoptions['closethread']))
{
$modoptions['closethread'] = $closed;
}

$modoptions_update = array();

				$modoptions_update = array();







// Close the thread.


// Close the thread.

				if($modoptions['closethread'] == 1 && $thread['closed'] != 1)
{
$modoptions_update['closed'] = $closed = 0;

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


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


				// Open the thread.
if($modoptions['closethread'] != 1 && $thread['closed'] == 1)
{
$modoptions_update['closed'] = $closed = 1;
log_moderator_action($modlogdata, $lang->thread_opened);
}

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

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







				{

				{

					$modoptions['stickthread'] = $thread['sticky'];


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

				}

// Stick the thread.

				}

// Stick the thread.

				if($modoptions['stickthread'] == 1 && $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($modoptions['stickthread'] != 1 && $thread['sticky'])

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

Zeile 1028Zeile 1053
			}
}


			}
}


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

		if($visible == 1)

		{
$now = TIME_NOW;


		{
$now = TIME_NOW;


Zeile 1036Zeile 1061
			$update_array = array(
'lastpost' => "'{$now}'"
);

			$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 1049Zeile 1074
		{
// Update a post that is a draft
$this->post_update_data = array(

		{
// Update a post that is a draft
$this->post_update_data = array(

				"subject" => $db->escape_string($post['subject']),
"icon" => (int)$post['icon'],

				"subject" => $db->escape_string($post['subject']),
"icon" => (int)$post['icon'],

				"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'],

Zeile 1104Zeile 1129
		$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;

$done_users = array();

$subject = $parser->parse_badwords($thread['subject']);

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

$done_users = array();

$subject = $parser->parse_badwords($thread['subject']);

			



			$parser_options = array(
'me_username' => $post['username'],
'filter_badwords' => 1

			$parser_options = array(
'me_username' => $post['username'],
'filter_badwords' => 1

Zeile 1139Zeile 1163
			while($subscribedmember = $db->fetch_array($query))
{
if($done_users[$subscribedmember['uid']])

			while($subscribedmember = $db->fetch_array($query))
{
if($done_users[$subscribedmember['uid']])

				{
continue;
}

$args['users'][$subscribedmember['uid']] = (int)$subscribedmember['uid'];

				{
continue;
}

$args['users'][$subscribedmember['uid']] = (int)$subscribedmember['uid'];


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


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


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

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

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

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

				}

				}

				elseif($mybb->settings['orig_bblanguage'])
{
$uselang = $mybb->settings['orig_bblanguage'];

				elseif($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'])

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

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

					{

					{

						$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 1205Zeile 1248

$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" => '',

					$new_email = array(
"mailto" => $db->escape_string($subscribedmember['email']),
"mailfrom" => '',

						"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

						"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

Zeile 1240Zeile 1283

$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 1260Zeile 1303
			update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
}
else if($thread['visible'] == -1)

			update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));
}
else if($thread['visible'] == -1)

		{

		{

			// 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'");
$attachmentcount = $db->fetch_field($query, "attachmentcount");


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

Zeile 1273Zeile 1322
			$thread_update['attachmentcount'] = "+{$attachmentcount}";
}
update_thread_counters($post['tid'], $thread_update);

			$thread_update['attachmentcount'] = "+{$attachmentcount}";
}
update_thread_counters($post['tid'], $thread_update);





		// Return the post's pid and whether or not it is visible.
$this->return_values = array(
"pid" => $this->pid,
"visible" => $visible,
"closed" => $closed
);

		// Return the post's pid and whether or not it is visible.
$this->return_values = array(
"pid" => $this->pid,
"visible" => $visible,
"closed" => $closed
);





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

return $this->return_values;

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

return $this->return_values;

	}

/**

	}

/**

	 * Validate a thread.
*
* @return boolean True when valid, false when invalid.

	 * Validate a thread.
*
* @return boolean True when valid, false when invalid.

Zeile 1337Zeile 1386
		}

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

		}

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

		{

		{

			$this->verify_options();

			$this->verify_options();

		}

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

		}

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


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


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

Zeile 1363Zeile 1412
	function insert_thread()
{
global $db, $mybb, $plugins, $cache, $lang;

	function insert_thread()
{
global $db, $mybb, $plugins, $cache, $lang;





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

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

Zeile 1414Zeile 1463
		}

if(isset($thread['pid']) && $thread['pid'] > 0)

		}

if(isset($thread['pid']) && $thread['pid'] > 0)

		{

		{

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

Zeile 1527Zeile 1576
			}

// Perform any selected moderation tools.

			}

// Perform any selected moderation tools.

			if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))

			if(is_moderator($thread['fid'], "", $thread['uid']) && isset($thread['modoptions']))

			{
$lang->load($this->language_file, true);


			{
$lang->load($this->language_file, true);


Zeile 1541Zeile 1590
				$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 1598Zeile 1647
				$done_users = array();

// Queue up any forum subscription notices to users who are subscribed to this forum.

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

				$excerpt = $thread['message'];


// Parse badwords
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$excerpt = $parser->parse_badwords($excerpt);


// Parse badwords
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;
$excerpt = $parser->parse_badwords($excerpt);







				$excerpt = $parser->text_parse_message($excerpt);
if(strlen($excerpt) > $mybb->settings['subscribeexcerpt'])
{
$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;
}

				$query = $db->query("
SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate
FROM ".TABLE_PREFIX."forumsubscriptions fs

				$query = $db->query("
SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate
FROM ".TABLE_PREFIX."forumsubscriptions fs

Zeile 1653Zeile 1706
					{
$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 1662Zeile 1721
							$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 1719Zeile 1786
		if($attachmentcount > 0)
{
update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}"));

		if($attachmentcount > 0)
{
update_thread_counters($this->tid, array("attachmentcount" => "+{$attachmentcount}"));

		}

		}


// Return the post's pid and whether or not it is visible.
$this->return_values = array(


// Return the post's pid and whether or not it is visible.
$this->return_values = array(

Zeile 1741Zeile 1808
	function update_post()
{
global $db, $mybb, $plugins;

	function update_post()
{
global $db, $mybb, $plugins;





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

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

Zeile 1785Zeile 1852
		else
{
$visible = 1;

		else
{
$visible = 1;

		}


		}


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

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

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

		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']))