-
Jared Hancock authored
Process inline attachments in thread entry and support inline images in piped emails Support inline images across the system, with draft support Migrate to a single attachment table That way we don't need a new table for everything we need to attach an inline image to (like a signature, for instance) Add richtext support for internal notes Implement images on site pages * Image paste in Redactor * Make non-local images optional * Placeholder for non-local images * Fix local image download hover * Don't re-attach inline images
864d3539
tickets.php 2.96 KiB
<?php
/*********************************************************************
tickets.php
Main client/user interface.
Note that we are using external ID. The real (local) ids are hidden from user.
Peter Rotich <peter@osticket.com>
Copyright (c) 2006-2013 osTicket
http://www.osticket.com
Released under the GNU General Public License WITHOUT ANY WARRANTY.
See LICENSE.TXT for details.
vim: expandtab sw=4 ts=4 sts=4:
**********************************************************************/
require('secure.inc.php');
if(!is_object($thisclient) || !$thisclient->isValid()) die('Access denied'); //Double check again.
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']))) {
$errors['err']='Unknown or invalid ticket ID.';
}elseif(!$ticket->checkClientAccess($thisclient)) {
$errors['err']='Unknown or invalid ticket ID.'; //Using generic message on purpose!
$ticket=null;
}
}
//Process post...depends on $ticket object above.
if($_POST && is_object($ticket) && $ticket->getId()):
$errors=array();
switch(strtolower($_POST['a'])){
case 'reply':
if(!$ticket->checkClientAccess($thisclient)) //double check perm again!
$errors['err']='Access Denied. Possibly invalid ticket ID';
if(!$_POST['message'])
$errors['message']='Message required';
if(!$errors) {
//Everything checked out...do the magic.
$vars = array('message'=>$_POST['message']);
if($cfg->allowOnlineAttachments() && $_FILES['attachments'])
$vars['files'] = AttachmentFile::format($_FILES['attachments'], true);
if (isset($_POST['draft_id']))
$vars['draft_id'] = $_POST['draft_id'];
if(($msgid=$ticket->postMessage($vars, 'Web'))) {
$msg='Message Posted Successfully';
// Cleanup drafts for the ticket. If not closed, only clean
// for this staff. Else clean all drafts for the ticket.
Draft::deleteForNamespace('ticket.client.' . $ticket->getExtId());
} else {
$errors['err']='Unable to post the message. Try again';
}
} elseif(!$errors['err']) {
$errors['err']='Error(s) occurred. Please try again';
}
break;
default:
$errors['err']='Unknown action';
}
$ticket->reload();
endif;
$nav->setActiveNav('tickets');
if($ticket && $ticket->checkClientAccess($thisclient)) {
$inc='view.inc.php';
} elseif($cfg->showRelatedTickets() && $thisclient->getNumTickets()) {
$inc='tickets.inc.php';
} else {
$nav->setActiveNav('new');
$inc='open.inc.php';
}
include(CLIENTINC_DIR.'header.inc.php');
include(CLIENTINC_DIR.$inc);
include(CLIENTINC_DIR.'footer.inc.php');
?>