$error\n";
}
$hesk_error_buffer = $tmp;
$hesk_error_buffer = $hesklang['pcer'].'
';
foreach ($att as $myatt)
{
$columnNumber++;
if ($columnNumber > 4)
{
echo '
';
$columnNumber = 1;
}
list($att_id, $att_name) = explode('#', $myatt);
echo '
';
$fileparts = pathinfo($att_name);
$fontAwesomeIcon = hesk_getFontAwesomeIconForFileExtension($fileparts['extension']);
echo '
';
//-- File is an image
if ($fontAwesomeIcon == 'fa fa-file-image-o') {
//-- Get the actual image location and display a thumbnail. It will be linked to a modal to view a larger size.
$path = hesk_getSavedNameUrlForAttachment($att_id);
if ($path == '') {
echo '
';
} else {
echo '
';
echo '
';
}
} else {
//-- Display the FontAwesome icon in the panel's body
echo '
';
}
echo '
';
echo '
';
}
echo '
';
return true;
} // End hesk_listAttachments()
function hesk_getSavedNameUrlForAttachment($att_id)
{
global $hesk_settings;
//-- Call the DB for the attachment
$nameRS = hesk_dbQuery("SELECT `saved_name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."attachments` WHERE `att_id` = ".hesk_dbEscape($att_id));
$name = hesk_dbFetchAssoc($nameRS);
$realpath = '../'.$hesk_settings['attach_dir'] . '/' . $name['saved_name'];
return !file_exists($realpath) ? '' : $realpath;
}
function hesk_getFontAwesomeIconForFileExtension($fileExtension)
{
$imageExtensions = array('jpg','png','bmp','gif');
//-- Word, Excel, and PPT file extensions: http://en.wikipedia.org/wiki/List_of_Microsoft_Office_filename_extensions
$wordFileExtensions = array('doc','docx','dotm','dot','docm','docb');
$excelFileExtensions = array('xls','xlt','xlm','xlsx','xlsm','xltx','xltm');
$pptFileExtensions = array('ppt','pot','pps','pptx','pptm','potx','potm','ppsx','ppsm','sldx','sldm');
//-- File archive extensions: http://en.wikipedia.org/wiki/List_of_archive_formats
$archiveFileExtensions = array('tar','gz','zip','rar','7z','bz2','lz','lzma','tgz','tbz2','zipx');
//-- Audio file extensions: http://en.wikipedia.org/wiki/Audio_file_format#List_of_formats
$audioFileExtensions = array('3gp','act','aiff','aac','amr','au','awb','dct','dss','dvf','flac','gsm','iklax','ivs','m4a','m4p','mmf','mp3','mpc','msv','ogg','oga','opus','ra','rm','raw','tta','vox','wav','wma','wv');
//-- Video file extensions: http://en.wikipedia.org/wiki/Video_file_format#List_of_video_file_formats
$videoFileExtensions = array('webm','mkv','flv','drc','mng','avi','mov','qt','wmv','yuv','rm','rmvb','asf','mp4','m4p','m4v','mpg','mp2','mpeg','mpe','mpv','m2v','svi','3gp','3g2','mxf','roq','nsv');
//-- The only one I know of :D
$pdfFileExtensions = array('pdf');
$textFileExtensions = array('txt');
$icon = 'fa fa-file-';
if (in_array($fileExtension, $imageExtensions)) {
$icon.='image-o';
} elseif (in_array($fileExtension, $wordFileExtensions)) {
$icon.='word-o';
} elseif (in_array($fileExtension, $excelFileExtensions)) {
$icon.='excel-o';
} elseif (in_array($fileExtension, $pptFileExtensions)) {
$icon.='powerpoint-o';
} elseif (in_array($fileExtension, $archiveFileExtensions)) {
$icon.='archive-o';
} elseif (in_array($fileExtension, $audioFileExtensions)) {
$icon.='audio-o';
} elseif (in_array($fileExtension, $videoFileExtensions)) {
$icon.='video-o';
} elseif (in_array($fileExtension, $pdfFileExtensions)) {
$icon.='pdf-o';
} elseif (in_array($fileExtension, $textFileExtensions)) {
$icon.='text-o';
} else {
$icon.='o';
}
return $icon;
}
function hesk_getAdminButtons($reply=0,$white=1)
{
global $hesk_settings, $hesklang, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete;
$options = '';
/* Style and mousover/mousout */
$tmp = $white ? 'White' : 'Blue';
$style = 'class="option'.$tmp.'OFF" onmouseover="this.className=\'option'.$tmp.'ON\'" onmouseout="this.className=\'option'.$tmp.'OFF\'"';
/* Lock ticket button */
if ( /* ! $reply && */ $can_edit)
{
if ($ticket['locked'])
{
$des = $hesklang['tul'] . ' - ' . $hesklang['isloc'];
$options .= '
'.$hesklang['tul'].' ';
}
else
{
$des = $hesklang['tlo'] . ' - ' . $hesklang['isloc'];
$options .= '
'.$hesklang['tlo'].' ';
}
}
/* Tag ticket button */
if ( /* ! $reply && */ $can_archive)
{
if ($ticket['archive'])
{
$options .= '
'.$hesklang['remove_archive'].' ';
}
else
{
$options .= '
'.$hesklang['add_archive'].' ';
}
}
/* Import to knowledgebase button */
if ($hesk_settings['kb_enable'] && hesk_checkPermission('can_man_kb',0))
{
$options .= '
'.$hesklang['import_kb'].' ';
}
/* Print ticket button */
$options .= '
'.$hesklang['printer_friendly'].' ';
/* Edit post */
if ($can_edit)
{
$tmp = $reply ? '&reply='.$reply['id'] : '';
$options .= '
'.$hesklang['edtt'].' ';
}
/* Delete ticket */
if ($can_delete)
{
if ($reply)
{
$url = 'admin_ticket.php';
$tmp = 'delete_post='.$reply['id'];
$img = 'delete.png';
$txt = $hesklang['delt'];
}
else
{
$url = 'delete_tickets.php';
$tmp = 'delete_ticket=1';
$img = 'delete_ticket.png';
$txt = $hesklang['dele'];
}
$options .= '
'.$txt.' ';
}
/* Return generated HTML */
$options .= '
';
return $options;
} // END hesk_getAdminButtons()
function hesk_getAdminButtonsInTicket($reply=0,$white=1)
{
global $hesk_settings, $hesklang, $ticket, $reply, $trackingID, $can_edit, $can_archive, $can_delete;
$options = '';
/* Style and mousover/mousout */
$tmp = $white ? 'White' : 'Blue';
$style = 'class="option'.$tmp.'OFF" onmouseover="this.className=\'option'.$tmp.'ON\'" onmouseout="this.className=\'option'.$tmp.'OFF\'"';
/* Edit post */
if ($can_edit)
{
$tmp = $reply ? '&reply='.$reply['id'] : '';
$options .= '
'.$hesklang['edtt'].' ';
}
/* Delete ticket */
if ($can_delete)
{
if ($reply)
{
$url = 'admin_ticket.php';
$tmp = 'delete_post='.$reply['id'];
$img = 'delete.png';
$txt = $hesklang['delt'];
}
else
{
$url = 'delete_tickets.php';
$tmp = 'delete_ticket=1';
$img = 'delete_ticket.png';
$txt = $hesklang['dele'];
}
$options .= '
'.$txt.' ';
}
/* Return generated HTML */
$options .= '
';
return $options;
} // END hesk_getAdminButtonsInTicket()
function print_form()
{
global $hesk_settings, $hesklang;
global $trackingID;
/* Print header */
require_once(HESK_PATH . 'inc/header.inc.php');
/* Print admin navigation */
require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
?>