diff --git a/include/class.mailer.php b/include/class.mailer.php index 99e0ba0955e57ff7756c4cea992a3ed0cfc16276..b5d759cb43801c662bac5a96049cf0a402984772 100644 --- a/include/class.mailer.php +++ b/include/class.mailer.php @@ -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']; diff --git a/include/class.staff.php b/include/class.staff.php index 87bb3e073c77c3c39b687cc6452459ff128afe98..57e0ee30bfa10f0a2f7017d43d8a8f912dfb591d 100644 --- a/include/class.staff.php +++ b/include/class.staff.php @@ -172,6 +172,9 @@ implements AuthenticatedUser, EmailContact { function getId() { return $this->staff_id; } + function getUserId() { + return $this->getId(); + } function getEmail() { return $this->email;