当前位置: 首页>>代码示例>>PHP>>正文


PHP recvsms函数代码示例

本文整理汇总了PHP中recvsms函数的典型用法代码示例。如果您正苦于以下问题:PHP recvsms函数的具体用法?PHP recvsms怎么用?PHP recvsms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了recvsms函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: gnokii_hook_getsmsinbox

function gnokii_hook_getsmsinbox()
{
    global $plugin_config;
    $handle = @opendir($plugin_config['gnokii']['path']);
    while ($sms_in_file = @readdir($handle)) {
        if (preg_match("/^ERR.in/i", $sms_in_file) && !preg_match("/^[.]/i", $sms_in_file)) {
            $fn = $plugin_config['gnokii']['path'] . "/{$sms_in_file}";
            // logger_print("infile:".$fn, 2, "gnokii incoming");
            $tobe_deleted = $fn;
            $lines = @file($fn);
            $sms_datetime = trim($lines[0]);
            $sms_sender = trim($lines[1]);
            $message = "";
            for ($lc = 2; $lc < count($lines); $lc++) {
                $message .= trim($lines[$lc]);
            }
            @unlink($tobe_deleted);
            // continue process only when incoming sms file can be deleted
            if (!file_exists($tobe_deleted)) {
                // collected:
                // $sms_datetime, $sms_sender, $message, $sms_receiver
                $sms_sender = addslashes($sms_sender);
                $message = addslashes($message);
                recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, $smsc);
                logger_print("sender:" . $sms_sender . " receiver:" . $sms_receiver . " dt:" . $sms_datetime . " msg:" . $message, 3, "gnokii incoming");
            }
        }
    }
}
开发者ID:yrahman,项目名称:playSMS,代码行数:29,代码来源:fn.php

示例2: array

$ok = FALSE;
if ($sms_sync_enable && $c_uid && $r['secret'] == $sms_sync_secret && $message_id && $sms_sender && $message) {
    $db_table = _DB_PREF_ . '_featureSmssysnc';
    $conditions = array('uid' => $c_uid, 'message_id' => $message_id);
    if (dba_isavail($db_table, $conditions, 'AND')) {
        _log("saving uid:" . $c_uid . " dt:" . $sms_datetime . " ts:" . $r['sent_timestamp'] . " message_id:" . $message_id . " s:" . $sms_sender . " m:" . $message . " r:" . $sms_receiver, 3, "sms_sync sync");
        // if keyword does not exists (checkavailablekeyword == TRUE)
        // then prefix the message with an @username so that it will be routed to $c_uid's inbox
        $m = explode(' ', $message);
        $c_m = str_replace('#', '', $m[0]);
        if (checkavailablekeyword($c_m)) {
            _log("forwarded to inbox uid:" . $c_uid . " message_id:" . $message_id, 3, "sms_sync sync");
            $message = "@" . user_uid2username($c_uid) . " " . $message;
        }
        // route it
        if ($recvsms_id = recvsms($sms_datetime, $sms_sender, $message, $sms_receiver)) {
            $items = array('uid' => $c_uid, 'message_id' => $message_id, 'recvsms_id' => $recvsms_id);
            dba_add($db_table, $items);
            _log("saved uid:" . $c_uid . " message_id:" . $message_id . " recvsms_id:" . $recvsms_id, 3, "sms_sync sync");
            $ret = array('payload' => array('success' => "true", 'error' => NULL));
            $ok = TRUE;
        } else {
            $error_string = "fail to save uid:" . $c_uid . " message_id:" . $message_id;
            _log($error_string, 3, "sms_sync sync");
        }
    } else {
        $error_string = "duplicate message uid:" . $c_uid . " message_id:" . $message_id;
        _log($error_string, 3, "sms_sync sync");
    }
    if (!$ok) {
        $ret = array('payload' => array('success' => "false", 'error' => $error_string));
开发者ID:yrahman,项目名称:playSMS,代码行数:31,代码来源:sync.php

示例3: trim

$cb_status = $_REQUEST['status'];
$cb_apimsgid = $_REQUEST['batch_id'];
$cb_smsc = trim($_REQUEST['smsc']) ? trim($_REQUEST['smsc']) : 'bulksms';
if ($cb_completed_time && $cb_from && ${$cb_apimsgid}) {
    $cb_datetime = date($datetime_format, strtotime($cb_completed_time));
    $sms_datetime = trim($cb_datetime);
    $sms_sender = trim($cb_from);
    $sms_receiver = trim($cb_to);
    $message = trim(htmlspecialchars_decode(urldecode($cb_message)));
    $apimsgid = trim($cb_apimsgid);
    logger_print("sender:" . $sms_sender . " receiver:" . $sms_receiver . " dt:" . $sms_datetime . " batchid:" . $apimsgid . " message:[" . $message . "]", 3, "bulksms incoming");
    // collected:
    // $sms_datetime, $sms_sender, $message, $sms_receiver
    $sms_sender = addslashes($sms_sender);
    $message = addslashes($message);
    recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, $cb_smsc);
}
if ($cb_status && $cb_apimsgid) {
    $db_query = "\n\t\tSELECT " . _DB_PREF_ . "_tblSMSOutgoing.smslog_id AS smslog_id," . _DB_PREF_ . "_tblSMSOutgoing.uid AS uid\n\t\tFROM " . _DB_PREF_ . "_tblSMSOutgoing," . _DB_PREF_ . "_gatewayBulksms_apidata\n\t\tWHERE\n\t\t\t" . _DB_PREF_ . "_tblSMSOutgoing.smslog_id=" . _DB_PREF_ . "_gatewayBulksms_apidata.smslog_id AND\n\t\t\t" . _DB_PREF_ . "_gatewayBulksms_apidata.apimsgid='{$cb_apimsgid}'";
    $db_result = dba_query($db_query);
    $db_row = dba_fetch_array($db_result);
    $uid = $db_row['uid'];
    $smslog_id = $db_row['smslog_id'];
    if ($uid && $smslog_id) {
        $c_sms_status = 0;
        switch ($cb_status) {
            case "0":
                $c_sms_status = 0;
                break;
                // pending
            // pending
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:callback.php

示例4: auth_block

    auth_block();
}
switch (_OP_) {
    case "simulate":
        $sender = '629876543210';
        $receiver = '1234';
        $datetime = core_get_datetime();
        $content .= _dialog() . "\n\t\t\t<h2>" . _('Simulate incoming SMS') . "</h2>\n\t\t\t<form action=\"index.php?app=main&inc=gateway_dev&route=simulate&op=simulate_yes\" method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t\t<tbody>\n\t\t\t\t<tr><td class=label-sizer>" . _('Message') . "</td><td><input type=text name=message value=\"{$message}\" maxlength=250></td></tr>\n\t\t\t\t<tr><td>" . _('Sender') . "</td><td><input type=text name=sender value=\"{$sender}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Receiver') . "</td><td><input type=text name=receiver value=\"{$receiver}\" maxlength=20></td></tr>\n\t\t\t\t<tr><td>" . _('Date/Time') . "</td><td><input type=text name=datetime value=\"" . core_display_datetime($datetime) . "\" maxlength=20></td></tr>\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t<p><input type=submit class=button value=\"" . _('Submit') . "\">\n\t\t\t</form>";
        _p($content);
        break;
    case "simulate_yes":
        $sms_sender = $_REQUEST['sender'] ? $_REQUEST['sender'] : '629876543210';
        $sms_receiver = $_REQUEST['receiver'] ? $_REQUEST['receiver'] : '1234';
        $sms_datetime = $_REQUEST['datetime'] ? $_REQUEST['datetime'] : core_get_datetime();
        $message = $_REQUEST['message'] ? $_REQUEST['message'] : _('This is a test incoming SMS message');
        $message = htmlspecialchars_decode($message);
        if (trim($sms_sender) && trim($sms_receiver) && trim($sms_datetime) && trim($message)) {
            recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, 'dev');
            $err[] = "Sender ID: " . $sms_sender;
            $err[] = "Receiver number: " . $sms_receiver;
            $err[] = "Sent: " . $sms_datetime;
            $err[] = "Message: " . stripslashes($message);
            _log(print_r($err, TRUE), 3, "dev incoming");
            $_SESSION['dialog']['info'][] = $err;
        } else {
            $_SESSION['dialog']['info'][] = _('Fail to simulate incoming SMS');
        }
        header("Location: " . _u('index.php?app=main&inc=gateway_dev&route=simulate&op=simulate'));
        exit;
        break;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:simulate.php

示例5: gammu_hook_getsmsinbox

function gammu_hook_getsmsinbox()
{
    // filename
    // IN20101017_091747_00_+628123423141312345_00.txt
    global $plugin_config;
    $handle = @opendir($plugin_config['gammu']['path'] . "/inbox");
    $messages = array();
    $files = array();
    while ($sms_in_file = @readdir($handle)) {
        if ($sms_in_file != "." && $sms_in_file != "..") {
            $files[] = $sms_in_file;
        }
    }
    sort($files);
    foreach ($files as $sms_in_file) {
        $fn = $plugin_config['gammu']['path'] . "/inbox/{$sms_in_file}";
        $matches = array();
        preg_match('/IN(\\d{4})(\\d{2})(\\d{2})_(\\d{2})(\\d{2})(\\d{2})_(\\d+)_([+]*\\w+)_(\\d+)/', basename($fn), $matches);
        list($s, $year, $month, $date, $hour, $minute, $second, $serial, $sms_sender, $seq) = $matches;
        $sms_datetime = $year . "-" . $month . "-" . $date . " " . $hour . ":" . $minute . ":" . $second;
        // message is in UTF-16, need to convert it to UTF-8
        $message = file_get_contents($fn);
        // if the message is unicode then convert it to UTF-8
        if (core_detect_unicode($message)) {
            $message = mb_convert_encoding($message, "UTF-8", "UTF-16");
        }
        @unlink($fn);
        // continue process only when incoming sms file can be deleted
        if (!file_exists($fn)) {
            if ($sms_sender && $sms_datetime) {
                // adding message parts to existing array
                if (array_key_exists($sms_sender, $messages) && (int) $seq > 0) {
                    $messages[$sms_sender][] = array("fn" => $fn, "message" => $message, "msg_datetime" => $sms_datetime);
                } else {
                    if (!array_key_exists($sms_sender, $messages) || array_key_exists($sms_sender, $messages) && (int) $seq == 0) {
                        if (count($messages) > 0) {
                            // saving concatenated message parts
                            $parts_sender = 0;
                            foreach ($messages as $sender => $message_parts) {
                                $parts_message = "";
                                $parts_sender = $sender;
                                foreach ($message_parts as $part) {
                                    $parts_message .= $part['message'];
                                }
                            }
                            $parts_datetime = $messages[$parts_sender][0]['msg_datetime'];
                            recvsms($parts_datetime, $parts_sender, $parts_message, $sms_receiver, 'gammu');
                            logger_print("sender:" . $parts_sender . " receiver:" . $sms_receiver . " dt:" . $parts_datetime . " msg:" . $parts_message, 3, "gammu incoming");
                            unset($messages);
                        }
                        // new message parts array
                        $messages[$sms_sender] = array(array("fn" => $fn, "message" => $message, "msg_datetime" => $sms_datetime));
                    }
                }
            }
        }
    }
    if (count($messages) > 0) {
        // saving last concatenated message parts
        $parts_sender = 0;
        foreach ($messages as $sender => $message_parts) {
            $parts_message = "";
            $parts_sender = $sender;
            foreach ($message_parts as $part) {
                $parts_message .= $part['message'];
            }
        }
        $parts_datetime = $messages[$parts_sender][0]['msg_datetime'];
        recvsms($parts_datetime, $parts_sender, $parts_message, $sms_receiver, $smsc);
        logger_print("sender:" . $parts_sender . " receiver:" . $sms_receiver . " dt:" . $parts_datetime . " msg:" . $_parts_message, 3, "gammu incoming");
        unset($messages);
    }
    @closedir($handle);
}
开发者ID:yrahman,项目名称:playSMS,代码行数:74,代码来源:fn.php

示例6: logger_print

}
$remote_addr = $_SERVER['REMOTE_ADDR'];
// srosa 20100531: added var below
$remote_host = $_SERVER['HTTP_HOST'];
// srosa 20100531: changed test below to allow hostname in bearerbox_host instead of ip
// if ($remote_addr != $plugin_config['kannel']['bearerbox_host'])
if ($remote_addr != $plugin_config['kannel']['bearerbox_host'] && $remote_host != $plugin_config['kannel']['bearerbox_host']) {
    logger_print("exit remote_addr:" . $remote_addr . " remote_host:" . $remote_host . " bearerbox_host:" . $plugin_config['kannel']['bearerbox_host'], 2, "kannel incoming");
    exit;
}
// if the arrival time is in UTC then we need to adjust it with this:
if ($plugin_config['kannel']['local_time']) {
    $t = trim($_REQUEST['t']);
} else {
    // in UTC
    $t = core_display_datetime($_REQUEST['t']);
}
$q = trim($_REQUEST['q']);
// sms_sender
$a = trim($_REQUEST['a']);
// message
$Q = trim($_REQUEST['Q']);
// sms_receiver
$smsc = trim($_REQUEST['smsc']);
// SMSC
logger_print("addr:" . $remote_addr . " host:" . $remote_host . " t:" . $t . " q:" . $q . " a:" . $a . " Q:" . $Q . " smsc:[" . $smsc . "]", 3, "kannel incoming");
if ($t && $q && $a) {
    // collected:
    // $sms_datetime, $sms_sender, $message, $sms_receiver
    recvsms($t, $q, $a, $Q, $smsc);
}
开发者ID:yrahman,项目名称:playSMS,代码行数:31,代码来源:geturl.php

示例7: playnet_hook_webservices_output

function playnet_hook_webservices_output($operation, $requests, $returns)
{
    global $plugin_config;
    $go = $requests['go'];
    $smsc = $requests['smsc'];
    $username = $requests['u'];
    $password = $requests['p'];
    if (!($operation == 'playnet' && $go && $smsc && $username && $password)) {
        return FALSE;
    }
    $c_plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
    // auth remote
    if (!($c_plugin_config['playnet']['local_playnet_username'] && $c_plugin_config['playnet']['local_playnet_password'] && $c_plugin_config['playnet']['local_playnet_username'] == $username && $c_plugin_config['playnet']['local_playnet_password'] == $password)) {
        $content['status'] = 'ERROR';
        $content['error_string'] = 'Authentication failed';
        $returns['modified'] = TRUE;
        $returns['param']['content'] = json_encode($content);
        $returns['param']['content-type'] = 'text/json';
        return $returns;
    }
    switch ($go) {
        case 'get_outgoing':
            $conditions = array('flag' => 1, 'smsc' => $smsc);
            $extras = array('ORDER BY' => 'id', 'LIMIT' => $c_plugin_config['playnet']['poll_limit']);
            $list = dba_search(_DB_PREF_ . '_gatewayPlaynet_outgoing', '*', $conditions, '', $extras);
            foreach ($list as $data) {
                $rows[] = array('smsc' => $data['smsc'], 'smslog_id' => $data['smslog_id'], 'uid' => $data['uid'], 'sender_id' => $data['sender_id'], 'sms_to' => $data['sms_to'], 'message' => $data['message'], 'sms_type' => $data['sms_type'], 'unicode' => $data['unicode']);
                // update flag
                $items = array('flag' => 2);
                $condition = array('flag' => 1, 'id' => $data['id']);
                dba_update(_DB_PREF_ . '_gatewayPlaynet_outgoing', $items, $condition, 'AND');
                // update dlr
                $p_status = 1;
                dlr($data['smslog_id'], $data['uid'], $p_status);
            }
            if (count($rows)) {
                $content['status'] = 'OK';
                $content['data'] = $rows;
            } else {
                $content['status'] = 'ERROR';
                $content['error_string'] = 'No outgoing data';
            }
            break;
        case 'set_incoming':
            $payload = json_decode(stripslashes($requests['payload']), 1);
            if ($payload['message']) {
                $sms_sender = $payload['sms_sender'];
                $message = $payload['message'];
                $sms_receiver = $payload['sms_receiver'];
                if ($id = recvsms(core_get_datetime(), $sms_sender, $message, $sms_receiver, $smsc)) {
                    $content['status'] = 'OK';
                    $content['data'] = array('recvsms_id' => $id);
                } else {
                    $content['status'] = 'ERROR';
                    $content['error_string'] = 'Unable to save incoming data';
                }
            } else {
                $content['status'] = 'ERROR';
                $content['error_string'] = 'No incoming data';
            }
    }
    $returns['modified'] = TRUE;
    $returns['param']['content'] = json_encode($content);
    $returns['param']['content-type'] = 'text/json';
    if ($content['status'] == 'OK') {
        _log('accessed param_go:[' . $go . '] param_smsc:[' . $smsc . '] param_u:[' . $username . '] param_p:[' . $password . ']', 3, 'playnet_hook_webservices_output');
    }
    return $returns;
}
开发者ID:10corp,项目名称:playSMS,代码行数:69,代码来源:fn.php

示例8: webservices_inject

function webservices_inject($c_username, $from, $msg, $recvnum = '', $smsc = '')
{
    $ret = '';
    if ($from && $msg) {
        if ($c_username) {
            // inject message
            $sms_datetime = core_display_datetime(core_get_datetime());
            recvsms($sms_datetime, $from, $msg, $recvnum, $smsc);
            $json['status'] = 'OK';
            $json['error'] = '0';
        } else {
            $json['status'] = 'ERR';
            $json['error'] = '601';
        }
    } else {
        $json['status'] = 'ERR';
        $json['error'] = '602';
    }
    return $json;
}
开发者ID:10corp,项目名称:playSMS,代码行数:20,代码来源:fn_webservices.php

示例9: smstools_hook_getsmsinbox


//.........这里部分代码省略.........
        $smsc = '';
        $sms_receiver = '';
        $sms_sender = '';
        $sms_datetime = '';
        $found_sender = FALSE;
        $found_datetime = FALSE;
        $fn = $plugin_config['smstools']['default_queue'] . '/incoming/' . $sms_in_file;
        $fn_backup = $plugin_config['smstools']['backup'] . '/incoming/' . $sms_in_file;
        $lines = @file($fn);
        $start = 0;
        for ($c = 0; $c < count($lines); $c++) {
            $c_line = $lines[$c];
            if (preg_match('/^From: /', $c_line)) {
                $sms_sender = '+' . trim(str_replace('From: ', '', trim($c_line)));
                $found_sender = TRUE;
            } else {
                if (preg_match('/^Received: /', $c_line)) {
                    $sms_datetime = '20' . trim(str_replace('Received: ', '', trim($c_line)));
                    $found_datetime = TRUE;
                } else {
                    if (preg_match('/^Modem: /', $c_line)) {
                        if ($smsc = trim(str_replace('Modem: ', '', trim($c_line)))) {
                            $c_plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
                            $sms_receiver = $c_plugin_config['smstools']['sms_receiver'];
                        }
                    } else {
                        if ($c_line == "\n") {
                            $start = $c + 1;
                            break;
                        }
                    }
                }
            }
        }
        // proceed only when the file contains some hint that it is an incoming SMS
        if ($found_sender && $found_datetime && $start) {
            // inspired by keke's suggestion (smstools3 dev).
            // copy to backup folder instead of delete it directly from original spool dir.
            // playSMS does the backup since probably not many smstools3 users configure
            // an eventhandler to backup incoming sms
            if (!rename($fn, $plugin_config['smstools']['backup'] . '/incoming/' . $sms_in_file)) {
                if (file_exists($fn)) {
                    @unlink($fn);
                }
            }
            // continue process only when incoming sms file can be deleted
            if (!file_exists($fn) && $start) {
                if ($sms_sender && $sms_datetime) {
                    $message = '';
                    for ($lc = $start; $lc < count($lines); $lc++) {
                        $message .= trim($lines[$lc]) . "\n";
                    }
                    if (strlen($message) > 0) {
                        $message = substr($message, 0, -1);
                    }
                    $is_dlr = false;
                    $msg = explode("\n", $message);
                    if (trim($msg[0]) == 'SMS STATUS REPORT') {
                        $label = explode(':', $msg[1]);
                        if (trim($label[0]) == 'Message_id') {
                            $message_id = trim($label[1]);
                        }
                        unset($label);
                        $label = explode(':', $msg[3]);
                        if (trim($label[0]) == 'Status') {
                            $status_var = explode(',', trim($label[1]));
                            $status = (int) $status_var[0];
                        }
                        if ($message_id && $status_var[1]) {
                            _log('DLR received message_id:' . $message_id . ' status:' . $status . ' info1:[' . $status_var[1] . '] info2:[' . $status_var[2] . '] smsc:[' . $smsc . ']', 2, 'smstools_hook_getsmsinbox');
                            $db_query = "SELECT id,uid,smslog_id FROM " . _DB_PREF_ . "_gatewaySmstools_dlr WHERE message_id='" . $message_id . "' AND status='1' ORDER BY id DESC LIMIT 1";
                            $db_result = dba_query($db_query);
                            $db_row = dba_fetch_array($db_result);
                            $id = $db_row['id'];
                            $uid = $db_row['uid'];
                            $smslog_id = $db_row['smslog_id'];
                            if ($uid && $smslog_id && $status === 0) {
                                $db_query = "UPDATE " . _DB_PREF_ . "_gatewaySmstools_dlr SET status='2' WHERE id='" . $id . "'";
                                if ($db_result = dba_affected_rows($db_query)) {
                                    $p_status = 3;
                                    dlr($smslog_id, $uid, $p_status);
                                    _log('DLR smslog_id:' . $smslog_id . ' p_status:' . $p_status . ' smsc:[' . $smsc . ']', 2, 'smstools_hook_getsmsinbox');
                                }
                            }
                            $is_dlr = true;
                        }
                    }
                    // collected: $sms_datetime, $sms_sender, $message, $sms_receiver
                    // if not a DLR then route it to incoming handler
                    if (!$is_dlr) {
                        _log('sender:' . $sms_sender . ' receiver:' . $sms_receiver . ' dt:' . $sms_datetime . ' msg:[' . $message . '] smsc:[' . $smsc . ']', 3, 'smstools_hook_getsmsinbox');
                        $sms_sender = addslashes($sms_sender);
                        $message = addslashes($message);
                        recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, $smsc);
                    }
                }
            }
        }
    }
}
开发者ID:borkz,项目名称:playSMS,代码行数:101,代码来源:fn.php

示例10: smstools_hook_getsmsinbox

function smstools_hook_getsmsinbox()
{
    global $plugin_config;
    $handle = @opendir($plugin_config['smstools']['spool_dir'] . "/incoming");
    while ($sms_in_file = @readdir($handle)) {
        $fn = $plugin_config['smstools']['spool_dir'] . "/incoming/{$sms_in_file}";
        $fn_bak = $plugin_config['smstools']['spool_bak'] . "/incoming/{$sms_in_file}";
        $lines = @file($fn);
        $start = 0;
        for ($c = 0; $c < count($lines); $c++) {
            $c_line = $lines[$c];
            if (preg_match('/^From: /', $c_line)) {
                $sms_sender = '+' . trim(str_replace('From: ', '', trim($c_line)));
            } else {
                if (preg_match('/^Received: /', $c_line)) {
                    $sms_datetime = '20' . trim(str_replace('Received: ', '', trim($c_line)));
                } else {
                    if ($c_line == "\n") {
                        $start = $c + 1;
                        break;
                    }
                }
            }
        }
        // inspired by keke's suggestion (smstools3 dev).
        // copy to backup folder instead of delete it directly from original spool dir.
        // playSMS does the backup since probably not many smstools3 users configure
        // an eventhandler to backup incoming sms
        if (is_dir($plugin_config['smstools']['spool_bak'] . '/incoming') && $start) {
            logger_print("infile backup:" . $fn_bak, 2, "smstools incoming");
            @shell_exec('mv ' . $fn . ' ' . $plugin_config['smstools']['spool_bak'] . '/incoming/');
        } else {
            @unlink($fn);
        }
        // continue process only when incoming sms file can be deleted
        if (!file_exists($fn) && $start) {
            if ($sms_sender && $sms_datetime) {
                $message = "";
                for ($lc = $start; $lc < count($lines); $lc++) {
                    $message .= trim($lines[$lc]) . "\n";
                }
                if (strlen($message) > 0) {
                    $message = substr($message, 0, -1);
                }
                $is_dlr = false;
                $msg = explode("\n", $message);
                if (trim($msg[0]) == 'SMS STATUS REPORT') {
                    $label = explode(':', $msg[1]);
                    if (trim($label[0]) == 'Message_id') {
                        $message_id = trim($label[1]);
                    }
                    unset($label);
                    $label = explode(':', $msg[3]);
                    if (trim($label[0]) == 'Status') {
                        $status_var = explode(',', trim($label[1]));
                        $status = $status_var[0];
                    }
                    if ($message_id && $status_var[1]) {
                        logger_print("DLR received message_id:" . $message_id . " status:" . $status . " info1:" . $status_var[1] . " info2:" . $status_var[2], 2, "smstools incoming");
                        $db_query = "SELECT uid,smslog_id FROM " . _DB_PREF_ . "_gatewaySmstools_dlr WHERE message_id='{$message_id}'";
                        $db_result = dba_query($db_query);
                        $db_row = dba_fetch_array($db_result);
                        $uid = $db_row['uid'];
                        $smslog_id = $db_row['smslog_id'];
                        if ($uid && $smslog_id && $status == 0) {
                            $p_status = 3;
                            dlr($smslog_id, $uid, $p_status);
                            logger_print("DLR smslog_id:" . $smslog_id . " p_status:" . $p_status, 2, "smstools incoming");
                        }
                        $is_dlr = true;
                    }
                }
                // collected: $sms_datetime, $sms_sender, $message, $sms_receiver
                // if not a DLR then route it to incoming handler
                if (!$is_dlr) {
                    logger_print("sender:" . $sms_sender . " receiver:" . $sms_receiver . " dt:" . $sms_datetime . " msg:" . $message, 3, "smstools incoming");
                    $sms_sender = addslashes($sms_sender);
                    $message = addslashes($message);
                    recvsms($sms_datetime, $sms_sender, $message, $sms_receiver, $smsc);
                }
            }
        }
    }
}
开发者ID:RobinKarlsen,项目名称:playSMS,代码行数:84,代码来源:fn.php

示例11: dlr

            }
            # Change SMS status in database
            dlr($smslog_id, $uid, $p_status);
            ob_end_clean();
        }
    }
    exit;
}
if ($_POST['event'] == 'incoming_message') {
    $c_smsc = 'telerivet';
    $c_remote_id = $_POST['id'];
    $c_message_type = $_POST['message_type'];
    $c_content = htmlspecialchars_decode(urldecode($_POST['content']));
    $c_from_number = $_POST['from_number'];
    $c_to_number = $_POST['to_number'];
    $c_time_created = $_POST['time_created'];
    $c_time_sent = $_POST['time_sent'];
    $c_contact_id = $_POST['contact_id'];
    $c_phone_id = $_POST['phone_id'];
    $c_service_id = $_POST['service_id'];
    $c_project_id = $_POST['project_id'];
    # Convert timestamp to datetime
    $c_time = date('Y-m-d H:i:s', $c_time_sent);
    logger_print("incoming smsc:" . $c_smsc . " message_id:" . $c_remote_slid . " s:" . $c_from_number . " d:" . $c_to_number, 2, "telerivet callback");
    $c_from_number = addslashes($c_from_number);
    $c_content = addslashes($c_content);
    recvsms($c_time, $c_from_number, $c_content, $c_to_number, $c_smsc);
    # Clean buffers and exit
    ob_end_clean();
    exit;
}
开发者ID:10corp,项目名称:playSMS,代码行数:31,代码来源:callback.php


注:本文中的recvsms函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。