Skip to content
Snippets Groups Projects
Commit 71da9b1e authored by Peter Rotich's avatar Peter Rotich Committed by Peter Rotich
Browse files

Change My Tickets (x) to Tickets (x) - with collaborators in mind

parent 9d5fef5a
No related branches found
No related tags found
No related merge requests found
......@@ -17,8 +17,8 @@
require('secure.inc.php');
require_once(INCLUDE_DIR.'class.attachment.php');
//Basic checks
if(!$thisclient
|| !$_GET['id']
if(!$thisclient
|| !$_GET['id']
|| !$_GET['h']
|| !($attachment=Attachment::lookup($_GET['id']))
|| !($file=$attachment->getFile()))
......@@ -26,9 +26,9 @@ if(!$thisclient
//Validate session access hash - we want to make sure the link is FRESH! and the user has access to the parent ticket!!
$vhash=md5($attachment->getFileId().session_id().$file->getHash());
if(strcasecmp(trim($_GET['h']),$vhash)
|| !($ticket=$attachment->getTicket())
|| !$ticket->checkClientAccess($thisclient))
if(strcasecmp(trim($_GET['h']),$vhash)
|| !($ticket=$attachment->getTicket())
|| !$ticket->checkUserAccess($thisclient))
die('Unknown or invalid attachment');
//Download the file..
$file->download();
......
......@@ -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()) {
$navs['tickets']=array('desc'=>sprintf('My Tickets (%d)',$user->getNumTickets()),
$navs['tickets']=array('desc'=>sprintf('Tickets (%d)',$user->getNumTickets()),
'href'=>'tickets.php',
'title'=>'Show all tickets');
} else {
......
......@@ -48,7 +48,7 @@ header("Content-Type: text/html; charset=UTF-8\r\n");
?>
<?php
if($cfg->showRelatedTickets()) {?>
<a href="<?php echo ROOT_PATH; ?>tickets.php">My Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> -
<a href="<?php echo ROOT_PATH; ?>tickets.php">Tickets <b>(<?php echo $thisclient->getNumTickets(); ?>)</b></a> -
<?php
} ?>
<a href="<?php echo ROOT_PATH; ?>logout.php?auth=<?php echo $ost->getLinkToken(); ?>">Log Out</a>
......
<?php
if(!defined('OSTCLIENTINC') || !$thisclient || !$ticket || !$ticket->checkClientAccess($thisclient)) die('Access Denied!');
if(!defined('OSTCLIENTINC') || !$thisclient || !$ticket || !$ticket->checkUserAccess($thisclient)) die('Access Denied!');
$info=($_POST && $errors)?Format::htmlchars($_POST):array();
......@@ -127,7 +127,7 @@ if($ticket->getThreadCount() && ($thread=$ticket->getClientThread())) {
<form id="reply" action="tickets.php?id=<?php echo $ticket->getExtId(); ?>#reply" name="reply" method="post" enctype="multipart/form-data">
<?php csrf_token(); ?>
<h2>Post a Reply</h2>
<input type="hidden" name="id" value="<?php echo $ticket->getExtId(); ?>">
<input type="hidden" name="id" value="<?php echo $ticket->getId(); ?>">
<input type="hidden" name="a" value="reply">
<table border="0" cellspacing="0" cellpadding="3" style="width:100%">
<tr>
......
......@@ -21,9 +21,9 @@ define('OSTCLIENTINC',TRUE); //make includes happy
require_once(INCLUDE_DIR.'class.client.php');
require_once(INCLUDE_DIR.'class.ticket.php');
if($_POST) {
if(($user=Client::login(trim($_POST['lticket']), trim($_POST['lemail']), null, $errors))) {
if ($_POST) {
if (($user = UserAuthenticationBackend::process($_POST['lemail'],
$_POST['lticket'], $errors))) {
//XXX: Ticket owner is assumed.
@header('Location: tickets.php?id='.$user->getTicketID());
require_once('tickets.php'); //Just in case of 'header already sent' error.
......
......@@ -20,9 +20,9 @@ require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.json.php');
$ticket=null;
if($_REQUEST['id']) {
if(!($ticket=Ticket::lookupByExtId($_REQUEST['id']))) {
if (!($ticket = Ticket::lookup($_REQUEST['id']))) {
$errors['err']='Unknown or invalid ticket ID.';
}elseif(!$ticket->checkClientAccess($thisclient)) {
} elseif(!$ticket->checkUserAccess($thisclient)) {
$errors['err']='Unknown or invalid ticket ID.'; //Using generic message on purpose!
$ticket=null;
}
......@@ -33,7 +33,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
$errors=array();
switch(strtolower($_POST['a'])){
case 'reply':
if(!$ticket->checkClientAccess($thisclient)) //double check perm again!
if(!$ticket->checkUserAccess($thisclient)) //double check perm again!
$errors['err']='Access Denied. Possibly invalid ticket ID';
if(!$_POST['message'])
......@@ -66,7 +66,7 @@ if($_POST && is_object($ticket) && $ticket->getId()):
$ticket->reload();
endif;
$nav->setActiveNav('tickets');
if($ticket && $ticket->checkClientAccess($thisclient)) {
if($ticket && $ticket->checkUserAccess($thisclient)) {
$inc='view.inc.php';
} elseif($cfg->showRelatedTickets() && $thisclient->getNumTickets()) {
$inc='tickets.inc.php';
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment