Vergleich inc/datahandlers/pm.php - 1.8.3 - 1.8.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 50Zeile 50

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


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

 
	 *
* @var int

	 */
public $pmid = 0;


	 */
public $pmid = 0;


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

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





	/**
* Verifies a private message subject.
*

	/**
* Verifies a private message subject.
*

Zeile 68Zeile 70
	function verify_subject()
{
$subject = &$this->data['subject'];

	function verify_subject()
{
$subject = &$this->data['subject'];





		// Subject is over 85 characters, too long.
if(my_strlen($subject) > 85)
{

		// Subject is over 85 characters, too long.
if(my_strlen($subject) > 85)
{

Zeile 77Zeile 79
		}
// No subject, apply the default [no subject]
if(!trim_blank_chrs($subject))

		}
// No subject, apply the default [no subject]
if(!trim_blank_chrs($subject))

		{

		{

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

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

Zeile 86Zeile 88

/**
* Verifies if a message for a PM is valid.


/**
* Verifies if a message for a PM is valid.

	 *

	 *

	 * @return boolean True when valid, false when invalid.
*/
function verify_message()

	 * @return boolean True when valid, false when invalid.
*/
function verify_message()

Zeile 123Zeile 125
		$sender = get_user($pm['fromid']);

// Collect user permissions for the sender.

		$sender = get_user($pm['fromid']);

// Collect user permissions for the sender.

		$sender_permissions = user_permissions($pm['fromid']);

		$sender_permissions = user_permissions($pm['fromid']);


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

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

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

				{

				{

					$pm[$recipient_type] = array($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]))

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

					if($recipient_type == 'to' && !$pm['saveasdraft'])
{
$this->set_error("no_recipients");

Zeile 195Zeile 197
				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;
}


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


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

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

$validUids = array();

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

$validUids = array();





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

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

Zeile 269Zeile 271
		// If we have one or more invalid recipients and we're not saving a draft, error
if(count($invalid_recipients) > 0)
{

		// If we have one or more invalid recipients and we're not saving a draft, error
if(count($invalid_recipients) > 0)
{

			$invalid_recipients = implode(", ", array_map("htmlspecialchars_uni", $invalid_recipients));

			$invalid_recipients = implode($lang->comma, array_map("htmlspecialchars_uni", $invalid_recipients));

			$this->set_error("invalid_recipients", array($invalid_recipients));

			$this->set_error("invalid_recipients", array($invalid_recipients));

			return false;
}

			return false;
}


$sender_permissions = user_permissions($pm['fromid']);



$sender_permissions = user_permissions($pm['fromid']);


Zeile 291Zeile 293
			// 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)
{
$ignorelist = explode(",", $user['ignorelist']);
if(!empty($ignorelist) && in_array($pm['fromid'], $ignorelist))
{
$this->set_error("recipient_is_ignoring", array($user['username']));
}

// Is the recipient only allowing private messages from their buddy list?
if($mybb->settings['allowbuddyonly'] == 1 && $user['receivefrombuddy'] == 1)
{
$buddylist = explode(",", $user['buddylist']);
if(!empty($buddylist) && !in_array($pm['fromid'], $buddylist))
{
$this->set_error("recipient_has_buddy_only", array(htmlspecialchars_uni($user['username'])));
}
}


			if($this->admin_override != true && $sender_permissions['canoverridepm'] != 1)
{
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?
if($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']))
{

				// 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($user['username']));

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

					return false;
}
}

					return false;
}
}

Zeile 327Zeile 324
				elseif($mybb->settings['bblanguage'])
{
$uselang = $mybb->settings['bblanguage'];

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

				}

				}

				else

				else

				{

				{

					$uselang = "english";

					$uselang = "english";

				}

				}

				if($uselang == $mybb->settings['bblanguage'] || !$uselang)
{
$emailsubject = $lang->emailsubject_reachedpmquota;
$emailmessage = $lang->email_reachedpmquota;

				if($uselang == $mybb->settings['bblanguage'] || !$uselang)
{
$emailsubject = $lang->emailsubject_reachedpmquota;
$emailmessage = $lang->email_reachedpmquota;

				}

				}

				else
{
$userlang = new MyLanguage;

				else
{
$userlang = new MyLanguage;

Zeile 355Zeile 352
					"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

					"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''

				);

				);


$db->insert_query("mailqueue", $new_email);
$cache->update_mailqueue();

if($this->admin_override != true)
{


$db->insert_query("mailqueue", $new_email);
$cache->update_mailqueue();

if($this->admin_override != true)
{

					$this->set_error("recipient_reached_quota", array($user['username']));

					$this->set_error("recipient_reached_quota", array(htmlspecialchars_uni($user['username'])));

				}
}


				}
}


Zeile 381Zeile 378
			if(isset($user['bcc']) && $user['bcc'] == 1)
{
$pm['recipients'][$user['uid']]['bcc'] = 1;

			if(isset($user['bcc']) && $user['bcc'] == 1)
{
$pm['recipients'][$user['uid']]['bcc'] = 1;

			}
}
return true;
}

			}
}
return true;
}


/**
* 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_pm_flooding()
{
global $mybb, $db;

	*/
function verify_pm_flooding()
{
global $mybb, $db;





		$pm = &$this->data;

// Check if post flooding is enabled within MyBB or if the admin override option is specified.

		$pm = &$this->data;

// Check if post flooding is enabled within MyBB or if the admin override option is specified.

		if($mybb->settings['pmfloodsecs'] > 0 && $pm['fromid'] != 0 && $this->admin_override == false)

		if($mybb->settings['pmfloodsecs'] > 0 && $pm['fromid'] != 0 && $this->admin_override == false && !is_moderator(0, '', $pm['fromid']))

		{
// Fetch the senders profile data.
$sender = get_user($pm['fromid']);

		{
// Fetch the senders profile data.
$sender = get_user($pm['fromid']);

Zeile 408Zeile 405
			$sender['lastpm'] = $db->fetch_field($query, "dateline");

// A little bit of calculation magic and moderator status checking.

			$sender['lastpm'] = $db->fetch_field($query, "dateline");

// A little bit of calculation magic and moderator status checking.

			if(TIME_NOW-$sender['lastpm'] <= $mybb->settings['pmfloodsecs'] && !is_moderator("", "", $pm['fromid']))

			if(TIME_NOW-$sender['lastpm'] <= $mybb->settings['pmfloodsecs'])

			{
// Oops, user has been flooding - throw back error message.
$time_to_wait = ($mybb->settings['pmfloodsecs'] - (TIME_NOW-$sender['lastpm'])) + 1;
if($time_to_wait == 1)
{
$this->set_error("pm_flooding_one_second");

			{
// Oops, user has been flooding - throw back error message.
$time_to_wait = ($mybb->settings['pmfloodsecs'] - (TIME_NOW-$sender['lastpm'])) + 1;
if($time_to_wait == 1)
{
$this->set_error("pm_flooding_one_second");

				}

				}

				else
{
$this->set_error("pm_flooding", array($time_to_wait));

				else
{
$this->set_error("pm_flooding", array($time_to_wait));

Zeile 433Zeile 430
	 * @return boolean True when valid, false when invalid.
*/
function verify_options()

	 * @return boolean True when valid, false when invalid.
*/
function verify_options()

	{

	{

		$options = &$this->data['options'];

$this->verify_yesno_option($options, 'signature', 1);

		$options = &$this->data['options'];

$this->verify_yesno_option($options, 'signature', 1);

Zeile 571Zeile 568
			'smilieoff' => $pm['options']['disablesmilies'],
'receipt' => (int)$pm['options']['readreceipt'],
'readtime' => 0,

			'smilieoff' => $pm['options']['disablesmilies'],
'receipt' => (int)$pm['options']['readreceipt'],
'readtime' => 0,

			'recipients' => $db->escape_string(serialize($recipient_list)),

			'recipients' => $db->escape_string(my_serialize($recipient_list)),

			'ipaddress' => $db->escape_binary($pm['ipaddress'])
);


			'ipaddress' => $db->escape_binary($pm['ipaddress'])
);


Zeile 657Zeile 654

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


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

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







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

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


$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $pm['message']);
$emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname'], $pm['subject']);


$emailmessage = $lang->sprintf($emailmessage, $recipient['username'], $pm['sender']['username'], $mybb->settings['bbname'], $mybb->settings['bburl'], $pm['message']);
$emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname'], $pm['subject']);