Payment Gateway Audit page

This commit is contained in:
Ibnu Maksum
2024-08-01 17:55:58 +07:00
parent efdb0fc6bc
commit b64e841bde
10 changed files with 242 additions and 34 deletions

View File

@ -12,14 +12,14 @@ class Admin
public static function getID()
{
global $db_pass, $config;
$enable_session_timeout = $config['enable_session_timeout'];
if ($enable_session_timeout) {
$timeout = 0;
if($config['session_timeout_duration']){
$timeout = intval($config['session_timeout_duration']);
}
$session_timeout_duration = $timeout * 60; // Convert minutes to seconds
}
$enable_session_timeout = $config['enable_session_timeout'];
if ($enable_session_timeout) {
$timeout = 0;
if ($config['session_timeout_duration']) {
$timeout = intval($config['session_timeout_duration']);
}
$session_timeout_duration = $timeout * 60; // Convert minutes to seconds
}
if (isset($_SESSION['aid']) && isset($_SESSION['aid_expiration']) && $_SESSION['aid_expiration'] > time()) {
return $_SESSION['aid'];

View File

@ -11,7 +11,7 @@ class Lang
public static function T($key)
{
global $_L, $lan_file, $config;
if(is_array($_SESSION['Lang'])){
if (is_array($_SESSION['Lang'])) {
$_L = array_merge($_L, $_SESSION['Lang']);
}
$key = preg_replace('/\s+/', ' ', $key);
@ -124,20 +124,20 @@ class Lang
}
}
$when = "";
if(time()>strtotime($datetime)){
if (time() > strtotime($datetime)) {
$when = Lang::T('ago');
}else{
} else {
$when = '';
}
if (!$full)
$string = array_slice($string, 0, 1);
if($string){
if(empty($when)){
return '<b>'. implode(', ', $string) .'</b>';
}else{
return implode(', ', $string) .' '. $when;
if ($string) {
if (empty($when)) {
return '<b>' . implode(', ', $string) . '</b>';
} else {
return implode(', ', $string) . ' ' . $when;
}
}else{
} else {
return Lang::T('just now');
}
}
@ -245,16 +245,30 @@ class Lang
return $txt;
}
public static function maskText($text){
public static function maskText($text)
{
$len = strlen($text);
if($len < 3){
if ($len < 3) {
return "***";
}else if($len<5){
return substr($text,0,1)."***".substr($text,-1,1);
}else if($len<8){
return substr($text,0,2)."***".substr($text,-2,2);
}else{
return substr($text,0,4)."******".substr($text,-3,3);
} else if ($len < 5) {
return substr($text, 0, 1) . "***" . substr($text, -1, 1);
} else if ($len < 8) {
return substr($text, 0, 2) . "***" . substr($text, -2, 2);
} else {
return substr($text, 0, 4) . "******" . substr($text, -3, 3);
}
}
// echo Json array to text
public static function jsonArray2text($array, $start = '', $result = '')
{
foreach ($array as $k => $v) {
if (is_array($v)) {
$result .= self::jsonArray2text($v, "$start$k.", '');
} else {
$result .= "$start$k = " . strval($v) . "\n";
}
}
return $result;
}
}

View File

@ -460,7 +460,6 @@ switch ($action) {
} else {
$d->price = ($plan['price'] + $add_cost + $tax);
}
//$d->price = ($plan['price'] + $add_cost);
$d->created_date = date('Y-m-d H:i:s');
$d->status = 1;
$d->save();

View File

@ -19,6 +19,36 @@ if ($action == 'delete') {
r2(U . 'paymentgateway', 's', Lang::T('Payment Gateway Deleted'));
}
if ($action == 'audit') {
$pg = alphanumeric($routes[2]);
$q = alphanumeric(_req('q'),'-._ ');
$query = ORM::for_table('tbl_payment_gateway')->order_by_desc("id");
$query->selects('id', 'username', 'gateway', 'gateway_trx_id', 'plan_id', 'plan_name', 'routers_id', 'routers', 'price', 'pg_url_payment', 'payment_method', 'payment_channel', 'expired_date', 'created_date', 'paid_date', 'trx_invoice', 'status');
$query->where('gateway', $pg);
if(!empty($q)) {
$query->whereRaw("(gateway_trx_id LIKE '%$q%' OR username LIKE '%$q%' OR routers LIKE '%$q%' OR plan_name LIKE '%$q%')");
$append_url = 'q='. urlencode($q);
}
$pgs = Paginator::findMany($query, ["search" => $search], 50, $append_url);
$ui->assign('_title', 'Payment Gateway Audit');
$ui->assign('pgs', $pgs);
$ui->assign('pg', $pg);
$ui->assign('q', $q);
$ui->display('paymentgateway-audit.tpl');
die();
}
if ($action == 'auditview') {
$pg = alphanumeric($routes[2]);
$d = ORM::for_table('tbl_payment_gateway')->find_one($pg);
$ui->assign('_title', 'Payment Gateway Audit View');
$ui->assign('pg', $d);
$ui->display('paymentgateway-audit-view.tpl');
die();
}
if (_post('save') == 'actives') {
$pgs = '';
if(is_array($_POST['pgs'])){

View File

@ -681,5 +681,10 @@
"Idle_Timeout__Logout_Admin_if_Idle_for_xx_minutes": "Idle Timeout, Logout Admin if Idle for xx minutes",
"Failed_to_create_transaction__please_tell_seller_": "Failed to create transaction, please tell seller.",
"paid_off": "paid off",
"Sync_account_if_you_failed_login_to_internet": "Sync account if you failed login to internet"
"Sync_account_if_you_failed_login_to_internet": "Sync account if you failed login to internet",
"Channel": "Channel",
"Payment_Link": "Payment Link",
"Created": "Created",
"2": "2",
"_": "-"
}

View File

@ -130,8 +130,8 @@
"ALTER TABLE `tbl_voucher` ADD `used_date` DATETIME NULL DEFAULT NULL AFTER `status`;",
"UPDATE `tbl_voucher` SET `used_date`=now() WHERE `status`=1;"
],
"2024.7.31" : [
"ALTER TABLE `tbl_payment_gateway` CHANGE `gateway_trx_id` `gateway_trx_id` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;",
"ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL;"
"2024.8.1" : [
"ALTER TABLE `tbl_payment_gateway` CHANGE `gateway_trx_id` `gateway_trx_id` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';",
"ALTER TABLE `tbl_payment_gateway` CHANGE `pg_url_payment` `pg_url_payment` VARCHAR(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '';"
]
}