From 34beef741bc4d291e62b2f2b8ac5e1953acf2287 Mon Sep 17 00:00:00 2001 From: Wajih Date: Wed, 15 Nov 2023 12:00:40 +0000 Subject: [PATCH] Fix htaccess check bug --- includes/paytabs_functions.php | 15 +++++++++------ paytabs-woocommerce.php | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/includes/paytabs_functions.php b/includes/paytabs_functions.php index 086ed40..3f1466e 100644 --- a/includes/paytabs_functions.php +++ b/includes/paytabs_functions.php @@ -42,7 +42,6 @@ function woocommerce_paytabs_check_log_permission() " Order Allow,Deny" . PHP_EOL . " Deny from all" . PHP_EOL . ""; - $htaccess_file_content = file_get_contents(PAYTABS_HTACCESS_FILE); // prevent debug file from opening inside the browser if (!file_exists(PAYTABS_HTACCESS_FILE)) { @@ -75,13 +74,17 @@ function woocommerce_paytabs_check_log_permission() } elseif ($error_num) { $output_err = curl_error($ch); PaytabsHelper::log("Checking .htaccess error: [{$output_err}].", 2); - } elseif (strpos($htaccess_file_content, PAYTABS_DEBUG_FILE_NAME) !== false) { - PaytabsHelper::log("Allow 'override all' into your webserver to enable the proper functioning of the .htaccess file.", 2); } else { - $htaccessFile = PAYTABS_HTACCESS_FILE; - file_put_contents($htaccessFile, $permission, FILE_APPEND); + $htaccess_file_content = file_get_contents(PAYTABS_HTACCESS_FILE); - PaytabsHelper::log("Debug file appended to htaccess.", 1); + if (strpos($htaccess_file_content, PAYTABS_DEBUG_FILE_NAME) !== false) { + PaytabsHelper::log("Allow 'override all' into your webserver to enable the proper functioning of the .htaccess file.", 2); + } else { + $htaccessFile = PAYTABS_HTACCESS_FILE; + file_put_contents($htaccessFile, $permission, FILE_APPEND); + + PaytabsHelper::log("Debug file appended to htaccess.", 1); + } } } } diff --git a/paytabs-woocommerce.php b/paytabs-woocommerce.php index 44d798e..bc7ebec 100644 --- a/paytabs-woocommerce.php +++ b/paytabs-woocommerce.php @@ -9,7 +9,7 @@ * Plugin URI: https://paytabs.com/ * Description: PayTabs is a 3rd party payment gateway. Ideal payment solutions for your internet business. - * Version: 4.18.1 + * Version: 4.18.2 * Requires PHP: 7.0 * Author: PayTabs * Author URI: integration@paytabs.com @@ -20,7 +20,7 @@ } -define('PAYTABS_PAYPAGE_VERSION', '4.18.1'); +define('PAYTABS_PAYPAGE_VERSION', '4.18.2'); define('PAYTABS_PAYPAGE_DIR', plugin_dir_path(__FILE__)); define('PAYTABS_PAYPAGE_ICONS_URL', plugins_url("icons/", __FILE__)); define('PAYTABS_PAYPAGE_IMAGES_URL', plugins_url("images/", __FILE__));