From e86d668a498e4cdfe6ddd6048495432e336a6b5d Mon Sep 17 00:00:00 2001 From: rMalie Date: Tue, 16 Aug 2011 16:22:13 +0000 Subject: [PATCH] // Fix download products git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8080 b9a71923-0436-4b27-9f14-aed3839534dd --- admin-dev/get-file-admin.php | 5 ++--- admin-dev/tabs/AdminProducts.php | 2 +- classes/ProductDownload.php | 5 ++++- controllers/GetFileController.php | 7 +++++++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/admin-dev/get-file-admin.php b/admin-dev/get-file-admin.php index f40678c83..78189216c 100644 --- a/admin-dev/get-file-admin.php +++ b/admin-dev/get-file-admin.php @@ -26,6 +26,5 @@ */ define('PS_ADMIN_DIR', getcwd()); - -include(PS_ADMIN_DIR.'/../get-file.php'); - +require(dirname(dirname(__FILE__)).'/config/config.inc.php'); +ControllerFactory::getController('getFileController')->run(); \ No newline at end of file diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index 5812d7938..67ce7f3cf 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -1335,7 +1335,7 @@ class AdminProducts extends AdminTab $download->display_filename = Tools::getValue('virtual_product_name'); $download->physically_filename = Tools::getValue('virtual_product_filename') ? Tools::getValue('virtual_product_filename') : ProductDownload::getNewFilename(); $download->date_deposit = date('Y-m-d H:i:s'); - $download->date_expiration = Tools::getValue('virtual_product_expiration_date') ? Tools::getValue('virtual_product_expiration_date').' 23:59:59' : '0000-00-00 00:00:00'; + $download->date_expiration = Tools::getValue('virtual_product_expiration_date') ? Tools::getValue('virtual_product_expiration_date').' 23:59:59' : ''; $download->nb_days_accessible = Tools::getValue('virtual_product_nb_days'); $download->nb_downloadable = Tools::getValue('virtual_product_nb_downloable'); $download->active = 1; diff --git a/classes/ProductDownload.php b/classes/ProductDownload.php index 77269e756..8804990d1 100644 --- a/classes/ProductDownload.php +++ b/classes/ProductDownload.php @@ -100,6 +100,9 @@ class ProductDownloadCore extends ObjectModel public function getFields() { $this->validateFields(); + + if (!$this->date_expiration) + $this->date_expiration = '0000-00-00 00:00:00'; $fields['id_product'] = (int)($this->id_product); $fields['display_filename'] = pSQL($this->display_filename); @@ -205,7 +208,7 @@ class ProductDownloadCore extends ObjectModel public function getTextLink($admin=true, $hash=false) { $key = $this->physically_filename . '-' . ($hash ? $hash : 'orderdetail'); - $link = ($admin) ? './index.php?controller=get-file-admin' : Tools::getHttpHost(true, true).'index.php?controller=get-file'; + $link = ($admin) ? 'get-file-admin.php?' : Tools::getHttpHost(true, true).'index.php?controller=get-file&'; $link .= ($admin) ? 'file='.$this->physically_filename : 'key='.$key; return $link; } diff --git a/controllers/GetFileController.php b/controllers/GetFileController.php index d72bd6348..bb0c13c63 100644 --- a/controllers/GetFileController.php +++ b/controllers/GetFileController.php @@ -27,6 +27,13 @@ class getFileControllerCore extends FrontController { + public function run() + { + $this->init(); + $this->preProcess(); + $this->process(); + } + public function process() { $cookie = $this->context->cookie;