Skip to content

Commit

Permalink
dont send if message empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ibnux committed Apr 15, 2024
1 parent 8f07c76 commit a164b34
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions system/autoload/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public static function sendTelegram($txt)
public static function sendSMS($phone, $txt)
{
global $config;
if(empty($txt)){
return "";
}
run_hook('send_sms'); #HOOK
if (!empty($config['sms_url'])) {
if (strlen($config['sms_url']) > 4 && substr($config['sms_url'], 0, 4) != "http") {
Expand Down Expand Up @@ -64,6 +67,9 @@ public static function sendSMS($phone, $txt)
public static function sendWhatsapp($phone, $txt)
{
global $config;
if(empty($txt)){
return "";
}
run_hook('send_whatsapp'); #HOOK
if (!empty($config['wa_url'])) {
$waurl = str_replace('[number]', urlencode(Lang::phoneFormat($phone)), $config['wa_url']);
Expand All @@ -75,6 +81,9 @@ public static function sendWhatsapp($phone, $txt)
public static function sendEmail($to, $subject, $body)
{
global $config;
if(empty($body)){
return "";
}
run_hook('send_email'); #HOOK
if (empty($config['smtp_host'])) {
$attr = "";
Expand Down Expand Up @@ -113,6 +122,9 @@ public static function sendEmail($to, $subject, $body)
public static function sendPackageNotification($customer, $package, $price, $message, $via)
{
global $u;
if(empty($message)){
return "";
}
$msg = str_replace('[[name]]', $customer['fullname'], $message);
$msg = str_replace('[[username]]', $customer['username'], $msg);
$msg = str_replace('[[plan]]', $package, $msg);
Expand Down

0 comments on commit a164b34

Please sign in to comment.