From 064db2568237499422d330dd71c3379fad31fa3f Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 20:48:40 +0200 Subject: [PATCH 01/27] Use basename instead of substr and strrpos --- catalog/includes/classes/order_total.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/catalog/includes/classes/order_total.php b/catalog/includes/classes/order_total.php index e7ea0f78e..f048f55d2 100644 --- a/catalog/includes/classes/order_total.php +++ b/catalog/includes/classes/order_total.php @@ -22,7 +22,7 @@ function order_total() { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/order_total/' . $value); include(DIR_WS_MODULES . 'order_total/' . $value); - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php'); $GLOBALS[$class] = new $class; } } @@ -32,7 +32,7 @@ function process() { $order_total_array = array(); if (is_array($this->modules)) { foreach($this->modules as $value) { - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php'); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->output = array(); $GLOBALS[$class]->process(); @@ -57,7 +57,7 @@ function output() { $output_string = ''; if (is_array($this->modules)) { foreach($this->modules as $value) { - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php'); if ($GLOBALS[$class]->enabled) { $size = sizeof($GLOBALS[$class]->output); for ($i=0; $i<$size; $i++) { From 5ab54ad8dab56940da0008dad857c6483de0e9f8 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 20:53:54 +0200 Subject: [PATCH 02/27] Use basename instead of substr strrpos --- catalog/includes/classes/shipping.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/catalog/includes/classes/shipping.php b/catalog/includes/classes/shipping.php index 939d5bbe3..c7ca75d94 100644 --- a/catalog/includes/classes/shipping.php +++ b/catalog/includes/classes/shipping.php @@ -23,10 +23,10 @@ function shipping($module = '') { $include_modules = array(); if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { - $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); + $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . basename($PHP_SELF, '.php')+1))); } else { foreach ($this->modules as $value) { - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php')); $include_modules[] = array('class' => $class, 'file' => $value); } } @@ -64,7 +64,7 @@ function quote($method = '', $module = '') { $include_quotes = array(); foreach($this->modules as $value) { - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php'); if (tep_not_null($module)) { if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) { $include_quotes[] = $class; @@ -89,7 +89,7 @@ function cheapest() { $rates = array(); foreach($this->modules as $value) { - $class = substr($value, 0, strrpos($value, '.')); + $class = basename($value, '.php'); if ($GLOBALS[$class]->enabled) { $quotes = $GLOBALS[$class]->quotes; for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) { From b3c74fa98033d03efbb22d8a0233df287d6c7387 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 20:56:06 +0200 Subject: [PATCH 03/27] Use basename instead of substrate --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 343900982..ef071b8a3 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -25,7 +25,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); - include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); + include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . basename($PHP_SELF, '.php')+1); } else { return false; } From 18341c3b39f0a14dafe45f646f411259b897716c Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 20:59:43 +0200 Subject: [PATCH 04/27] Fix typo --- catalog/includes/classes/shipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/shipping.php b/catalog/includes/classes/shipping.php index c7ca75d94..da5077078 100644 --- a/catalog/includes/classes/shipping.php +++ b/catalog/includes/classes/shipping.php @@ -23,7 +23,7 @@ function shipping($module = '') { $include_modules = array(); if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { - $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . basename($PHP_SELF, '.php')+1))); + $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . basename($PHP_SELF, '.php')+1)); } else { foreach ($this->modules as $value) { $class = basename($value, '.php')); From ace2bb0880a82520a3052fe2897c5a59d97b532d Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:00:17 +0200 Subject: [PATCH 05/27] Fix typo --- catalog/includes/classes/shipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/shipping.php b/catalog/includes/classes/shipping.php index da5077078..4bcd8c01f 100644 --- a/catalog/includes/classes/shipping.php +++ b/catalog/includes/classes/shipping.php @@ -26,7 +26,7 @@ function shipping($module = '') { $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . basename($PHP_SELF, '.php')+1)); } else { foreach ($this->modules as $value) { - $class = basename($value, '.php')); + $class = basename($value, '.php'); $include_modules[] = array('class' => $class, 'file' => $value); } } From 83d25a2b692e524955684735dc1e733669b2474f Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:05:50 +0200 Subject: [PATCH 06/27] Use basename instead of substr strrpos --- catalog/includes/modules/header_tags/ht_robot_noindex.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/modules/header_tags/ht_robot_noindex.php b/catalog/includes/modules/header_tags/ht_robot_noindex.php index 79b2b1b82..54809bd90 100644 --- a/catalog/includes/modules/header_tags/ht_robot_noindex.php +++ b/catalog/includes/modules/header_tags/ht_robot_noindex.php @@ -113,7 +113,7 @@ function ht_robot_noindex_edit_pages($values, $key) { if ($dir = @dir(DIR_FS_CATALOG)) { while ($file = $dir->read()) { if (!is_dir(DIR_FS_CATALOG . $file)) { - if (substr($file, strrpos($file, '.')) == $file_extension) { + if (basename($file, '.php') == $file_extension) { $files_array[] = $file; } } From 8b34ad9b0d847600cf12907308fd6cc1db5143b8 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:18:32 +0200 Subject: [PATCH 07/27] Use path info for file extension --- catalog/includes/classes/action_recorder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index ef071b8a3..e9ec38674 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -21,11 +21,11 @@ function actionRecorder($module, $user_id = null, $user_name = null) { $module = tep_sanitize_string(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { - if (tep_not_null($module) && in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { + if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); - include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . basename($PHP_SELF, '.php')+1); + include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { return false; } From 7054146792c8c302dbc334f555233162dbbb4e6d Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:19:42 +0200 Subject: [PATCH 08/27] Use path info for file extension --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index e9ec38674..761e2b635 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -23,7 +23,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { - if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)))) { + if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { From 492ee95a5fa736280288ab4b1e0632102c2ffd06 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:25:37 +0200 Subject: [PATCH 09/27] Use path info for file extension --- catalog/includes/classes/shipping.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/shipping.php b/catalog/includes/classes/shipping.php index 4bcd8c01f..6c0423c96 100644 --- a/catalog/includes/classes/shipping.php +++ b/catalog/includes/classes/shipping.php @@ -23,7 +23,7 @@ function shipping($module = '') { $include_modules = array(); if ( (tep_not_null($module)) && (in_array(substr($module['id'], 0, strpos($module['id'], '_')) . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { - $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . basename($PHP_SELF, '.php')+1)); + $include_modules[] = array('class' => substr($module['id'], 0, strpos($module['id'], '_')), 'file' => substr($module['id'], 0, strpos($module['id'], '_')) . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { foreach ($this->modules as $value) { $class = basename($value, '.php'); From 0e8d59b04371c1b418ffcc724f10f3066e743154 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 21:53:03 +0200 Subject: [PATCH 10/27] Fix typo --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 761e2b635..02465b667 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -23,7 +23,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { - if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)))) { + if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { From 4668178ba1febeea0a3897ab0107eecc4d023bab Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 22:30:14 +0200 Subject: [PATCH 11/27] Use pathinfo for file extension --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 02465b667..b2e6f840a 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -24,7 +24,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { - include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1))); + include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { return false; From 8e73ea2f8eb9033ddd8222303304513aca961c12 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 22:35:18 +0200 Subject: [PATCH 12/27] Fix typo --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index b2e6f840a..09ed8a7d9 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -21,7 +21,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { $module = tep_sanitize_string(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { - if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { + if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))); From 13d9c60a0c352641ebe7addc5f3201247acaa781 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 22:52:55 +0200 Subject: [PATCH 13/27] Fix typos --- catalog/includes/classes/action_recorder.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 09ed8a7d9..6dfdda308 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -21,9 +21,9 @@ function actionRecorder($module, $user_id = null, $user_name = null) { $module = tep_sanitize_string(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { - if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { + if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED)) { if (!class_exists($module)) { - if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { + if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { From 7f927798ad6178991d4385ca78511441da3a5d63 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 22:54:25 +0200 Subject: [PATCH 14/27] REFIX typo --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 6dfdda308..55e251beb 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -23,7 +23,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED)) { if (!class_exists($module)) { - if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)) { + if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { From ee8a45ea2a0eee100a3a409eaaa622ec20a8cc70 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 22:55:43 +0200 Subject: [PATCH 15/27] Fix typo Will this end? --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 55e251beb..fb3db81e2 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -24,7 +24,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED)) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { - include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))); + include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { return false; From b54607938caa0a01262d68931fe2c11d594d4cdc Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 23:10:09 +0200 Subject: [PATCH 16/27] Fix file extension check with pathinfo instead of basename --- catalog/includes/modules/header_tags/ht_robot_noindex.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/modules/header_tags/ht_robot_noindex.php b/catalog/includes/modules/header_tags/ht_robot_noindex.php index 54809bd90..9a64829ff 100644 --- a/catalog/includes/modules/header_tags/ht_robot_noindex.php +++ b/catalog/includes/modules/header_tags/ht_robot_noindex.php @@ -108,12 +108,12 @@ function ht_robot_noindex_show_pages($text) { function ht_robot_noindex_edit_pages($values, $key) { global $PHP_SELF; - $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); + $file_extension = '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION); $files_array = array(); if ($dir = @dir(DIR_FS_CATALOG)) { while ($file = $dir->read()) { if (!is_dir(DIR_FS_CATALOG . $file)) { - if (basename($file, '.php') == $file_extension) { + if ('.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION) == $file_extension) { $files_array[] = $file; } } From 4ab5fefdc6a3a34dfc7b3afbd246f339e39d13dc Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 23:14:11 +0200 Subject: [PATCH 17/27] Fix remove point from extension check --- catalog/includes/modules/header_tags/ht_robot_noindex.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/modules/header_tags/ht_robot_noindex.php b/catalog/includes/modules/header_tags/ht_robot_noindex.php index 9a64829ff..bf74f93c0 100644 --- a/catalog/includes/modules/header_tags/ht_robot_noindex.php +++ b/catalog/includes/modules/header_tags/ht_robot_noindex.php @@ -108,12 +108,12 @@ function ht_robot_noindex_show_pages($text) { function ht_robot_noindex_edit_pages($values, $key) { global $PHP_SELF; - $file_extension = '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION); + $file_extension = pathinfo($PHP_SELF, PATHINFO_EXTENSION); $files_array = array(); if ($dir = @dir(DIR_FS_CATALOG)) { while ($file = $dir->read()) { if (!is_dir(DIR_FS_CATALOG . $file)) { - if ('.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION) == $file_extension) { + if (pathinfo($PHP_SELF, PATHINFO_EXTENSION) == $file_extension) { $files_array[] = $file; } } From 5e9ff304bc36bbc52b3895663e71f81ef8a28eec Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Thu, 28 Aug 2014 23:33:18 +0200 Subject: [PATCH 18/27] Fix typo --- catalog/includes/classes/action_recorder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index fb3db81e2..f664d4149 100644 --- a/catalog/includes/classes/action_recorder.php +++ b/catalog/includes/classes/action_recorder.php @@ -21,7 +21,7 @@ function actionRecorder($module, $user_id = null, $user_name = null) { $module = tep_sanitize_string(str_replace(' ', '', $module)); if (defined('MODULE_ACTION_RECORDER_INSTALLED') && tep_not_null(MODULE_ACTION_RECORDER_INSTALLED)) { - if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED)) { + if (tep_not_null($module) && in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), explode(';', MODULE_ACTION_RECORDER_INSTALLED))) { if (!class_exists($module)) { if (file_exists(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION))) { include(DIR_WS_LANGUAGES . $_SESSION['language'] . '/modules/action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); From f1063082bddff47d75f27c5bd9854d43327230f0 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 08:59:05 +0200 Subject: [PATCH 19/27] Use pathinfo to get file extension instead of string operations --- catalog/includes/modules/header_tags/ht_datepicker_jquery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php index 6cceed344..09e5a9c22 100644 --- a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php +++ b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php @@ -91,12 +91,12 @@ function ht_datepicker_jquery_show_pages($text) { function ht_datepicker_jquery_edit_pages($values, $key) { global $PHP_SELF; - $file_extension = substr($PHP_SELF, strrpos($PHP_SELF, '.')); + $file_extension = pathinfo($path, PATHINFO_EXTENSION); $files_array = array(); if ($dir = @dir(DIR_FS_CATALOG)) { while ($file = $dir->read()) { if (!is_dir(DIR_FS_CATALOG . $file)) { - if (substr($file, strrpos($file, '.')) == $file_extension) { + if (pathinfo($file, PATHINFO_EXTENSION) == $file_extension) { $files_array[] = $file; } } From 2917f59a73d8e0e32a19504e2cc141363206f5c7 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 09:00:34 +0200 Subject: [PATCH 20/27] Use pathinfo instead of string operations to get file extension --- catalog/includes/classes/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/payment.php b/catalog/includes/classes/payment.php index 8cbe40cc8..b2d85a892 100644 --- a/catalog/includes/classes/payment.php +++ b/catalog/includes/classes/payment.php @@ -22,7 +22,7 @@ function payment($module = '') { $include_modules = array(); - if ( (tep_not_null($module)) && (in_array($module . '.' . substr($PHP_SELF, (strrpos($PHP_SELF, '.')+1)), $this->modules)) ) { + if ( (tep_not_null($module)) && (in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), $this->modules)) ) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); From f3834bbf9a5f541919e26a58b78f388a2db9917c Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 09:08:22 +0200 Subject: [PATCH 21/27] Use basename instead of substr strrpos --- catalog/includes/functions/general.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/functions/general.php b/catalog/includes/functions/general.php index 7a87c5167..3964ec064 100644 --- a/catalog/includes/functions/general.php +++ b/catalog/includes/functions/general.php @@ -1069,7 +1069,7 @@ function tep_count_modules($modules = '') { $modules_array = explode(';', $modules); for ($i=0, $n=sizeof($modules_array); $i<$n; $i++) { - $class = substr($modules_array[$i], 0, strrpos($modules_array[$i], '.')); + $class = basename($modules_array[$i], '.php'); if (isset($GLOBALS[$class]) && is_object($GLOBALS[$class])) { if ($GLOBALS[$class]->enabled) { From cd41fac4958a0183adb3ba2e1950dac32fb1f50d Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 13:59:09 +0200 Subject: [PATCH 22/27] fix name variable --- catalog/includes/modules/header_tags/ht_datepicker_jquery.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php index 09e5a9c22..b65e531a7 100644 --- a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php +++ b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php @@ -91,7 +91,7 @@ function ht_datepicker_jquery_show_pages($text) { function ht_datepicker_jquery_edit_pages($values, $key) { global $PHP_SELF; - $file_extension = pathinfo($path, PATHINFO_EXTENSION); + $file_extension = pathinfo($PHP_SELF, PATHINFO_EXTENSION); $files_array = array(); if ($dir = @dir(DIR_FS_CATALOG)) { while ($file = $dir->read()) { @@ -104,7 +104,7 @@ function ht_datepicker_jquery_edit_pages($values, $key) { sort($files_array); $dir->close(); } - +pa $values_array = explode(';', $values); $output = ''; From b381897af485d0b436973ac657a833a41d8a0549 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 14:24:14 +0200 Subject: [PATCH 23/27] Fix typo --- catalog/includes/classes/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/payment.php b/catalog/includes/classes/payment.php index b2d85a892..7e63e7faf 100644 --- a/catalog/includes/classes/payment.php +++ b/catalog/includes/classes/payment.php @@ -22,7 +22,7 @@ function payment($module = '') { $include_modules = array(); - if ( (tep_not_null($module)) && (in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), $this->modules)) ) { + if ( (tep_not_null($module)) && (in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), $this->modules)) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); From e63d080da7242d01aef4fccbf625520e74edc769 Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 14:40:29 +0200 Subject: [PATCH 24/27] fix typo --- catalog/includes/modules/header_tags/ht_datepicker_jquery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php index b65e531a7..3c86f8fda 100644 --- a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php +++ b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php @@ -104,7 +104,7 @@ function ht_datepicker_jquery_edit_pages($values, $key) { sort($files_array); $dir->close(); } -pa + $values_array = explode(';', $values); $output = ''; From de5d425ec2dd568f10799e15a6ee60167ebb2e0b Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 14:41:50 +0200 Subject: [PATCH 25/27] fix typo --- catalog/includes/classes/payment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/payment.php b/catalog/includes/classes/payment.php index 7e63e7faf..64d814059 100644 --- a/catalog/includes/classes/payment.php +++ b/catalog/includes/classes/payment.php @@ -22,7 +22,7 @@ function payment($module = '') { $include_modules = array(); - if ( (tep_not_null($module)) && (in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)), $this->modules)) { + if ( (tep_not_null($module)) && (in_array($module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION), $this->modules))) { $this->selected_module = $module; $include_modules[] = array('class' => $module, 'file' => $module . '.php'); From 7600efffb3ab00e4ec0cf5fd9035288b5209457e Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 17:47:27 +0200 Subject: [PATCH 26/27] Use pathinfo instead of strinfg operations to get file extension --- catalog/includes/classes/email.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/classes/email.php b/catalog/includes/classes/email.php index 99528f48b..118e86b9c 100644 --- a/catalog/includes/classes/email.php +++ b/catalog/includes/classes/email.php @@ -131,7 +131,7 @@ function find_html_images($images_dir) { for ($i=0; $iget_file($images_dir . $html_images[$i])) { - $content_type = $this->image_types[substr($html_images[$i], strrpos($html_images[$i], '.') + 1)]; + $content_type = $this->image_types[pathinfo($html_images[$i], PATHINFO_EXTENSION)]; $this->add_html_image($image, basename($html_images[$i]), $content_type); } } From 3278910133e2bb2c84f6a7046b149730a79cbd8b Mon Sep 17 00:00:00 2001 From: acidvertigo Date: Fri, 29 Aug 2014 17:49:00 +0200 Subject: [PATCH 27/27] Use pahtinfo instead of string functions to get the file extension --- catalog/includes/modules/boxes/bm_card_acceptance.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catalog/includes/modules/boxes/bm_card_acceptance.php b/catalog/includes/modules/boxes/bm_card_acceptance.php index f8cd854ce..4788234ea 100644 --- a/catalog/includes/modules/boxes/bm_card_acceptance.php +++ b/catalog/includes/modules/boxes/bm_card_acceptance.php @@ -95,7 +95,7 @@ function bm_card_acceptance_edit_logos($values, $key) { if ( $dir = @dir(DIR_FS_CATALOG . DIR_WS_IMAGES . 'card_acceptance') ) { while ( $file = $dir->read() ) { if ( !is_dir(DIR_FS_CATALOG . DIR_WS_IMAGES . 'card_acceptance/' . $file) ) { - if ( in_array(substr($file, strrpos($file, '.')+1), array('gif', 'jpg', 'png')) ) { + if ( in_array(pathinfo($file, PATHINFO_EXTENSION), array('gif', 'jpg', 'png')) ) { $files_array[] = $file; } }