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

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

Zeile 104Zeile 106
	 * @var array
*/
public $return_values = array();

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

 

/**
* Is this the first post of a thread when editing
*
* @var boolean
*/
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 111Zeile 120
	 * @return boolean True if the author information is valid, false if invalid.
*/
function verify_author()

	 * @return boolean True if the author information is valid, false if invalid.
*/
function verify_author()

	{
global $mybb;

	{
global $mybb, $lang;


$post = &$this->data;



$post = &$this->data;


Zeile 141Zeile 150
			if(!$userhandler->verify_username())
{
// invalid username

			if(!$userhandler->verify_username())
{
// invalid username

				$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

			if($userhandler->verify_username_exists())
{
// username is in use

Zeile 165Zeile 174
	/**
* Verifies a post subject.
*

	/**
* 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 175Zeile 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 259Zeile 243
	/**
* Verifies a post message.
*

	/**
* Verifies a post message.
*

	 * @param string The message content.

	 * @return bool

	 */
function verify_message()
{

	 */
function verify_message()
{

Zeile 331Zeile 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 370Zeile 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;

Zeile 396Zeile 385

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


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

		{
return true;
}


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

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

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

		{
return true;
}


		{
return true;
}


		if($mybb->settings['postmergefignore'] == -1)
{
return true;

		if($mybb->settings['postmergefignore'] == -1)
{
return true;

Zeile 436Zeile 425
		if($simple_mode == true)
{
return false;

		if($simple_mode == true)
{
return false;

		}

		}


if($post['uid'])
{


if($post['uid'])
{

Zeile 475Zeile 464

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


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

		{

		{

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


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


Zeile 508Zeile 497
				return false;
}
}

				return false;
}
}

 

return true;

	}

/**

	}

/**

Zeile 536Zeile 527
				return false;
}
}

				return false;
}
}

 

return true;

	}

/**

	}

/**

Zeile 575Zeile 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 625Zeile 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))
{
$prefix = 0;


// If a valid prefix isn't supplied, don't assign one.
if(empty($prefix))
{
$prefix = 0;

		}

		}

		else
{

		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 652Zeile 649
				else
{
$user = get_user($this->data['uid']);

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

				}

if(!is_member($prefix_cache['groups'], array('usergroup' => $user['usergroup'], 'additionalgroups' => $user['additionalgroups'])))
{
$this->set_error('invalid_prefix');
return false;
}
}

				}

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

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


			if($prefix_cache['forums'] != "-1")
{
// 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 685Zeile 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 705Zeile 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 728Zeile 718
				return false;
}
}

				return false;
}
}





		return true;
}

		return true;
}





	/**
* Validate a post.
*

	/**
* Validate a post.
*

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

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


$post = &$this->data;


$post = &$this->data;

		$time = TIME_NOW;

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

 
		}

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

		}

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

		}

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

Zeile 819Zeile 837
		if(!$this->get_validated())
{
die("The post needs to be validated before inserting it into the DB.");

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

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

Zeile 860Zeile 878

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

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


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)

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

				{

				{

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

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

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

// Open the thread.

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

// Open the thread.

				if($modoptions['closethread'] != 1 && $thread['closed'] == 1)

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

				{

				{

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

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

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

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

				}

if(!isset($modoptions['stickthread']))
{
$modoptions['stickthread'] = $thread['sticky'];

 
				}

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

				}

				}


// Execute moderation options.
if($modoptions_update)


// Execute moderation options.
if($modoptions_update)

Zeile 969Zeile 977
				);
$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 1007Zeile 1015
				$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)
{

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

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

			if($forum['usepostcounts'] != 0)

			if($forum['usepostcounts'] != 0 && $thread['visible'] == 1)

			{
$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 1036Zeile 1044
				"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'],

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

				"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible
);

				"smilieoff" => $post['options']['disablesmilies'],
"visible" => $visible
);

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

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

$done_users = array();





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

			$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 1104Zeile 1111

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

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

Zeile 1119Zeile 1126
			);

while($subscribedmember = $db->fetch_array($query))

			);

while($subscribedmember = $db->fetch_array($query))

			{

			{

				if($done_users[$subscribedmember['uid']])
{
continue;

				if($done_users[$subscribedmember['uid']])
{
continue;

Zeile 1186Zeile 1193
					$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 1203Zeile 1210
					$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 1222Zeile 1229

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

		}

		}

		// Post is stuck in moderation queue
else if($visible == 0)

		// Post is stuck in moderation queue
else if($visible == 0)

		{

		{

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

		{
// Update the unapproved posts count for the current forum
$thread_update = array('replies' => '+1');

		{
// Update the unapproved posts count for the current forum
$thread_update = array('replies' => '+1');

			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)

Zeile 1246Zeile 1253
			// 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'");

		}

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

Zeile 1278Zeile 1291
		global $mybb, $db, $plugins;

$thread = &$this->data;

		global $mybb, $db, $plugins;

$thread = &$this->data;





		// Validate all thread assets.

if(!$thread['savedraft'])

		// Validate all thread assets.

if(!$thread['savedraft'])

Zeile 1330Zeile 1343
		if(count($this->get_errors()) > 0)
{
return false;

		if(count($this->get_errors()) > 0)
{
return false;

		}

		}

		else
{
return true;

		else
{
return true;

Zeile 1453Zeile 1466
				"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,

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

Zeile 1508Zeile 1522
			}

// 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 1522Zeile 1536
				$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 1717Zeile 1731
	/**
* 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 1742Zeile 1757

$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 1786Zeile 1783
		}

// 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 1887Zeile 1884
		// 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);