Exemple #1
0
function sms_subscribe_hook_setsmsincomingaction($sms_datetime, $sms_sender, $subscribe_keyword, $subscribe_param = '', $sms_receiver = '')
{
    $ok = false;
    $db_query = "SELECT uid FROM " . _DB_PREF_ . "_featureSubscribe WHERE subscribe_keyword='{$subscribe_keyword}'";
    $db_result = dba_query($db_query);
    if ($db_row = dba_fetch_array($db_result)) {
        $c_uid = $db_row['uid'];
        if (sms_subscribe_handle($c_uid, $sms_datetime, $sms_sender, $subscribe_keyword, $subscribe_param)) {
            $ok = true;
        }
    }
    $ret['uid'] = $c_uid;
    $ret['status'] = $ok;
    return $ret;
}
Exemple #2
0
function sms_subscribe_hook_recvsms_process($sms_datetime, $sms_sender, $subscribe_keyword, $subscribe_param = '', $sms_receiver = '', $smsc = '', $raw_message = '')
{
    $ok = false;
    $db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe WHERE subscribe_keyword='{$subscribe_keyword}'";
    $db_result = dba_query($db_query);
    if ($db_row = dba_fetch_array($db_result)) {
        if ($db_row['uid'] && $db_row['subscribe_enable']) {
            _log('begin k:' . $subscribe_keyword . ' c:' . $subscribe_param, 2, 'sms_subscribe');
            if (sms_subscribe_handle($db_row, $sms_datetime, $sms_sender, $subscribe_keyword, $subscribe_param, $sms_receiver, $smsc, $raw_message)) {
                $ok = true;
            }
            $status = $ok ? 'handled' : 'unhandled';
            _log('end k:' . $subscribe_keyword . ' c:' . $subscribe_param . ' s:' . $status, 2, 'sms_subscribe');
        }
    }
    $ret['uid'] = $db_row['uid'];
    $ret['status'] = $ok;
    return $ret;
}