diff --git a/catalog/includes/classes/action_recorder.php b/catalog/includes/classes/action_recorder.php index 343900982..f664d4149 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 . '.' . 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 . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); + include(DIR_WS_MODULES . 'action_recorder/' . $module . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } else { return false; } diff --git a/catalog/includes/classes/email.php b/catalog/includes/classes/email.php index 33acf9354..ccf8ed9fd 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); } } 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++) { diff --git a/catalog/includes/classes/payment.php b/catalog/includes/classes/payment.php index 8cbe40cc8..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 . '.' . 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'); diff --git a/catalog/includes/classes/shipping.php b/catalog/includes/classes/shipping.php index 939d5bbe3..6c0423c96 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'], '_')) . '.' . pathinfo($PHP_SELF, PATHINFO_EXTENSION)); } 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++) { diff --git a/catalog/includes/functions/general.php b/catalog/includes/functions/general.php index f0fc26aa2..620975d55 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) { 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; } } diff --git a/catalog/includes/modules/header_tags/ht_datepicker_jquery.php b/catalog/includes/modules/header_tags/ht_datepicker_jquery.php index 6cceed344..3c86f8fda 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($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 (substr($file, strrpos($file, '.')) == $file_extension) { + if (pathinfo($file, PATHINFO_EXTENSION) == $file_extension) { $files_array[] = $file; } } diff --git a/catalog/includes/modules/header_tags/ht_robot_noindex.php b/catalog/includes/modules/header_tags/ht_robot_noindex.php index 79b2b1b82..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 = 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 (substr($file, strrpos($file, '.')) == $file_extension) { + if (pathinfo($PHP_SELF, PATHINFO_EXTENSION) == $file_extension) { $files_array[] = $file; } }