From de3312055a918ce9507c20bf048317e8663a1119 Mon Sep 17 00:00:00 2001 From: Ibnu Maksum Date: Fri, 1 Mar 2024 09:57:59 +0700 Subject: [PATCH] add hook when recharge --- init.php | 4 +++- system/autoload/Package.php | 5 ++++- ui/ui/alert.tpl | 6 +++--- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/init.php b/init.php index 76ba7d7..2779888 100644 --- a/init.php +++ b/init.php @@ -238,7 +238,7 @@ function r2($to, $ntype = 'e', $msg = '') exit; } -function _alert($text, $type = 'success', $url = "home") +function _alert($text, $type = 'success', $url = "home", $time = 3) { global $ui; if (!isset($ui)) return; @@ -251,8 +251,10 @@ function _alert($text, $type = 'success', $url = "home") } $ui->assign('text', $text); $ui->assign('type', $type); + $ui->assign('time', $time); $ui->assign('url', $url); $ui->display('alert.tpl'); + die(); } diff --git a/system/autoload/Package.php b/system/autoload/Package.php index c0eb1f5..94e5aa6 100644 --- a/system/autoload/Package.php +++ b/system/autoload/Package.php @@ -94,6 +94,9 @@ class Package ->where('Type', $p['type']) ->find_one(); + run_hook("recharge_user"); + + $mikrotik = Mikrotik::info($router_name); if ($p['validity_unit'] == 'Months') { $date_exp = date("Y-m-d", strtotime('+' . $p['validity'] . ' month')); @@ -357,8 +360,8 @@ class Package "\nChannel: " . $channel . "\nPrice: " . Lang::moneyFormat($p['price'])); } - Message::sendInvoice($c, $t); + run_hook("recharge_user_finish"); return true; } diff --git a/ui/ui/alert.tpl b/ui/ui/alert.tpl index b44f4af..d322108 100644 --- a/ui/ui/alert.tpl +++ b/ui/ui/alert.tpl @@ -9,7 +9,7 @@ - + @@ -20,7 +20,7 @@ {$text}