'.$hesklang['attachments'].':


'; $att=explode(',',substr($attachments, 0, -1)); echo '
'; echo ''; echo ''; if ($is_staff) { echo ''; } echo ''; echo ''; foreach ($att as $myatt) { list($att_id, $att_name) = explode('#', $myatt); $fileparts = pathinfo($att_name); $fontAwesomeIcon = mfh_getFontAwesomeIconForFileExtension($fileparts['extension']); echo ' '; if ($is_staff) { echo ''; } echo ' '; } echo '
  ' . $hesklang['file_name'] . ''.$hesklang['download_count'].''.$hesklang['action'].'
'; //-- 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 = mfh_getSavedNameUrlForAttachment($att_id, $is_staff); if ($path == '') { echo ''; } else { echo ' '.$hesklang['image'].' '; echo ''; } } else { //-- Display the FontAwesome icon in the panel's body echo ''; } echo'

'.$att_name.'

'.mfh_getNumberOfDownloadsForAttachment($att_id).'
'; /* Can edit and delete tickets? */ if ($is_staff && $can_edit && $can_delete) { echo ' '; } echo ' '; echo '
'; return true; } // End hesk_listAttachments() function mfh_getSavedNameUrlForAttachment($att_id, $is_staff) { 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); if ($is_staff) { $realpath = '../'.$hesk_settings['attach_dir'] . '/' . $name['saved_name']; } else { $realpath = $hesk_settings['attach_dir'] . '/' . $name['saved_name']; } return !file_exists($realpath) ? '' : $realpath; } function mfh_getFontAwesomeIconForFileExtension($fileExtension) { $imageExtensions = array('jpg','jpeg','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-'; $fileExtension = strtolower($fileExtension); 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; }