function log($id) { if ($id && ($log = Log::lookup($id))) { $content = sprintf('<div style="width:500px;"> <strong>%s</strong><br><p>%s</p> <hr><strong>Log Date:</strong> <em>%s</em> <strong>IP Address:</strong> <em>%s</em></div>', $log->getTitle(), Format::display(str_replace(',', ', ', $log->getText())), Format::db_daydatetime($log->getCreateDate()), $log->getIP()); } else { $content = '<div style="width:295px;"> <strong>Error:</strong>Unknown or invalid log ID</div>'; } return $content; }
function log($id) { if ($id && ($log = Log::lookup($id))) { $content = sprintf('<div style="width:500px;"> <strong>%s</strong><br><p style="white-space:pre-line;">%s</p> <hr><strong>%s:</strong> <em>%s</em> <strong>%s:</strong> <em>%s</em></div>', $log->getTitle(), Format::display(str_replace(',', ', ', $log->getText())), __('Log Date'), Format::db_daydatetime($log->getCreateDate()), __('IP Address'), $log->getIP()); } else { $content = '<div style="width:295px;"> <strong>' . __('Error') . ':</strong>' . sprintf(__('%s: Unknown or invalid ID.'), __('log entry')) . '</div>'; } return $content; }
function faq($id, $format = 'html') { //XXX: user ajax->getThisStaff() (nolint) global $thisstaff; include_once INCLUDE_DIR . 'class.faq.php'; if (!($faq = FAQ::lookup($id))) { return null; } //TODO: $f*g->getJSON() for json format. (nolint) $resp = sprintf('<div style="width:650px;"> <strong>%s</strong><p>%s</p> <div class="faded">Last updated %s</div> <hr> <a href="faq.php?id=%d">View</a> | <a href="faq.php?id=%d">Attachments (%s)</a>', $faq->getQuestion(), Format::safe_html($faq->getAnswer()), Format::db_daydatetime($faq->getUpdateDate()), $faq->getId(), $faq->getId(), $faq->getNumAttachments()); if ($thisstaff && $thisstaff->canManageFAQ()) { $resp .= sprintf(' | <a href="faq.php?id=%d&a=edit">Edit</a>', $faq->getId()); } $resp .= '</div>'; return $resp; }
if(!defined('OSTCLIENTINC') || !$faq || !$faq->isPublished()) die('Access Denied'); $category=$faq->getCategory(); ?> <h1>Frequently Asked Questions</h1> <div id="breadcrumbs"> <a href="index.php">All Categories</a> » <a href="faq.php?cid=<? echo $category->getId(); ?>"><? echo $category->getName(); ?></a> </div> <div style="width:700;padding-top:2px; float:left;"> <strong style="font-size:16px;"><?php echo $faq->getQuestion() ?></strong> </div> <div style="float:right;text-align:right;padding-top:5px;padding-right:5px;"></div> <div class="clear"></div> <p> <?php echo Format::safe_html($faq->getAnswer()); ?> </p> <p> <?php if($faq->getNumAttachments()) { ?> <div><span class="faded"><b>Attachments:</b></span> <?php echo $faq->getAttachmentsLinks(); ?></div> <? }?> <div><span class="faded"><b>Help Topics:</b></span> <?php echo ($topics=$faq->getHelpTopics())?implode(', ',$topics):' '; ?> </div> </p> <hr> <div class="faded"> Last updated <?php echo Format::db_daydatetime($category->getUpdateDate()); ?></div>
?> </td></tr> </table> <?php //get answers for messages $sql = 'SELECT resp.*,count(attach_id) as attachments FROM ' . TICKET_RESPONSE_TABLE . ' resp ' . ' LEFT JOIN ' . TICKET_ATTACHMENT_TABLE . ' attach ON resp.ticket_id=attach.ticket_id AND resp.response_id=attach.ref_id AND ref_type=\'R\' ' . ' WHERE msg_id=' . db_input($msg_row['msg_id']) . ' AND resp.ticket_id=' . db_input($ticket->getId()) . ' GROUP BY resp.response_id ORDER BY created'; //echo $sql; $resp = db_query($sql); while ($resp_row = db_fetch_array($resp)) { $respID = $resp_row['response_id']; $name = $cfg->hideStaffName() ? 'staff' : Format::htmlchars($resp_row['staff_name']); ?> <table align="center" class="response" cellspacing="0" cellpadding="1" width="100%" border=0> <tr> <th><?php echo Format::db_daydatetime($resp_row['created']); ?> - <?php echo $name; ?> </th></tr> <?php if ($resp_row['attachments'] > 0) { ?> <tr class="header"> <td><?php echo $ticket->getAttachmentStr($respID, 'R'); ?> </td></tr> <?php
<?php $total=0; $ids=($errors && is_array($_POST['ids']))?$_POST['ids']:null; if($res && db_num_rows($res)): while ($row = db_fetch_array($res)) { $sel=false; if($ids && in_array($row['log_id'],$ids)) $sel=true; ?> <tr id="<?php echo $row['log_id']; ?>"> <td width=7px> <input type="checkbox" class="ckb" name="ids[]" value="<?php echo $row['log_id']; ?>" <?php echo $sel?'checked="checked"':''; ?>> </td> <td> <a class="tip" href="#log/<?php echo $row['log_id']; ?>"><?php echo Format::htmlchars($row['title']); ?></a></td> <td><?php echo $row['log_type']; ?></td> <td> <?php echo Format::db_daydatetime($row['created']); ?></td> <td><?php echo $row['ip_address']; ?></td> </tr> <?php } //end of while. endif; ?> </tbody> <tfoot> <tr> <td colspan="6"> <?php if($res && $num){ ?> <?php echo __('Select');?>: <a id="selectAll" href="#ckb"><?php echo __('All');?></a> <a id="selectNone" href="#ckb"><?php echo __('None');?></a> <a id="selectToggle" href="#ckb"><?php echo __('Toggle');?></a> <?php }else{
<div style="float:right;text-align:right;padding-top:5px;padding-right:5px;"></div> <div class="clear"></div> <p> <?php echo Format::safe_html($faq->getAnswer()); ?> </p> <p> <?php if ($faq->getNumAttachments()) { ?> <div><span class="faded"><b>Attachments:</b></span> <?php echo $faq->getAttachmentsLinks(); ?> </div> <?php } ?> <div class="article-meta"><span class="faded"><b>Help Topics:</b></span> <?php echo ($topics = $faq->getHelpTopics()) ? implode(', ', $topics) : ' '; ?> </div> </p> <hr> <div class="faded"> Last updated <?php echo Format::db_daydatetime($category->getUpdateDate()); ?> </div>
function replaceTemplateVars($text) { global $cfg; $dept = $this->getDept(); $staff = $this->getStaff(); $search = array('/%id/', '/%ticket/', '/%email/', '/%name/', '/%subject/', '/%topic/', '/%phone/', '/%status/', '/%priority/', '/%dept/', '/%assigned_staff/', '/%createdate/', '/%duedate/', '/%closedate/', '/%url/'); $replace = array($this->getId(), $this->getExtId(), $this->getEmail(), $this->getName(), $this->getSubject(), $this->getHelpTopic(), $this->getPhoneNumber(), $this->getStatus(), $this->getPriority(), $dept ? $dept->getName() : '', $staff ? $staff->getName() : '', Format::db_daydatetime($this->getCreateDate()), Format::db_daydatetime($this->getDueDate()), Format::db_daydatetime($this->getCloseDate()), $cfg->getBaseUrl()); return preg_replace($search, $replace, $text); }
</p> <p> <?php if ($faq->getNumAttachments()) { ?> <div><span class="faded"><b><?php echo __('Attachments'); ?> :</b></span> <?php echo $faq->getAttachmentsLinks(); ?> </div> <?php } ?> <div class="article-meta"><span class="faded"><b><?php echo __('Help Topics'); ?> :</b></span> <?php echo ($topics = $faq->getHelpTopics()) ? implode(', ', $topics) : ' '; ?> </div> </p> <hr> <div class="faded"> <?php echo __('Last updated') . ' ' . Format::db_daydatetime($category->getUpdateDate()); ?> </div>
<input type="hidden" name="id" value="<?php echo $template->getId(); ?> "> <table width="100%" border="0" cellspacing=0 cellpadding=0> <tr><td> <table width="100%" border="0" cellspacing=0 cellpadding=2 class="tform tpl"> <tr class="header"><td colspan=2 ><?php echo _('Template Info'); ?> </td></tr> <tr class="subheader"><td colspan=2><b><?php echo _('Last updated on'); ?> <?php echo Format::db_daydatetime($template->getUpdateDate()); ?> </b></td></tr> <tr> <th><?php echo _('Name'); ?> </th> <td> <input type="text" size="45" name="name" value="<?php echo $tpl['name']; ?> "> <font class="error">* <?php echo $errors['name']; ?>
<tr class="header"><td><?=$ticket->getAttachmentStr($msg_row['msg_id'],'M')?></td></tr> <?}?> <tr><td><?=Format::display($msg_row['message'])?> </td></tr> </table> <? //get answers for messages $sql='SELECT resp.*,count(attach_id) as attachments FROM '.TICKET_RESPONSE_TABLE.' resp '. ' LEFT JOIN '.TICKET_ATTACHMENT_TABLE." attach ON resp.ticket_id=attach.ticket_id AND resp.response_id=attach.ref_id AND ref_type='R' ". ' WHERE msg_id='.db_input($msg_row['msg_id']).' AND resp.ticket_id='.db_input($id). ' GROUP BY resp.response_id ORDER BY created'; $resp =db_query($sql); while ($resp_row = db_fetch_array($resp)) { $respID=$resp_row['response_id']; ?> <table align="center" class="response" cellspacing="0" cellpadding="1" width="100%" border=0> <tr><th><?=Format::db_daydatetime($resp_row['created'])?> - <?=$resp_row['staff_name']?></th></tr> <?if($resp_row['attachments']>0){ ?> <tr class="header"> <td><?=$ticket->getAttachmentStr($respID,'R')?></td></tr> <?}?> <tr><td> <?=Format::display($resp_row['response'])?></td></tr> </table> <?} $msgid =$msg_row['msg_id']; }?> </div> </div> <table align="center" cellspacing="0" cellpadding="3" width="90%" border=0> <?if($_POST['a']!='process') {?> <tr> <td align="center"> <?if($errors['err']) {?>
?> </div> <div class="clear"></div> <p> <div><span class="faded"><b>Attachments:</b></span> <?php echo $faq->getAttachmentsLinks(); ?> </div> <div><span class="faded"><b>Help Topics:</b></span> <?php echo ($topics = $faq->getHelpTopics()) ? implode(', ', $topics) : ' '; ?> </div> </p> <div class="faded"> Last updated <?php echo Format::db_daydatetime($faq->getUpdateDate()); ?> </div> <hr> <?php if ($thisstaff->canManageFAQ()) { //TODO: add js confirmation.... ?> <div> <form action="faq.php?id=<?php echo $faq->getId(); ?> " method="post"> <?php csrf_token(); ?>
} ?> </div> <div class="clear"></div> <div class="thread-body"> <?php echo $faq->getAnswerWithImages(); ?> </div> <div class="clear"></div> <p> <div><span class="faded"><b><?php echo __('Attachments');?>:</b></span> <?php echo $faq->getAttachmentsLinks(); ?></div> <div><span class="faded"><b><?php echo __('Help Topics');?>:</b></span> <?php echo ($topics=$faq->getHelpTopics())?implode(', ',$topics):' '; ?> </div> </p> <div class="faded"> <?php echo __('Last updated');?> <?php echo Format::db_daydatetime($faq->getUpdateDate()); ?></div> <hr> <?php if($thisstaff->canManageFAQ()) { //TODO: add js confirmation.... ?> <div> <form action="faq.php?id=<?php echo $faq->getId(); ?>" method="post"> <?php csrf_token(); ?> <input type="hidden" name="id" value="<?php echo $faq->getId(); ?>"> <input type="hidden" name="do" value="manage-faq"> <div> <strong><?php echo __('Options');?>: </strong> <select name="a" style="width:200px;"> <option value=""><?php echo __('Select Action');?></option> <?php
<?php echo $ticket->getAttachmentStr($msg_row['msg_id'], 'M'); ?> <?php } ?> </div> <?php } elseif ($msg_row['msg_type'] == 'R') { //get answers for messages $respID = $resp_row['response_id']; $name = $cfg->hideStaffName() ? 'staff' : Format::htmlchars($msg_row['staff_name']); ?> <div class="responselabel"> <span class="Icon inMessage"> <?php echo Format::db_daydatetime($msg_row['created']); ?> - <?php echo $name; ?> </span> </div> <div class="message"> <?php echo Format::display($msg_row['message']); ?> </div> <div class="attachment"> <?php if ($msg_row['attachments'] > 0) { ?>
</table> <? //get answers for messages $sql='SELECT resp.*,count(attach_id) as attachments FROM '.TICKET_RESPONSE_TABLE.' resp '. ' LEFT JOIN '.TICKET_ATTACHMENT_TABLE.' attach ON resp.ticket_id=attach.ticket_id AND resp.response_id=attach.ref_id AND ref_type=\'R\' '. ' WHERE msg_id='.db_input($msg_row['msg_id']).' AND resp.ticket_id='.db_input($ticket->getId()). ' GROUP BY resp.response_id ORDER BY created'; //echo $sql; $resp =db_query($sql); while ($resp_row = db_fetch_array($resp)) { $respID=$resp_row['response_id']; $name=$cfg->hideStaffName()?'staff':Format::htmlchars($resp_row['staff_name']); ?> <table align="center" class="response" cellspacing="0" cellpadding="1" width="100%" border=0> <tr> <th><?=Format::db_daydatetime($resp_row['created'])?> - <?=$name?></th></tr> <?if($resp_row['attachments']>0){ ?> <tr class="header"> <td><?=$ticket->getAttachmentStr($respID,'R')?></td></tr> <?}?> <tr class="info"> <td> <?=Format::display($resp_row['response'])?></td></tr> </table> <? } //endwhile...response loop. $msgid =$msg_row['msg_id']; endwhile; //message loop. ?> </div> </div>
function replaceTemplateVars($text) { global $cfg; $dept = $this->getDept(); $staff = $this->getStaff(); $team = $this->getTeam(); //TODO: add new vars (team, sla...etc) $search = array('/%id/', '/%ticket/', '/%email/', '/%name/', '/%subject/', '/%topic/', '/%phone/', '/%status/', '/%priority/', '/%dept/', '/%assigned_staff/', '/%createdate/', '/%duedate/', '/%closedate/', '/%url/', '/%auth/', '/%clientlink/'); $replace = array($this->getId(), $this->getExtId(), $this->getEmail(), $this->getName(), $this->getSubject(), $this->getHelpTopic(), $this->getPhoneNumber(), $this->getStatus(), $this->getPriority(), $dept ? $dept->getName() : '', $staff ? $staff->getName() : '', Format::db_daydatetime($this->getCreateDate()), Format::db_daydatetime($this->getDueDate()), Format::db_daydatetime($this->getCloseDate()), $cfg->getBaseUrl(), $this->getAuthToken(), '%url/view.php?t=%ticket&e=%email&a=%auth'); while ($text != ($T = preg_replace($search, $replace, $text))) { $text = $T; } return $text; }