$limitstart = intval($vm_mainframe->getUserStateFromRequest("view{$keyword}{$category_id}{$pagename}limitstart", 'limitstart', 0));
/* Who cares for Safe Mode ? Not me! */
if (@file_exists("/usr/bin/htmldoc")) {
    $allowed_pdf_pages = array('shop.product_details', 'shop.browse');
    if (in_array($showpage, $allowed_pdf_pages)) {
        exit;
    }
    $load_page = escapeshellarg($mosConfig_live_site . "/index2.php?option=com_virtuemart&page={$showpage}&flypage={$flypage}&product_id={$product_id}&category_id={$category_id}&pop=1&hide_js=1&output=pdf");
    header("Content-Type: application/pdf");
    header("Content-Disposition: inline; filename=\"pdf-store.pdf\"");
    flush();
    //following line for Linux only - windows may need the path as well...
    passthru("/usr/bin/htmldoc --no-localfiles --quiet -t pdf14 --jpeg --webpage --header t.D --footer ./. --size letter --left 0.5in {$load_page}");
    exit;
} else {
    freePDF($showpage, $flypage, $product_id, $category_id, $limitstart, $limit);
}
function repairImageLinks($html)
{
    if (PSHOP_IMG_RESIZE_ENABLE == '1') {
        $images = array();
        if (preg_match_all("/<img[^>]*>/", $html, $images) > 0) {
            $i = 0;
            foreach ($images as $image) {
                if (is_array($image)) {
                    foreach ($image as $src) {
                        preg_match("'src=\"[^\"]*\"'si", $src, $matches);
                        $source = str_replace("src=\"", "", $matches[0]);
                        $source = str_replace("\"", "", $source);
                        $fileNamePos = strpos($source, "filename=");
                        if ($fileNamePos > 0) {
$category_id = vmGet($_REQUEST, 'category_id');
/* Who cares for Safe Mode ? Not me! */
if (@file_exists("/usr/bin/htmldoc")) {
    $allowed_pdf_pages = array('shop.product_details', 'shop.browse');
    if (in_array($showpage, $allowed_pdf_pages)) {
        exit;
    }
    $load_page = escapeshellarg($mosConfig_live_site . "/index2.php?option=com_virtuemart&page={$showpage}&flypage={$flypage}&product_id={$product_id}&category_id={$category_id}&pop=1&hide_js=1&output=pdf");
    header("Content-Type: application/pdf");
    header("Content-Disposition: inline; filename=\"pdf-store.pdf\"");
    flush();
    //following line for Linux only - windows may need the path as well...
    passthru("/usr/bin/htmldoc --no-localfiles --quiet -t pdf14 --jpeg --webpage --header t.D --footer ./. --size letter --left 0.5in {$load_page}");
    exit;
} else {
    freePDF($showpage, $flypage, $product_id, $category_id);
}
function repairImageLinks($html)
{
    if (PSHOP_IMG_RESIZE_ENABLE == '1') {
        $images = array();
        if (preg_match_all("/<img[^>]*>/", $html, $images) > 0) {
            $i = 0;
            foreach ($images as $image) {
                if (is_array($image)) {
                    foreach ($image as $src) {
                        preg_match("'src=\"[^\"]*\"'si", $src, $matches);
                        $source = str_replace("src=\"", "", $matches[0]);
                        $source = str_replace("\"", "", $source);
                        $fileNamePos = strpos($source, "filename=");
                        if ($fileNamePos > 0) {