Skip to content
Snippets Groups Projects
Commit 2668623e authored by Jared Hancock's avatar Jared Hancock
Browse files

mailer: Merge #1730 to develop-next

parent 3658e2be
Branches
Tags
No related merge requests found
......@@ -144,26 +144,24 @@ class Mailer {
'abcdefghiklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_=');
$sig = $this->getEmail()?$this->getEmail()->getEmail():'@osTicketMailer';
$sysid = static::getSystemMessageIdCode();
if ($recipient instanceof EmailContact) {
// Create a tag for the outbound email
$entry = (isset($options['thread']) && $options['thread'] instanceof ThreadEntry)
? $options['thread'] : false;
$thread = $entry ? $entry->getThread()
: (isset($options['thread']) && $options['thread'] instanceof Thread
? $options['thread'] : false);
$tag = pack('VVVa',
$recipient->getId(),
$entry ? $entry->getId() : 0,
$thread ? $thread->getId() : 0,
($recipient instanceof Staff ? 'S'
: ($recipient instanceof TicketOwner ? 'U'
: ($recipient instanceof Collaborator ? 'C'
: '?')))
);
// Sign the tag with the system secret salt
$tag .= substr(hash_hmac('sha1', $tag.$rand.$sysid, SECRET_SALT, true), -5);
$tag = str_replace('=','',base64_encode($tag));
}
// Create a tag for the outbound email
$entry = (isset($options['thread']) && $options['thread'] instanceof ThreadEntry)
? $options['thread'] : false;
$thread = $entry ? $entry->getThread()
: (isset($options['thread']) && $options['thread'] instanceof Thread
? $options['thread'] : false);
$tag = pack('VVVa',
$recipient instanceof EmailContact ? $recipient->getUserId() : 0,
$entry ? $entry->getId() : 0,
$thread ? $thread->getId() : 0,
($recipient instanceof Staff ? 'S'
: ($recipient instanceof TicketOwner ? 'U'
: ($recipient instanceof Collaborator ? 'C'
: '?')))
);
// Sign the tag with the system secret salt
$tag .= substr(hash_hmac('sha1', $tag.$rand.$sysid, SECRET_SALT, true), -5);
$tag = str_replace('=','',base64_encode($tag));
return sprintf('B%s-%s-%s-%s',
$sysid, $rand, $tag, $sig);
}
......@@ -258,7 +256,7 @@ class Mailer {
// Attempt to make the user-id more specific
$classes = array(
'S' => 'staffId', 'U' => 'userId'
'S' => 'staffId', 'U' => 'userId', 'C' => 'userId',
);
if (isset($classes[$rv['userClass']]))
$rv[$classes[$rv['userClass']]] = $rv['uid'];
......
......@@ -172,6 +172,9 @@ implements AuthenticatedUser, EmailContact {
function getId() {
return $this->staff_id;
}
function getUserId() {
return $this->getId();
}
function getEmail() {
return $this->email;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment