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

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 53Zeile 53
	 * post = New post
* thread = New thread
* edit = Editing a thread or post

	 * post = New post
* thread = New thread
* edit = Editing a thread or post

 
	 *
* @var string

	 */
public $action;

	 */
public $action;





	/**
* Array of data inserted in to a post.

	/**
* Array of data inserted in to a post.

	 *
* @var array
*/

	 *
* @var array
*/

	public $post_insert_data = array();

/**
* Array of data used to update a post.

	public $post_insert_data = array();

/**
* Array of data used to update a post.

	 *
* @var array
*/

	 *
* @var array
*/

	public $post_update_data = array();

	public $post_update_data = array();





	/**
* Post ID currently being manipulated by the datahandlers.
*

	/**
* Post ID currently being manipulated by the datahandlers.
*

Zeile 83Zeile 85
	 * @var array
*/
public $thread_insert_data = array();

	 * @var array
*/
public $thread_insert_data = array();


/**


/**

	 * Array of data used to update a thread.

	 * Array of data used to update a thread.

	 *

	 *

	 * @var array

	 * @var array

	 */

	 */

	public $thread_update_data = array();

	public $thread_update_data = array();


/**


/**

	 * Thread ID currently being manipulated by the datahandlers.
*
* @var int

	 * Thread ID currently being manipulated by the datahandlers.
*
* @var int

Zeile 99Zeile 101
	public $tid = 0;

/**

	public $tid = 0;

/**

	 * Values to be returned after inserting/updating a post/thread.








	 * Values to be returned after inserting/updating a post/thread.
*
* @var array
*/
public $return_values = array();

/**
* Is this the first post of a thread when editing

	 *

	 *

	 * @var array

	 * @var boolean

	 */

	 */

	public $return_values = array();

	public $first_post = false;


/**
* Verifies the author of a post and fetches the username if necessary.


/**
* Verifies the author of a post and fetches the username if necessary.

Zeile 112Zeile 121
	 */
function verify_author()
{

	 */
function verify_author()
{

		global $mybb;


		global $mybb, $lang;


		$post = &$this->data;

// Don't have a user ID at all - not good (note, a user id of 0 will still work).

		$post = &$this->data;

// Don't have a user ID at all - not good (note, a user id of 0 will still work).

Zeile 121Zeile 130
		{
$this->set_error("invalid_user_id");
return false;

		{
$this->set_error("invalid_user_id");
return false;

		}

		}

		// If we have a user id but no username then fetch the username.
else if($post['uid'] > 0 && empty($post['username']))
{
$user = get_user($post['uid']);
$post['username'] = $user['username'];

		// If we have a user id but no username then fetch the username.
else if($post['uid'] > 0 && empty($post['username']))
{
$user = get_user($post['uid']);
$post['username'] = $user['username'];

		}

		}

		// 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())
{
// invalid username

			if(!$userhandler->verify_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 152Zeile 168
			$post['username'] = "Guest";
}


			$post['username'] = "Guest";
}


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

 
		return true;
}

/**
* Verifies a post subject.
*

		return true;
}

/**
* Verifies a post subject.
*

	 * @param string True if the subject is valid, false if invalid.

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

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

Zeile 170Zeile 183
		$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);


		$subject = &$post['subject'];
$subject = trim_blank_chrs($subject);


		// Are we editing an existing thread or post?

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

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

			if(empty($post['tid']))
{
$query = $db->simple_select("posts", "tid", "pid='".(int)$post['pid']."'");
$post['tid'] = $db->fetch_field($query, "tid");
}
// Here we determine if we're editing the first post of a thread or not.
$options = array(
"limit" => 1,
"limit_start" => 0,
"order_by" => "dateline",
"order_dir" => "asc"
);
$query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options);
$first_check = $db->fetch_array($query);
if($first_check['pid'] == $post['pid'])
{
$first_post = true;
}
else
{
$first_post = false;
}


 
			// If this is the first post there needs to be a subject, else make it the default one.

			// 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(my_strlen($subject) == 0 && $this->first_post)

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

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

Zeile 254Zeile 243
	/**
* Verifies a post message.
*

	/**
* Verifies a post message.
*

	 * @param string The message content.

	 * @return bool

	 */
function verify_message()
{

	 */
function verify_message()
{

Zeile 326Zeile 315
	/**
* Verify that the user is not flooding the system.
*

	/**
* Verify that the user is not flooding the system.
*

	* @return boolean True

	* @return boolean

	*/
function verify_post_flooding()
{

	*/
function verify_post_flooding()
{

Zeile 365Zeile 354
		return true;
}


		return true;
}


 
	/**
* @param bool $simple_mode
*
* @return array|bool
*/

	function verify_post_merge($simple_mode=false)
{
global $mybb, $db, $session;

	function verify_post_merge($simple_mode=false)
{
global $mybb, $db, $session;





		$post = &$this->data;

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

		$post = &$this->data;

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

		{
return true;
}

		{
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
if(trim($mybb->settings['postmergesep']) == "")
{

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

Zeile 390Zeile 384
		}

// Check to see if this person is in a usergroup that is excluded

		}

// Check to see if this person is in a usergroup that is excluded

		if($mybb->settings['postmergeuignore'] == -1)
{
return true;
}
elseif($mybb->settings['postmergeuignore'] != '' && is_member($mybb->settings['postmergeuignore'], $post['uid']))

		if(is_member($mybb->settings['postmergeuignore'], $post['uid']))





		{
return true;
}

		{
return true;
}

Zeile 507Zeile 497
				return false;
}
}

				return false;
}
}

 

return true;

	}

/**

	}

/**

Zeile 535Zeile 527
				return false;
}
}

				return false;
}
}

 

return true;

	}

/**

	}

/**

Zeile 594Zeile 588

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

		{

		{

			$post['icon'] = 0;
}
return true;

			$post['icon'] = 0;
}
return true;

Zeile 624Zeile 618
	function verify_prefix()
{
$prefix = &$this->data['prefix'];

	function verify_prefix()
{
$prefix = &$this->data['prefix'];


$prefix_cache = build_prefixes();

 

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

Zeile 653Zeile 651
					$user = get_user($this->data['uid']);
}


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


				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'])) && (empty($this->data['tid']) || $prefix != $thread['prefix']))

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

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

Zeile 664Zeile 662
				// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix_cache['forums']);


				// Decide whether this prefix can be used in our forum
$forums = explode(",", $prefix_cache['forums']);


				if(!in_array($this->data['fid'], $forums))

				if(!in_array($this->data['fid'], $forums) && (empty($this->data['tid']) || $prefix != $thread['prefix']))

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

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

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

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

			}

			}

			else

			else

			{

			{

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

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





			$prefix_cache = build_prefixes();

if(!empty($prefix_cache))

			$prefix_cache = build_prefixes();

if(!empty($prefix_cache))

Zeile 704Zeile 702
						if(!in_array($forum['fid'], $forums))
{
continue;

						if(!in_array($forum['fid'], $forums))
{
continue;

						}
}

						}
}





					if($required['groups'] != "-1")
{
if(!is_member($required['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
{
$num_prefixes = true;
}
}
else

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








					{
$num_prefixes = true;
}

					{
$num_prefixes = true;
}

Zeile 727Zeile 718
				return false;
}
}

				return false;
}
}





		return true;
}

		return true;
}





	/**
* Validate a post.
*

	/**
* Validate a post.
*

Zeile 739Zeile 730
	function validate_post()
{
global $mybb, $db, $plugins;

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





		$post = &$this->data;
$time = TIME_NOW;

		$post = &$this->data;
$time = TIME_NOW;





		$this->action = "post";

		$this->action = "post";





		if($this->method != "update" && !$post['savedraft'])

		if($this->method != "update" && !$post['savedraft'])

		{

		{

			$this->verify_post_flooding();

			$this->verify_post_flooding();

 
		}

// Are we editing an existing thread or post?
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");
}
// Here we determine if we're editing the first post of a thread or not.
$options = array(
"limit" => 1,
"limit_start" => 0,
"order_by" => "dateline",
"order_dir" => "asc"
);
$query = $db->simple_select("posts", "pid", "tid='".$post['tid']."'", $options);
$first_check = $db->fetch_array($query);
if($first_check['pid'] == $post['pid'])
{
$this->first_post = true;
}

		}

// Verify all post assets.

		}

// Verify all post assets.

Zeile 787Zeile 801
		if($this->method == "insert" || array_key_exists('options', $post))
{
$this->verify_options();

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

		}

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







		}

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

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


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

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

		{

		{

			return false;
}
else

			return false;
}
else

Zeile 816Zeile 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.");
}
if(count($this->get_errors()) > 0)

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

			die("The post is not valid.");

		}


		}


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

		$closed = $thread['closed'];

// This post is being saved as a draft.

Zeile 842Zeile 861
			if($post['options']['subscriptionmethod'] != "" && $post['uid'] > 0)
{
switch($post['options']['subscriptionmethod'])

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

				{

				{

					case "pm":
$notification = 2;

					case "pm":
$notification = 2;

						break;

						break;

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

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

Zeile 866Zeile 885
				$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;
}

// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
{
$newstick = "sticky='1'";
log_moderator_action($modlogdata, $lang->thread_stuck);

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

// Stick the thread.
if($modoptions['stickthread'] == 1 && $thread['sticky'] != 1)
{
$modoptions_update['sticky'] = 1;
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']}'");





				}
}


				}
}


Zeile 961Zeile 966
		{
$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");

		}
else

		}
else

		{
$draft_check = false;
}

		{
$draft_check = false;
}

Zeile 982Zeile 987
				);
$update_query['edituid'] = (int)$post['uid'];
$update_query['edittime'] = TIME_NOW;

				);
$update_query['edituid'] = (int)$post['uid'];
$update_query['edittime'] = TIME_NOW;

				$query = $db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");

				$db->update_query("posts", $update_query, "pid='".$double_post['pid']."'");


if($draft_check)
{


if($draft_check)
{

Zeile 1106Zeile 1111
			$done_users = array();

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

			$done_users = array();

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

			$excerpt = $parser->text_parse_message($post['message'], array('me_username' => $post['username'], 'filter_badwords' => 1, 'safe_html' => 1));
$excerpt = my_substr($excerpt, 0, $mybb->settings['subscribeexcerpt']).$lang->emailbit_viewthread;







			
$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
$query = $db->query("


// Fetch any users subscribed to this thread receiving instant notification and queue up their subscription notices
$query = $db->query("

				SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.subscriptionkey, s.notification

				SELECT u.username, u.email, u.uid, u.language, u.loginkey, u.salt, u.regdate, s.notification

				FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
AND s.uid != '{$post['uid']}'
AND u.lastactive>'{$thread['lastpost']}'
");

				FROM ".TABLE_PREFIX."threadsubscriptions s
LEFT JOIN ".TABLE_PREFIX."users u ON (u.uid=s.uid)
WHERE (s.notification='1' OR s.notification='2') AND s.tid='{$post['tid']}'
AND s.uid != '{$post['uid']}'
AND u.lastactive>'{$thread['lastpost']}'
");

 

$args = array(
'this' => &$this,
'done_users' => &$done_users,
'users' => array()
);


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

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

 

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


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

$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
continue;

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

$forumpermissions = forum_permissions($thread['fid'], $subscribedmember['uid']);
if($forumpermissions['canview'] == 0 || $forumpermissions['canviewthreads'] == 0)
{
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;

				}

				}


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'];
}
else
{
$uselang = "english";

					$uselang = $mybb->settings['orig_bblanguage'];
}
else
{
$uselang = "english";

				}

				}


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


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

Zeile 1183Zeile 1204
					$emailsubject = $lang->sprintf($emailsubject, $subject);

$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);

					$emailsubject = $lang->sprintf($emailsubject, $subject);

$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("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code);

					$emailmessage = $lang->sprintf($emailmessage, $subscribedmember['username'], $post['username'], $mybb->settings['bbname'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", 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" => '',

Zeile 1200Zeile 1221
					$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$pm = array(
'subject' => array('pmsubject_subscription', $subject),

					$post_code = md5($subscribedmember['loginkey'].$subscribedmember['salt'].$subscribedmember['regdate']);
$pm = array(
'subject' => array('pmsubject_subscription', $subject),

						'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $subscribedmember['subscriptionkey'], $post_code),

						'message' => array('pm_subscription', $subscribedmember['username'], $post['username'], $subject, $excerpt, $mybb->settings['bburl'], str_replace("&", "&", get_thread_link($thread['tid'], 0, "newpost")), $thread['tid'], $post_code),

						'touid' => $subscribedmember['uid'],
'language' => $subscribedmember['language'],
'language_file' => 'messages'

						'touid' => $subscribedmember['uid'],
'language' => $subscribedmember['language'],
'language_file' => 'messages'

Zeile 1208Zeile 1229
					send_pm($pm, -1, true);
}
}

					send_pm($pm, -1, true);
}
}

 

$plugins->run_hooks('datahandler_post_insert_subscribed', $args);


			// Have one or more emails been queued? Update the queue count
if(isset($queued_email) && $queued_email == 1)
{

			// Have one or more emails been queued? Update the queue count
if(isset($queued_email) && $queued_email == 1)
{

Zeile 1227Zeile 1251
			// Update the unapproved posts count for the current thread and current forum
$thread_update = array('unapprovedposts' => '+1');
update_thread_counters($post['tid'], array("unapprovedposts" => "+1"));

			// Update the unapproved posts count for the current thread and current forum
$thread_update = array('unapprovedposts' => '+1');
update_thread_counters($post['tid'], array("unapprovedposts" => "+1"));

			update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));

			update_forum_counters($post['fid'], array("unapprovedposts" => "+1"));

		}
else if($thread['visible'] == 0)
{

		}
else if($thread['visible'] == 0)
{

Zeile 1278Zeile 1302
		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		if(!$thread['savedraft'])
{
$this->verify_post_flooding();

		}

		}


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


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

Zeile 1288Zeile 1312
		if($this->method == "insert" || array_key_exists('prefix', $thread))
{
$this->verify_prefix();

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

		}

		}


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


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

		{

		{

			$this->verify_subject();

			$this->verify_subject();

		}


		}


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

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

Zeile 1303Zeile 1327
		}

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

		}

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

		{

		{

			$this->verify_dateline();
}

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

			$this->verify_dateline();
}

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

		}

		}


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

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

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

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

		{

		{

			return false;
}
else
{
return true;

			return false;
}
else
{
return true;

		}

		}

	}

/**

	}

/**

Zeile 1377Zeile 1401

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


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

			{

			{

				$visible = 0;
}
}

				$visible = 0;
}
}

Zeile 1387Zeile 1411
		{
$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");

		}


		}


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

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

Zeile 1401Zeile 1425

// Are we updating a post which is already a draft? Perhaps changing it into a visible post?
if($draft_check)


// 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']),
"icon" => (int)$thread['icon'],
"username" => $db->escape_string($thread['username']),
"dateline" => (int)$thread['dateline'],

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

				"lastpost" => (int)$thread['dateline'],
"lastposter" => $db->escape_string($thread['username']),
"visible" => $visible
);

$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']),
"dateline" => (int)$thread['dateline'],
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),
"includesig" => $thread['options']['signature'],
"smilieoff" => $thread['options']['disablesmilies'],

				"lastpost" => (int)$thread['dateline'],
"lastposter" => $db->escape_string($thread['username']),
"visible" => $visible
);

$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']),
"dateline" => (int)$thread['dateline'],
"message" => $db->escape_string($thread['message']),
"ipaddress" => $db->escape_binary(my_inet_pton(get_ip())),
"includesig" => $thread['options']['signature'],
"smilieoff" => $thread['options']['disablesmilies'],

				"visible" => $visible
);
$plugins->run_hooks("datahandler_post_insert_thread_post", $this);

				"visible" => $visible
);
$plugins->run_hooks("datahandler_post_insert_thread_post", $this);

Zeile 1447Zeile 1471
				"dateline" => (int)$thread['dateline'],
"lastpost" => (int)$thread['dateline'],
"lastposter" => $db->escape_string($thread['username']),

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

 
				"lastposteruid" => $thread['uid'],

				"views" => 0,
"replies" => 0,
"visible" => $visible,
"notes" => ''

				"views" => 0,
"replies" => 0,
"visible" => $visible,
"notes" => ''

			);

			);


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



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


Zeile 1500Zeile 1525
				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']);
}





			// Perform any selected moderation tools.
if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
{

			// Perform any selected moderation tools.
if(is_moderator($thread['fid'], "", $thread['uid']) && is_array($thread['modoptions']))
{

Zeile 1509Zeile 1534
				$modoptions = $thread['modoptions'];
$modlogdata['fid'] = $thread['fid'];
if(isset($thread['tid']))

				$modoptions = $thread['modoptions'];
$modlogdata['fid'] = $thread['fid'];
if(isset($thread['tid']))

				{

				{

					$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)
{
$newclosed = "closed=1";

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

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

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

				}


				}


				// Stick the thread.

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

Zeile 1723Zeile 1736
	/**
* Updates a post that is already in the database.
*

	/**
* Updates a post that is already in the database.
*

 
	 * @return array

	 */
function update_post()
{

	 */
function update_post()
{

Zeile 1748Zeile 1762

$forum = get_forum($post['fid']);
$forumpermissions = forum_permissions($post['fid'], $post['uid']);


$forum = get_forum($post['fid']);
$forumpermissions = forum_permissions($post['fid'], $post['uid']);


// Check if this is the first post in a thread.
$options = array(
"order_by" => "dateline",
"order_dir" => "asc",
"limit_start" => 0,
"limit" => 1
);
$query = $db->simple_select("posts", "pid", "tid='".(int)$post['tid']."'", $options);
$first_post_check = $db->fetch_array($query);
if($first_post_check['pid'] == $post['pid'])
{
$first_post = true;
}
else
{
$first_post = false;
}

 

// Decide on the visibility of this post.
$ismod = is_moderator($post['fid'], "", $post['uid']);


// Decide on the visibility of this post.
$ismod = is_moderator($post['fid'], "", $post['uid']);

Zeile 1792Zeile 1788
		}

// Update the thread details that might have been changed first.

		}

// Update the thread details that might have been changed first.

		if($first_post)

		if($this->first_post)

		{
$this->tid = $post['tid'];


		{
$this->tid = $post['tid'];


Zeile 1893Zeile 1889
		// Return the thread's first post id and whether or not it is visible.
$this->return_values = array(
'visible' => $visible,

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

			'first_post' => $first_post

			'first_post' => $this->first_post

		);

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

		);

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