$_kbCategoryContainer = $_knowledgebaseCategory['category'][0]; } //Retrieve and process comments $_searchParameters = array('ListAll'); $_commentContainer_Complete = $_restClient->get($_commentController, $_searchParameters); $_commentContainer_Complete = $_commentContainer_Complete['kbarticlecomment']; $_itemIDKey = 'kbarticleid'; $_itemID = $_GET['articleid']; include 'comments.php'; //Process article attachments $_searchParameters = array('ListAll', $_GET['articleid']); $_attachmentContainer = $_restClient->get($_attachmentController, $_searchParameters); $_attachmentContainer = $_attachmentContainer['kbattachment']; foreach ($_attachmentContainer as $_key => $_attachment) { $_attachmentContainer[$_key]['name'] = $_attachment['filename']; $_attachmentContainer[$_key]['size'] = FormattedSize($_attachment['filesize']); $_fileExtension = mb_strtolower(substr($_attachment['filename'], strrpos($_attachment['filename'], '.') + 1)); $_mimeData = GetMimeData($_fileExtension); $_attachmentIcon = 'icon_file.gif'; if (isset($_mimeData[1])) { $_attachmentIcon = $_mimeData[1]; } $_attachmentContainer[$_key]['icon'] = $_attachmentIcon; $_attachmentContainer[$_key]['link'] = WHMCS_URL . 'knowledgebase.php?articleid=' . $_GET['articleid'] . '&aid=' . $_attachment['id']; } $smarty->assign('_knowledgebaseArticle', $_knowledgebaseArticle); $smarty->assign('_kbCategoryContainer', $_kbCategoryContainer); $smarty->assign('_attachmentContainer', $_attachmentContainer); $smarty->assign('_imageURL', IMAGE_URL); $smarty->assign('_commentSubmitURL', WHMCS_URL . 'knowledgebase.php?articleid=' . $_GET['articleid'] . '&action=savecomment'); $templatefile = 'knowledgebasearticle';
/** * Download file * * @author Ruchi Kothari * * @param string $_fileName File name * @param string $_fileContent File contents * * @return true */ function Download($_fileName, $_fileContent) { if (isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { // IE Bug in download name workaround @ini_set('zlib.output_compression', 'Off'); } $_fileNameSplitted = explode('.', $_fileName); $_fileExtension = $_fileNameSplitted[1]; $_mimeContainer = GetMimeData($_fileExtension); // Get the file extension if ($_mimeContainer && isset($_mimeContainer[0])) { header('Content-Type: ' . $_mimeContainer[0] . SWIFT_CRLF); } else { header('Content-Type: application/force-download'); } header("Content-Disposition: attachment; filename=\"" . $_fileName . "\""); header("Content-Transfer-Encoding: binary"); echo $_fileContent; return true; }