Zeile 151 | Zeile 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]); }
$recipientUsernames = array_map('trim', $pm[$recipient_type]); $recipientUsernames = array_filter($recipientUsernames); $recipientUsernames = array_map(array($db, 'escape_string'), $recipientUsernames); $recipientUsernames = "'".implode("','", $recipientUsernames)."'";
$query = $db->simple_select('users', '*', 'username IN('.$recipientUsernames.')');
| { 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; }
|
|
|
$validUsernames = array();
| $recipientUsernames = array_map(array($db, 'escape_string'), $pm[$recipient_type]); $recipientUsernames = "'".implode("','", $recipientUsernames)."'";
|
|
|
while ($user = $db->fetch_array($query)) { if ($recipient_type == "bcc") {
| $query = $db->simple_select('users', '*', 'username IN('.$recipientUsernames.')');
$validUsernames = array();
while($user = $db->fetch_array($query)) { if($recipient_type == "bcc") {
|
$user['bcc'] = 1; }
| $user['bcc'] = 1; }
|
Zeile 182 | Zeile 194 |
---|
$validUsernames[] = $user['username']; }
|
$validUsernames[] = $user['username']; }
|
foreach ($pm[$recipient_type] as $username) { if (!in_array($username, $validUsernames) AND trim($username)) {
| foreach($pm[$recipient_type] as $username) { if(!in_array($username, $validUsernames)) {
|
$invalid_recipients[] = $username; } }
| $invalid_recipients[] = $username; } }
|
Zeile 194 | Zeile 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;
|
} } }
| } } }
|