Skip to content

Commit

Permalink
Fix login check
Browse files Browse the repository at this point in the history
  • Loading branch information
AminulBD committed Oct 20, 2020
1 parent e677ed2 commit 2c331b3
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions modules/gateways/callback/bkashlegacy.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
<?php

use Carbon\Carbon;
use Symfony\Component\HttpFoundation\Request;
use WHMCS\ClientArea;
use WHMCS\Database\Capsule;

require_once __DIR__ . '/../../../init.php';
require_once __DIR__ . '/../../../includes/gatewayfunctions.php';
require_once __DIR__ . '/../../../includes/invoicefunctions.php';
Expand Down Expand Up @@ -139,7 +134,7 @@ private function setGateway()
*/
private function setRequest()
{
$this->request = Request::createFromGlobals();
$this->request = \Symfony\Component\HttpFoundation\Request::createFromGlobals();
}

/**
Expand All @@ -163,12 +158,12 @@ private function setInvoice()
private function setCurrency()
{
$this->gatewayCurrency = (int)$this->gatewayParams['convertto'];
$this->customerCurrency = Capsule::table('tblclients')
$this->customerCurrency = \WHMCS\Database\Capsule::table('tblclients')
->where('id', '=', $this->invoice['userid'])
->value('currency');

if (!empty($this->gatewayCurrency) && ($this->customerCurrency !== $this->gatewayCurrency)) {
$this->convoRate = Capsule::table('tblcurrencies')
$this->convoRate = \WHMCS\Database\Capsule::table('tblcurrencies')
->where('id', '=', $this->gatewayCurrency)
->value('rate');
} else {
Expand Down Expand Up @@ -247,7 +242,7 @@ private function addTransaction($trxId)
'invoiceid' => $this->invoice['invoiceid'],
'transid' => $trxId,
'gateway' => $this->gatewayModuleName,
'date' => Carbon::now()->toDateTimeString(),
'date' => \Carbon\Carbon::now()->toDateTimeString(),
'amount' => $this->due,
'fees' => $this->fee,
];
Expand Down Expand Up @@ -388,7 +383,7 @@ public function makeTransaction()
die("Direct access forbidden.");
}

if ((new ClientArea())->isLoggedIn()) {
if (!(new \WHMCS\ClientArea())->isLoggedIn()) {
die("You will need to login first.");
}

Expand Down

0 comments on commit 2c331b3

Please sign in to comment.