diff --git a/include/class.auth.php b/include/class.auth.php index 563a79b1908b83cc462b3e8a7442a0675c823196..1cd2c584fcd0dd862403fc2e4f1a067fccefa7bb 100644 --- a/include/class.auth.php +++ b/include/class.auth.php @@ -793,6 +793,7 @@ class AuthTokenAuthentication extends UserAuthenticationBackend { if (!$user || strcmp($this->getAuthKey($user), $authkey)) return null; + $user->flagGuest(); return $user; } diff --git a/include/class.client.php b/include/class.client.php index 14533f9bba16d7d52d3bb0274a427138e42bb381..910be9b4bfdfcb548c727caa7bbd079f34f565fd 100644 --- a/include/class.client.php +++ b/include/class.client.php @@ -18,6 +18,7 @@ abstract class TicketUser { static private $token_regex = '/^(?P<type>\w{1})(?P<algo>\d+)x(?P<hash>.*)$/i'; protected $user; + protected $_guest = false; function __construct($user) { $this->user = $user; @@ -137,6 +138,14 @@ abstract class TicketUser { && $this->user->getId() == $this->getTicket()->getOwnerId()); } + function flagGuest() { + $this->_guest = true; + } + + function isGuest() { + return $this->_guest; + } + abstract function getTicketId(); abstract function getTicket(); } diff --git a/include/class.nav.php b/include/class.nav.php index d2798cece21ab141a3a4a36074785babf5c3585b..4cdd222fc5dc12a44f8249ecd742a2b388395b53 100644 --- a/include/class.nav.php +++ b/include/class.nav.php @@ -282,7 +282,7 @@ class UserNav { $navs['new']=array('desc'=>'Open New Ticket','href'=>'open.php','title'=>''); if($user && $user->isValid()) { - if($cfg && $cfg->showRelatedTickets()) { + if(!$user->isGuest() && $cfg && $cfg->showRelatedTickets()) { $navs['tickets']=array('desc'=>sprintf('Tickets (%d)',$user->getNumTickets()), 'href'=>'tickets.php', 'title'=>'Show all tickets'); diff --git a/include/client/header.inc.php b/include/client/header.inc.php index 1fe599486ca1451365a7465cb9107edf6861739b..707c50241d31795e6015217716ac6e26a2dd5725 100644 --- a/include/client/header.inc.php +++ b/include/client/header.inc.php @@ -43,7 +43,8 @@ header("Content-Type: text/html; charset=UTF-8\r\n"); style="height: 5em"></a> <p> <?php - if($thisclient && is_object($thisclient) && $thisclient->isValid()) { + if ($thisclient && is_object($thisclient) && $thisclient->isValid() + && !$thisclient->isGuest()) { echo Format::htmlchars($thisclient->getName()).' |'; ?> <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> | diff --git a/tickets.php b/tickets.php index 01d8b799c4220aa9ffc66ad7ce3e238ef2984925..1580119830d1f7d6b11bf40c54589446ca834f37 100644 --- a/tickets.php +++ b/tickets.php @@ -16,6 +16,10 @@ **********************************************************************/ require('secure.inc.php'); if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again. + +if ($thisclient->isGuest()) + $_REQUEST['id'] = $thisclient->getTicketId(); + require_once(INCLUDE_DIR.'class.ticket.php'); require_once(INCLUDE_DIR.'class.json.php'); $ticket=null;