From f0f3679cbd90717a5bdff1a4cab65d7caed4568a Mon Sep 17 00:00:00 2001 From: gRoussac Date: Tue, 12 Nov 2013 15:56:04 +0100 Subject: [PATCH 1/3] [*] FO : https on TOS in fancybox, follow up https://github.com/PrestaShop/PrestaShop/pull/956 --- controllers/front/CmsController.php | 10 +++++++--- controllers/front/ParentOrderController.php | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/controllers/front/CmsController.php b/controllers/front/CmsController.php index bc0823809..2c9793ec4 100644 --- a/controllers/front/CmsController.php +++ b/controllers/front/CmsController.php @@ -30,12 +30,13 @@ class CmsControllerCore extends FrontController public $assignCase; public $cms; public $cms_category; + public $ssl = false; public function canonicalRedirection($canonicalURL = '') { if (Tools::getValue('live_edit')) return ; - if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms))) + if (Validate::isLoadedObject($this->cms) && ($canonicalURL = $this->context->link->getCMSLink($this->cms, $this->cms->link_rewrite, $this->ssl))) parent::canonicalRedirection($canonicalURL); else if (Validate::isLoadedObject($this->cms_category) && ($canonicalURL = $this->context->link->getCMSCategoryLink($this->cms_category))) parent::canonicalRedirection($canonicalURL); @@ -47,13 +48,16 @@ class CmsControllerCore extends FrontController */ public function init() { - parent::init(); - if ($id_cms = (int)Tools::getValue('id_cms')) $this->cms = new CMS($id_cms, $this->context->language->id); else if ($id_cms_category = (int)Tools::getValue('id_cms_category')) $this->cms_category = new CMSCategory($id_cms_category, $this->context->language->id); + if (Configuration::get('PS_SSL_ENABLED') && Tools::getValue('content_only') && Tools::getValue('id_cms') == (int)Configuration::get('PS_CONDITIONS_CMS_ID') && Validate::isLoadedObject($this->cms)) + $this->ssl = true; + + parent::init(); + $this->canonicalRedirection(); // assignCase (1 = CMS page, 2 = CMS category) diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index adf7c9d4d..e0672255e 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -511,7 +511,7 @@ class ParentOrderControllerCore extends FrontController // TOS $cms = new CMS(Configuration::get('PS_CONDITIONS_CMS_ID'), $this->context->language->id); - $this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite); + $this->link_conditions = $this->context->link->getCMSLink($cms, $cms->link_rewrite, (bool)Configuration::get('PS_SSL_ENABLED')); if (!strpos($this->link_conditions, '?')) $this->link_conditions .= '?content_only=1'; else From b5eb7c5c283250b3c348f2005e9a37ad5b5ab28f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 12 Nov 2013 16:25:13 +0100 Subject: [PATCH 2/3] // typo --- install-dev/classes/languages.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/install-dev/classes/languages.php b/install-dev/classes/languages.php index 8e35b3f33..e4c744b9b 100644 --- a/install-dev/classes/languages.php +++ b/install-dev/classes/languages.php @@ -138,7 +138,8 @@ class InstallLanguages $args[0] = $translation; if(count($args) > 1) return call_user_func_array('sprintf', $args); - else return $translation; + else + return $translation; } /** From 75e6a035916172e47814f153c581312dcc3f60f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Tue, 12 Nov 2013 16:38:34 +0100 Subject: [PATCH 3/3] // small fix --- classes/Cart.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/Cart.php b/classes/Cart.php index 9fb756f7e..fc313e8aa 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -1088,7 +1088,7 @@ class CartCore extends ObjectModel $id_customization = Db::getInstance()->Insert_ID(); } - $field = preg_replace("/\/i", "\n", $field); + $field = preg_replace("//i", "\n", $field); $query = 'INSERT INTO `'._DB_PREFIX_.'customized_data` (`id_customization`, `type`, `index`, `value`) VALUES ('.(int)$id_customization.', '.(int)$type.', '.(int)$index.', \''.pSQL($field).'\')';