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