$id = trim($_GET['id']); } else { header("Location: /404"); exit; } $report = $erapi->report($_GET['id']); if (empty($report)) { header('Location: /404'); exit; } $user = !empty($current_user) ? $current_user->ID : ''; switch ($type) { case 'pdf': $reporthtml = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/index.php?p=report&id=' . $report->id . '&pdf=1'); $reportheader = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/libs/report-pdf-header.php'); $reportfooter = file_get_contents('http://' . $_SERVER['HTTP_HOST'] . '/libs/report-pdf-footer.php'); $pdf = new WKPDF(); $pdf->set_html($reporthtml); $pdf->set_header($reportheader); $pdf->set_footer($reportfooter); $pdf->set_toc(false); $pdf->set_zoom(0.75); $pdf->set_page_size("A4"); $pdf->render(); $pdf->output(WKPDF::$PDF_DOWNLOAD, 'report-' . $report->domain . '.pdf'); break; default: header("Location: /404"); exit; } exit;
$DB = new conn(); $DB->connect(); $sql = "select data from reports where id = " . $DB->sanitize($_REQUEST["report_id"]); $result = $DB->query_scalar($sql); $time = time(); $css = "<link rel=\"StyleSheet\" href=\"" . $FQDN . "/" . $ROOTPATH . "/CSS/main.css.php?" . $time . "/>"; // Get Querystring params $output = $DB->sanitize($_REQUEST["output"]); $footer = $DB->sanitize($_REQUEST["footer"]); $orient = $DB->sanitize($_REQUEST["orient"]); $result = str_replace("<HTML><HEAD></HEAD>", "<HTML><HEAD>" . $css . "</HEAD>", $result); require_once "wk.php"; $pdf = new WKPDF(); $pdf->set_html($result); if ($footer) { $pdf->set_footer("Page [page] of [toPage]"); } if ($orient) { $pdf->set_orientation($orient); } $pdf->render(); if ($output) { if ($output == "pdf") { } $pdf->output(WKPDF::$PDF_DOWNLOAD, 'sample.pdf'); } else { $pdf->output(WKPDF::$PDF_EMBEDDED, 'sample.pdf'); } ?>