Add test SMS, WA and Telegram
This commit is contained in:
parent
72fbc27f97
commit
7e7b70ba75
@ -14,7 +14,7 @@ class Message
|
||||
global $config;
|
||||
run_hook('send_telegram'); #HOOK
|
||||
if (!empty($config['telegram_bot']) && !empty($config['telegram_target_id'])) {
|
||||
Http::getData('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
|
||||
return Http::getData('https://api.telegram.org/bot' . $config['telegram_bot'] . '/sendMessage?chat_id=' . $config['telegram_target_id'] . '&text=' . urlencode($txt));
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,17 +27,17 @@ class Message
|
||||
if (strlen($config['sms_url']) > 4 && substr($config['sms_url'], 0, 4) != "http") {
|
||||
if (strlen($txt) > 160) {
|
||||
$txts = str_split($txt, 160);
|
||||
foreach ($txts as $txt) {
|
||||
try {
|
||||
$mikrotik = Mikrotik::info($config['sms_url']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
try {
|
||||
$mikrotik = Mikrotik::info($config['sms_url']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
foreach ($txts as $txt) {
|
||||
Mikrotik::sendSMS($client, $phone, $txt);
|
||||
} catch (Exception $e) {
|
||||
// ignore, add to logs
|
||||
_log("Failed to send SMS using Mikrotik.\n" . $e->getMessage(), 'SMS', 0);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
// ignore, add to logs
|
||||
_log("Failed to send SMS using Mikrotik.\n" . $e->getMessage(), 'SMS', 0);
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
try {
|
||||
$mikrotik = Mikrotik::info($config['sms_url']);
|
||||
$client = Mikrotik::getClient($mikrotik['ip_address'], $mikrotik['username'], $mikrotik['password']);
|
||||
@ -50,7 +50,7 @@ class Message
|
||||
} else {
|
||||
$smsurl = str_replace('[number]', urlencode($phone), $config['sms_url']);
|
||||
$smsurl = str_replace('[text]', urlencode($txt), $smsurl);
|
||||
Http::getData($smsurl);
|
||||
return Http::getData($smsurl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,20 @@ switch ($action) {
|
||||
if ($admin['user_type'] != 'Admin') {
|
||||
r2(U . "dashboard", 'e', $_L['Do_Not_Access']);
|
||||
}
|
||||
|
||||
if (!empty(_get('testWa'))) {
|
||||
$result = Message::sendWhatsapp(_get('testWa'), 'PHPNuxBill Test Whatsapp');
|
||||
r2(U . "settings/app", 's', 'Test Whatsapp has been send<br>Result: ' . $result);
|
||||
}
|
||||
if (!empty(_get('testSms'))) {
|
||||
$result = Message::sendSMS(_get('testSms'), 'PHPNuxBill Test SMS');
|
||||
r2(U . "settings/app", 's', 'Test SMS has been send<br>Result: ' . $result);
|
||||
}
|
||||
if (!empty(_get('testTg'))) {
|
||||
$result = Message::sendTelegram('PHPNuxBill Test Telegram');
|
||||
r2(U . "settings/app", 's', 'Test Telegram has been send<br>Result: ' . $result);
|
||||
}
|
||||
|
||||
if (file_exists('system/uploads/logo.png')) {
|
||||
$logo = 'system/uploads/logo.png?' . time();
|
||||
} else {
|
||||
@ -272,7 +286,7 @@ switch ($action) {
|
||||
}
|
||||
}
|
||||
// save all settings
|
||||
foreach($_POST as $key => $value) {
|
||||
foreach ($_POST as $key => $value) {
|
||||
$d = ORM::for_table('tbl_appconfig')->where('setting', $key)->find_one();
|
||||
if ($d) {
|
||||
$d->value = $value;
|
||||
|
@ -54,10 +54,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-md-2 control-label"><i class="glyphicon glyphicon-print"></i> Print Max Char</label>
|
||||
<label class="col-md-2 control-label"><i class="glyphicon glyphicon-print"></i> Print Max
|
||||
Char</label>
|
||||
<div class="col-md-6">
|
||||
<input type="number" required class="form-control" id="printer_cols" placeholder="37" name="printer_cols"
|
||||
value="{$_c['printer_cols']}">
|
||||
<input type="number" required class="form-control" id="printer_cols" placeholder="37"
|
||||
name="printer_cols" value="{$_c['printer_cols']}">
|
||||
</div>
|
||||
<span class="help-block col-md-4">For invoice print using Thermal Printer</span>
|
||||
</div>
|
||||
@ -218,6 +219,7 @@
|
||||
</div>
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-success btn-xs" style="color: black;" href="javascript:testTg()">Test TG</a>
|
||||
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
|
||||
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
@ -244,6 +246,7 @@
|
||||
</div>
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-success btn-xs" style="color: black;" href="javascript:testSms()">Test SMS</a>
|
||||
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
|
||||
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
@ -281,6 +284,7 @@
|
||||
</div>
|
||||
<div class="panel-heading">
|
||||
<div class="btn-group pull-right">
|
||||
<a class="btn btn-success btn-xs" style="color: black;" href="javascript:testWa()">Test WA</a>
|
||||
<button class="btn btn-primary btn-xs" title="save" type="submit"><span
|
||||
class="glyphicon glyphicon-floppy-disk" aria-hidden="true"></span></button>
|
||||
</div>
|
||||
@ -427,14 +431,17 @@
|
||||
<input type="password" class="form-control" id="envato_token" name="envato_token"
|
||||
value="{$_c['envato_token']}" placeholder="BldWuBsxxxxxxxxxxxPDzPozHAPui">
|
||||
</div>
|
||||
<span class="help-block col-md-4"><a href="https://build.envato.com/create-token/" target="_blank">Create Token</a></span>
|
||||
<span class="help-block col-md-4"><a href="https://build.envato.com/create-token/"
|
||||
target="_blank">Create Token</a></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-offset-2 col-md-8" style="text-align: left;">Envato Permission<br>
|
||||
- View and search Envato sites<br>
|
||||
- Download the user's purchased items<br>
|
||||
- List purchases the user has made<br><br>
|
||||
<a href="https://codecanyon.net/category/php-scripts?term=phpnuxbill" target="_blank" class="btn btn-xs btn-primary">View MarketPlace</a>
|
||||
<label class="control-label col-md-offset-2 col-md-8" style="text-align: left;">Envato
|
||||
Permission<br>
|
||||
- View and search Envato sites<br>
|
||||
- Download the user's purchased items<br>
|
||||
- List purchases the user has made<br><br>
|
||||
<a href="https://codecanyon.net/category/php-scripts?term=phpnuxbill" target="_blank"
|
||||
class="btn btn-xs btn-primary">View MarketPlace</a>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
@ -465,4 +472,23 @@ add dst-host=*.{$_domain}</pre>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function testWa() {
|
||||
var target = prompt("Phone number\nSave First before Test", "");
|
||||
if (target != null) {
|
||||
window.location.href = '{$_url}settings/app&testWa='+target;
|
||||
}
|
||||
}
|
||||
|
||||
function testSms() {
|
||||
var target = prompt("Phone number\nSave First before Test", "");
|
||||
if (target != null) {
|
||||
window.location.href = '{$_url}settings/app&testSms='+target;
|
||||
}
|
||||
}
|
||||
|
||||
function testTg() {
|
||||
window.location.href = '{$_url}settings/app&testTg=test';
|
||||
}
|
||||
</script>
|
||||
{include file="sections/footer.tpl"}
|
@ -104,7 +104,12 @@
|
||||
</table>
|
||||
</div>
|
||||
<div class="box-footer">
|
||||
<a href="https://paypal.me/ibnux" target="_blank" class="btn btn-primary btn-sm btn-block">Paypal</a>
|
||||
<div class="btn-group btn-group-justified" role="group" aria-label="...">
|
||||
<a href="https://paypal.me/ibnux" target="_blank"
|
||||
class="btn btn-primary btn-sm btn-block">Paypal</a>
|
||||
<a href="https://wise.com/pay/me/ibnum37" target="_blank"
|
||||
class="btn btn-primary btn-sm btn-block">Wise</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user