Vergleich inc/datahandlers/pm.php - 1.8.8 - 1.8.30

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

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

 

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


		return true;
}


Zeile 130Zeile 138
		// 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)

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

			{
$pm['options']['savecopy'] = 0;
}
}

			{
$pm['options']['savecopy'] = 0;
}
}





		// Assign the sender information to the data.
$pm['sender'] = array(
"uid" => $sender['uid'],

		// Assign the sender information to the data.
$pm['sender'] = array(
"uid" => $sender['uid'],

Zeile 174Zeile 182
				}

$pm[$recipient_type] = array_map('trim', $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'])
{
$this->set_error("no_recipients");

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

						return false;
}
continue;
}





				$recipientUsernames = array_map(array($db, 'escape_string'), $pm[$recipient_type]);
$recipientUsernames = "'".implode("','", $recipientUsernames)."'";

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

				$recipientUsernames = array_map(array($db, 'escape_string'), $pm[$recipient_type]);
$recipientUsernames = "'".implode("','", $recipientUsernames)."'";

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





				$validUsernames = array();

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

$recipients[] = $user;

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

$recipients[] = $user;

					$validUsernames[] = $user['username'];
}


					$validUsernames[] = $user['username'];
}


Zeile 210Zeile 218
					if(!in_array($username, $validUsernames))
{
$invalid_recipients[] = $username;

					if(!in_array($username, $validUsernames))
{
$invalid_recipients[] = $username;

					}
}

					}
}

			}
}
// We have recipient IDs

			}
}
// We have recipient IDs

Zeile 220Zeile 228
			foreach(array("toid", "bccid") as $recipient_type)
{
if(!isset($pm[$recipient_type]))

			foreach(array("toid", "bccid") as $recipient_type)
{
if(!isset($pm[$recipient_type]))

				{

				{

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

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

Zeile 239Zeile 247
						return false;
}
continue;

						return false;
}
continue;

				}


				}


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

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

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

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

Zeile 259Zeile 267
				}

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

				}

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

				{

				{

					if(!in_array($uid, $validUids))
{
$invalid_recipients[] = $uid;

					if(!in_array($uid, $validUids))
{
$invalid_recipients[] = $uid;

Zeile 293Zeile 301
			// See if the sender is on the recipients ignore list and that either
// - admin_override is set or
// - sender is an administrator

			// See if the sender is on the recipients ignore list and that either
// - admin_override is set or
// - sender is an administrator

			if(($this->admin_override != true && $sender_permissions['cancp'] != 1) && $sender_permissions['canoverridepm'] != 1)

			if($this->admin_override != true && $sender_permissions['canoverridepm'] != 1)

			{
if(!empty($user['ignorelist']) && strpos(','.$user['ignorelist'].',', ','.$pm['fromid'].',') !== false)
{

			{
if(!empty($user['ignorelist']) && strpos(','.$user['ignorelist'].',', ','.$pm['fromid'].',') !== false)
{

Zeile 301Zeile 309
				}

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

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

Zeile 315Zeile 323
			}

// Check to see if the user has reached their private message quota - if they have, email them.

			}

// Check to see if the user has reached their private message quota - if they have, email them.

			if($recipient_permissions['pmquota'] != "0" && $user['totalpms'] >= $recipient_permissions['pmquota'] && $recipient_permissions['cancp'] != 1 && $sender_permissions['cancp'] != 1 && empty($pm['saveasdraft']) && !$this->admin_override)

			if($recipient_permissions['pmquota'] != 0 && $user['totalpms'] >= $recipient_permissions['pmquota'] && $sender_permissions['cancp'] != 1 && empty($pm['saveasdraft']) && !$this->admin_override)

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

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

Zeile 418Zeile 426
					$this->set_error("pm_flooding", array($time_to_wait));
}
return false;

					$this->set_error("pm_flooding", array($time_to_wait));
}
return false;

			}

			}

		}
// All is well that ends well - return true.
return true;

		}
// All is well that ends well - return true.
return true;

Zeile 426Zeile 434

/**
* Verifies if the various 'options' for sending PMs are valid.


/**
* Verifies if the various 'options' for sending PMs are valid.

	 *
* @return boolean True when valid, false when invalid.
*/

	 *
* @return boolean True when valid, false when invalid.
*/

	function verify_options()
{
$options = &$this->data['options'];

	function verify_options()
{
$options = &$this->data['options'];

Zeile 448Zeile 456
		}
return true;
}

		}
return true;
}





	/**
* Validate an entire private message.
*

	/**
* Validate an entire private message.
*

Zeile 497Zeile 505
		else
{
return true;

		else
{
return true;

		}

		}

	}

/**

	}

/**

Zeile 517Zeile 525
		if(count($this->get_errors()) > 0)
{
die("The PM is not valid.");

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

		}

		}


// Assign data to common variable
$pm = &$this->data;


// Assign data to common variable
$pm = &$this->data;

Zeile 527Zeile 535
			$pm['pmid'] = 0;
}
$pm['pmid'] = (int)$pm['pmid'];

			$pm['pmid'] = 0;
}
$pm['pmid'] = (int)$pm['pmid'];





		if(empty($pm['icon']) || $pm['icon'] < 0)
{
$pm['icon'] = 0;
}

		if(empty($pm['icon']) || $pm['icon'] < 0)
{
$pm['icon'] = 0;
}





		$uid = 0;

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

		$uid = 0;

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

		{

		{

			$recipient_list = array();
}
else

			$recipient_list = array();
}
else

Zeile 575Zeile 583
		// Check if we're updating a draft or not.
$query = $db->simple_select("privatemessages", "pmid, deletetime", "folder='3' AND uid='".(int)$pm['sender']['uid']."' AND pmid='{$pm['pmid']}'");
$draftcheck = $db->fetch_array($query);

		// Check if we're updating a draft or not.
$query = $db->simple_select("privatemessages", "pmid, deletetime", "folder='3' AND uid='".(int)$pm['sender']['uid']."' AND pmid='{$pm['pmid']}'");
$draftcheck = $db->fetch_array($query);





		// This PM was previously a draft

		// This PM was previously a draft

		if($draftcheck['pmid'])

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

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

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

Zeile 602Zeile 610
			}

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

			}

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

			$db->insert_query("privatemessages", $this->pm_insert_data);





$this->pmid = $db->insert_query("privatemessages", $this->pm_insert_data);

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


// If this is a draft, end it here - below deals with complete messages
return array(


// If this is a draft, end it here - below deals with complete messages
return array(

Zeile 618Zeile 629
			// 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']))
{
$uselang = $recipient['language'];
}
elseif($mybb->settings['bblanguage'])

			{
if($recipient['language'] != "" && $lang->language_exists($recipient['language']))
{
$uselang = $recipient['language'];
}
elseif($mybb->settings['bblanguage'])

				{

				{

					$uselang = $mybb->settings['bblanguage'];
}
else

					$uselang = $mybb->settings['bblanguage'];
}
else

Zeile 654Zeile 665

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 681Zeile 692
			$this->pm_insert_data['toid'] = $recipient['uid'];

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

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

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

 


			$this->pmid[] = $db->insert_query("privatemessages", $this->pm_insert_data);

			$this->pmid[] = $db->insert_query("privatemessages", $this->pm_insert_data);

 

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


// If PM noices/alerts are on, show!
if($recipient['pmnotice'] == 1)


// If PM noices/alerts are on, show!
if($recipient['pmnotice'] == 1)

Zeile 701Zeile 715
		if($pm['pmid'])
{
if($pm['do'] == "reply" || $pm['do'] == "replyall")

		if($pm['pmid'])
{
if($pm['do'] == "reply" || $pm['do'] == "replyall")

			{

			{

				$sql_array = array(
'status' => 3,

				$sql_array = array(
'status' => 3,

					'statustime' => TIME_NOW
);
$db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
}

					'statustime' => TIME_NOW
);
$db->update_query("privatemessages", $sql_array, "pmid={$pm['pmid']} AND uid={$pm['sender']['uid']}");
}

			elseif($pm['do'] == "forward")
{
$sql_array = array(

			elseif($pm['do'] == "forward")
{
$sql_array = array(

Zeile 721Zeile 735
		// 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;
}
else

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

Zeile 735Zeile 749
			$this->pm_insert_data['receipt'] = 0;

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

			$this->pm_insert_data['receipt'] = 0;

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

 


			$db->insert_query("privatemessages", $this->pm_insert_data);

			$db->insert_query("privatemessages", $this->pm_insert_data);

 

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


// Because the sender saved a copy, update their total pm count
require_once MYBB_ROOT."/inc/functions_user.php";


// Because the sender saved a copy, update their total pm count
require_once MYBB_ROOT."/inc/functions_user.php";