private function DownloadExport() { unset($_SESSION['AjaxExport'][$this->sessionid]); $exportFile = ''; if(isset($this->filename) && basename($this->filename) == $this->filename && file_exists(APP_ROOT."/../cache/".$this->filename)) { $exportFile = $this->filename; } if(!$exportFile) { echo "<script type='text/javascript'>self.parent.AjaxExportError('".GetLang('AjaxExportInvalidFile')."');</script>"; exit; } unset($this->filename); $file = APP_ROOT."/../cache/".$exportFile; Interspire_Download::downloadFile($file, $this->GetExportFileName(), true, 'application/force-download', GetConfig('CharacterSet')); }
private function DownloadImage() { if (!isset($_GET['image'])) { die; } $imagefile = basename($_GET['image']); $imagepath = ISC_BASE_PATH . '/' . GetConfig('ImageDirectory') . '/uploaded_images/' . $imagefile; if (!file_exists($imagepath)) { die(); } Interspire_Download::downloadFile($imagepath); }
/** * Download a particular digital download attached to a product. */ public function DownloadProductFile() { if(!$GLOBALS['ISC_CLASS_ADMIN_AUTH']->HasPermission(AUTH_Edit_Products)) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php'); } $query = " SELECT * FROM [|PREFIX|]product_downloads WHERE downloadid='".(int)$_REQUEST['downloadid']."' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $download = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if(!$download) { FlashMessage(GetLang('ProductDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewProducts'); } // If they're downloading a file for the product they're currently creating, don't check if the // product exists, as it won't. if($download['productid']) { $query = " SELECT productid, prodvendorid FROM [|PREFIX|]products WHERE productid='".$download['productid']."' "; $result = $GLOBALS['ISC_CLASS_DB']->Query($query); $product = $GLOBALS['ISC_CLASS_DB']->Fetch($result); if(!$product) { FlashMessage(GetLang('ProductDoesntExist'), MSG_ERROR, 'index.php?ToDo=viewProducts'); } if($GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId() && $product['prodvendorid'] != $GLOBALS['ISC_CLASS_ADMIN_AUTH']->GetVendorId()) { FlashMessage(GetLang('Unauthorized'), MSG_ERROR, 'index.php?ToDo=viewProducts'); } } $filepath = realpath(ISC_BASE_PATH.'/'.GetConfig('DownloadDirectory')).'/'.$download['downfile']; Interspire_Download::downloadFile($filepath); exit; }
/** * Forces a feed file to be downloaded. */ public function downloadShoppingComparisonFeedAction() { GetModuleById('shoppingcomparison', $module, $this->getValue($_REQUEST, 'mid')); if($module) Interspire_Download::downloadFile($module->getExportFile()); die(); }