Esempio n. 1
0
/**
 * SMS_getCreditPrice
 *
 * @return float
 */
function SMS_getCreditPrice()
{
    $f = SMS_callApi('check-credits-price');
    return (double) $f->price;
}
Esempio n. 2
0
/**
 * send a load of SMSes
 *
 * @return array result
 */
function Sms_adminSendBulk()
{
    $aid = (int) $_REQUEST['to'];
    $msg = $_REQUEST['msg'];
    if (!$msg || preg_replace('/a-zA-Z0-9 !_\\-.,:\'"/', '', $msg) != $msg) {
        Core_quit();
    }
    $tos = array();
    $to_names = array();
    $subs = dbOne('select subscribers from sms_addressbooks where id=' . $aid . ' limit 1', 'subscribers');
    $subs = dbAll('select name,phone from sms_subscribers where id in (' . preg_replace('/[^0-9,]/', '', $subs) . ')');
    foreach ($subs as $sub) {
        $tos[] = $sub['phone'];
        $to_names[] = preg_replace('/[^a-zA-Z0-9 \\-.\']/', '', $sub['name']);
    }
    $ret = SMS_callApi('send-bulk', '&to=' . join(',', $tos) . '&message=' . urlencode($msg) . '&names=' . join(',', $to_names));
    return $ret;
}