Vergleich inc/datahandlers/pm.php - 1.8.14 - 1.8.34

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 101Zeile 101
			$this->set_error("missing_message");
return false;
}

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

		return true;
}

/**










// If the length of message is beyond SQL limitation for 'text' field
else if(strlen($message) > 65535)
{
$this->set_error("message_too_long", array('65535', strlen($message)));
return false;
}

return true;
}

/**

	 * Verifies if the specified sender is valid or not.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if the specified sender is valid or not.
*
* @return boolean True when valid, false when invalid.

Zeile 112Zeile 120
	function verify_sender()
{
global $db, $mybb, $lang;

	function verify_sender()
{
global $db, $mybb, $lang;





		$pm = &$this->data;

// Return if we've already validated

		$pm = &$this->data;

// Return if we've already validated

Zeile 129Zeile 137

// Check if the sender is over their quota or not - if they are, disable draft sending
if(isset($pm['options']['savecopy']) && $pm['options']['savecopy'] != 0 && empty($pm['saveasdraft']))


// Check if the sender is over their quota or not - if they are, disable draft sending
if(isset($pm['options']['savecopy']) && $pm['options']['savecopy'] != 0 && empty($pm['saveasdraft']))

		{

		{

			if($sender_permissions['pmquota'] != 0 && $sender['totalpms'] >= $sender_permissions['pmquota'] && $this->admin_override != true)
{
$pm['options']['savecopy'] = 0;

			if($sender_permissions['pmquota'] != 0 && $sender['totalpms'] >= $sender_permissions['pmquota'] && $this->admin_override != true)
{
$pm['options']['savecopy'] = 0;

Zeile 163Zeile 171
		if(array_key_exists("to", $pm))
{
foreach(array("to", "bcc") as $recipient_type)

		if(array_key_exists("to", $pm))
{
foreach(array("to", "bcc") as $recipient_type)

			{
if(!isset($pm[$recipient_type]))
{
$pm[$recipient_type] = array();
}
if(!is_array($pm[$recipient_type]))
{

			{
if(!isset($pm[$recipient_type]))
{
$pm[$recipient_type] = array();
}
if(!is_array($pm[$recipient_type]))
{

					$pm[$recipient_type] = array($pm[$recipient_type]);
}

$pm[$recipient_type] = array_map('trim', $pm[$recipient_type]);

					$pm[$recipient_type] = array($pm[$recipient_type]);
}

$pm[$recipient_type] = array_map('trim', $pm[$recipient_type]);

				$pm[$recipient_type] = array_filter($pm[$recipient_type]);

// No recipients? Skip query
if(empty($pm[$recipient_type]))
{
if($recipient_type == 'to' && !$pm['saveasdraft'])

				$pm[$recipient_type] = array_filter($pm[$recipient_type]);

// No recipients? Skip query
if(empty($pm[$recipient_type]))
{
if($recipient_type == 'to' && empty($pm['saveasdraft']))

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

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

Zeile 193Zeile 201
				$query = $db->simple_select('users', '*', 'username IN('.$recipientUsernames.')');

$validUsernames = array();

				$query = $db->simple_select('users', '*', 'username IN('.$recipientUsernames.')');

$validUsernames = array();


while($user = $db->fetch_array($query))
{
if($recipient_type == "bcc")


while($user = $db->fetch_array($query))
{
if($recipient_type == "bcc")

					{
$user['bcc'] = 1;
}

					{
$user['bcc'] = 1;
}

Zeile 222Zeile 230
				if(!isset($pm[$recipient_type]))
{
$pm[$recipient_type] = array();

				if(!isset($pm[$recipient_type]))
{
$pm[$recipient_type] = array();

				}

				}

				if(!is_array($pm[$recipient_type]))
{
$pm[$recipient_type] = array($pm[$recipient_type]);

				if(!is_array($pm[$recipient_type]))
{
$pm[$recipient_type] = array($pm[$recipient_type]);

Zeile 239Zeile 247
						return false;
}
continue;

						return false;
}
continue;

				}

				}


$recipientUids = "'".implode("','", $pm[$recipient_type])."'";


$recipientUids = "'".implode("','", $pm[$recipient_type])."'";





				$query = $db->simple_select('users', '*', 'uid IN('.$recipientUids.')');

				$query = $db->simple_select('users', '*', 'uid IN('.$recipientUids.')');





				$validUids = array();

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

				$validUids = array();

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

				{

				{

					if($recipient_type == "bccid")
{
$user['bcc'] = 1;

					if($recipient_type == "bccid")
{
$user['bcc'] = 1;

Zeile 256Zeile 264

$recipients[] = $user;
$validUids[] = $user['uid'];


$recipients[] = $user;
$validUids[] = $user['uid'];

				}

				}


foreach($pm[$recipient_type] as $uid)
{


foreach($pm[$recipient_type] as $uid)
{

Zeile 285Zeile 293
		}

// Now we're done with that we loop through each recipient

		}

// Now we're done with that we loop through each recipient

 
		$pm['recipients'] = array();

		foreach($recipients as $user)
{
// Collect group permissions for this recipient.

		foreach($recipients as $user)
{
// Collect group permissions for this recipient.

Zeile 298Zeile 307
				if(!empty($user['ignorelist']) && strpos(','.$user['ignorelist'].',', ','.$pm['fromid'].',') !== false)
{
$this->set_error("recipient_is_ignoring", array(htmlspecialchars_uni($user['username'])));

				if(!empty($user['ignorelist']) && strpos(','.$user['ignorelist'].',', ','.$pm['fromid'].',') !== false)
{
$this->set_error("recipient_is_ignoring", array(htmlspecialchars_uni($user['username'])));

				}


				}


				// Is the recipient only allowing private messages from their buddy list?

				// Is the recipient only allowing private messages from their buddy list?

				if($mybb->settings['allowbuddyonly'] == 1 && $user['receivefrombuddy'] == 1 && !empty($user['buddylist']) && strpos(','.$user['buddylist'].',', ','.$pm['fromid'].',') === false)

				if(empty($pm['saveasdraft']) && $mybb->settings['allowbuddyonly'] == 1 && $user['receivefrombuddy'] == 1 && !empty($user['buddylist']) && strpos(','.$user['buddylist'].',', ','.$pm['fromid'].',') === false)

				{
$this->set_error('recipient_has_buddy_only', array(htmlspecialchars_uni($user['username'])));
}

// Can the recipient actually receive private messages based on their permissions or user setting?
if(($user['receivepms'] == 0 || $recipient_permissions['canusepms'] == 0) && empty($pm['saveasdraft']))

				{
$this->set_error('recipient_has_buddy_only', array(htmlspecialchars_uni($user['username'])));
}

// Can the recipient actually receive private messages based on their permissions or user setting?
if(($user['receivepms'] == 0 || $recipient_permissions['canusepms'] == 0) && empty($pm['saveasdraft']))

				{

				{

					$this->set_error("recipient_pms_disabled", array(htmlspecialchars_uni($user['username'])));
return false;
}

					$this->set_error("recipient_pms_disabled", array(htmlspecialchars_uni($user['username'])));
return false;
}

Zeile 535Zeile 544

$uid = 0;



$uid = 0;


		if(!is_array($pm['recipients']))



		// Build recipient list
$recipient_list = array();
if(isset($pm['recipients']) && is_array($pm['recipients']))

		{

		{

			$recipient_list = array();
}
else
{
// Build recipient list

 
			foreach($pm['recipients'] as $recipient)
{
if(!empty($recipient['bcc']))

			foreach($pm['recipients'] as $recipient)
{
if(!empty($recipient['bcc']))

Zeile 577Zeile 583
		$draftcheck = $db->fetch_array($query);

// This PM was previously a draft

		$draftcheck = $db->fetch_array($query);

// This PM was previously a draft

		if($draftcheck['pmid'])

		if(!empty($draftcheck['pmid']))

		{
if($draftcheck['deletetime'])
{

		{
if($draftcheck['deletetime'])
{

Zeile 621Zeile 627
			// Send email notification of new PM if it is enabled for the recipient
$query = $db->simple_select("privatemessages", "dateline", "uid='".$recipient['uid']."' AND folder='1'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 1));
$lastpm = $db->fetch_array($query);

			// Send email notification of new PM if it is enabled for the recipient
$query = $db->simple_select("privatemessages", "dateline", "uid='".$recipient['uid']."' AND folder='1'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 1));
$lastpm = $db->fetch_array($query);

			if($recipient['pmnotify'] == 1 && $recipient['lastactive'] > $lastpm['dateline'])

			if($recipient['pmnotify'] == 1 && (empty($lastpm['dateline']) || $recipient['lastactive'] > $lastpm['dateline']))

			{
if($recipient['language'] != "" && $lang->language_exists($recipient['language']))
{

			{
if($recipient['language'] != "" && $lang->language_exists($recipient['language']))
{

Zeile 657Zeile 663

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


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

			



				$parser_options = array(
'me_username' => $pm['sender']['username'],
'filter_badwords' => 1

				$parser_options = array(
'me_username' => $pm['sender']['username'],
'filter_badwords' => 1

Zeile 727Zeile 733
		// If we're saving a copy
if($pm['options']['savecopy'] != 0)
{

		// If we're saving a copy
if($pm['options']['savecopy'] != 0)
{

			if(isset($recipient_list['to']) && count($recipient_list['to']) == 1)

			if(isset($recipient_list['to']) && is_array($recipient_list['to']) && count($recipient_list['to']) == 1)

			{
$this->pm_insert_data['toid'] = $uid;
}

			{
$this->pm_insert_data['toid'] = $uid;
}