$html = get_magic_quotes_gpc() ? stripslashes($_POST["html"]) : $_POST["html"]; // quickbook_item_supplements $sizeKey = "size"; $productTypeKey = "productType"; $query = createSqlQuery("SELECT qbis.size as '{$sizeKey}'", ", qbis.product_type as '{$productTypeKey}'", "FROM quickbooks_item_supplements qbis", "WHERE qbis.id LIKE '{$idBase}-%'"); $result = queryDb($query); if (mysql_num_rows($result) == 0) { // quickbooks_item_supplements with this id doesn't exist echo "No information for products with id base: {$idBase}."; return; } $row = mysql_fetch_assoc($result); $productType = $row[$productTypeKey]; $size = $row[$sizeKey]; $htmlForPdfPath = getHtmlForPdfPath($productType, $size); mkFileDirs($htmlForPdfPath); file_put_contents($htmlForPdfPath, $html); $htmlForPdfUrl = "http://" . $_SERVER['SERVER_NAME'] . "/" . getDirectoryPathFromRoot(__FILE__) . "/{$htmlForPdfPath}"; $pdfPath = getPdfPath($productType, $size); $tmpPdfPath = $pdfPath . ".tmp"; if (!convertToPdf($htmlForPdfUrl, $tmpPdfPath, $errorMessage)) { echo implode("\n", array("PDF generation failed because: {$errorMessage}", "PDF path: {$tmpPdfPath}", "PDF HTML URL: {$htmlForPdfUrl}", "HTML: {$html}")); unlink($tmpPdfPath); return; } if (file_exists($pdfPath)) { $archivedPdfPath = getArchivedPdfPath($productType, $size); mkFileDirs($archivedPdfPath); rename($pdfPath, $archivedPdfPath); } rename($tmpPdfPath, $pdfPath);
<?php require_once "util.php"; $dirPath = getDirectoryPathFromRoot(__FILE__); ?> <style type="text/css"> .print-icon { background-image:url(<?php echo $dirPath; ?> /images/icons/silk/printer.png) !important; } .pdf-icon { background-image:url(<?php echo $dirPath; ?> /images/icons/silk/page_white_acrobat.png) !important; } </style>
<?php require_once "../../Common/util.php"; $currentDirectoryPath = getDirectoryPathFromRoot(__FILE__); $pdfIconPath = "pdfIcon.png"; ?> <script type="text/javascript" src="<?php echo $currentDirectoryPath; ?> /functions.js"></script> <style type="text/css"> .download-pdf { text-align:center; font-size : 20px; padding : 5px; background-color : white; } .download-pdf .pdf-icon { width : 128px; height : 128px; background-image : url(<?php echo "{$currentDirectoryPath}/{$pdfIconPath}"; ?> ) !important; } </style>