Skip to content

Commit

Permalink
! fix #3476 ACP PBE functions are not using the new db structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Spuds committed Mar 11, 2021
1 parent 85c4bd7 commit ee206db
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion sources/admin/ManageMaillist.controller.php
Expand Up @@ -414,7 +414,7 @@ public function action_approve_email()
{
// Set up the details needed to get this posted
$force = true;
$key = $temp_email[0]['key'];
$key = $temp_email[0]['key'] . '-' . $temp_email[0]['type'] . $temp_email[0]['message'];
$data = $temp_email[0]['body'];

// Unknown from email? Update the message ONLY if we found an appropriate one during the error checking process
Expand Down
5 changes: 4 additions & 1 deletion sources/subs/EmailParse.class.php
Expand Up @@ -1018,7 +1018,10 @@ public function load_key($key = '')
// Supplied a key, lets check it
if (!empty($key))
{
preg_match($regex_key, $key, $match);
if (preg_match($regex_key, $key, $match) === 1)
{
$this->_load_key_details($match);
}
}
// Otherwise we play find the key
else
Expand Down
35 changes: 16 additions & 19 deletions sources/subs/Emailpost.subs.php
Expand Up @@ -638,7 +638,7 @@ function pbe_emailError($error, $email_message)
$subject = ($subject === '' ? $txt['no_subject'] : $subject);

// Start off with what we know about the security key, even if its nothing
$message_key = (string) $email_message->message_key_id;
$message_key = (string) $email_message->message_key;
$message_type = (string) $email_message->message_type;
$message_id = (int) $email_message->message_id;
$board_id = -1;
Expand All @@ -653,7 +653,7 @@ function pbe_emailError($error, $email_message)
$email_message->email['from'] = $email_message->email['from'] . ' => ' . $key_owner;

// Since we have a valid key set those details as well
$message_key = $email_message->message_key_id;
$message_key = $email_message->message_key;
$message_type = $email_message->message_type;
$message_id = $email_message->message_id;
}
Expand All @@ -669,7 +669,7 @@ function pbe_emailError($error, $email_message)
$email_message->email['from'] = $key_owner . ' => ' . $email_message->email['from'];

// Since we have a valid key set those details as well
$message_key = $email_message->message_key_id;
$message_key = $email_message->message_key;
$message_type = $email_message->message_type;
$message_id = $email_message->message_id;
}
Expand All @@ -689,24 +689,21 @@ function pbe_emailError($error, $email_message)
// While we have keys to look at see if we can match up this lost message on subjects
foreach ($user_keys as $user_key)
{
if (preg_match('~([a-z0-9]{32})\-(p|t|m)(\d+)~', $user_key['id_email'], $match))
{
$key = $match[0];
$type = $match[2];
$message = $match[3];
$key = $user_key['message_key'];
$type = $user_key['message_type'];
$message = $user_key['message_id'];

// If we know/suspect its a "m,t or p" then use that to avoid a match on a wrong type, that would be bad ;)
if ((!empty($message_type) && $message_type === $type) || (empty($message_type) && $type !== 'p'))
// If we know/suspect its a "m,t or p" then use that to avoid a match on a wrong type, that would be bad ;)
if ((!empty($message_type) && $message_type === $type) || (empty($message_type) && $type !== 'p'))
{
// lets look up this message/topic/pm and see if the subjects match ... if they do then tada!
if (query_load_subject($message, $type, $email_message->email['from']) === $subject)
{
// lets look up this message/topic/pm and see if the subjects match ... if they do then tada!
if (query_load_subject($message, $type, $email_message->email['from']) === $subject)
{
// This email has a subject that matches the subject of a message that was sent to them
$message_key = $key;
$message_id = $message;
$message_type = $type;
break;
}
// This email has a subject that matches the subject of a message that was sent to them
$message_key = $key;
$message_id = $message;
$message_type = $type;
break;
}
}
}
Expand Down

0 comments on commit ee206db

Please sign in to comment.