本文整理汇总了PHP中gateway_apply_smsc_config函数的典型用法代码示例。如果您正苦于以下问题:PHP gateway_apply_smsc_config函数的具体用法?PHP gateway_apply_smsc_config怎么用?PHP gateway_apply_smsc_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了gateway_apply_smsc_config函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: openvox_hook_sendsms
function openvox_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "openvox_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($plugin_config['openvox']['gateway_host'] && $plugin_config['openvox']['gateway_port'] && $sms_to && $sms_msg) {
$query_string = "username=" . $plugin_config['openvox']['username'] . "&password=" . $plugin_config['openvox']['password'] . "&phonenumber=" . urlencode($sms_to) . "&message=" . urlencode($sms_msg) . "&report=JSON&smslog_id=" . $smslog_id;
$url = 'http://' . $plugin_config['openvox']['gateway_host'] . ":" . $plugin_config['openvox']['gateway_port'] . '/sendsms?' . $query_string;
_log("url:[" . $url . "]", 3, "openvox outgoing");
$resp = json_decode(file_get_contents($url), true);
$data = $resp['report'][0][0][0];
$data['message'] = $resp['message'];
_log('response result:' . $data['result'] . ' port:' . $data['port'] . ' to:' . $data['phonenumber'] . ' time:' . $data['time'], 3, 'openvox_hook_sendsms');
if ($data['result'] == 'success') {
$p_status = 1;
dlr($smslog_id, $uid, $p_status);
} else {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
}
return TRUE;
}
开发者ID:10corp,项目名称:playSMS,代码行数:29,代码来源:fn.php
示例2: nexmo_hook_sendsms
function nexmo_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "nexmo_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['nexmo']['module_sender']) {
$sms_sender = $plugin_config['nexmo']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$ok = false;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($sms_sender && $sms_to && $sms_msg) {
$unicode = "";
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
// $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2", "auto");
$unicode = "&type=unicode";
// added at the of query string if unicode
}
}
$query_string = "api_key=" . $plugin_config['nexmo']['api_key'] . "&api_secret=" . $plugin_config['nexmo']['api_secret'] . "&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_sender) . "&text=" . urlencode($sms_msg) . $unicode . "&status-report-req=1&client-ref=" . $smslog_id;
$url = $plugin_config['nexmo']['url'] . "?" . $query_string;
_log("url:[" . $url . "]", 3, "nexmo outgoing");
// fixme anton
// rate limit to 1 second per submit - nexmo rule
sleep(1);
$resp = json_decode(file_get_contents($url), true);
if ($resp['message-count']) {
$c_status = $resp['messages'][0]['status'];
$c_message_id = $resp['messages'][0]['message-id'];
$c_network = $resp['messages'][0]['network'];
$c_error_text = $resp['messages'][0]['error-text'];
_log("sent smslog_id:" . $smslog_id . " message_id:" . $c_message_id . " status:" . $c_status . " error:" . $c_error_text, 2, "nexmo outgoing");
$db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayNexmo (local_smslog_id,remote_smslog_id,status,network,error_text)\n\t\t\t\tVALUES ('{$smslog_id}','{$c_message_id}','{$c_status}','{$c_network}','{$c_error_text}')";
$id = @dba_insert_id($db_query);
if ($id && $c_status == 0) {
$ok = true;
$p_status = 1;
dlr($smslog_id, $uid, $p_status);
}
} else {
// even when the response is not what we expected we still print it out for debug purposes
$resp = str_replace("\n", " ", $resp);
$resp = str_replace("\r", " ", $resp);
_log("failed smslog_id:" . $smslog_id . " resp:" . $resp, 2, "nexmo outgoing");
}
}
if (!$ok) {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
return $ok;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:59,代码来源:fn.php
示例3: blocked_hook_sendsms
function blocked_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "blocked_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
return TRUE;
}
开发者ID:10corp,项目名称:playSMS,代码行数:10,代码来源:fn.php
示例4: uplink_hook_sendsms
function uplink_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
// global $plugin_config; // global all variables needed, eg: varibles from config.php
// ...
// ...
// return true or false
// return $ok;
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "uplink_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['uplink']['module_sender']) {
$sms_sender = $plugin_config['uplink']['module_sender'];
}
$sms_footer = $sms_footer ? $sms_footer : stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg) . $sms_footer;
$ok = false;
if ($sms_to && $sms_msg) {
$unicode = trim($unicode) ? 1 : 0;
$nofooter = $plugin_config['uplink']['try_disable_footer'] ? 1 : 0;
$ws = new Playsms\Webservices();
$ws->url = $plugin_config['uplink']['master'] . '/index.php?app=ws';
$ws->username = $plugin_config['uplink']['username'];
$ws->token = $plugin_config['uplink']['token'];
$ws->to = $sms_to;
$ws->from = $sms_sender;
$ws->msg = $sms_msg;
$ws->unicode = $unicode;
$ws->nofooter = $nofooter;
$ws->sendSms();
// _log('url:'.$ws->getWebservicesUrl(), 3, 'uplink sendsms');
if ($ws->getStatus()) {
$response = $ws->getData();
$db_query = "\n\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayUplink (up_local_smslog_id,up_remote_smslog_id,up_status,up_remote_queue_code,up_dst)\n\t\t\t\tVALUES ('{$smslog_id}','" . $response->smslog_id . "','0','" . $response->queue . "','{$sms_to}')";
if ($up_id = @dba_insert_id($db_query)) {
$ok = true;
}
_log('sendsms success. smslog_id:' . $smslog_id . ' remote_smslog_id:' . $response->smslog_id . ' remote_queue:' . $response->queue, 3, 'uplink sendsms');
} else {
_log('sendsms failed. error:' . $ws->getError() . ' error_string:' . $ws->getErrorString(), 3, 'uplink sendsms');
}
}
if ($ok && ($response->smslog_id || $response->queue)) {
$p_status = 0;
} else {
$p_status = 2;
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:51,代码来源:fn.php
示例5: dev_hook_sendsms
function dev_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
$ok = false;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "dev_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
if ($plugin_config['dev']['enable_outgoing']) {
$p_status = 3;
dlr($smslog_id, $uid, $p_status);
$ok = true;
}
return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:14,代码来源:fn.php
示例6: gnokii_hook_sendsms
function gnokii_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "gnokii_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$sms_id = "{$gpid}.{$uid}.{$smslog_id}";
if (empty($sms_id)) {
$sms_id = mktime();
}
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
$sms_msg = str_replace("\n", " ", $sms_msg);
$sms_msg = str_replace("\r", " ", $sms_msg);
$the_msg = "{$sms_to}\n{$sms_msg}";
$fn = $plugin_config['gnokii']['path'] . "/out.{$sms_id}";
logger_print("saving outfile:" . $fn, 2, "gnokii outgoing");
umask(0);
$fd = @fopen($fn, "w+");
@fputs($fd, $the_msg);
@fclose($fd);
$ok = false;
if (file_exists($fn)) {
$ok = true;
$p_status = 0;
logger_print("saved outfile:" . $fn, 2, "gnokii outgoing");
} else {
$p_status = 2;
logger_print("fail to save outfile:" . $fn, 2, "gnokii outgoing");
}
dlr($smslog_id, $uid, $p_status);
@unlink($fn);
return $ok;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:38,代码来源:fn.php
示例7: smstools_hook_sendsms
function smstools_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log('enter smsc:' . $smsc . ' smslog_id:' . $smslog_id . ' uid:' . $uid . ' to:' . $sms_to, 3, 'smstools_hook_sendsms');
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
$the_msg = 'From: ' . $sms_sender . "\n";
$the_msg .= 'To: ' . $sms_to . "\n";
$the_msg .= "Report: yes\n";
if ($sms_type == 'flash') {
$the_msg .= "Flash: yes\n";
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$the_msg .= "Alphabet: UCS\n";
$sms_msg = mb_convert_encoding($sms_msg, 'UCS-2BE', 'auto');
}
// $sms_msg = str2hex($sms_msg);
}
// final message file content
$the_msg .= "\n" . $sms_msg;
// outfile
$gpid = (int) $gpid ? (int) $gpid : 0;
$uid = (int) $uid ? (int) $uid : 0;
$smslog_id = (int) $smslog_id ? (int) $smslog_id : 0;
$sms_id = $gpid . '.' . $uid . '.' . $smslog_id;
$outfile = 'out.' . $sms_id;
$fn = $plugin_config['smstools']['queue'] . '/' . $outfile;
if ($fd = @fopen($fn, 'w+')) {
@fputs($fd, $the_msg);
@fclose($fd);
_log('saving outfile:' . $fn . ' smsc:[' . $smsc . ']', 3, 'smstools_hook_sendsms');
}
$ok = false;
if (file_exists($fn)) {
$ok = true;
$p_status = 0;
_log('saved outfile:' . $fn . ' smsc:[' . $smsc . ']', 2, 'smstools_hook_sendsms');
} else {
$p_status = 2;
_log('fail to save outfile:' . $fn . ' smsc:[' . $smsc . ']', 2, 'smstools_hook_sendsms');
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
开发者ID:borkz,项目名称:playSMS,代码行数:51,代码来源:fn.php
示例8: bulksms_hook_sendsms
function bulksms_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
// Based on http://www.bulksms.com/int/docs/eapi/submission/send_sms/
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "bulksms_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['bulksms']['module_sender']) {
$sms_sender = $plugin_config['bulksms']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$sms_from = $sms_sender;
$sms_dca = "7bit";
$sms_class = "2";
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
switch ($sms_type) {
case "flash":
$sms_class = "0";
break;
case "logo":
case "picture":
case "ringtone":
case "rtttl":
$sms_dca = "8bit";
break;
default:
$sms_dca = "7bit";
$sms_class = "2";
}
// Automatically setting the unicode flag if necessary
//if (!$unicode) {
// $unicode = core_detect_unicode($sms_msg);
//}
if ($unicode) {
$unicode = 1;
$sms_dca = "16bit";
}
// fixme anton - if sms_from is not set in gateway_number and global number, we cannot pass it to bulksms
$set_sms_from = $sms_from == $sms_sender ? '' : "&sender=" . urlencode($sms_from);
// $query_string = "submission/send_sms/2/2.0?username=" . $plugin_config['bulksms']['username'] . "&password=" . $plugin_config['bulksms']['password'] . "&msisdn=" . urlencode($sms_to) . "&msg_class=$sms_class&message=" . urlencode($sms_msg) . "&dca=" . $sms_dca . $set_sms_from;
// $url = $plugin_config['bulksms']['send_url'] . "/" . $query_string;
// if ($additional_param = $plugin_config['bulksms']['additional_param']) {
// $additional_param = "&" . $additional_param;
// } else {
// $additional_param = "routing_group=1&repliable=0";
// }
// $url .= $additional_param;
// $url = str_replace("&&", "&", $url);
// logger_print("url:" . $url, 3, "bulksms outgoing");
// $fd = @implode('', file($url));
$fd = buklsms_multiple_sms($sms_to, $sms_class, $sms_msg, $sms_dca, $set_sms_from, $unicode);
$ok = false;
// failed
$p_status = 2;
if ($fd) {
$response = explode("|", $fd);
if (count($response) == 3) {
$status_code = trim($response[0]);
$apimsgid = trim($response[2]);
bulksms_setsmsapimsgid($smslog_id, $apimsgid);
if ($status_code == '1') {
list($c_sms_credit, $c_sms_status) = bulksms_getsmsstatus($smslog_id);
// pending
$p_status = 0;
if ($c_sms_status) {
$p_status = $c_sms_status;
}
} else {
// sent
$p_status = 1;
}
logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " sms_status:" . $p_status . " response:" . $response[0] . " " . $response[1] . " " . $response[2], 2, "bulksms outgoing");
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("smslog_id:" . $smslog_id . " response:" . $fd, 2, "bulksms outgoing");
}
$ok = true;
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:87,代码来源:fn.php
示例9: kannel_hook_sendsms
function kannel_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $core_config, $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "kannel_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['kannel']['module_sender']) {
$sms_sender = $plugin_config['kannel']['module_sender'];
}
$sms_footer = stripslashes(htmlspecialchars_decode($sms_footer));
$sms_msg = stripslashes(htmlspecialchars_decode($sms_msg));
$ok = false;
$account = user_uid2username($uid);
$msg_type = 1;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($sms_type == 'flash') {
$msg_type = 0;
// flash
} else {
$msg_type = 1;
// text, default
}
// this doesn't work properly if kannel is not on the same server with playSMS
// $dlr_url = $core_config['http_path']['base'] . "/plugin/gateway/kannel/dlr.php?type=%d&smslog_id=$smslog_id&uid=$uid";
// prior to 0.9.5.1
// $dlr_url = $plugin_config['kannel']['playsms_web'] . "/plugin/gateway/kannel/dlr.php?type=%d&smslog_id=".$smslog_id."&uid=".$uid;
// since 0.9.5.1
$dlr_url = $plugin_config['kannel']['playsms_web'] . "/index.php?app=call&cat=gateway&plugin=kannel&access=dlr&type=%d&smslog_id=" . $smslog_id . "&uid=" . $uid;
$URL = "/cgi-bin/sendsms?username=" . urlencode($plugin_config['kannel']['username']) . "&password=" . urlencode(htmlspecialchars_decode($plugin_config['kannel']['password']));
$URL .= "&from=" . urlencode($sms_sender) . "&to=" . urlencode($sms_to);
// Handle DLR options config (emmanuel)
// $URL .= "&dlr-mask=31&dlr-url=".urlencode($dlr_url);
$URL .= "&dlr-mask=" . $plugin_config['kannel']['dlr'] . "&dlr-url=" . urlencode($dlr_url);
// end of Handle DLR options config (emmanuel)
if ($sms_type == 'flash') {
$URL .= "&mclass=" . $msg_type;
}
// Automatically setting the unicode flag if necessary
if (!$unicode) {
$unicode = core_detect_unicode($sms_msg);
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$URL .= "&charset=UTF-16BE";
}
$URL .= "&coding=2";
}
$URL .= "&account=" . $account;
$URL .= "&text=" . urlencode($sms_msg);
// fixme anton - patch 1.4.3, dlr requries smsc-id, you should add at least smsc=<your smsc-id in kannel.conf> from web
if ($additional_param = htmlspecialchars_decode($plugin_config['kannel']['additional_param'])) {
$additional_param = "&" . $additional_param;
}
$URL .= $additional_param;
$URL = str_replace("&&", "&", $URL);
logger_print("URL: http://" . $plugin_config['kannel']['sendsms_host'] . ":" . $plugin_config['kannel']['sendsms_port'] . $URL, 3, "kannel_hook_sendsms");
// srosa 20100531: Due to improper http response from Kannel, file_get_contents cannot be used.
// One issue is that Kannel responds with HTTP 202 whereas file_get_contents expect HTTP 200
// The other is that a missing CRLF at the end of Kannel's message forces file_get_contents to wait forever.
// reverting to previous way of doing things which works fine.
/*
* if ($rv = trim(file_get_contents("$URL"))) { // old kannel responsed with Sent. // new kannel with the other 2 if (($rv == "Sent.") || ($rv == "0: Accepted for delivery") || ($rv == "3: Queued for later delivery")) { $ok = true; // set pending $p_status = 0; dlr($smslog_id, $uid, $p_status); } }
*/
// fixme anton - deprecated when using PHP5
// $connection = fsockopen($plugin_config['kannel']['sendsms_host'],$plugin_config['kannel']['sendsms_port'],&$error_number,&$error_description,60);
$connection = fsockopen($plugin_config['kannel']['sendsms_host'], $plugin_config['kannel']['sendsms_port'], $error_number, $error_description, 60);
if ($connection) {
socket_set_blocking($connection, false);
fputs($connection, "GET " . $URL . " HTTP/1.0\r\n\r\n");
while (!feof($connection)) {
$rv = fgets($connection, 128);
if ($rv == "Sent." || $rv == "0: Accepted for delivery" || $rv == "3: Queued for later delivery") {
logger_print("smslog_id:" . $smslog_id . " response:" . $rv, 3, "kannel outgoing");
// set pending
$p_status = 0;
$ok = true;
}
}
fclose($connection);
}
if (!$ok) {
// set failed
$p_status = 2;
$ok = true;
// return true eventhough failed
}
dlr($smslog_id, $uid, $p_status);
logger_print("end smslog_id:" . $smslog_id . " p_status:" . $p_status, 3, "kannel outgoing");
// good or bad, print it on the log
return $ok;
}
开发者ID:RobinKarlsen,项目名称:playSMS,代码行数:95,代码来源:fn.php
示例10: msgtoolbox_hook_sendsms
function msgtoolbox_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
// global $plugin_config; // global all variables needed, eg: varibles from config.php
// ...
// ...
// return true or false
// return $ok;
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "msgtoolbox_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['msgtoolbox']['module_sender']) {
$sms_sender = $plugin_config['msgtoolbox']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$ok = false;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
if ($sms_to && $sms_msg) {
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
// $sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2", "auto");
$unicode = "&coding=unicode";
// added at the of query string if unicode
}
}
// fixme anton - from playSMS v0.9.5.1 references to input.php replaced with index.php?app=webservices
// I should add autodetect, if its below v0.9.5.1 should use input.php
$query_string = "username=" . $plugin_config['msgtoolbox']['username'] . "&password=" . $plugin_config['msgtoolbox']['password'] . "&to=" . urlencode($sms_to) . "&from=" . urlencode($sms_sender) . "&message=" . urlencode($sms_msg) . $unicode . "&route=" . $plugin_config['msgtoolbox']['route'];
$url = $plugin_config['msgtoolbox']['url'] . "?" . $query_string;
/*
* not used if ($additional_param = $plugin_config['msgtoolbox']['additional_param']) { $additional_param = "&".$additional_param; } $url .= $additional_param; $url = str_replace("&&", "&", $url);
*/
logger_print($url, 3, "msgtoolbox outgoing");
$fd = @implode('', file($url));
if ($fd) {
$response = explode(",", $fd);
if (trim($response[0]) == "1") {
$remote_smslog_id = trim($response[1]);
if ($remote_smslog_id) {
// this is for callback, if callback not used then the status would be sent or failed only
// local_smslog_id is local SMS log id (local smslog_id)
// remote_smslog_id is remote SMS log id (in API doc its referred to smsid or messageid)
// status=10 delivered to gateway
$db_query = "\n\t\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_gatewayMsgtoolbox (local_smslog_id,remote_smslog_id,status)\n\t\t\t\t\t\tVALUES ('{$smslog_id}','{$remote_smslog_id}','10')\n\t\t\t\t\t ";
$id = @dba_insert_id($db_query);
if ($id) {
$ok = true;
$p_status = 1;
// sms sent
dlr($smslog_id, $uid, $p_status);
}
}
}
logger_print("sent smslog_id:" . $smslog_id . " response:" . $fd, 2, "msgtoolbox outgoing");
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("failed smslog_id:" . $smslog_id . " response:" . $fd, 2, "msgtoolbox outgoing");
}
}
if (!$ok) {
$p_status = 2;
dlr($smslog_id, $uid, $p_status);
}
return $ok;
}
开发者ID:yrahman,项目名称:playSMS,代码行数:72,代码来源:fn.php
示例11: uplink_hook_getsmsstatus
function uplink_hook_getsmsstatus($gpid = 0, $uid = "", $smslog_id = "", $p_datetime = "", $p_update = "")
{
// global $plugin_config;
// p_status :
// 0 = pending
// 1 = delivered
// 2 = failed
// dlr($smslog_id,$uid,$p_status);
global $plugin_config;
$smscs = gateway_getall_smsc_names($plugin_config['uplink']['name']);
foreach ($smscs as $smsc) {
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$db_query = "SELECT * FROM " . _DB_PREF_ . "_gatewayUplink WHERE up_local_smslog_id='{$smslog_id}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$local_smslog_id = $db_row['up_local_smslog_id'];
$remote_smslog_id = $db_row['up_remote_smslog_id'];
$remote_queue_code = $db_row['up_remote_queue_code'];
$dst = $db_row['up_dst'];
if ($local_smslog_id && ($remote_smslog_id || $remote_queue_code && $dst)) {
$ws = new Playsms\Webservices();
$ws->url = $plugin_config['uplink']['master'] . '/index.php?app=ws';
$ws->username = $plugin_config['uplink']['username'];
$ws->token = $plugin_config['uplink']['token'];
$ws->smslog_id = $remote_smslog_id;
$ws->queue = $remote_queue_code;
$ws->count = 1;
$ws->getOutgoing();
// _log('getsmsstatus url:[' . $ws->getWebservicesUrl() . '] smsc:[' . $smsc . ']', 3, 'uplink_hook_getsmsstatus');
$response = $ws->getData()->data[0];
if ($response->status == 2) {
$p_status = 2;
dlr($local_smslog_id, $uid, $p_status);
} else {
if ($p_status = (int) $response->status) {
dlr($local_smslog_id, $uid, $p_status);
}
}
}
}
}
}
开发者ID:10corp,项目名称:playSMS,代码行数:42,代码来源:fn.php
示例12: clickatell_hook_sendsms
function clickatell_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "clickatell_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['clickatell']['module_sender']) {
$sms_sender = $plugin_config['clickatell']['module_sender'];
}
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg);
$sms_from = $sms_sender;
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
switch ($sms_type) {
case "flash":
$sms_type = "SMS_FLASH";
break;
case "logo":
$sms_type = "SMS_NOKIA_OLOGO";
break;
case "picture":
$sms_type = "SMS_NOKIA_PICTURE";
break;
case "ringtone":
case "rtttl":
$sms_type = "SMS_NOKIA_RTTTL";
break;
case "text":
default:
$sms_type = "SMS_TEXT";
}
// Automatically setting the unicode flag if necessary
if (!$unicode) {
$unicode = core_detect_unicode($sms_msg);
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
}
$sms_msg = core_str2hex($sms_msg);
$unicode = 1;
}
// fixme anton - if sms_from is not set in gateway_number and global number, we cannot pass it to clickatell
$set_sms_from = $sms_from ? "&from=" . urlencode($sms_from) : '';
// fixme anton - temporary solution #385 Unable to send messages when clickatell password contains &
$password = urlencode(htmlspecialchars_decode($plugin_config['clickatell']['password']));
$query_string = "sendmsg?api_id=" . $plugin_config['clickatell']['api_id'] . "&user=" . $plugin_config['clickatell']['username'] . "&password=" . $password . "&to=" . urlencode($sms_to) . "&msg_type={$sms_type}&text=" . urlencode($sms_msg) . "&unicode=" . $unicode . $set_sms_from;
$url = $plugin_config['clickatell']['send_url'] . "/" . $query_string;
if ($additional_param = $plugin_config['clickatell']['additional_param']) {
$additional_param = "&" . htmlspecialchars_decode($additional_param);
} else {
$additional_param = "&deliv_ack=1&callback=3";
}
$url .= $additional_param;
$url = str_replace("&&", "&", $url);
logger_print("url:" . $url, 3, "clickatell outgoing");
$fd = @implode('', file($url));
$ok = false;
// failed
$p_status = 2;
if ($fd) {
$response = explode(":", $fd);
$err_code = trim($response[1]);
if (strtoupper($response[0]) == "ID") {
if ($apimsgid = trim($response[1])) {
clickatell_setsmsapimsgid($smslog_id, $apimsgid);
list($c_sms_credit, $c_sms_status) = clickatell_getsmsstatus($smslog_id);
// pending
$p_status = 0;
if ($c_sms_status) {
$p_status = $c_sms_status;
}
} else {
// sent
$p_status = 1;
}
logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " sms_status:" . $p_status . " response:" . $response[0] . " " . $response[1], 2, "clickatell outgoing");
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("smslog_id:" . $smslog_id . " response:" . $fd, 2, "clickatell outgoing");
}
$ok = true;
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
开发者ID:RobinKarlsen,项目名称:playSMS,代码行数:91,代码来源:fn.php
示例13: infobip_hook_sendsms
function infobip_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
$ok = false;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 3, "infobip_hook_sendsms");
// override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
$sms_sender = stripslashes($sms_sender);
if ($plugin_config['infobip']['module_sender']) {
$sms_sender = $plugin_config['infobip']['module_sender'];
}
$sms_from = $sms_sender;
$smsType = "&SMSText";
if ($sms_footer) {
$sms_msg = $sms_msg . $sms_footer;
}
switch ($sms_type) {
case "flash":
$sms_type = 1;
break;
case "text":
default:
$sms_type = 0;
}
if ($unicode) {
if (function_exists('mb_convert_encoding')) {
$sms_msg = mb_convert_encoding($sms_msg, "UCS-2BE", "auto");
}
$sms_msg = core_str2hex($sms_msg);
$unicode = 8;
$smsType = "&binary";
}
// fixme anton - if sms_from is not set in gateway_number and global number, we cannot pass it to infobip
$set_sms_from = $sms_from == $sms_sender ? '' : urlencode($sms_from);
// query_string = "sendmsg?api_id=".$plugin_config['infobip']['api_id']."&user=".$plugin_config['infobip']['username']."&password=".$plugin_config['infobip']['password']."&to=".urlencode($sms_to)."&msg_type=$sms_type&text=".urlencode($sms_msg)."&unicode=".$unicode.$set_sms_from;
$query_string = "sendsms/plain?user=" . $plugin_config['infobip']['username'] . "&password=" . $plugin_config['infobip']['password'];
$query_string .= "&GSM=" . urlencode($sms_to) . $smsType . "=" . urlencode($sms_msg) . "&sender=" . $sms_from;
$query_string .= "&IsFlash=" . $sms_type . "&DataCoding=" . $unicode;
$url = $plugin_config['infobip']['send_url'] . "/" . $query_string;
$dlr_nopush = $plugin_config['infobip']['dlr_nopush'];
if ($dlr_nopush == '0') {
$additional_param = "&nopush=0";
} elseif ($dlr_nopush == '1') {
$additional_param = "&nopush=1";
}
if ($additional_param = $plugin_config['infobip']['additional_param']) {
$additional_param .= "&" . $additional_param;
}
$url .= $additional_param;
$url = str_replace("&&", "&", $url);
logger_print("url:" . $url, 3, "infobip outgoing");
$xml = file_get_contents($url);
$response = core_xml_to_array($xml);
if ($response) {
if ($response['result']['status'] == 0) {
if ($apimsgid = trim($response['result']['messageid'])) {
infobip_setsmsapimsgid($smslog_id, $apimsgid);
list($c_sms_credit, $c_sms_status) = infobip_getsmsstatus($smslog_id);
// pending
$p_status = 0;
if ($c_sms_status) {
$p_status = $c_sms_status;
}
} else {
// sent
$p_status = 1;
}
logger_print("smslog_id:" . $smslog_id . " charge:" . $c_sms_credit . " p_status:" . $p_status . " response:" . $response['result']['status'], 2, "infobip outgoing");
} elseif ($response['result']['status'] == -2) {
logger_print("smslog_id:" . $smslog_id . " response:" . $response['result']['status'] . " NOT_ENOUGH_CREDIT", 2, "infobip outgoing");
} else {
// even when the response is not what we expected we still print it out for debug purposes
$fd = str_replace("\n", " ", $fd);
$fd = str_replace("\r", " ", $fd);
logger_print("smslog_id:" . $smslog_id . " response:" . $response['result']['status'] . " UNKNOWN_CODE", 2, "infobip outgoing");
}
$ok = true;
} else {
logger_print("no response smslog_id:" . $smslog_id, 3, "infobip outgoing");
}
if (!$ok) {
$p_status = 2;
}
dlr($smslog_id, $uid, $p_status);
return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:86,代码来源:fn.php
示例14: telerivet_hook_sendsms
function telerivet_hook_sendsms($smsc, $sms_sender, $sms_footer, $sms_to, $sms_msg, $uid = '', $gpid = 0, $smslog_id = 0, $sms_type = 'text', $unicode = 0)
{
global $plugin_config;
$ok = false;
_log("enter smsc:" . $smsc . " smslog_id:" . $smslog_id . " uid:" . $uid . " to:" . $sms_to, 2, "telerivet_hook_sendsms");
# Initialize CURL context
$api_key = $plugin_config['telerivet']['api_key'];
$project_id = $plugin_config['telerivet']['project_id'];
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.telerivet.com/v1/projects/{$project_id}/messages/outgoing");
curl_setopt($curl, CURLOPT_USERPWD, "{$api_key}:");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
# override plugin gateway configuration by smsc configuration
$plugin_config = gateway_apply_smsc_config($smsc, $plugin_config);
# Pre-process parameters
$sms_sender = stripslashes($sms_sender);
$sms_footer = stripslashes($sms_footer);
$sms_msg = stripslashes($sms_msg) . $sms_footer;
# Build data array
$data = array();
$data['to_number'] = $sms_to;
$data['content'] = $sms_msg;
if (trim($plugin_config['telerivet']['status_url'])) {
$data['status_url'] = trim($plugin_config['telerivet']['status_url']);
}
if (trim($plugin_config['telerivet']['status_secret'])) {
$data['status_secret'] = trim($plugin_config['telerivet']['status_secret']);
}
# Build API query
curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($data, '', '&'));
_log('building http query', 3, 'telerivet_query');
# Send query to API and get result
$json = curl_exec($curl);
$network_error = curl_error($curl);
curl_close($curl);
# Catch query error
if ($network_error) {
_log('curl error:' . $network_error, 2, 'telerivet_query');
dlr($smslog_id, $uid, 2);
} else {
# Save JSON reply
$res = json_decode($json, true);
if (is_array($res)) {
foreach ($res as $key => $val) {
$log .= $key . ':' . $val . ' ';
}
_log('api response:' . $log, 3, 'telerivet_query');
}
# Catch API errors
if (isset($res['error'])) {
_log('api error' . $res['error_message'], 2, 'telerivet_query');
dlr($smslog_id, $uid, 2);
} else {
_log('api success: id:' . $res['id'] . ' status:' . $res['status'] . ' source:' . $res['source'], 2, 'telerivet_query');
}
$c_remote_id = $res['id'];
$c_status = $res['status'];
$c_phone_id = $res['phone_id'];
$c_message_type = $res['message_type'];
$c_source = $res['source'];
$c_error = $res['error_message'];
# Ref: https://telerivet.com/api/webhook#send_status
# Available status:
# sent the message has been successfully sent to the mobile network
# queued the message has not been sent yet
# failed the message has failed to send
# failed_queued the message has failed to send, but Telerivet will try to send it again later
# delivered the message has been delivered to the recipient phone (if delivery reports are enabled)
# not_delivered the message could not be delivered (if delivery reports are enabled)
# cancelled the message was cancelled by the user
# Reminder delivery status
# $p_status = 0 --> pending
# $p_status = 1 --> sent
# $p_status = 2 --> failed
# $p_status = 3 --> delivered
if ($c_remote_id && $c_status) {
$db_query = '
INSERT INTO ' . _DB_PREF_ . '_gatewayTelerivet (local_slid, remote_slid, status, phone_id, message_type, source, error_text)
VALUES (' . $smslog_id . ',"' . $c_remote_id . '","' . $c_status . '","' . $c_phone_id . '","' . $c_message_type . '","' . $c_source . '","' . $c_error . '")';
_log('sql:' . $db_query, 3, 'telerivet query');
if ($id = @dba_insert_id($db_query) && $c_status) {
switch ($c_status) {
case "queued":
$ok = true;
$p_status = 0;
break;
case "sent":
$ok = true;
$p_status = 1;
break;
case "delivered":
$ok = true;
$p_status = 3;
break;
case "failed":
case "failed_queued":
case "not_delivered":
case "cancelled":
default:
$p_status = 2;
//.........这里部分代码省略.........
开发者ID:10corp,项目名称:playSMS,代码行数:101,代码来源:fn.php
示例15: twilio_hook_sendsms
-
This vulnerability allows remote attackers to execute arbitrary code on affected
阅读:1130|2022-07-29
-
对于农民朋友来说,亩这个单位非常熟悉。亩呢,是中国的市制土地面积单位,1亩等于60
阅读:409|2022-07-30
-
chasinginfinity/ml-from-scratch: Machine Learning algorithms implemented in Pyth
阅读:1548|2022-08-19
-
mkyong/spring3-mvc-maven-annotation-hello-world: Maven + Spring 3 MVC hello worl
阅读:818|2022-08-17
-
床的笔顺怎么写?床的笔顺笔画顺序是什么?中国练字网了解到好多人在学习中会遇到床的笔
阅读:1378|2022-11-06
-
zendesk/android-floating-action-button: Floating Action Button for Android based
阅读:599|2022-08-17
-
lizhuohua/linux-kernel-module-rust
阅读:535|2022-08-15
-
rhysd/Shiba: Rich markdown live preview app with linter
阅读:397|2022-08-18
-
bpocallaghan/laravel-admin-starter: A Laravel Admin Starter project with Page Bu
阅读:732|2022-08-12
-
win7系统电脑使用过程中有不少朋友表示遇到过win7系统程序加锁的状况,当出现win7系统
阅读:441|2022-11-06
|
请发表评论