From 6274d08a78292359288028824f6047594cb8b713 Mon Sep 17 00:00:00 2001
From: Jared Hancock <jared@osticket.com>
Date: Fri, 6 Jun 2014 14:39:31 -0500
Subject: [PATCH] Allow guests to sign out

Otherwise, a user's session cannot be voluntarily destroyed
---
 include/client/header.inc.php | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/include/client/header.inc.php b/include/client/header.inc.php
index 65ce26499..3f84db8d1 100644
--- a/include/client/header.inc.php
+++ b/include/client/header.inc.php
@@ -2,6 +2,8 @@
 $title=($cfg && is_object($cfg) && $cfg->getTitle())?$cfg->getTitle():'osTicket :: Support Ticket System';
 $signin_url = ROOT_PATH . "login.php"
     . ($thisclient ? "?e=".urlencode($thisclient->getEmail()) : "");
+$signout_url = ROOT_PATH . "logout.php?auth=".$ost->getLinkToken();
+
 header("Content-Type: text/html; charset=UTF-8\r\n");
 ?>
 <!DOCTYPE html>
@@ -51,13 +53,16 @@ header("Content-Type: text/html; charset=UTF-8\r\n");
                  ?>
                 <a href="<?php echo ROOT_PATH; ?>account.php">Profile</a> |
                 <a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> -
-                <a href="<?php echo ROOT_PATH; ?>logout.php?auth=<?php echo $ost->getLinkToken(); ?>">Log Out</a>
+                <a href="<?php echo $signout_url; ?>">Sign Out</a>
             <?php
             } elseif($nav) {
                 if ($cfg->getClientRegistrationMode() == 'public') { ?>
                     Guest User | <?php
                 }
-                if ($cfg->getClientRegistrationMode() != 'disabled') { ?>
+                if ($thisclient && $thisclient->isValid() && $thisclient->isGuest()) { ?>
+                    <a href="<?php echo $signout_url; ?>">Sign Out</a><?php
+                }
+                elseif ($cfg->getClientRegistrationMode() != 'disabled') { ?>
                     <a href="<?php echo $signin_url; ?>">Sign In</a>
 <?php
                 }
-- 
GitLab