[[Company_Name]] |
+
+ + [[Body]] + |
+
diff --git a/pages_template/Email.html b/pages_template/Email.html new file mode 100644 index 00000000..8979a620 --- /dev/null +++ b/pages_template/Email.html @@ -0,0 +1,159 @@ + + + +
+ + ++ | +
+
+
+
+
+
|
+ + | +
} } public static function sendPackageNotification($customer, $package, $price, $message, $via) { - global $ds; - if(empty($message)){ + global $ds, $config; + if (empty($message)) { return ""; } $msg = str_replace('[[name]]', $customer['fullname'], $message); @@ -146,19 +171,19 @@ class Message $msg = str_replace('[[package]]', $package, $msg); $msg = str_replace('[[price]]', Lang::moneyFormat($price), $msg); list($bills, $add_cost) = User::getBills($customer['id']); - if($add_cost>0){ + if ($add_cost > 0) { $note = ""; foreach ($bills as $k => $v) { $note .= $k . " : " . Lang::moneyFormat($v) . "\n"; } - $note .= "Total : " . Lang::moneyFormat($add_cost+$price) . "\n"; + $note .= "Total : " . Lang::moneyFormat($add_cost + $price) . "\n"; $msg = str_replace('[[bills]]', $note, $msg); - }else{ + } else { $msg = str_replace('[[bills]]', '', $msg); } if ($ds) { $msg = str_replace('[[expired_date]]', Lang::dateAndTimeFormat($ds['expiration'], $ds['time']), $msg); - }else{ + } else { $msg = str_replace('[[expired_date]]', "", $msg); } if ( @@ -167,6 +192,8 @@ class Message ) { if ($via == 'sms') { echo Message::sendSMS($customer['phonenumber'], $msg); + } else if ($via == 'email') { + self::sendEmail($customer['email'], '[' . $config['CompanyName'] . '] ' . Lang::T("Internet Plan Reminder"), $msg); } else if ($via == 'wa') { echo Message::sendWhatsapp($customer['phonenumber'], $msg); } @@ -174,17 +201,21 @@ class Message return "$via: $msg"; } - public static function sendBalanceNotification($phone, $name, $balance, $balance_now, $message, $via) + public static function sendBalanceNotification($cust, $balance, $balance_now, $message, $via) { - $msg = str_replace('[[name]]', $name, $message); + global $config; + $msg = str_replace('[[name]]', $cust['fullname'] . ' (' . $cust['username'] . ')', $message); $msg = str_replace('[[current_balance]]', Lang::moneyFormat($balance_now), $msg); $msg = str_replace('[[balance]]', Lang::moneyFormat($balance), $msg); + $phone = $cust['phonenumber']; if ( !empty($phone) && strlen($phone) > 5 - && !empty($message) && in_array($via, ['sms', 'wa']) + && !empty($message) && in_array($via, ['sms', 'wa', 'email']) ) { if ($via == 'sms') { Message::sendSMS($phone, $msg); + } else if ($config['user_notification_payment'] == 'email') { + self::sendEmail($cust['email'], '[' . $config['CompanyName'] . '] ' . Lang::T("Balance Notification"), $msg); } else if ($via == 'wa') { Message::sendWhatsapp($phone, $msg); } @@ -221,6 +252,8 @@ class Message if ($config['user_notification_payment'] == 'sms') { Message::sendSMS($cust['phonenumber'], $textInvoice); + } else if ($config['user_notification_payment'] == 'email') { + self::sendEmail($cust['email'], '[' . $config['CompanyName'] . '] ' . Lang::T("Invoice") . ' #' . $trx['invoice'], $textInvoice); } else if ($config['user_notification_payment'] == 'wa') { Message::sendWhatsapp($cust['phonenumber'], $textInvoice); } diff --git a/system/controllers/home.php b/system/controllers/home.php index 87641d26..7971f43a 100644 --- a/system/controllers/home.php +++ b/system/controllers/home.php @@ -71,8 +71,8 @@ if (_post('send') == 'balance') { $d->pg_url_payment = 'balance'; $d->status = 2; $d->save(); - Message::sendBalanceNotification($user['phonenumber'], $target['fullname'] . ' (' . $target['username'] . ')', $balance, ($user['balance'] - $balance), Lang::getNotifText('balance_send'), $config['user_notification_payment']); - Message::sendBalanceNotification($target['phonenumber'], $user['fullname'] . ' (' . $user['username'] . ')', $balance, ($target['balance'] + $balance), Lang::getNotifText('balance_received'), $config['user_notification_payment']); + Message::sendBalanceNotification($user, $balance, ($user['balance'] - $balance), Lang::getNotifText('balance_send'), $config['user_notification_payment']); + Message::sendBalanceNotification($target, $balance, ($target['balance'] + $balance), Lang::getNotifText('balance_received'), $config['user_notification_payment']); Message::sendTelegram("#u$user[username] send balance to #u$target[username] \n" . Lang::moneyFormat($balance)); r2(U . 'home', 's', Lang::T('Sending balance success')); } @@ -245,16 +245,16 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI $ui->assign('logged', $_GET['logged']); if ($_app_stage != 'demo') { if ($_GET['mikrotik'] == 'login') { - r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully')); - } + r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully')); + } $getmsg = $_GET['msg']; ///get auth notification from mikrotik if($getmsg == 'Connected') { $msg .= Lang::T($getmsg); - r2(U . 'home&logged=1', 's', $msg); + r2(U . 'home&logged=1', 's', $msg); } else if($getmsg){ $msg .= Lang::T($getmsg); - r2(U . 'home', 's', $msg); + r2(U . 'home', 's', $msg); } } } @@ -272,16 +272,16 @@ if (!empty($_SESSION['nux-mac']) && !empty($_SESSION['nux-ip'] && !empty($_SESSI $ui->assign('logged', $_GET['logged']); if ($_app_stage != 'demo') { if ($_GET['mikrotik'] == 'login') { - r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully')); - } + r2(U . 'home&hchap=true', 's', Lang::T('Login Request successfully')); + } $getmsg = $_GET['msg']; ///get auth notification from mikrotik if($getmsg == 'Connected') { $msg .= Lang::T($getmsg); - r2(U . 'home&logged=1', 's', $msg); + r2(U . 'home&logged=1', 's', $msg); } else if($getmsg){ $msg .= Lang::T($getmsg); - r2(U . 'home', 's', $msg); + r2(U . 'home', 's', $msg); } } } diff --git a/ui/ui/app-settings.tpl b/ui/ui/app-settings.tpl index 11486ca7..09307959 100644 --- a/ui/ui/app-settings.tpl +++ b/ui/ui/app-settings.tpl @@ -476,6 +476,8 @@ {/if}>Whatsapp +
{Lang::T('User will get notification when package expired')}
@@ -490,6 +492,8 @@ {/if}>Whatsapp +@@ -505,6 +509,8 @@ {/if}>Whatsapp + @@ -622,21 +628,23 @@ {Lang::T('If user buy same internet plan, expiry date will extend')}
+ {Lang::T('Hotspot Authentication Method. Make sure you have changed your hotspot login page.')}
Download
+ phpnuxbill-login-hotspot
+