From 11e4a0cf616a72240dd0ae3e8339a9ab2cf84dcd Mon Sep 17 00:00:00 2001 From: Peter Rotich <peter@osticket.com> Date: Thu, 31 Dec 2015 16:53:06 +0000 Subject: [PATCH] Credit @greezybacon --- include/class.client.php | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/include/class.client.php b/include/class.client.php index 23b64d161..932a5bde6 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -36,25 +36,7 @@ implements EmailContact, ITicketUser, TemplateVariable { ? call_user_func_array(array($this->user, $name), $args) : call_user_func(array($this->user, $name)); - if ($rv) return $rv; - - $tag = substr($name, 3); - switch (strtolower($tag)) { - case 'ticket_link': - $qstr = array(); - if ($cfg && $cfg->isAuthTokenEnabled() - && ($ticket=$this->getTicket())) - $qstr['auth'] = $ticket->getAuthToken($this); - - return sprintf('%s/view.php?%s', - $cfg->getBaseUrl(), - Http::build_query($qstr, false) - ); - break; - } - - return false; - + return $rv ?: false; } // Required for Internationalization::getCurrentLanguage() in templates @@ -70,6 +52,22 @@ implements EmailContact, ITicketUser, TemplateVariable { ); } + function getVar($tag) { + switch (strtolower($tag)) { + case 'ticket_link': + $qstr = array(); + if ($cfg && $cfg->isAuthTokenEnabled() + && ($ticket=$this->getTicket())) + $qstr['auth'] = $ticket->getAuthToken($this); + + return sprintf('%s/view.php?%s', + $cfg->getBaseUrl(), + Http::build_query($qstr, false) + ); + break; + } + } + function getId() { return ($this->user) ? $this->user->getId() : null; } function getEmail() { return ($this->user) ? $this->user->getEmail() : null; } -- GitLab