Vergleich inc/datahandlers/post.php - 1.8.12 - 1.8.18

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





	/**
* Verifies a post subject.
*

	/**
* Verifies a post subject.
*

Zeile 189Zeile 183
			if(my_strlen($subject) == 0 && $this->first_post)
{
$this->set_error("firstpost_no_subject");

			if(my_strlen($subject) == 0 && $this->first_post)
{
$this->set_error("firstpost_no_subject");

				return false;
}

				return false;
}

			elseif(my_strlen($subject) == 0)

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

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 post is reply and begins with "RE: ", remove 4 from subject length.
$subject_length = my_strlen($subject);

Zeile 242Zeile 236

/**
* Verifies a post message.


/**
* Verifies a post message.

	 *

	 *

	 * @return bool
*/
function verify_message()
{

	 * @return bool
*/
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

			if(!$mybb->settings['mycodemessagelength'])
{
// Check to see of the text is full of MyCode

Zeile 298Zeile 327

/**
* Verifies the specified post options are correct.


/**
* Verifies the specified post options are correct.

	 *

	 *

	 * @return boolean True
*/
function verify_options()

	 * @return boolean True
*/
function verify_options()

Zeile 373Zeile 402

// 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']) == "")

Zeile 446Zeile 475
	* @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;

$post = &$this->data;

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


	{
global $mybb, $db;

$post = &$this->data;

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


		// Fetch the forum this post is being made in
if(!$post['fid'])
{

		// Fetch the forum this post is being made in
if(!$post['fid'])
{

Zeile 478Zeile 507
			);

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

			);

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

			{

			{

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

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

			}

$image_check = $parser->parse_message($post['message'], $parser_options);


			}

$image_check = $parser->parse_message($post['message'], $parser_options);


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

Zeile 503Zeile 532

/**
* Verifies the video count.


/**
* Verifies the video count.

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

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

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

$post = &$this->data;

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

$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 525Zeile 554
				// 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;
}


	/**
* Verify the reply-to post.
*

	/**
* Verify the reply-to post.
*

Zeile 581Zeile 610
	function verify_post_icon()
{
global $cache;

	function verify_post_icon()
{
global $cache;





		$post = &$this->data;

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

		$post = &$this->data;

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

Zeile 858Zeile 887
		else
{
// Automatic subscription to the thread

		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.

			}

// Perform any selected moderation tools.

Zeile 914Zeile 949
				{
$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 929Zeile 964
			// Decide on the visibility of this post.
$forumpermissions = forum_permissions($post['fid'], $post['uid']);
if($forumpermissions['modposts'] == 1 && !$ismod)

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

			{
$visible = 0;

			{
$visible = 0;

			}
else

			}
else

			{

			{

				$visible = 1;

				$visible = 1;

			}

			}


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


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

Zeile 947Zeile 982
		if(!isset($post['pid']))
{
$post['pid'] = 0;

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

		}

		}


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


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

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

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

					}


					}


					$attachmentassign = array(
"pid" => $double_post['pid'],
"posthash" => ''

					$attachmentassign = array(
"pid" => $double_post['pid'],
"posthash" => ''

Zeile 1021Zeile 1056
		if($visible == 1)
{
$now = TIME_NOW;

		if($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 1030Zeile 1065
			{
$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);
}


Zeile 1044Zeile 1079
				"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 1090Zeile 1125
			);
$db->update_query("attachments", $attachmentassign, "posthash='{$post['posthash']}' AND pid='0'");
}

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





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

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

Zeile 1159Zeile 1194
				else
{
$uselang = "english";

				else
{
$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(!isset($langcache[$uselang]['emailsubject_subscription']))






if(($subscribedmember['notification'] == 1 && !isset($langcache[$uselang]['emailsubject_subscription'])) || !isset($langcache[$uselang]['guest']))
{
$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 1593Zeile 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 1648Zeile 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 1657Zeile 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 1714Zeile 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 1736Zeile 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 1780Zeile 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 1826Zeile 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']))