Vergleich inc/datahandlers/pm.php - 1.6.6 - 1.6.9

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: pm.php 5625 2011-10-02 19:16:35Z ralgith $

 * $Id$

 */

// Disallow direct access to this file for security reasons

 */

// Disallow direct access to this file for security reasons

Zeile 141Zeile 141
	 */
function verify_recipient()
{

	 */
function verify_recipient()
{

		global $db, $mybb, $lang;

		global $cache, $db, $mybb, $lang;


$pm = &$this->data;



$pm = &$this->data;


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

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

			}

			}


foreach(array("to", "bcc") as $recipient_type)
{
if(!is_array($pm[$recipient_type]))
{
$pm[$recipient_type] = array($pm[$recipient_type]);


foreach(array("to", "bcc") as $recipient_type)
{
if(!is_array($pm[$recipient_type]))
{
$pm[$recipient_type] = array($pm[$recipient_type]);

				}

				}

				foreach($pm[$recipient_type] as $username)
{
$username = trim($username);

				foreach($pm[$recipient_type] as $username)
{
$username = trim($username);

Zeile 196Zeile 196
				if(count($pm['toid']) <= 0)
{
$this->set_error("no_recipients");

				if(count($pm['toid']) <= 0)
{
$this->set_error("no_recipients");

					return false;
}

					return false;
}

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

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

Zeile 253Zeile 253
				if(!empty($ignorelist) && in_array($pm['fromid'], $ignorelist))
{
$this->set_error("recipient_is_ignoring", array($user['username']));

				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)

				
// Is the recipient only allowing private messages from their buddy list?
if($mybb->settings['allowbuddyonly'] == 1 && $user['receivefrombuddy'] == 1)

Zeile 289Zeile 289
					$uselang = "english";
}
if($uselang == $mybb->settings['bblanguage'] || !$uselang)

					$uselang = "english";
}
if($uselang == $mybb->settings['bblanguage'] || !$uselang)

				{

				{

					$emailsubject = $lang->emailsubject_reachedpmquota;
$emailmessage = $lang->email_reachedpmquota;
}

					$emailsubject = $lang->emailsubject_reachedpmquota;
$emailmessage = $lang->email_reachedpmquota;
}

Zeile 304Zeile 304
				}
$emailmessage = $lang->sprintf($emailmessage, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
$emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname']);

				}
$emailmessage = $lang->sprintf($emailmessage, $user['username'], $mybb->settings['bbname'], $mybb->settings['bburl']);
$emailsubject = $lang->sprintf($emailsubject, $mybb->settings['bbname']);

				my_mail($user['email'], $emailsubject, $emailmessage);












$new_email = array(
"mailto" => $db->escape_string($user['email']),
"mailfrom" => '',
"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)
{
$this->set_error("recipient_reached_quota", array($user['username']));

	
if($this->admin_override != true)
{
$this->set_error("recipient_reached_quota", array($user['username']));

				}
}


				}
}


			// Everything looks good, assign some specifics about the recipient
$pm['recipients'][$user['uid']] = array(
"uid" => $user['uid'],

			// Everything looks good, assign some specifics about the recipient
$pm['recipients'][$user['uid']] = array(
"uid" => $user['uid'],

Zeile 325Zeile 335
			
// If this recipient is defined as a BCC recipient, save it
if($user['bcc'] == 1)

			
// If this recipient is defined as a BCC recipient, save it
if($user['bcc'] == 1)

			{

			{

				$pm['recipients'][$user['uid']]['bcc'] = 1;
}
}

				$pm['recipients'][$user['uid']]['bcc'] = 1;
}
}

Zeile 367Zeile 377
					$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 375Zeile 385

/**
* 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.
*/
function verify_options()

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

Zeile 425Zeile 435

$this->verify_options();



$this->verify_options();


		$plugins->run_hooks_by_ref("datahandler_pm_validate", $this);


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


		// Choose the appropriate folder to save in.
if($pm['saveasdraft'])
{

		// Choose the appropriate folder to save in.
if($pm['saveasdraft'])
{

Zeile 456Zeile 466
	 */
function insert_pm()
{

	 */
function insert_pm()
{

		global $db, $mybb, $plugins, $lang;

		global $cache, $db, $mybb, $plugins, $lang;


// Yes, validating is required.
if(!$this->get_validated())


// Yes, validating is required.
if(!$this->get_validated())

Zeile 539Zeile 549
		if($pm['saveasdraft'])
{
$this->pm_insert_data['uid'] = $pm['sender']['uid'];

		if($pm['saveasdraft'])
{
$this->pm_insert_data['uid'] = $pm['sender']['uid'];





			// If this is a reply, then piggyback into the deletetime to let us know in the future
if($pm['do'] == "reply" || $pm['do'] == "replyall")
{
$this->pm_insert_data['deletetime'] = $pm['pmid'];
}


			// If this is a reply, then piggyback into the deletetime to let us know in the future
if($pm['do'] == "reply" || $pm['do'] == "replyall")
{
$this->pm_insert_data['deletetime'] = $pm['pmid'];
}


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

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

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

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

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

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

Zeile 554Zeile 564
				"draftsaved" => 1
);
}

				"draftsaved" => 1
);
}





		// Save a copy of the PM for each of our recipients
foreach($pm['recipients'] as $recipient)
{

		// Save a copy of the PM for each of our recipients
foreach($pm['recipients'] as $recipient)
{

Zeile 568Zeile 578
					$uselang = $recipient['language'];
}
elseif($mybb->settings['bblanguage'])

					$uselang = $recipient['language'];
}
elseif($mybb->settings['bblanguage'])

				{

				{

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

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

Zeile 588Zeile 598
					$userlang->load("messages");
$emailsubject = $userlang->emailsubject_newpm;
$emailmessage = $userlang->email_newpm;

					$userlang->load("messages");
$emailsubject = $userlang->emailsubject_newpm;
$emailmessage = $userlang->email_newpm;

				}


				}


				if(!$pm['sender']['username'])
{
$pm['sender']['username'] = $lang->mybb_engine;
}

				if(!$pm['sender']['username'])
{
$pm['sender']['username'] = $lang->mybb_engine;
}

				

				

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

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

				my_mail($recipient['email'], $emailsubject, $emailmessage);











				
$new_email = array(
"mailto" => $db->escape_string($recipient['email']),
"mailfrom" => '',
"subject" => $db->escape_string($emailsubject),
"message" => $db->escape_string($emailmessage),
"headers" => ''
);

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

			}

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


			}

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


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

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

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

// If PM noices/alerts are on, show!

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

// If PM noices/alerts are on, show!

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

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

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

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

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

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

Zeile 657Zeile 677
			$this->pm_insert_data['status'] = 1;
$this->pm_insert_data['receipt'] = 0;


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


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

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

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

// Because the sender saved a copy, update their total pm count

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

// Because the sender saved a copy, update their total pm count