Vergleich inc/datahandlers/post.php - 1.8.4 - 1.8.5

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 130Zeile 130
		}
// if the uid is 0 verify the username
else if($post['uid'] == 0 && $post['username'] != $lang->guest)

		}
// if the uid is 0 verify the username
else if($post['uid'] == 0 && $post['username'] != $lang->guest)

		{	

		{

			// Set up user handler
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler();

			// Set up user handler
require_once MYBB_ROOT."inc/datahandlers/user.php";
$userhandler = new UserDataHandler();

			



			$data_array = array('username' => $post['username']);
$userhandler->set_data($data_array);

			$data_array = array('username' => $post['username']);
$userhandler->set_data($data_array);

			



			if(!$userhandler->verify_username())

			if(!$userhandler->verify_username())

			{

			{

				// invalid username

				// invalid username

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

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

Zeile 150Zeile 157
		if(!$post['username'])
{
$post['username'] = "Guest";

		if(!$post['username'])
{
$post['username'] = "Guest";

		}

// Sanitize the username
$post['username'] = htmlspecialchars_uni($post['username']);
return true;

		}

return true;



	}

/**

	}

/**

Zeile 198Zeile 203

// If this is the first post there needs to be a subject, else make it the default one.
if(my_strlen($subject) == 0 && $first_post)


// If this is the first post there needs to be a subject, else make it the default one.
if(my_strlen($subject) == 0 && $first_post)

			{

			{

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

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

Zeile 241Zeile 246
		}

if($subject_length > 85)

		}

if($subject_length > 85)

		{

		{

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

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

Zeile 285Zeile 290
				$post['fid'] = 0;
}
if(!$mybb->settings['mycodemessagelength'])

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

				// Check to see of the text is full of MyCode
require_once MYBB_ROOT."inc/class_parser.php";
$parser = new postParser;

Zeile 301Zeile 306
			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 true;
}


				return false;
}
}
return true;
}


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

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

Zeile 650Zeile 655
				}

if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))

				}

if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))

				{
$this->set_error('invalid_prefix');
return false;
}

				{
$this->set_error('invalid_prefix');
return false;
}

			}
if($prefix_cache['forums'] != "-1")
{

			}
if($prefix_cache['forums'] != "-1")
{

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

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


$newstick = $newclosed = '';

 

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


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

				{
$modoptions['closethread'] = 0;
}



				{
$modoptions['closethread'] = $closed;
}

$modoptions_update = array();


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


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

				{
$newclosed = "closed=1";

				{
$modoptions_update['closed'] = $closed = 0;

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

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

					$closed = 1;
}

				}



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


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

					$newclosed = "closed=0";

					$modoptions_update['closed'] = $closed = 1;

					log_moderator_action($modlogdata, $lang->thread_opened);

					log_moderator_action($modlogdata, $lang->thread_opened);

					$closed = 0;
}


				}



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

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

				{
$modoptions['stickthread'] = 0;
}


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


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

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

					$newstick = "sticky='1'";

					$modoptions_update['sticky'] = 1;

					log_moderator_action($modlogdata, $lang->thread_stuck);

					log_moderator_action($modlogdata, $lang->thread_stuck);

				}


				}


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

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

					$newstick = "sticky='0'";

					$modoptions_update['sticky'] = 0;

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

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

				}


				}


				// Execute moderation options.

				// Execute moderation options.

				if($newstick && $newclosed)
{
$sep = ",";
}
else
{
$sep = '';
}
if($newstick || $newclosed)

				if($modoptions_update)









				{

				{

					$db->write_query("
UPDATE ".TABLE_PREFIX."threads
SET {$newclosed}{$sep}{$newstick}
WHERE tid='{$thread['tid']}'
");

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





				}

				}

			}

			}


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


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

Zeile 934Zeile 925
				$visible = 0;
}
else

				$visible = 0;
}
else

			{

			{

				$visible = 1;
}


				$visible = 1;
}


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

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

				}

				}


if($post['posthash'])
{


if($post['posthash'])
{

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

return $this->return_values;

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

return $this->return_values;

			}
}

			}
}


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


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

Zeile 1045Zeile 1036
				"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']),
"ipaddress" => $db->escape_binary($post['ipaddress']),
"includesig" => $post['options']['signature'],
"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible

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

			);

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

			);

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

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

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

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

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

		}


		}


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

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

Zeile 1091Zeile 1082
			);
$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 = get_thread($post['tid']);
require_once MYBB_ROOT.'inc/class_parser.php';
$parser = new Postparser;

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

			$done_users = array();





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

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

			$excerpt = $parser->text_parse_message($post['message'], array('me_username' => $post['username'], 'filter_badwords' => 1, 'safe_html' => 1));







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

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

			$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices

			$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;

// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices

Zeile 1522Zeile 1519
					$modlogdata['tid'] = $thread['tid'];
}


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


				$newclosed = $newstick = '';

				$modoptions_update = array();


// Close the thread.


// Close the thread.

				if(isset($modoptions['closethread']) && $modoptions['closethread'] == 1)

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

				{

				{

					$newclosed = "closed=1";

					$modoptions_update['closed'] = 1;

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

// Stick the thread.

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

// Stick the thread.

				if(isset($modoptions['stickthread']) && $modoptions['stickthread'] == 1)

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

				{

				{

					$newstick = "sticky='1'";

					$modoptions_update['sticky'] = 1;

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

// Execute moderation options.

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

// Execute moderation options.

				if($newstick && $newclosed)
{
$sep = ",";
}
else
{
$sep = '';
}
if($newstick || $newclosed)

				if($modoptions_update)









				{

				{

					$db->write_query("
UPDATE ".TABLE_PREFIX."threads
SET $newclosed$sep$newstick
WHERE tid='{$this->tid}'
");

					$db->update_query('threads', $modoptions_update, "tid='{$this->tid}'");





				}
}
if($visible == 1)

				}
}
if($visible == 1)