// set dirs manual
         $smarty->template_dir = DIR_FS_CATALOG . 'templates';
         $smarty->compile_dir = DIR_FS_CATALOG . 'templates_c';
         $smarty->config_dir = DIR_FS_CATALOG . 'lang';
         $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
         $smarty->assign('logo_path', HTTP_SERVER . DIR_WS_CATALOG . 'templates/' . CURRENT_TEMPLATE . '/img/');
         $smarty->assign('NAME', $check_status['customers_name']);
         $smarty->assign('ORDER_NR', $billnr);
         $smarty->assign('ORDER_LINK', xtc_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL'));
         $smarty->assign('ORDER_DATE', xtc_date_long($check_status['date_purchased']));
         $smarty->assign('NOTIFY_COMMENTS', $notify_comments);
         $smarty->assign('ORDER_STATUS', $orders_status_array[$status]);
         $html_mail = $smarty->fetch('db:invoice_mail.html');
         $txt_mail = $smarty->fetch('db:invoice_mail.txt');
         $pdffile = DIR_FS_ADMIN . get_pdf_invoice_filename($oID);
         $pdffile_downloadname = get_pdf_invoice_download_filename($oID);
         $order_subject = str_replace('{$nr}', $order->info['ibn_billnr'], EMAIL_BILLING_SUBJECT);
         $order_subject = str_replace('{$date}', strftime(DATE_FORMAT_LONG), $order_subject);
         xtc_php_mail(EMAIL_BILLING_ADDRESS, EMAIL_BILLING_NAME, $check_status['customers_email_address'], $check_status['customers_name'], '', EMAIL_BILLING_REPLY_ADDRESS, EMAIL_BILLING_REPLY_ADDRESS_NAME, $pdffile, '', $order_subject, $html_mail, $txt_mail);
         //  $message_body_plain
         xtc_db_query("update " . TABLE_ORDERS . " set ibn_pdfnotifydate = now() where orders_id = '" . $oID . "'");
     }
 }
 // EOF - Fishnet Services - Nicolas Gemsjäger
 if ($order_updated) {
     $messageStack->add_session(SUCCESS_ORDER_UPDATED, 'success');
 } else {
     $messageStack->add_session(WARNING_ORDER_NOT_UPDATED, 'warning');
 }
 xtc_redirect(xtc_href_link(FILENAME_ORDERS, xtc_get_all_get_params(array('action')) . 'action=edit'));
 break;
$admindir = 'admin/';
require 'includes/application_top.php';
require $admindir . 'includes/ipdfbill/pdfbill_lib.php';
//security checks
if (!isset($_SESSION['customer_id'])) {
    xtc_redirect(xtc_href_link(FILENAME_LOGIN, '', 'SSL'));
}
if (!isset($_GET['oID']) || isset($_GET['oID']) && !is_numeric($_GET['oID'])) {
    xtc_redirect(xtc_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
}
$customer_info_query = xtc_db_query("select customers_id from " . TABLE_ORDERS . " where orders_id = '" . (int) $_GET['oID'] . "'");
$customer_info = xtc_db_fetch_array($customer_info_query);
if ($customer_info['customers_id'] != $_SESSION['customer_id']) {
    xtc_redirect(xtc_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
}
$pdffile = $admindir . get_pdf_invoice_filename($_GET['oID']);
$pdffile_downloadname = get_pdf_invoice_download_filename($_GET['oID']);
/*
echo "pdffflie=$pdffile<br>\n";
echo "pdffile_downloadname=$pdffile_downloadname<br>\n";
exit;
*/
$fp = fopen($pdffile, 'rb');
$template = fread($fp, filesize($pdffile));
fclose($fp);
//HTTP-Header ausgeben
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$pdffile_downloadname}\"");
header("Content-type: application/pdf");
//das fertige PDF ausgeben
echo $template;