Exemplo n.º 1
0
 // Get image size information and add the full URL
 if (substr($product_full_image, 0, 4) != 'http') {
     // This is a local image
     if (file_exists(IMAGEPATH . 'product/' . $product_full_image)) {
         $full_image_info = getimagesize(IMAGEPATH . 'product/' . $product_full_image);
         $full_image_width = $full_image_info[0] + 40;
         $full_image_height = $full_image_info[1] + 40;
     }
     $product_full_image = IMAGEURL . 'product/' . $product_full_image;
 } elseif (!isset($full_image_width) || !isset($full_image_height)) {
     // This is a URL image
     $full_image_info = getimagesize($product_full_image);
     $full_image_width = $full_image_info[0] + 40;
     $full_image_height = $full_image_info[1] + 40;
 }
 $files = ps_product_files::getFilesForProduct($db_browse->f('product_id'));
 $products[$i]['files'] = $files['files'];
 $products[$i]['images'] = $files['images'];
 $product_name = $db_browse->f("product_name");
 if ($db_browse->f("product_publish") == "N") {
     $product_name .= " (" . $VM_LANG->_('CMN_UNPUBLISHED', false) . ")";
 }
 if (empty($product_name) && $product_parent_id != 0) {
     $product_name = $dbp->f("product_name");
     // Use product_name from Parent Product
 }
 $product_s_desc = $db_browse->f("product_s_desc");
 if (empty($product_s_desc) && $product_parent_id != 0) {
     $product_s_desc = $dbp->f("product_s_desc");
     // Use product_s_desc from Parent Product
 }
Exemplo n.º 2
0
 /**
  * The function that holds the code for deleting
  * one product from the database and all related tables
  * plus deleting files related to the product
  *
  * @param int $product_id
  * @param array $d The input vars
  * @return boolean True on success, false on error
  */
 function delete_product($product_id, &$d)
 {
     global $vmLogger, $VM_LANG;
     $db = new ps_DB();
     if (!$this->validate_delete($product_id, $d)) {
         return false;
     }
     /* If is Product */
     if ($this->is_product($product_id)) {
         /* Delete all items first */
         $q = "SELECT product_id FROM #__{vm}_product WHERE product_parent_id='{$product_id}'";
         $db->setQuery($q);
         $db->query();
         while ($db->next_record()) {
             $d2["product_id"] = $db->f("product_id");
             if (!$this->delete($d2)) {
                 return false;
             }
         }
         /* Delete attributes */
         $q = "DELETE FROM #__{vm}_product_attribute_sku WHERE product_id='{$product_id}' ";
         $db->setQuery($q);
         $db->query();
         /* Delete categories xref */
         $q = "DELETE FROM #__{vm}_product_category_xref WHERE product_id = '{$product_id}' ";
         $db->setQuery($q);
         $db->query();
     } else {
         /* Delete attribute values */
         $q = "DELETE FROM #__{vm}_product_attribute WHERE product_id='{$product_id}'";
         $db->setQuery($q);
         $db->query();
     }
     /* For both Product and Item */
     /* Delete product - manufacturer xref */
     $q = "DELETE FROM #__{vm}_product_mf_xref WHERE product_id='{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* Delete Product - ProductType Relations */
     $q = "DELETE FROM `#__{vm}_product_product_type_xref` WHERE `product_id`={$product_id}";
     $db->setQuery($q);
     $db->query();
     /* Delete product votes */
     $q = "DELETE FROM #__{vm}_product_votes WHERE product_id='{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* Delete product reviews */
     $q = "DELETE FROM #__{vm}_product_reviews WHERE product_id='{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* Delete Image files */
     if (!vmImageTools::process_images($d)) {
         return false;
     }
     /* Delete other Files and Images files */
     require_once CLASSPATH . 'ps_product_files.php';
     $ps_product_files = new ps_product_files();
     $db->query("SELECT file_id FROM #__{vm}_product_files WHERE file_product_id='{$product_id}'");
     while ($db->next_record()) {
         $d["file_id"] = $db->f("file_id");
         $ps_product_files->delete($d);
     }
     /* Delete Product Relations */
     $q = "DELETE FROM #__{vm}_product_relations WHERE product_id = '{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* Delete Prices */
     $q = "DELETE FROM #__{vm}_product_price WHERE product_id = '{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* Delete entry FROM #__{vm}_product table */
     $q = "DELETE FROM #__{vm}_product WHERE product_id = '{$product_id}'";
     $db->setQuery($q);
     $db->query();
     /* If only deleting an item, go to the parent product page after
      ** the deletion. This had to be done here because the product id
      ** of the item to be deleted had to be passed as product_id */
     if (!empty($d["product_parent_id"])) {
         $d["product_id"] = $d["product_parent_id"];
         $d["product_parent_id"] = "";
     }
     $vmLogger->info(str_replace('{product_id}', $product_id, $VM_LANG->_('VM_PRODUCT_DELETED', false)));
     return true;
 }
Exemplo n.º 3
0
require_once CLASSPATH . "ps_product_files.php";
$file_id = vmGet($_REQUEST, 'file_id');
$product_id = vmGet($_REQUEST, 'product_id');
$option = empty($option) ? vmGet($_REQUEST, 'option', 'com_virtuemart') : $option;
$selected_type = array();
$q = "SELECT product_id, product_name, product_full_image as file_name, product_thumb_image as file_name2 FROM #__{vm}_product WHERE product_id=" . intval($product_id);
$db->query($q);
$db->next_record();
$hasProductImages = $db->f('file_name2') != '';
$selected_type = array("selected=\"selected\"", '', '', '', '', '');
$product_name = '<a href="' . $_SERVER['PHP_SELF'] . '?option=' . $option . '&amp;product_id=' . $product_id . '&amp;page=product.product_form">' . $db->f("product_name") . '</a>';
$title = '<img src="' . $mosConfig_live_site . '/administrator/images/mediamanager.png" width="48" height="48" align="center" alt="Product List" border="0" />' . $VM_LANG->_('PHPSHOP_FILES_FORM') . ": " . $product_name;
$attribute_id = '';
if (!empty($file_id)) {
    if ((int) $file_id > 0) {
        $isProductDownload = ps_product_files::isProductDownloadFile($file_id, $product_id);
        $q = "SELECT file_name,file_url,file_is_image,file_published,file_title \n\t\t\t  FROM #__{vm}_product_files \n\t\t\t  WHERE file_id='{$file_id}'";
        $db->query($q);
        if ($db->next_record()) {
            if ($isProductDownload) {
                $dbf = new ps_DB();
                $dbf->query('SELECT attribute_id FROM `#__{vm}_product_attribute` WHERE attribute_name=\'download\' AND attribute_value=\'' . $db->f('file_title') . '\' AND product_id=\'' . $product_id . '\'');
                $dbf->next_record();
                $attribute_id = $dbf->f('attribute_id');
                vmCommonHTML::setSelectedArray($selected_type, 3, 'selected', array(0, 1, 2, 4));
            } else {
                $index = $db->f("file_is_image") == 1 ? 4 : 5;
                $disableArr = $db->f("file_is_image") == 1 ? array(3, 5) : array(0, 1, 2, 4);
                vmCommonHTML::setSelectedArray($selected_type, $index, 'selected', $disableArr);
            }
        }
Exemplo n.º 4
0
<?php

if (!defined('_VALID_MOS') && !defined('_JEXEC')) {
    die('Direct Access to ' . basename(__FILE__) . ' is not allowed.');
}
/**
*
* @version $Id: shop.getfile.php 1095 2007-12-19 20:19:16Z soeren_nb $
* @package VirtueMart
* @subpackage html
* @copyright Copyright (C) 2004-2007 soeren - All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* See /administrator/components/com_virtuemart/COPYRIGHT.php for copyright notices and details.
*
* http://virtuemart.net
*/
mm_showMyFileName(__FILE__);
require_once CLASSPATH . 'ps_product_files.php';
$product_id = intval(vmGet($_REQUEST, "product_id", null));
$file_id = intval(vmGet($_REQUEST, "file_id", null));
if (!empty($product_id) && !empty($file_id)) {
    ps_product_files::send_file($file_id, $product_id);
}
Exemplo n.º 5
0
 /**
  * Validates an uploaded image. Creates UNIX commands to be used
  * by the process_images function, which has to be called after
  * the validation.
  * @author jep
  * @author soeren
  * @static 
  * @param array $d
  * @param string $field_name The name of the field in the table $table, the image is assigned to [e.g. product_thumb_image]
  * @param string $table_name The name of a table in the database [e.g. #__{vm}_product]
  * @return boolean When the upload validation was sucessfull, true is returned, otherwise false
  */
 function validate_image(&$d, $field_name, $table_name)
 {
     global $vmLogger;
     // The commands to be executed by the process_images
     // function are returned as strings in an array here.
     if (empty($d['image_commands']) || !empty($_REQUEST['image_commands'])) {
         unset($_REQUEST['image_commands']);
         $d['image_commands'] = array();
     }
     // Generate the path to images
     $path = IMAGEPATH;
     $path .= $table_name . "/";
     // Check permissions to write to destination directory
     // Workaround for Window$
     if (strstr($path, ":")) {
         $path_begin = substr($path, strpos($path, ":") + 1, strlen($path));
         $path = str_replace("//", "/", $path_begin);
     }
     if (!is_dir($path)) {
         mkdir($path, 0777);
         $vmLogger->debug('Had to create the directory ' . $path);
     }
     if (!is_writable($path) && !empty($_FILES[$field_name]["tmp_name"])) {
         $vmLogger->err('Cannot write to ' . $table_name . ' image directory: ' . $path);
         return false;
     }
     if (PSHOP_IMG_WIDTH == 0 or PSHOP_IMG_HEIGHT == 0) {
         $vmLogger->err('Thumb default height or width is set to 0! Cannot resize the image');
         return false;
     }
     // Check for upload errors
     require_once CLASSPATH . 'ps_product_files.php';
     ps_product_files::checkUploadedFile($field_name);
     // proof of concept fix by jmarsik 20090422 - safely move the uploaded file from upload_tmp_dir to temporary location (hopefully) included in open_basedir, following code will be much happier :)
     // if the file is not moved, following code will try to manipulate it using functions that check open_basedir (for example copy, file_exists, unlink, getimagesize)
     if (!empty($_FILES[$field_name]["tmp_name"]) && is_uploaded_file($_FILES[$field_name]["tmp_name"])) {
         $tmpfile_moved_from_uploaded_file = $path . "tmpForThumb_" . basename($_FILES[$field_name]["tmp_name"]);
         $vmLogger->debug("Moving file from " . $_FILES[$field_name]["tmp_name"] . " to " . $tmpfile_moved_from_uploaded_file . " (helps when upload_tmp_dir is not in open_basedir)");
         move_uploaded_file($_FILES[$field_name]["tmp_name"], $tmpfile_moved_from_uploaded_file);
         $_FILES[$field_name]["tmp_name"] = $tmpfile_moved_from_uploaded_file;
     }
     $tmp_field_name = str_replace("thumb", "full", $field_name);
     //	Class for resizing Thumbnails
     require_once CLASSPATH . "class.img2thumb.php";
     if (@$d[$tmp_field_name . '_action'] == 'auto_resize') {
         // proof of concept fix by jmarsik 20090422 - safely move the uploaded file from upload_tmp_dir to temporary location (hopefully) included in open_basedir, following code will be much happier :)
         // if the file is not moved, following code will try to manipulate it using functions that check open_basedir (for example copy, file_exists, unlink, getimagesize)
         if (!empty($_FILES[$tmp_field_name]["tmp_name"]) && is_uploaded_file($_FILES[$tmp_field_name]["tmp_name"])) {
             $tmpfile_moved_from_uploaded_file = $path . "tmpForThumb_" . basename($_FILES[$tmp_field_name]["tmp_name"]);
             $vmLogger->debug("Moving file from " . $_FILES[$tmp_field_name]["tmp_name"] . " to " . $tmpfile_moved_from_uploaded_file . " (helps when upload_tmp_dir is not in open_basedir)");
             move_uploaded_file($_FILES[$tmp_field_name]["tmp_name"], $tmpfile_moved_from_uploaded_file);
             $_FILES[$tmp_field_name]["tmp_name"] = $tmpfile_moved_from_uploaded_file;
         }
         // Resize the Full Image
         if (!empty($_FILES[$tmp_field_name]["tmp_name"])) {
             $full_file = $_FILES[$tmp_field_name]["tmp_name"];
             $image_info = getimagesize($full_file);
         } elseif (!empty($d[$tmp_field_name . "_url"])) {
             $tmp_file_from_url = $full_file = ps_product_files::getRemoteFile($d[$tmp_field_name . "_url"]);
             if ($full_file) {
                 $vmLogger->debug('Successfully fetched the image file from ' . $d[$tmp_field_name . "_url"] . ' for later resizing');
                 $image_info = getimagesize($full_file);
             }
         }
         if (!empty($image_info)) {
             if ($image_info[2] == 1) {
                 if (function_exists("imagegif")) {
                     $ext = ".gif";
                     $noimgif = "";
                 } else {
                     $ext = ".jpg";
                     $noimgif = ".gif";
                 }
             } elseif ($image_info[2] == 2) {
                 $ext = ".jpg";
                 $noimgif = "";
             } elseif ($image_info[2] == 3) {
                 $ext = ".png";
                 $noimgif = "";
             }
             $vmLogger->debug('The resized Thumbnail will have extension ' . $noimgif . $ext);
             /* Generate Image Destination File Name */
             if (!empty($d[$table_name . '_name'])) {
                 $filename = substr($d[$table_name . '_name'], 0, 16);
                 $filename = vmSafeFileName($filename);
             } else {
                 $filename = md5('virtuemart');
             }
             $to_file_thumb = uniqid($filename . '_');
             $fileout = IMAGEPATH . "{$table_name}/resized/{$to_file_thumb}" . '_' . PSHOP_IMG_WIDTH . 'x' . PSHOP_IMG_HEIGHT . $noimgif . $ext;
             if (!file_exists(dirname($fileout))) {
                 mkdir(dirname($fileout));
                 $vmLogger->debug('Created Directory ' . dirname($fileout));
             }
             $neu = new Img2Thumb($full_file, PSHOP_IMG_WIDTH, PSHOP_IMG_HEIGHT, $fileout, 0, 255, 255, 255);
             $thumbname = 'resized/' . basename($fileout);
             $vmLogger->debug('Finished creating the thumbnail ' . $thumbname);
             if (isset($tmp_file_from_url)) {
                 unlink(realpath($tmp_file_from_url));
             }
             $tmp_field_name = str_replace("full", "thumb", $tmp_field_name);
             $tmp_field_name = str_replace("_url", "", $tmp_field_name);
             $_FILES[$tmp_field_name]['tmp_name'] = $fileout;
             $_FILES[$tmp_field_name]['name'] = $thumbname;
             $d[$tmp_field_name] = $thumbname;
             $curr_file = isset($_REQUEST[$tmp_field_name . "_curr"]) ? $_REQUEST[$tmp_field_name . "_curr"] : "";
             if (!empty($curr_file)) {
                 $delete = str_replace("\\", "/", realpath($path . "/" . $curr_file));
                 $d["image_commands"][] = array('command' => 'unlink', 'param1' => $delete);
                 $vmLogger->debug('Preparing: delete old thumbnail image: ' . $delete);
                 /* Remove the resized image if exists */
                 if (PSHOP_IMG_RESIZE_ENABLE == "1") {
                     $pathinfo = pathinfo($delete);
                     isset($pathinfo["dirname"]) or $pathinfo["dirname"] = "";
                     isset($pathinfo["extension"]) or $pathinfo["extension"] = "";
                     $filehash = basename($delete, "." . $pathinfo["extension"]);
                     $resizedfilename = $pathinfo["dirname"] . "/resized/" . $filehash . "_" . PSHOP_IMG_WIDTH . "x" . PSHOP_IMG_HEIGHT . "." . $pathinfo["extension"];
                     $d["image_commands"][] = array('command' => 'unlink', 'param1' => $resizedfilename);
                     $vmLogger->debug('Preparing: delete resized thumbnail ' . $resizedfilename);
                 }
             }
         }
     }
     $temp_file = isset($_FILES[$field_name]['tmp_name']) ? $_FILES[$field_name]['tmp_name'] : "";
     $file_type = isset($_FILES[$field_name]['type']) ? $_FILES[$field_name]['type'] : "";
     $orig_file = isset($_FILES[$field_name]["name"]) ? $_FILES[$field_name]['name'] : "";
     $curr_file = isset($_REQUEST[$field_name . "_curr"]) ? $_REQUEST[$field_name . "_curr"] : "";
     /* Generate text to display in error messages */
     if (stristr("thumb", $field_name)) {
         $image_type = "thumbnail image";
     } elseif (stristr("full", $field_name)) {
         $image_type = "full image";
     } else {
         $image_type = str_replace("_", " ", $field_name);
     }
     /* If User types "none" in Image Upload Field */
     if (@$d[$field_name . "_action"] == "delete") {
         /* If there is a current image file */
         if (!empty($curr_file)) {
             $delete = str_replace("\\", "/", realpath($path . "/" . $curr_file));
             $d["image_commands"][] = array('command' => 'unlink', 'param1' => $delete);
             $vmLogger->debug('Preparing: delete old ' . $image_type . ' ' . $delete);
             /* Remove the resized image if exists */
             if (PSHOP_IMG_RESIZE_ENABLE == "1" && $image_type == "thumbnail image") {
                 $pathinfo = pathinfo($delete);
                 isset($pathinfo["dirname"]) or $pathinfo["dirname"] = "";
                 isset($pathinfo["extension"]) or $pathinfo["extension"] = "";
                 $filehash = basename($delete, "." . $pathinfo["extension"]);
                 $resizedfilename = $pathinfo["dirname"] . "/resized/" . $filehash . "_" . PSHOP_IMG_WIDTH . "x" . PSHOP_IMG_HEIGHT . "." . $pathinfo["extension"];
                 $d["image_commands"][] = array('command' => 'unlink', 'param1' => $resizedfilename);
                 $vmLogger->debug('Preparing: delete resized thumbnail ' . $resizedfilename);
             }
         }
         $d[$field_name] = "";
         return true;
     } elseif ($orig_file and $temp_file == "none") {
         $vmLogger->err($image_type . ' upload failed.');
         return false;
     } else {
         // If nothing was entered in the Upload box, there is no image to process
         if (!$orig_file) {
             $d[$field_name] = $curr_file;
             return true;
         }
     }
     if (empty($temp_file)) {
         $vmLogger->err('The File Upload was not successful: there\'s no uploaded temporary file!');
         return false;
     }
     /* Generate Image Destination File Name */
     if (!empty($d[$table_name . '_name'])) {
         $filename = substr($d[$table_name . '_name'], 0, 16);
         $filename = vmSafeFileName($filename);
     } else {
         $filename = md5('virtuemart');
     }
     $to_file = uniqid($filename . '_');
     /* Check image file format */
     if ($orig_file != "none") {
         $to_file .= $ext = '.' . Img2Thumb::GetImgType($temp_file);
         if (!$to_file) {
             $vmLogger->err($image_type . ' file is invalid: ' . $file_type . '.');
             return false;
         }
     }
     /*
      ** If it gets to this point then there is an uploaded file in the system
      ** and it is a valid image file.
      */
     /* If Updating */
     if (!empty($curr_file)) {
         /* Command to remove old image file */
         $delete = str_replace("\\", "/", realpath($path) . "/" . $curr_file);
         $d["image_commands"][] = array('command' => 'unlink', 'param1' => $delete);
         /* Remove the resized image if exists */
         if (PSHOP_IMG_RESIZE_ENABLE == "1" && $image_type == "thumbnail image") {
             $pathinfo = pathinfo($delete);
             $filehash = basename($delete, "." . $pathinfo["extension"]);
             $resizedfilename = $pathinfo["dirname"] . "/resized/" . $filehash . "_" . PSHOP_IMG_WIDTH . "x" . PSHOP_IMG_HEIGHT . "." . $pathinfo["extension"];
             $d["image_commands"][] = array('command' => 'unlink', 'param1' => $resizedfilename);
             $vmLogger->debug('Preparing: delete resized thumbnail ' . $resizedfilename);
         }
     }
     /* Command to move uploaded file into destination directory */
     // Command to move uploaded file into destination directory
     $d["image_commands"][] = array('command' => 'move_uploaded_file', 'param1' => $temp_file, 'param2' => $path . $to_file);
     $d["image_commands"][] = array('command' => 'unlink', 'param1' => $temp_file);
     if (empty($d[$field_name])) {
         /* Return new image file name */
         $d[$field_name] = $to_file;
     }
     return true;
 }
Exemplo n.º 6
0
 /**
  * Handles a download Request
  *
  * @param array $d
  * @return boolean
  */
 function download_request(&$d)
 {
     global $download_id, $VM_LANG, $vmLogger;
     $db = new ps_DB();
     $download_id = $db->getEscaped(vmGet($d, "download_id"));
     $q = "SELECT * FROM #__{vm}_product_download WHERE";
     $q .= " download_id = '{$download_id}'";
     $db->query($q);
     $db->next_record();
     $download_id = $db->f("download_id");
     $file_name = $db->f("file_name");
     if (strncmp($file_name, 'http', 4) !== 0) {
         $datei = DOWNLOADROOT . $file_name;
     } else {
         $datei = $file_name;
     }
     $download_max = $db->f("download_max");
     $end_date = $db->f("end_date");
     $zeit = time();
     if (!$download_id) {
         $vmLogger->err($VM_LANG->_('PHPSHOP_DOWNLOADS_ERR_INV', false));
         return false;
         //vmRedirect("index.php?option=com_virtuemart&page=shop.downloads", $d["error"]);
     } elseif ($download_max == "0") {
         $q = "DELETE FROM #__{vm}_product_download";
         $q .= " WHERE download_id = '" . $download_id . "'";
         $db->query($q);
         $db->next_record();
         $vmLogger->err($VM_LANG->_('PHPSHOP_DOWNLOADS_ERR_MAX', false));
         return false;
         //vmRedirect("index.php?option=com_virtuemart&page=shop.downloads", $d["error"]);
     } elseif ($end_date != "0" && $zeit > $end_date) {
         $q = "DELETE FROM #__{vm}_product_download";
         $q .= " WHERE download_id = '" . $download_id . "'";
         $db->query($q);
         $db->next_record();
         $vmLogger->err($VM_LANG->_('PHPSHOP_DOWNLOADS_ERR_EXP', false));
         return false;
         //vmRedirect("index.php?option=com_virtuemart&page=shop.downloads", $d["error"]);
     }
     require_once CLASSPATH . 'connectionTools.class.php';
     $download_count = true;
     if (@file_exists($datei)) {
         // Check if this is a request for a special range of the file (=Resume Download)
         $range_request = vmConnector::http_rangeRequest(filesize($datei), false);
         if ($range_request[0] == 0) {
             // this is not a request to resume a download,
             $download_count = true;
         } else {
             $download_count = false;
         }
     } else {
         $download_count = false;
     }
     // Parameter to check if the file should be removed after download, which is only true,
     // if we have a remote file, which was transferred to this server into a temporary file
     $unlink = false;
     if (strncmp($datei, 'http', 4) === 0) {
         require_once CLASSPATH . 'ps_product_files.php';
         $datei_local = ps_product_files::getRemoteFile($datei);
         if ($datei_local !== false) {
             $datei = $datei_local;
             $unlink = true;
         } else {
             $vmLogger->err($VM_LANG->_('VM_DOWNLOAD_FILE_NOTFOUND', false));
             return false;
         }
     } else {
         // Check, if file path is correct
         // and file is
         if (!@file_exists($datei)) {
             $vmLogger->err($VM_LANG->_('VM_DOWNLOAD_FILE_NOTFOUND', false));
             return false;
             //vmRedirect("index.php?option=com_virtuemart&page=shop.downloads", $d["error"]);
         }
         if (!@is_readable($datei)) {
             $vmLogger->err($VM_LANG->_('VM_DOWNLOAD_FILE_NOTREADABLE', false));
             return false;
             //vmRedirect("index.php?option=com_virtuemart&page=shop.downloads", $d["error"]);
         }
     }
     if ($download_count) {
         // decrement the download_max to limit the number of downloads
         $q = "UPDATE `#__{vm}_product_download` SET";
         $q .= " `download_max`=`download_max` - 1";
         $q .= " WHERE download_id = '" . $download_id . "'";
         $db->query($q);
         $db->next_record();
     }
     if ($end_date == "0") {
         // Set the Download Expiry Date, so the download can expire after DOWNLOAD_EXPIRE seconds
         $end_date = time('u') + DOWNLOAD_EXPIRE;
         $q = "UPDATE #__{vm}_product_download SET";
         $q .= " end_date={$end_date}";
         $q .= " WHERE download_id = '" . $download_id . "'";
         $db->query($q);
         $db->next_record();
     }
     if (ereg('Opera(/| )([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
         $UserBrowser = "Opera";
     } elseif (ereg('MSIE ([0-9].[0-9]{1,2})', $_SERVER['HTTP_USER_AGENT'])) {
         $UserBrowser = "IE";
     } else {
         $UserBrowser = '';
     }
     $mime_type = $UserBrowser == 'IE' || $UserBrowser == 'Opera' ? 'application/octetstream' : 'application/octet-stream';
     // dump anything in the buffer
     while (@ob_end_clean()) {
     }
     vmConnector::sendFile($datei, $mime_type, basename($file_name));
     if ($unlink) {
         // remove the temporarily downloaded remote file
         @unlink($datei);
     }
     $GLOBALS['vm_mainframe']->close(true);
 }
Exemplo n.º 7
0
    $product_packaging = "";
}
// Change Packaging - End
// PRODUCT IMAGE
$product_full_image = $product_parent_id != 0 && !$db_product->f("product_full_image") ? $dbp->f("product_full_image") : $db_product->f("product_full_image");
// Change
$product_thumb_image = $product_parent_id != 0 && !$db_product->f("product_thumb_image") ? $dbp->f("product_thumb_image") : $db_product->f("product_thumb_image");
// Change
/* MORE IMAGES ??? */
$files = ps_product_files::getFilesForProduct($product_id);
$more_images = "";
if (!empty($files['images'])) {
    $more_images = $tpl->vmMoreImagesLink($files['images']);
}
// Does the Product have files?
$file_list = ps_product_files::get_file_list($files['product_id']);
$product_availability = '';
if (@$_REQUEST['output'] != "pdf") {
    // Show the PDF, Email and Print buttons
    $tpl->set('option', $option);
    $tpl->set('category_id', $category_id);
    $tpl->set('product_id', $product_id);
    $buttons_header = $tpl->fetch('common/buttons.tpl.php');
    $tpl->set('buttons_header', $buttons_header);
    // AVAILABILITY
    // This is the place where it shows: Availability: 24h, In Stock: 5 etc.
    // You can make changes to this functionality in the file: classes/ps_product.php
    $product_availability = $ps_product->get_availability($product_id);
}
$product_availability_data = $ps_product->get_availability_data($product_id);
/** Ask seller a question **/
Exemplo n.º 8
0
 $link = $sess->url($link);
 $text = shopMakeHtmlSafe($db->f("product_name"));
 // The link to the product form / to the child products
 if ($vmLayout == 'standard') {
     $tmpcell = vmCommonHTML::hyperLink($link, $text, '', 'Edit: ' . $text);
 } else {
     $tmpcell = vmCommonHTML::hyperLink($link, $text, '', 'Edit: ' . $text, 'onclick="parent.addSimplePanel( \'' . $db->getEscaped($db->f("product_name")) . '\', \'' . $link . '\' );return false;"');
 }
 if ($ps_product->parent_has_children($db->f("product_id"))) {
     $tmpcell .= "&nbsp;&nbsp;&nbsp;<a href=\"";
     $tmpcell .= $sess->url($_SERVER['PHP_SELF'] . "?page={$modulename}.product_list&product_parent_id=" . $db->f("product_id"));
     $tmpcell .= "\">[ " . $VM_LANG->_('PHPSHOP_PRODUCT_FORM_ITEM_INFO_LBL') . " ]</a>";
 }
 $listObj->addCell($tmpcell);
 // Product Media Link
 $numFiles = ps_product_files::countFilesForProduct($db->f('product_id'));
 if ($db->f('product_full_image')) {
     $numFiles++;
 }
 if ($db->f('product_thumb_image')) {
     $numFiles++;
 }
 $link = $sess->url($_SERVER['PHP_SELF'] . '?page=product.file_list&product_id=' . $db->f('product_id') . '&no_menu=1');
 $link = defined('_VM_IS_BACKEND') ? str_replace('index2.php', 'index3.php', str_replace('index.php', 'index3.php', $link)) : str_replace('index.php', 'index2.php', $link);
 $text = '<img src="' . $mosConfig_live_site . '/includes/js/ThemeOffice/media.png" align="middle" border="0" />&nbsp;(' . $numFiles . ')';
 $tmpcell = vmPopupLink($link, $text, 800, 540, '_blank', '', 'screenX=100,screenY=100');
 $listObj->addCell($tmpcell);
 // The product sku
 $listObj->addCell($db->f("product_sku"));
 // The product Price
 $price = $ps_product->getPriceByShopperGroup($db->f('product_id'), '');
Exemplo n.º 9
0
    $product_packaging = "";
}
// Change Packaging - End
// PRODUCT IMAGE
$product_full_image = $product_parent_id != 0 && !$db_product->f("product_full_image") ? $dbp->f("product_full_image") : $db_product->f("product_full_image");
// Change
$product_thumb_image = $product_parent_id != 0 && !$db_product->f("product_thumb_image") ? $dbp->f("product_thumb_image") : $db_product->f("product_thumb_image");
// Change
/* MORE IMAGES ??? */
$files = ps_product_files::getFilesForProduct($product_id);
$more_images = "";
if (!empty($files['images'])) {
    $more_images = $tpl->vmMoreImagesLink($files['images']);
}
// Does the Product have files?
$file_list = ps_product_files::get_file_list($product_id);
$product_availability = '';
if (@$_REQUEST['output'] != "pdf") {
    // Show the PDF, Email and Print buttons
    $tpl->set('option', $option);
    $tpl->set('category_id', $category_id);
    $tpl->set('product_id', $product_id);
    $buttons_header = $tpl->fetch('common/buttons.tpl.php');
    $tpl->set('buttons_header', $buttons_header);
    // AVAILABILITY
    // This is the place where it shows: Availability: 24h, In Stock: 5 etc.
    // You can make changes to this functionality in the file: classes/ps_product.php
    $product_availability = $ps_product->get_availability($product_id);
}
$product_availability_data = $ps_product->get_availability_data($product_id);
/** Ask seller a question **/