Vergleich inc/datahandlers/pm.php - 1.6.11 - 1.6.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 62Zeile 62
	function verify_subject()
{
$subject = &$this->data['subject'];

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


$subject = utf8_handle_4byte_string($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)

		{

		{

			$this->set_error("too_long_subject");

			$this->set_error("too_long_subject");

			return false;

			return false;

		}
// No subject, apply the default [no subject]
if(!trim_blank_chrs($subject))
{
$this->set_error("missing_subject");

		}
// No subject, apply the default [no subject]
if(!trim_blank_chrs($subject))
{
$this->set_error("missing_subject");

			return false;
}
return true;
}

/**

			return false;
}
return true;
}

/**

	 * Verifies if a message for a PM is valid.
*
* @return boolean True when valid, false when invalid.

	 * Verifies if a message for a PM is valid.
*
* @return boolean True when valid, false when invalid.

Zeile 88Zeile 86
	function verify_message()
{
$message = &$this->data['message'];

	function verify_message()
{
$message = &$this->data['message'];


$message = utf8_handle_4byte_string($message);

 

// No message, return an error.
if(trim_blank_chrs($message) == '')
{
$this->set_error("missing_message");
return false;


// No message, return an error.
if(trim_blank_chrs($message) == '')
{
$this->set_error("missing_message");
return false;

		}
return true;

		}
return true;

	}

/**

	}

/**

Zeile 155Zeile 151
		// We have our recipient usernames but need to fetch user IDs
if(array_key_exists("to", $pm))
{

		// We have our recipient usernames but need to fetch user IDs
if(array_key_exists("to", $pm))
{

			if((count($pm['to']) <= 0 || trim(implode("", $pm['to'])) == "") && !$pm['saveasdraft'])
{
$this->set_error("no_recipients");
return false;
}


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

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

				if(!is_array($pm[$recipient_type]))
{
$pm[$recipient_type] = 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_filter($pm[$recipient_type]);

// No recipients? Skip query
if(empty($pm[$recipient_type]))
{
if($recipient_type == 'to' && !$pm['saveasdraft'])
{
$this->set_error("no_recipients");
return false;
}
continue;
}





				$recipientUsernames = array_map('trim', $pm[$recipient_type]);
$recipientUsernames = array_filter($recipientUsernames);
$recipientUsernames = array_map(array($db, 'escape_string'), $recipientUsernames);

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



				$recipientUsernames = "'".implode("','", $recipientUsernames)."'";


				$recipientUsernames = "'".implode("','", $recipientUsernames)."'";


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

$validUsernames = array();

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







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





				$validUsernames = array();

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

						$user['bcc'] = 1;
}

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

						$user['bcc'] = 1;
}

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

				}

foreach ($pm[$recipient_type] as $username) {
if (!in_array($username, $validUsernames) AND trim($username)) {
$invalid_recipients[] = $username;
}
}



				}

foreach($pm[$recipient_type] as $username)
{
if(!in_array($username, $validUsernames))
{
$invalid_recipients[] = $username;
}
}

			}
}
// We have recipient IDs

			}
}
// We have recipient IDs

Zeile 198Zeile 208
		{
foreach(array("toid", "bccid") as $recipient_type)
{

		{
foreach(array("toid", "bccid") as $recipient_type)
{

				if(count($pm['toid']) <= 0)
{
$this->set_error("no_recipients");
return false;
}
if(is_array($pm[$recipient_type]))
{
$recipientUids = array_map('intval', $pm[$recipient_type]);
$recipientUids = array_filter($recipientUids);
$recipientUids = "'".implode("','", $recipientUids)."'";

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

$validUids = array();





















				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('intval', $pm[$recipient_type]);
$pm[$recipient_type] = array_filter($pm[$recipient_type]);

// No recipients? Skip query
if(empty($pm[$recipient_type]))
{
if($recipient_type == 'toid' && !$pm['saveasdraft'])
{
$this->set_error("no_recipients");
return false;
}
continue;
}

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

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

$validUids = array();

while($user = $db->fetch_array($query))
{
if($recipient_type == "bccid")
{
$user['bcc'] = 1;
}





					while ($user = $db->fetch_array($query)) {
if ($recipient_type == "bcc") {
$user['bcc'] = 1;
}

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






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

foreach ($pm[$recipient_type] as $uid) {
if (!in_array($uid, $validUids) AND trim($uid)) {
$invalid_recipients[] = $uid;
}

				foreach($pm[$recipient_type] as $uid)
{
if(!in_array($uid, $validUids))
{
$invalid_recipients[] = $uid;




					}
}
}

					}
}
}