diff --git a/CHANGELOG.md b/CHANGELOG.md index 0130720..ef564df 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ # CHANGELOG +## 2024.3.12 + +- Check if Validity Period, so calculate price will not affected other validity +- Add firewall using .htaccess for apache only +- Multiple Payment Gateway by @Focuslinkstech +- Fix Logic Multiple Payment gateway +- Fix delete Attribute +- Allow Delete Payment Gateway +- Allow Delete Plugin + ## 2024.3.6 - change attributes view diff --git a/system/controllers/order.php b/system/controllers/order.php index c9de5a5..b45aa8c 100644 --- a/system/controllers/order.php +++ b/system/controllers/order.php @@ -272,20 +272,30 @@ switch ($action) { if (strpos($user['email'], '@') === false) { r2(U . 'accounts/profile', 'e', Lang::T("Please enter your email address")); } - $files = scandir($PAYMENTGATEWAY_PATH); - foreach ($files as $file) { - if (pathinfo($file, PATHINFO_EXTENSION) == 'php') { - $pgs[] = str_replace('.php', '', $file); + $pgs = array_values(explode(',', $config['payment_gateway'])); + if(count($pgs)==0){ + sendTelegram("Payment Gateway not set, please set it in Settings"); + _log(Lang::T("Payment Gateway not set, please set it in Settings")); + r2(U . "home", 'e', Lang::T("Failed to create Transaction..")); + } + if(count($pgs)>1){ + $ui->assign('pgs',$pgs ); + //$ui->assign('pgs', $pgs); + $ui->assign('route2', $routes[2]); + $ui->assign('route3', $routes[3]); + + //$ui->assign('plan', $plan); + $ui->display('user-selectGateway.tpl'); + break; + }else{ + if(empty($pgs[0])){ + sendTelegram("Payment Gateway not set, please set it in Settings"); + _log(Lang::T("Payment Gateway not set, please set it in Settings")); + r2(U . "home", 'e', Lang::T("Failed to create Transaction..")); + }else{ + $_POST['gateway'] = $pgs[0]; } } - $ui->assign('pgs', $pgs); - $ui->assign('route2', $routes[2]); - $ui->assign('route3', $routes[3]); - - //$ui->assign('plan', $plan); - $ui->display('user-selectGateway.tpl'); - break; - case 'buy': $gateway = _post('gateway'); if (empty($gateway) && !empty($_SESSION['gateway'])) { diff --git a/system/controllers/paymentgateway.php b/system/controllers/paymentgateway.php index 72ed9b4..7621b11 100644 --- a/system/controllers/paymentgateway.php +++ b/system/controllers/paymentgateway.php @@ -19,6 +19,24 @@ if ($action == 'delete') { r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway Deleted')); } +if (_post('save') == 'actives') { + $pgs = ''; + if(is_array($_POST['pgs'])){ + $pgs = implode(',', $_POST['pgs']); + } + $d = ORM::for_table('tbl_appconfig')->where('setting', 'payment_gateway')->find_one(); + if ($d) { + $d->value = $pgs; + $d->save(); + } else { + $d = ORM::for_table('tbl_appconfig')->create(); + $d->setting = 'payment_gateway'; + $d->value = $pgs; + $d->save(); + } + r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully')); +} + if (file_exists($PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php')) { include $PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php'; if ($_SERVER['REQUEST_METHOD'] === 'POST') { @@ -44,22 +62,9 @@ if (file_exists($PAYMENTGATEWAY_PATH . DIRECTORY_SEPARATOR . $action . '.php')) $pgs[] = str_replace('.php', '', $file); } } - if (isset($_POST['payment_gateway'])) { - $payment_gateway = _post('payment_gateway'); - $d = ORM::for_table('tbl_appconfig')->where('setting', 'payment_gateway')->find_one(); - if ($d) { - $d->value = $payment_gateway; - $d->save(); - } else { - $d = ORM::for_table('tbl_appconfig')->create(); - $d->setting = 'payment_gateway'; - $d->value = $payment_gateway; - $d->save(); - } - r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway saved successfully')); - } $ui->assign('_title', 'Payment Gateway Settings'); $ui->assign('pgs', $pgs); + $ui->assign('actives', explode(',', $config['payment_gateway'])); $ui->display('paymentgateway.tpl'); } } diff --git a/system/lan/english.json b/system/lan/english.json index dc2cfac..071f1b7 100644 --- a/system/lan/english.json +++ b/system/lan/english.json @@ -461,5 +461,12 @@ "Customer_Announcement": "Customer Announcement", "1_Period___1_Month__Expires_the_20th_of_each_month": "1 Period = 1 Month, Expires the 20th of each month", "Period": "Period", - "Add": "Add" + "Add": "Add", + "Select_Payment_Gateway": "Select Payment Gateway", + "Available_Payment_Gateway": "Available Payment Gateway", + "Pay_Now": "Pay Now", + "Please_select_Payment_Gateway": "Please select Payment Gateway", + "Payment_Gateway_Deleted": "Payment Gateway Deleted", + "Payment_Gateway_not_set__please_set_it_in_Settings": "Payment Gateway not set, please set it in Settings", + "Failed_to_create_Transaction__": "Failed to create Transaction.." } \ No newline at end of file diff --git a/ui/ui/paymentgateway.tpl b/ui/ui/paymentgateway.tpl index 0a583bd..5fdf115 100644 --- a/ui/ui/paymentgateway.tpl +++ b/ui/ui/paymentgateway.tpl @@ -1,22 +1,31 @@ {include file="sections/header.tpl"} -
-
-
-
{Lang::T('Payment Gateway')}
-
- - - {foreach $pgs as $pg} - - - - - {/foreach} - -
{ucwords($pg)}
+
+
+
+
+
{Lang::T('Payment Gateway')}
+
+ + + {foreach $pgs as $pg} + + + + + + {/foreach} + +
{ucwords($pg)}
+
+
+
{include file="sections/footer.tpl"} \ No newline at end of file diff --git a/ui/ui/user-selectGateway.tpl b/ui/ui/user-selectGateway.tpl index d74bd75..4a86462 100644 --- a/ui/ui/user-selectGateway.tpl +++ b/ui/ui/user-selectGateway.tpl @@ -11,8 +11,8 @@
diff --git a/version.json b/version.json index 7a93c66..13a15d0 100644 --- a/version.json +++ b/version.json @@ -1,3 +1,3 @@ { - "version": "2024.3.6" + "version": "2024.3.12" } \ No newline at end of file