From 7e51bd6e15adcc69a91fe1ca87fd43cb51535a51 Mon Sep 17 00:00:00 2001 From: Brian Sandall Date: Thu, 11 May 2017 14:17:31 -0700 Subject: [PATCH 01/14] Resolves issue #1633 --- classes/catalogue.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/catalogue.class.php b/classes/catalogue.class.php index f792d364e..85e1da363 100755 --- a/classes/catalogue.class.php +++ b/classes/catalogue.class.php @@ -215,7 +215,7 @@ public function descriptionShort($product){ } if($substr && $product_precis>0 && strlen($short_description)>$product_precis) { - return substr($short_description, 0, $product_precis).'…'; + return htmlentities(substr(html_entity_decode($short_description, ENT_COMPAT, 'UTF-8'), 0, $product_precis), ENT_QUOTES, 'UTF-8').'…'; } else { return $short_description; } From 54ae3ad0d326fb8b72fdb3ae7f19c6861fa9cc1d Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 09:46:51 +0100 Subject: [PATCH 02/14] Fixed #1637 --- classes/session.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/session.class.php b/classes/session.class.php index ac1540e4b..f2e9f370b 100755 --- a/classes/session.class.php +++ b/classes/session.class.php @@ -121,7 +121,7 @@ final private function __construct() { // make sure session cookies are http ONLY! ini_set('session.cookie_httponly',true); } - if (!$ini['session.cookie_secure'] && $GLOBALS['config']->get('config', 'ssl')=='1') { + if (!$ini['session.cookie_secure'] && CC_SSL) { // make sure session cookies are secure if SSL is enabled ini_set('session.cookie_secure',true); } From 73d29555ebbd22a17b40079de22d5e7149b694d2 Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 09:51:44 +0100 Subject: [PATCH 03/14] #1637 removed duplicate ini_set --- classes/session.class.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/classes/session.class.php b/classes/session.class.php index f2e9f370b..f154b25a3 100755 --- a/classes/session.class.php +++ b/classes/session.class.php @@ -100,8 +100,6 @@ final private function __construct() { ini_set('session.cookie_path', $GLOBALS['rootRel']); } - ini_set('session.cookie_httponly',true); - //If the current session time is longer we will not change anything if ($ini['session.gc_maxlifetime'] < $this->_session_timeout) { ini_set('session.gc_maxlifetime', $this->_session_timeout); @@ -123,7 +121,7 @@ final private function __construct() { } if (!$ini['session.cookie_secure'] && CC_SSL) { // make sure session cookies are secure if SSL is enabled - ini_set('session.cookie_secure',true); + //ini_set('session.cookie_secure',true); } $this->_start(); From 994eb0b889e5bb95be76ef45b0335746f74b97c9 Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 10:05:52 +0100 Subject: [PATCH 04/14] #1637 --- classes/sanitize.class.php | 35 ++++++++++++++++++----------------- classes/session.class.php | 2 +- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/classes/sanitize.class.php b/classes/sanitize.class.php index 58ce2fe39..8f620d1d8 100755 --- a/classes/sanitize.class.php +++ b/classes/sanitize.class.php @@ -30,26 +30,27 @@ static public function checkToken() { $csrf_path = CC_ROOT_DIR.'/'.$glob['adminFolder'].'/skins/'.$GLOBALS['config']->get('config', 'admin_skin').'/csrf.inc.php'; if(file_exists($csrf_path)) { require_once($csrf_path); - if(is_array($csrf_maps)) - foreach($csrf_maps as $csrf_map) { - if(is_array($csrf_map)) { - $csrf_check = false; - foreach($csrf_map as $key => $value) { - if((!$value && isset($_GET[$key])) || (isset($_GET[$key]) && $_GET[$key]==$value)) { - $csrf_check = true; - } else { - $csrf_check = false; - break; + if(is_array($csrf_maps)) { + foreach($csrf_maps as $csrf_map) { + if(is_array($csrf_map)) { + $csrf_check = false; + foreach($csrf_map as $key => $value) { + if((!$value && isset($_GET[$key])) || (isset($_GET[$key]) && $_GET[$key]==$value)) { + $csrf_check = true; + } else { + $csrf_check = false; + break; + } } - } - if($csrf_check) { - if (!isset($_GET['token']) || !$GLOBALS['session']->checkToken($_GET['token'])) { - //Make a new token just to insure that it doesn't get used again - $GLOBALS['session']->getToken(true); - self::_stopToken(); + if($csrf_check) { + if (!isset($_GET['token']) || !$GLOBALS['session']->checkToken($_GET['token'])) { + //Make a new token just to insure that it doesn't get used again + $GLOBALS['session']->getToken(true); + self::_stopToken(); + } + break; } - break; } } } diff --git a/classes/session.class.php b/classes/session.class.php index f154b25a3..7e9918c46 100755 --- a/classes/session.class.php +++ b/classes/session.class.php @@ -121,7 +121,7 @@ final private function __construct() { } if (!$ini['session.cookie_secure'] && CC_SSL) { // make sure session cookies are secure if SSL is enabled - //ini_set('session.cookie_secure',true); + ini_set('session.cookie_secure',true); } $this->_start(); From 3c2fd75e304620cc56ee4c0375cb297c326c136c Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 10:06:30 +0100 Subject: [PATCH 05/14] #1637 - Fixed admin login --- classes/sanitize.class.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/classes/sanitize.class.php b/classes/sanitize.class.php index 8f620d1d8..9ea8c16bf 100755 --- a/classes/sanitize.class.php +++ b/classes/sanitize.class.php @@ -143,10 +143,12 @@ private static function _safety($value) { * Used when the POST token is not valid */ static private function _stopToken() { - unset($_POST, $_GET); - $message = 'Security Alert: Possible Cross-Site Request Forgery (CSRF) or browser back button used.'; - $gui_message['error'][md5($message)] = $message; - $GLOBALS['session']->set('GUI_MESSAGE', $gui_message); - trigger_error('Invalid Security Token', E_USER_WARNING); + if(CC_IN_ADMIN && Admin::getInstance()->is()) { + unset($_POST, $_GET); + $message = 'Security Alert: Possible Cross-Site Request Forgery (CSRF) or browser back button used.'; + $gui_message['error'][md5($message)] = $message; + $GLOBALS['session']->set('GUI_MESSAGE', $gui_message); + trigger_error('Invalid Security Token', E_USER_WARNING); + } } } \ No newline at end of file From 77a11a4d6374db9277a0b60db6bc0f79da494788 Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 10:07:54 +0100 Subject: [PATCH 06/14] Revert "#1637 - Fixed admin login" This reverts commit 3c2fd75e304620cc56ee4c0375cb297c326c136c. --- classes/sanitize.class.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/classes/sanitize.class.php b/classes/sanitize.class.php index 9ea8c16bf..8f620d1d8 100755 --- a/classes/sanitize.class.php +++ b/classes/sanitize.class.php @@ -143,12 +143,10 @@ private static function _safety($value) { * Used when the POST token is not valid */ static private function _stopToken() { - if(CC_IN_ADMIN && Admin::getInstance()->is()) { - unset($_POST, $_GET); - $message = 'Security Alert: Possible Cross-Site Request Forgery (CSRF) or browser back button used.'; - $gui_message['error'][md5($message)] = $message; - $GLOBALS['session']->set('GUI_MESSAGE', $gui_message); - trigger_error('Invalid Security Token', E_USER_WARNING); - } + unset($_POST, $_GET); + $message = 'Security Alert: Possible Cross-Site Request Forgery (CSRF) or browser back button used.'; + $gui_message['error'][md5($message)] = $message; + $GLOBALS['session']->set('GUI_MESSAGE', $gui_message); + trigger_error('Invalid Security Token', E_USER_WARNING); } } \ No newline at end of file From d75faa35edb4d481fc25ae066064a18d23ac7d36 Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 10:56:02 +0100 Subject: [PATCH 07/14] #1637 changed cookie names depending on session security --- classes/session.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classes/session.class.php b/classes/session.class.php index 7e9918c46..477bcf8dc 100755 --- a/classes/session.class.php +++ b/classes/session.class.php @@ -651,7 +651,8 @@ private function _start() { } session_cache_limiter('none'); - session_name('CCS_'.strtoupper(substr(md5(CC_ROOT_DIR), 0,10))); + $session_prefix = CC_SSL ? 'S' : ''; + session_name('CC'.$session_prefix.'_'.strtoupper(substr(md5(CC_ROOT_DIR), 0,10))); session_start(); // Increase session length on each page load. NOT IE however as we all know it is a wingy PITA From 0f0fdc41286b23f9d99da90e02e11eef882ff04a Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Fri, 12 May 2017 11:31:24 +0100 Subject: [PATCH 08/14] Fixed #1619 --- skins/foundation/templates/content.category.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/skins/foundation/templates/content.category.php b/skins/foundation/templates/content.category.php index eeeb799a1..aca973d67 100755 --- a/skins/foundation/templates/content.category.php +++ b/skins/foundation/templates/content.category.php @@ -213,10 +213,10 @@ *} - {* Add "hide-for-small-up" to the class attribute to not display the more button *}
{$category.cat_id}
{if $page!=='all' && ($page < $total)} {$params[$var_name] = $page + 1} + {* Add "hide-for-medium-up" to the class attribute to not display the more button *} {$LANG.common.more} {/if} From e76affc7835fd8343e0ea05100707f4cb5c3637e Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Mon, 15 May 2017 13:38:40 +0100 Subject: [PATCH 09/14] Updated version tag --- ini.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ini.inc.php b/ini.inc.php index a3ecd4ce0..b16cb8af1 100755 --- a/ini.inc.php +++ b/ini.inc.php @@ -50,7 +50,7 @@ } /************* CUBECART SPECIFIC SETTINGS *************/ -define('CC_VERSION', '6.1.7'); // Version Number +define('CC_VERSION', '6.1.8'); // Version Number define('CC_INI_SET', true); // Stop includes and the like from being executed on their own define('CC_DS', DIRECTORY_SEPARATOR); // Deprecated but kept for backward compatibility define('CC_PS', PATH_SEPARATOR); From 4b4da87ff292985a410c5d2822fe49379f09ceb8 Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Tue, 16 May 2017 11:00:58 +0100 Subject: [PATCH 10/14] Fixed #1639 --- admin/sources/maintenance.index.inc.php | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/admin/sources/maintenance.index.inc.php b/admin/sources/maintenance.index.inc.php index aab111322..a324e2077 100755 --- a/admin/sources/maintenance.index.inc.php +++ b/admin/sources/maintenance.index.inc.php @@ -97,7 +97,7 @@ function crc_integrity_check($files, $mode = 'upgrade') { $zip->addFile($file_path); $zip->close(); $GLOBALS['main']->setACPNotify(sprintf($lang['maintain']['file_compressed'], basename($file_path))); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } else { $GLOBALS['main']->setACPWarning("Error reading file ".basename($file_path)); } @@ -128,7 +128,7 @@ function crc_integrity_check($files, $mode = 'upgrade') { $zip->close(); } else { $GLOBALS['main']->setACPWarning("Error reading file ".$file_name); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } @@ -156,7 +156,7 @@ function crc_integrity_check($files, $mode = 'upgrade') { if ($import) { $GLOBALS['main']->setACPNotify($lang['maintain']['db_restored']); $GLOBALS['cache']->clear(); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } elseif (preg_match('/^files/', $file_name)) { // restore archive @@ -178,11 +178,11 @@ function crc_integrity_check($files, $mode = 'upgrade') { if ($errors!==false) { $GLOBALS['main']->setACPWarning($lang['maintain']['files_restore_fail']); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } else { $GLOBALS['main']->setACPNotify($lang['maintain']['files_restore_success']); $GLOBALS['cache']->clear(); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } else { $GLOBALS['main']->setACPWarning($lang['maintain']['files_restore_not_possible']); @@ -190,7 +190,7 @@ function crc_integrity_check($files, $mode = 'upgrade') { } else { $GLOBALS['main']->setACPWarning($lang['maintain']['files_restore_not_possible']); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } @@ -198,24 +198,24 @@ function crc_integrity_check($files, $mode = 'upgrade') { $contents = false; ## Download the version we want - $request = new Request('www.cubecart.com', '/download/'.$_GET['upgrade'].'.zip', 80, false, true, 10); + $request = new Request('www.cubecart.com', '/download/'.$_GET['upgrade'].'.zip', 80, false, true, 10);# $request->setMethod('get'); $request->setSSL(); $request->setUserAgent('CubeCart'); $request->skiplog(true); if (!$contents = $request->send()) { - $contents = file_get_contents('https://www.cubecart.com/download/'.$_GET['upgrade'].'.zip'); + $contents = file_get_contents('http#s://www.cubecart.com/download/'.$_GET['upgrade'].'.zip'); } if (empty($contents)) { $GLOBALS['main']->setACPWarning($lang['maintain']['files_upgrade_download_fail']); - httpredir('?_g=maintenance&node=index#upgrade'); + httpredir('?_g=maintenance&node=index','upgrade'); } else { if (stristr($contents, 'DOCTYPE') ) { $GLOBALS['main']->setACPWarning("Sorry. CubeCart-".$_GET['upgrade'].".zip was not found. Please try again later."); - httpredir('?_g=maintenance&node=index#upgrade'); + httpredir('?_g=maintenance&node=index','upgrade'); } $destination_path = CC_ROOT_DIR.'/backup/CubeCart-'.$_GET['upgrade'].'.zip'; @@ -253,7 +253,7 @@ function crc_integrity_check($files, $mode = 'upgrade') { if ($errors!==false) { $GLOBALS['main']->setACPWarning($lang['maintain']['files_upgrade_fail']); - httpredir('?_g=maintenance&node=index#upgrade'); + httpredir('?_g=maintenance&node=index','upgrade'); } elseif ($_POST['force']) { ## Try to delete setup folder recursiveDelete(CC_ROOT_DIR.'/setup'); @@ -263,13 +263,13 @@ function crc_integrity_check($files, $mode = 'upgrade') { rename(CC_ROOT_DIR.'/setup', CC_ROOT_DIR.'/setup_'.md5(time().$_GET['upgrade'])); } $GLOBALS['main']->setACPNotify($lang['maintain']['current_version_restored']); - httpredir('?_g=maintenance&node=index#upgrade'); + httpredir('?_g=maintenance&node=index','upgrade'); } else { httpredir(CC_ROOT_REL.'setup/index.php?autoupdate=1'); } } else { $GLOBALS['main']->setACPWarning("Unable to read archive."); - httpredir('?_g=maintenance&node=index#upgrade'); + httpredir('?_g=maintenance&node=index','upgrade'); } } } @@ -279,20 +279,20 @@ function crc_integrity_check($files, $mode = 'upgrade') { $file = 'backup/'.basename($_GET['delete']); if(in_array($_GET['delete'], array('restore_error_log','upgrade_error_log'))) { unlink($file); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } else if(file_exists($file) && preg_match('/^.*\.(sql|zip)$/i', $file)) { ## Generic error message for logs delete specific for backup $message = preg_match('/\_error_log$/', $file) ? $lang['filemanager']['notify_file_delete'] : sprintf($lang['maintain']['backup_deleted'], basename($file)); $GLOBALS['main']->setACPNotify($message); unlink($file); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } if (isset($_GET['download'])) { $file = 'backup/'.basename($_GET['download']); if(file_exists($file)) { deliverFile($file); - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } } @@ -503,7 +503,7 @@ function cleanImageCache($path = null) { $zip->close(); $GLOBALS['main']->setACPNotify($lang['maintain']['files_backup_complete']); } - httpredir('?_g=maintenance&node=index#backup'); + httpredir('?_g=maintenance&node=index','backup'); } if (isset($_POST['backup'])) { From 56658cb6c29ba17d6ab5ec7a981709d5ca40361a Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Thu, 18 May 2017 08:59:56 +0100 Subject: [PATCH 11/14] Fixed clone redirect relates to #1639 --- admin/sources/products.index.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/sources/products.index.inc.php b/admin/sources/products.index.inc.php index 8908b5f84..f77cd1a1c 100755 --- a/admin/sources/products.index.inc.php +++ b/admin/sources/products.index.inc.php @@ -488,7 +488,7 @@ if (isset($_GET['action']) && strtolower($_GET['action'])=='clone' && isset($_GET['product_id']) && (int)$_GET['product_id']>0 && Admin::getInstance()->permissions('products', CC_PERM_EDIT)) { if ($GLOBALS['config']->get('config', 'product_clone')!=1) - httpredir(sprintf('%s?_g=settings#Extra', $glob['adminFile'])); + httpredir(sprintf('%s?_g=settings', $glob['adminFile']), 'Extra'); $product_id_parent = (int)$_GET['product_id']; From 0e6819b3656ad34185b03b7b18156ca170c76d6d Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Thu, 18 May 2017 09:18:37 +0100 Subject: [PATCH 12/14] Relates to #1639 --- setup/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup/index.php b/setup/index.php index b61f6677f..f2b5cf23d 100755 --- a/setup/index.php +++ b/setup/index.php @@ -564,7 +564,7 @@ $db->truncate('CubeCart_system_error_log'); include $global_file; if ($_SESSION['setup']['autoupgrade'] && !$update_config) { - httpredir('../'.$glob['adminFile'].'?_g=maintenance&node=index#upgrade'); + httpredir('../'.$glob['adminFile'].'?_g=maintenance&node=index', 'upgrade'); } } } From 40262ddefd939b22f91fde274512541a554bb91a Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Thu, 18 May 2017 09:20:56 +0100 Subject: [PATCH 13/14] Relates to #1639 --- admin/sources/products.reviews.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/sources/products.reviews.inc.php b/admin/sources/products.reviews.inc.php index bfb78ab47..e57a5fac0 100644 --- a/admin/sources/products.reviews.inc.php +++ b/admin/sources/products.reviews.inc.php @@ -105,7 +105,7 @@ } ## origin variable tells us we need to come back to the dashboard now if (isset($_GET['origin']) && !empty($_GET['origin']) && $_GET['origin']=="dashboard") { - httpredir('?#product_reviews'); + httpredir('?', 'product_reviews'); } } From 0b946dff8cdc93710e9219e1c34a6db312829f6b Mon Sep 17 00:00:00 2001 From: Al Brookbanks Date: Thu, 18 May 2017 11:08:48 +0100 Subject: [PATCH 14/14] Updated feature request submission text --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index dd4000c2e..b52d4ef34 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,7 +3,7 @@ First of all THANK YOU! All contributions be it bug fix, reporting an issue or features request; we greatly appreciate your time which helps make CubeCart even better. ## Feature Requests -Please note that we close ALL new feature requests. This doesn't mean we won't implement them but it means they may well be opened at a later date and assigned to a milestone. +Please submit feature requests to [http://features.cubecart.com](http://features.cubecart.com). ## Sponsored Feature Requests If you are really keen to see a specific feature and don't want to wait, the great news is that we take bribes! Please contact our sales department via our [helpdesk](https://support.cubecart.com/Tickets/Submit).