Skip to content

Commit

Permalink
Fix htaccess check bug
Browse files Browse the repository at this point in the history
  • Loading branch information
wajihkm committed Nov 15, 2023
1 parent 463201d commit 34beef7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
15 changes: 9 additions & 6 deletions includes/paytabs_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ function woocommerce_paytabs_check_log_permission()
" Order Allow,Deny" . PHP_EOL .
" Deny from all" . PHP_EOL .
"</Files>";
$htaccess_file_content = file_get_contents(PAYTABS_HTACCESS_FILE);

// prevent debug file from opening inside the browser
if (!file_exists(PAYTABS_HTACCESS_FILE)) {
Expand Down Expand Up @@ -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);
}
}
}
}
4 changes: 2 additions & 2 deletions paytabs-woocommerce.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* Plugin URI: https://paytabs.com/
* Description: PayTabs is a <strong>3rd party payment gateway</strong>. 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
Expand All @@ -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__));
Expand Down

0 comments on commit 34beef7

Please sign in to comment.