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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
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";

		// 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 227Zeile 227
			{
$subject_length = $subject_length - 4;
}

			{
$subject_length = $subject_length - 4;
}

		}


		}


		if($subject_length > 85)
{
// Subject is too long

		if($subject_length > 85)
{
// Subject is too long

Zeile 256Zeile 256
		if(my_strlen($post['message']) == 0)
{
$this->set_error("missing_message");

		if(my_strlen($post['message']) == 0)
{
$this->set_error("missing_message");

			return false;
}


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

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

Zeile 272Zeile 272
			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 509Zeile 509
	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 539Zeile 539
	function verify_reply_to()
{
global $db;

	function verify_reply_to()
{
global $db;

		$post = &$this->data;

		$post = &$this->data;


// Check if the post being replied to actually exists in this thread.
if($post['replyto'])


// Check if the post being replied to actually exists in this thread.
if($post['replyto'])

Zeile 547Zeile 547
			$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'");
$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])

			$query = $db->simple_select("posts", "pid", "pid='".(int)$post['replyto']."'");
$valid_post = $db->fetch_array($query);
if(!$valid_post['pid'])

			{

			{

				$post['replyto'] = 0;

				$post['replyto'] = 0;

			}

			}

			else
{
return true;
}

			else
{
return true;
}

		}

		}


// If this post isn't a reply to a specific post, attach it to the first post.
if(!$post['replyto'])


// If this post isn't a reply to a specific post, attach it to the first post.
if(!$post['replyto'])

Zeile 568Zeile 568
			$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.
*

	/**
* Verify the post icon.
*

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

	function verify_post_icon()
{
global $cache;


$post = &$this->data;



$post = &$this->data;


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

// If we don't have a post icon assign it as 0.

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

// If we don't have a post icon assign it as 0.

Zeile 627Zeile 627
		else
{
if(!empty($this->data['tid']))

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

if(empty($prefix_cache))

			$prefix_cache = build_prefixes($prefix);

if(empty($prefix_cache))

			{

			{

				$this->set_error('invalid_prefix');
return false;
}
if($prefix_cache['groups'] != "-1")
{
if(!empty($this->data['edit_uid']))

				$this->set_error('invalid_prefix');
return false;
}
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']);
}

Zeile 671Zeile 671
		}

// Does this forum require a prefix?

		}

// Does this forum require a prefix?

		$forum = get_forum($this->data['fid']);


		$forum = get_forum($this->data['fid']);


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

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

			{

			{

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

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

			}

			}


$prefix_cache = build_prefixes();



$prefix_cache = build_prefixes();


Zeile 745Zeile 745
		if($this->method == "update")
{
if(empty($post['tid']))

		if($this->method == "update")
{
if(empty($post['tid']))

			{

			{

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

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

Zeile 774Zeile 774
		if($this->method == "insert" || array_key_exists('subject', $post))
{
$this->verify_subject();

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

		}


		}


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

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

Zeile 835Zeile 835

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


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

		{

		{

			die("The post needs to be validated before inserting it into the DB.");

			die("The post needs to be validated before inserting it into the DB.");

		}

		}

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

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

Zeile 845Zeile 845

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


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





		$closed = $thread['closed'];

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

		$closed = $thread['closed'];

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

		{

		{

			$visible = -2;
}


			$visible = -2;
}


Zeile 864Zeile 864
				{
case "pm":
$notification = 2;

				{
case "pm":
$notification = 2;

						break;

						break;

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

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

Zeile 879Zeile 879
			// Perform any selected moderation tools.
$ismod = is_moderator($post['fid'], "", $post['uid']);
if($ismod && isset($post['modoptions']))

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

			{

			{

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

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

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

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





				$modoptions_update = array();

				$modoptions_update = array();





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

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

				}


				}


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

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

Zeile 953Zeile 953
		$post['uid'] = (int)$post['uid'];

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

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

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

		{

		{

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

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

Zeile 982Zeile 982
				if($draft_check)
{
$db->delete_query("posts", "pid='".$post['pid']."'");

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

				}

				}


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


if($post['posthash'])
{
// 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");


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


Zeile 997Zeile 997
						// 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 1039Zeile 1039
		{
// 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'],
"uid" => $post['uid'],

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

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

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

Zeile 1101Zeile 1101
			$done_users = array();

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

			$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