本文整理汇总了PHP中uid2username函数的典型用法代码示例。如果您正苦于以下问题:PHP uid2username函数的具体用法?PHP uid2username怎么用?PHP uid2username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了uid2username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_autosend_hook_playsmsd
function sms_autosend_hook_playsmsd()
{
global $core_config;
$timenow = mktime();
$db_query = "SELECT uid,time_id," . _DB_PREF_ . "_featureAutosend.autosend_id, autosend_message,autosend_number,autosend_time\n\t\t\t\t\t\t\tFROM " . _DB_PREF_ . "_featureAutosend\n\t\t\t\t\t\t\tINNER JOIN " . _DB_PREF_ . "_featureAutosend_time\n\t\t\t\t\t\t\tON " . _DB_PREF_ . "_featureAutosend.autosend_id = " . _DB_PREF_ . "_featureAutosend_time.autosend_id\n\t\t\t\t\t\t\tWHERE UNIX_TIMESTAMP(" . _DB_PREF_ . "_featureAutosend_time.autosend_time) <= '{$timenow}'\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend_time.sent='0'\n\t\t\t\t\t\t\tAND autosend_time != ''\n\t\t\t\t\t\t\tAND " . _DB_PREF_ . "_featureAutosend.autosend_enable='1'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$message = $db_row['autosend_message'];
$c_uid = $db_row['uid'];
$username = uid2username($c_uid);
$sms_to = $db_row['autosend_number'];
// we are sending to this number
$autosend_id = $db_row['autosend_id'];
$time_id = $db_row['time_id'];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
list($ok, $to, $smslog_id) = sendsms_pv($username, $sms_to, $message, 'text', $unicode);
if ($ok[0]) {
$db_query = "UPDATE " . _DB_PREF_ . "_featureAutosend_time SET sent='1' WHERE time_id = '{$time_id}'";
$db_result = @dba_affected_rows($db_query);
}
}
}
示例2: sms_command_handle
function sms_command_handle($sms_datetime, $sms_sender, $command_keyword, $command_param = '')
{
global $datetime_now, $plugin_config;
$ok = false;
$db_query = "SELECT command_exec,uid,command_return_as_reply FROM " . _DB_PREF_ . "_featureCommand WHERE command_keyword='{$command_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$command_exec = $db_row['command_exec'];
$sms_datetime = core_display_datetime($sms_datetime);
$command_exec = str_replace("{SMSDATETIME}", "\"{$sms_datetime}\"", $command_exec);
$command_exec = str_replace("{SMSSENDER}", "\"{$sms_sender}\"", $command_exec);
$command_exec = str_replace("{COMMANDKEYWORD}", "\"{$command_keyword}\"", $command_exec);
$command_exec = str_replace("{COMMANDPARAM}", "\"{$command_param}\"", $command_exec);
$command_exec = $plugin_config['feature']['sms_command']['bin'] . "/" . $command_exec;
$command_output = shell_exec(stripslashes($command_exec));
$username = uid2username($db_row['uid']);
if ($db_row['command_return_as_reply'] == 1) {
sendsms_pv($username, $sms_sender, $command_output, 'text', 0);
}
$db_query = "\n\tINSERT INTO " . _DB_PREF_ . "_featureCommand_log\n\t(sms_sender,command_log_datetime,command_log_keyword,command_log_exec) \n\tVALUES\n\t('{$sms_sender}','{$datetime_now}','{$command_keyword}','{$command_exec}')\n ";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
return $ok;
}
示例3: sms_board_handle
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '')
{
global $web_title, $email_service, $email_footer, $gateway_module, $datetime_now;
$ok = false;
if ($sms_sender && $board_keyword && $board_param) {
// masked sender sets here
$masked_sender = substr_replace($sms_sender, 'xxxx', -4);
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureBoard_log \n\t (in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime) \n\t VALUES ('{$gateway_module}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','{$datetime_now}')\n\t";
if ($cek_ok = @dba_insert_id($db_query)) {
$db_query1 = "SELECT board_forward_email FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$board_keyword}'";
$db_result1 = dba_query($db_query1);
$db_row1 = dba_fetch_array($db_result1);
$email = $db_row1['board_forward_email'];
if ($email) {
// get name from c_uid's phonebook
$c_username = uid2username($c_uid);
$c_name = phonebook_number2name($sms_sender, $c_username);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$subject = "[SMSGW-" . $board_keyword . "] " . _('from') . " {$sms_sender}";
$body = _('Forward WebSMS') . " ({$web_title})\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('Keyword') . ": {$board_keyword}\n\n";
$body .= _('Message') . ":\n{$board_param}\n\n";
$body .= $email_footer . "\n\n";
sendmail($email_service, $email, $subject, $body);
}
$ok = true;
}
}
return $ok;
}
示例4: sms_quiz_handle
function sms_quiz_handle($c_uid, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '')
{
global $core_config, $datetime_now;
$ok = false;
$username = uid2username($c_uid);
$sms_to = $sms_sender;
// we are replying to this sender
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$quiz_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($db_row['quiz_enable'] == 1) {
if ($db_row['quiz_answer'] == strtoupper($quiz_param)) {
$message = $db_row['quiz_msg_correct'];
} else {
$message = $db_row['quiz_msg_incorrect'];
}
$quiz_id = $db_row['quiz_id'];
$answer = strtoupper($quiz_param);
$db_query = "INSERT INTO " . _DB_PREF_ . "_featureQuiz_log (quiz_id,quiz_answer,quiz_sender,in_datetime) VALUES ('{$quiz_id}','{$answer}','{$sms_to}','{$datetime_now}')";
if ($logged = @dba_insert_id($db_query)) {
//list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
// $ok = $ok[0];
$ok = $ret['status'];
}
} else {
if ($db_row['quiz_keyword'] == $quiz_keyword) {
// returns true even if its logged as correct/incorrect answer
// this situation happens when user answers a disabled quiz
// returning false will make this SMS as unhandled SMS
$ok = true;
}
}
return $ok;
}
示例5: sms_autoreply_handle
function sms_autoreply_handle($sms_datetime, $sms_sender, $c_uid, $autoreply_id, $autoreply_keyword, $autoreply_param = '')
{
global $datetime_now;
$ok = false;
$autoreply_request = $autoreply_keyword . " " . $autoreply_param;
$array_autoreply_request = explode(" ", $autoreply_request);
for ($i = 0; $i < count($array_autoreply_request); $i++) {
$autoreply_part[$i] = trim($array_autoreply_request[$i]);
$tmp_autoreply_request .= trim($array_autoreply_request[$i]) . " ";
}
$autoreply_request = trim($tmp_autoreply_request);
for ($i = 1; $i < 7; $i++) {
$autoreply_scenario_param_list .= "autoreply_scenario_param{$i}='" . $autoreply_part[$i] . "' AND ";
}
$db_query = "\n\tSELECT autoreply_scenario_result FROM " . _DB_PREF_ . "_featureAutoreply_scenario \n\tWHERE autoreply_id='{$autoreply_id}' AND {$autoreply_scenario_param_list} 1=1\n ";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($autoreply_scenario_result = $db_row['autoreply_scenario_result']) {
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureAutoreply_log\n\t (sms_sender,autoreply_log_datetime,autoreply_log_keyword,autoreply_log_request) \n\t VALUES\n\t ('{$sms_sender}','{$datetime_now}','{$autoreply_keyword}','{$autoreply_request}')\n\t";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
}
if ($ok) {
$ok = false;
$c_username = uid2username($c_uid);
//list($ok,$to,$smslog_id) = sendsms_pv($c_username,$sms_sender,$autoreply_scenario_result);
//$ok = $ok[0];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
list($ok, $to, $smslog_id) = sendsms_pv($c_username, $sms_sender, $autoreply_scenario_result, 'text', $unicode);
$ok = $ok[0];
}
return $ok;
}
示例6: sms_custom_handle
function sms_custom_handle($sms_datetime, $sms_sender, $custom_keyword, $custom_param = '')
{
global $datetime_now;
$ok = false;
$db_query = "SELECT custom_url,uid,custom_return_as_reply FROM " . _DB_PREF_ . "_featureCustom WHERE custom_keyword='{$custom_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$custom_url = $db_row['custom_url'];
$sms_datetime = core_display_datetime($sms_datetime);
$custom_url = str_replace("{SMSDATETIME}", urlencode($sms_datetime), $custom_url);
$custom_url = str_replace("{SMSSENDER}", urlencode($sms_sender), $custom_url);
$custom_url = str_replace("{CUSTOMKEYWORD}", urlencode($custom_keyword), $custom_url);
$custom_url = str_replace("{CUSTOMPARAM}", urlencode($custom_param), $custom_url);
$username = uid2username($db_row['uid']);
$debug = dba_query("INSERT INTO " . _DB_PREF_ . "_toolsDebug (value)VALUES('{$username}')");
$url = parse_url($custom_url);
if (!$url['port']) {
$url['port'] = 80;
}
// fixme anton -deprecated when using PHP5
//$connection = fsockopen($url['host'],$url['port'],&$error_number,&$error_description,60);
//fixme Edward, change to file_get_contents
$returns = file_get_contents($custom_url);
if ($returns) {
//fixme Edward, change to file_get_contents
//socket_set_blocking($connection, false);
//fputs($connection, "GET $custom_url HTTP/1.0\r\n\r\n");
$username = uid2username($db_row['uid']);
if ($db_row['custom_return_as_reply'] == 1) {
sendsms_pv($username, $sms_sender, $returns, 'text', 0);
}
$db_query = "\n\t INSERT INTO " . _DB_PREF_ . "_featureCustom_log\n\t (sms_sender,custom_log_datetime,custom_log_keyword,custom_log_url) \n\t VALUES\n\t ('{$sms_sender}','{$datetime_now}','{$custom_keyword}','{$custom_url}')\n\t";
if ($new_id = @dba_insert_id($db_query)) {
$ok = true;
}
}
return $ok;
}
示例7: sms_survey_handle
function sms_survey_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $survey_keyword, $survey_param = '')
{
global $core_config;
$ok = false;
// get survey data by keyword
$data = sms_survey_getdatabykeyword($survey_keyword);
if ($data['status'] == 1) {
// survey enabled, accept incoming answers
$session = $data['session'];
$sid = $data['id'];
$m = sms_survey_getmemberbymobile($sid, $sms_sender);
// link_id is used to link each questions and answers
if ($link_id = sms_survey_getlinkid($session, $sid, $m['id'])) {
// get last question data from log
$l = sms_survey_getoutlogs($link_id);
$outlogs = $l[count($l) - 1];
$qn = $outlogs['question_number'];
$next_qn = $qn + 1;
// save answer in log
$log = "";
$log['incoming'] = 1;
$log['question_number'] = $qn;
$log['link_id'] = $link_id;
$log['in_datetime'] = $sms_datetime;
$log['in_sender'] = $sms_sender;
$log['in_receiver'] = $sms_receiver;
$log['answer'] = $survey_param;
$log['session'] = $session;
if (sms_survey_savelog($log)) {
// get next question
$q = sms_survey_getquestions($sid);
// stop when ran out questions
if ($qn < count($q)) {
$c_message = $q[$qn]['question'];
// yes, not $next_qn, array questions start from 0
$c_username = uid2username($c_uid);
$c_keyword = $survey_keyword;
$c_sms_msg = $c_keyword . " " . $c_message;
$c_sms_to = $sms_sender;
logger_print("playsmsd send start next qn:" . $next_qn . " sid:" . $c_sid . " username:" . $c_username . " to:" . $c_sms_to . " msg:" . $c_sms_msg, 3, "sms_survey");
// if member's mobile, question and username owned the survey exists
if ($c_sms_to && $c_sms_msg && $c_username) {
$type = 'text';
$unicode = '0';
// send next question to member
list($ok, $to, $smslog_id) = sendsms_pv($c_username, $c_sms_to, $c_sms_msg, $type, $unicode);
$ok = $ok[0] ? "true" : "false";
logger_print("playsmsd send finish sid:" . $c_sid . " smslog_id:" . $smslog_id[0] . " ok:" . $ok, 3, "sms_survey");
// save the log
$log = "";
$log['survey_id'] = $sid;
$log['question_id'] = $q[$qn]['id'];
$log['member_id'] = $m['id'];
$log['link_id'] = $link_id;
$log['smslog_id'] = $smslog_id[0];
$log['name'] = $m['name'];
$log['mobile'] = $m['mobile'];
$log['question'] = $q[$qn]['question'];
$log['question_number'] = $next_qn;
$log['creation_datetime'] = $core_config['datetime']['now'];
$log['session'] = $session;
sms_survey_savelog($log);
}
}
// set handled
$ok = true;
}
}
} else {
// returns true even if its not handled since survey is disabled
// returning false will make this SMS as unhandled SMS
$ok = true;
}
return $ok;
}
示例8: count
$db_query = "SELECT count(*) as count FROM " . _DB_PREF_ . "_tblUserInbox WHERE in_hidden='0'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$num_rows = $db_row['count'];
$pages = ceil($num_rows / $line_per_page);
$nav_pages = themes_navbar($pages, $nav, $max_nav, "index.php?app=menu&inc=all_inbox&op=all_inbox", $page);
$limit = ($page - 1) * $line_per_page;
$content = "\n\t <h2>" . _('All Inbox') . "</h2>\n\t <p>{$nav_pages}</p>\n\t <form name=\"fm_inbox\" action=\"index.php?app=menu&inc=all_inbox&op=act_del\" method=post onSubmit=\"return SureConfirm()\">\n\t <table cellpadding=1 cellspacing=2 border=0 width=100% class=\"sortable\">\n <thead>\n\t <tr>\n\t <th align=center width=4>*</th>\n\t <th align=center width=10%>" . _('User') . "</th>\n\t <th align=center width=20%>" . _('Time') . "</th>\n\t <th align=center width=10%>" . _('From') . "</th>\n\t <th align=center width=60%>" . _('Message') . "</th>\n\t <th align=center class=\"sorttable_nosort\">" . _('Action') . "</td>\n\t <th width=4 class=\"sorttable_nosort\"><input type=checkbox onclick=CheckUncheckAll(document.fm_inbox)></td>\n\t </tr>\n </thead>\n <tbody>\n\t";
$db_query = "SELECT * FROM " . _DB_PREF_ . "_tblUserInbox WHERE in_hidden='0' ORDER BY in_id DESC LIMIT {$limit},{$line_per_page}";
$db_result = dba_query($db_query);
$i = $num_rows - $line_per_page * ($page - 1) + 1;
$j = 0;
while ($db_row = dba_fetch_array($db_result)) {
$j++;
$in_id = $db_row['in_id'];
$in_username = uid2username($db_row['in_uid']);
$in_sender = $db_row['in_sender'];
$p_desc = phonebook_number2name($in_sender);
$current_sender = $in_sender;
if ($p_desc) {
$current_sender = "{$in_sender}<br>({$p_desc})";
}
$in_msg = core_display_text($db_row['in_msg'], 25);
$in_datetime = core_display_datetime($db_row['in_datetime']);
$i--;
$td_class = $i % 2 ? "box_text_odd" : "box_text_even";
$content .= "\n\t\t<tr>\n\t <td valign=top class={$td_class} align=left>{$i}.</td>\n\t <td valign=top class={$td_class} align=center>{$in_username}</td>\n\t <td valign=top class={$td_class} align=center>{$in_datetime}</td>\n\t <td valign=top class={$td_class} align=center>{$current_sender}</td>\n\t <td valign=top class={$td_class} align=left>{$in_msg}</td>\n\t <td valign=top class={$td_class} align=center nowrap>\n\t\t <!-- <a href=\"javascript: PopupReplySms('{$current_sender}', '" . urlencode($in_msg) . "')\">{$icon_reply}</a> -->\n\t\t <!-- <a href=\"index.php?app=menu&inc=phone_add&op=add&phone={$current_sender}\">{$icon_phonebook}</a> -->\n\t\t <a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete this SMS ?') . "','index.php?app=menu&inc=all_inbox&op=all_inbox_del&inid={$in_id}')\">{$icon_delete}</a>\n\t\t \n\t\t </td>\n\t\t<td class={$td_class} width=4>\n\t\t <input type=hidden name=inid" . $j . " value=\"{$in_id}\">\n\t\t <input type=checkbox name=chkid" . $j . ">\n\t\t</td>\t\t \n\t\t</tr>\n\t ";
}
$item_count = $j;
$content .= "\n </tbody>\n </table>\n\t<table width=100% cellpadding=0 cellspacing=0 border=0>\n\t<tr>\n\t <td width=100% colspan=2 align=right>\n\t\t<input type=hidden name=item_count value=\"{$item_count}\">\n\t\t<input type=submit value=\"" . _('Delete selection') . "\" class=button />\n\t </td>\n\t</tr>\n\t</table>\t \n </form>\n <p>{$nav_pages}</p>\n ";
if ($err) {
示例9: simplerate_hook_rate_refund
function simplerate_hook_rate_refund($smslog_id)
{
$ok = false;
logger_print("start smslog_id:" . $smslog_id, 3, "simplerate refund");
$db_query = "SELECT p_dst,p_msg,uid FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE p_status='2' AND smslog_id='{$smslog_id}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
$p_dst = $db_row['p_dst'];
$p_msg = $db_row['p_msg'];
$uid = $db_row['uid'];
if ($p_dst && $p_msg && $uid) {
if (billing_rollback($smslog_id)) {
$bill = billing_getdata($smslog_id);
$rate = $bill['rate'];
$status = $bill['status'];
logger_print("rolling smslog_id:" . $smslog_id, 3, "simplerate refund");
if ($status == '2') {
// here should be added a routine to check charset encoding
// utf8 devided by 140, ucs2 devided by 70
$count = ceil(strlen($p_msg) / 153);
$charge = $count * $rate;
$username = uid2username($uid);
$credit = rate_getusercredit($username);
$remaining = $credit + $charge;
if (rate_setusercredit($uid, $remaining)) {
logger_print("refund smslog_id:" . $smslog_id, 3, "simplerate refund");
$ok = true;
}
}
}
}
}
return $ok;
}
示例10: setsmsincomingaction
function setsmsincomingaction($sms_datetime, $sms_sender, $message, $sms_receiver = "")
{
global $gateway_module, $core_config;
// make sure sms_datetime is in supported format and in GMT+0
$sms_datetime = core_adjust_datetime($sms_datetime);
// incoming sms will be handled by plugin/tools/* first
$ret_intercept = interceptincomingsms($sms_datetime, $sms_sender, $message, $sms_receiver);
if ($ret_intercept['modified']) {
$sms_datetime = $ret_intercept['param']['sms_datetime'] ? $ret_intercept['param']['sms_datetime'] : $sms_datetime;
$sms_sender = $ret_intercept['param']['sms_sender'] ? $ret_intercept['param']['sms_sender'] : $sms_sender;
$message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message;
$sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver;
}
// if hooked function returns cancel=true then stop the processing incoming sms, return false
if ($ret_intercept['cancel']) {
logger_print("cancelled datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction");
return false;
}
$c_uid = 0;
$c_feature = "";
$ok = false;
$array_target_keyword = explode(" ", $message);
$target_keyword = strtoupper(trim($array_target_keyword[0]));
$message_full = $message;
$message = $array_target_keyword[1];
for ($i = 2; $i < count($array_target_keyword); $i++) {
$message .= " " . $array_target_keyword[$i];
}
switch ($target_keyword) {
case "BC":
$c_uid = mobile2uid($sms_sender);
$c_username = uid2username($c_uid);
$c_feature = 'core';
$array_target_group = explode(" ", $message);
$target_group = strtoupper(trim($array_target_group[0]));
$c_gpid = phonebook_groupcode2id($c_uid, $target_group);
$message = $array_target_group[1];
for ($i = 2; $i < count($array_target_group); $i++) {
$message .= " " . $array_target_group[$i];
}
logger_print("username:" . $c_username . " gpid:" . $c_gpid . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction bc");
list($ok, $to, $queue) = sendsms_bc($c_username, $c_gpid, $message);
$ok = true;
break;
case "PV":
$c_feature = 'core';
$array_target_user = explode(" ", $message);
$target_user = strtoupper(trim($array_target_user[0]));
$c_uid = username2uid($target_user);
$message = $array_target_user[1];
for ($i = 2; $i < count($array_target_user); $i++) {
$message .= " " . $array_target_user[$i];
}
logger_print("datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user . " message:" . $message, 3, "setsmsincomingaction pv");
if (insertsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver)) {
$ok = true;
}
break;
default:
for ($c = 0; $c < count($core_config['featurelist']); $c++) {
$c_feature = $core_config['featurelist'][$c];
$ret = x_hook($c_feature, 'setsmsincomingaction', array($sms_datetime, $sms_sender, $target_keyword, $message, $sms_receiver));
if ($ok = $ret['status']) {
$c_uid = $ret['uid'];
logger_print("feature:" . $c_feature . " datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " keyword:" . $target_keyword . " message:" . $message, 3, "setsmsincomingaction");
break;
}
}
}
$c_status = $ok ? 1 : 0;
if ($c_status == 0) {
$c_feature = '';
$target_keyword = '';
$message = $message_full;
// from interceptincomingsms(), force status as 'handled'
if ($ret_intercept['hooked']) {
$c_status = 1;
logger_print("intercepted datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction");
} else {
logger_print("unhandled datetime:" . $sms_datetime . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " message:" . $message, 3, "setsmsincomingaction");
}
}
$db_query = "\n INSERT INTO " . _DB_PREF_ . "_tblSMSIncoming \n (in_uid,in_feature,in_gateway,in_sender,in_receiver,in_keyword,in_message,in_datetime,in_status)\n VALUES\n ('{$c_uid}','{$c_feature}','{$gateway_module}','{$sms_sender}','{$sms_receiver}','{$target_keyword}','{$message}','{$sms_datetime}','{$c_status}')\n ";
$db_result = dba_query($db_query);
return $ok;
}
示例11: dba_query
}
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutoreply WHERE autoreply_id='{$autoreply_id}' {$query_user_only}";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$manage_autoreply_keyword = $db_row['autoreply_keyword'];
$o_uid = $db_row['uid'];
if ($err) {
$content = "<div class=error_string>{$err}</div>";
}
$content .= "\n\t <h2>" . _('Manage autoreply') . "</h2>\n\t <p>\n\t <p>" . _('SMS autoreply keyword') . ": <b>{$manage_autoreply_keyword}</b>\n\t <p>\n\t <input type=button value=\"" . _('Add SMS autoreply scenario') . "\" onClick=\"javascript:linkto('index.php?app=menu&inc=feature_sms_autoreply&op=sms_autoreply_scenario_add&autoreply_id={$autoreply_id}')\" class=\"button\" />\n\t <p>\n <table cellpadding=1 cellspacing=2 border=0 width=100%>\n <tr>\n <td class=box_title width=5>*</td>\n <td class=box_title width=100>" . _('Param') . "</td>\n <td class=box_title>" . _('Return') . "</td>\n <td class=box_title width=100>" . _('User') . "</td>\t\n <td class=box_title width=75>" . _('Action') . "</td>\n </tr>\t\t \n\t";
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutoreply_scenario WHERE autoreply_id='{$autoreply_id}' ORDER BY autoreply_scenario_param1";
$db_result = dba_query($db_query);
$j = 0;
while ($db_row = dba_fetch_array($db_result)) {
$j++;
$owner = uid2username($o_uid);
$td_class = $i % 2 ? "box_text_odd" : "box_text_even";
$list_of_param = "";
for ($i = 1; $i <= 7; $i++) {
$list_of_param .= $db_row['autoreply_scenario_param' . $i] . " ";
}
$action = "<a href=index.php?app=menu&inc=feature_sms_autoreply&op=sms_autoreply_scenario_edit&autoreply_id={$autoreply_id}&autoreply_scenario_id=" . $db_row['autoreply_scenario_id'] . ">{$icon_edit}</a>";
$action .= "<a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete this SMS autoreply scenario ?') . "','index.php?app=menu&inc=feature_sms_autoreply&op=sms_autoreply_scenario_del&autoreply_id={$autoreply_id}&autoreply_scenario_id=" . $db_row['autoreply_scenario_id'] . "')\">{$icon_delete}</a>";
$content .= "\n <tr>\n\t<td class={$td_class}> {$j}.</td>\n\t<td class={$td_class}>{$list_of_param}</td>\n\t<td class={$td_class}>" . $db_row['autoreply_scenario_result'] . "</td>\n\t<td class={$td_class}>{$owner}</td>\n\t<td class={$td_class} align=center>{$action}</td>\n </tr>\n\t";
}
$content .= "\n </table>\n\t <p>\n\t <input type=button value=\"" . _('Add SMS autoreply scenario') . "\" onClick=\"javascript:linkto('index.php?app=menu&inc=feature_sms_autoreply&op=sms_autoreply_scenario_add&autoreply_id={$autoreply_id}')\" class=\"button\" />\n\t </form>\n\t";
echo $content;
break;
case "sms_autoreply_del":
$autoreply_id = $_REQUEST['autoreply_id'];
$db_query = "SELECT autoreply_keyword FROM " . _DB_PREF_ . "_featureAutoreply WHERE autoreply_id='{$autoreply_id}'";
示例12: sms_collect_handle
function sms_collect_handle($c_uid, $sms_datetime, $sms_sender, $collect_keyword, $collect_param = '', $sms_receiver)
{
global $core_config;
global $web_title, $email_service, $email_footer, $gateway_module;
$ok = false;
$collect_keyword = strtoupper($collect_keyword);
$username = uid2username($c_uid);
$sms_to = $sms_sender;
// we are replying to this sender
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureCollect WHERE collect_keyword='{$collect_keyword}'";
$db_result = dba_query($db_query);
if ($db_row = dba_fetch_array($db_result)) {
if (!$db_row['collect_enable']) {
$message = _('Collect service inactive');
//list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
//$ok = $ok[0];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
$ok = $ret['status'];
return $ok;
}
}
$c_uid = $db_row['uid'];
$collect_id = $db_row['collect_id'];
$num_rows = dba_num_rows($db_query);
if ($num_rows) {
$msg1 = $db_row['collect_msg'];
$db_query = "INSERT INTO " . _DB_PREF_ . "_featureCollect_member (collect_id,collect_msg,member_number,member_since) VALUES ('{$collect_id}','{$collect_param}','{$sms_to}',now())";
$message = $msg1;
$logged = dba_query($db_query);
$ok = true;
$unicode = core_detect_unicode($message);
logger_print('to:' . $sms_to . ' m:' . $message, 3, "sms_collect_handle");
list($ok, $to, $smslog_id, $queue) = sendsms($username, $sms_to, $message, 'text', $unicode);
$ok = $ok[0];
// Forward to email as well if enable
$db_query = "SELECT collect_fwd_email FROM " . _DB_PREF_ . "_featureCollect WHERE collect_keyword='{$collect_keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
if ($email = $db_row['collect_fwd_email']) {
// get name from c_uid's phonebook
$c_username = uid2username($c_uid);
$c_name = phonebook_number2name($sms_sender, $c_username);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$subject = "[SMSGW-" . $collect_keyword . "] " . _('from') . " {$sms_sender}";
$body = _('Forward WebSMS') . " ({$web_title})\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('Keyword') . ": {$collect_keyword}\n\n";
$body .= _('Message') . ":\n{$collect_param}\n\n";
$body .= $email_footer . "\n\n";
sendmail($email_service, $email, $subject, $body);
logger_print("fwd email to:" . $email, "3", "sms_collect_handle");
}
//$ok = true;
} else {
$ok = false;
}
return $ok;
}
示例13: sms_subscribe_handle
function sms_subscribe_handle($c_uid, $sms_datetime, $sms_sender, $subscribe_keyword, $subscribe_param = '')
{
global $core_config;
$ok = false;
$subscribe_param = strtoupper($subscribe_param);
$subscribe_keyword = strtoupper($subscribe_keyword);
$username = uid2username($c_uid);
$sms_to = $sms_sender;
// we are replying to this sender
$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['subscribe_enable']) {
$message = _('Subscribe service inactive');
//list($ok,$to,$smslog_id) = sendsms_pv($username, $sms_to, $message);
//$ok = $ok[0];
$unicode = 0;
if (function_exists('mb_detect_encoding')) {
$encoding = mb_detect_encoding($message, 'auto');
if ($encoding != 'ASCII') {
$unicode = 1;
}
}
$ret = sendsms($core_config['main']['cfg_gateway_number'], '', $sms_to, $message, $c_uid, 0, 'text', $unicode);
$ok = $ret['status'];
return $ok;
}
}
$c_uid = $db_row['uid'];
$subscribe_id = $db_row['subscribe_id'];
$num_rows = dba_num_rows($db_query);
if ($num_rows) {
$msg1 = $db_row['subscribe_msg'];
$msg2 = $db_row['unsubscribe_msg'];
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe_member WHERE member_number='{$sms_to}' AND subscribe_id='{$subscribe_id}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$num_rows = dba_num_rows($db_query);
if ($num_rows == 0) {
$member = false;
$db_query = "INSERT INTO " . _DB_PREF_ . "_featureSubscribe_member (subscribe_id,member_number,member_since) VALUES ('{$subscribe_id}','{$sms_to}',now())";
switch ($subscribe_param) {
case "ON":
$message = $msg1;
$logged = dba_query($db_query);
$ok = true;
break;
case "IN":
$message = $msg1;
$logged = dba_query($db_query);
$ok = true;
break;
case "REG":
$message = $msg1;
$logged = dba_query($db_query);
$ok = true;
break;
case "OFF":
$message = _('You are not a member');
$ok = true;
break;
case "OUT":
$message = _('You are not a member');
$ok = true;
break;
case "UNREG":
$message = _('You are not a member');
$ok = true;
break;
default:
$message = _('Unknown SMS format');
$ok = true;
break;
}
} else {
$member = true;
$db_query = "DELETE FROM " . _DB_PREF_ . "_featureSubscribe_member WHERE member_number='{$sms_to}' AND subscribe_id='{$subscribe_id}'";
switch ($subscribe_param) {
case "OFF":
$message = $msg2;
$deleted = dba_query($db_query);
if ($deleted) {
$ok = true;
}
break;
case "OUT":
$message = $msg2;
$deleted = dba_query($db_query);
if ($deleted) {
$ok = true;
}
break;
case "UNREG":
$message = $msg2;
$deleted = dba_query($db_query);
if ($deleted) {
$ok = true;
}
break;
case "ON":
//.........这里部分代码省略.........
示例14: _
$content .= "\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td class={$td_class}> {$i}.</td>\n\t\t\t\t\t\t\t\t<td class={$td_class}>{$message}</td>\n\t\t\t\t\t\t\t\t<td class={$td_class}>{$repeat}</td>\n\t\t\t\t\t\t\t\t<td class={$td_class}>{$owner}</td>\n\t\t\t\t\t\t\t\t<td class={$td_class}>{$send_to}</td>\t\n\t\t\t\t\t\t\t\t<td class={$td_class}>{$autosend_status}</td>\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t<td class={$td_class} align=center>{$action}</td>\n\t\t\t\t\t\t\t</tr>";
}
$content .= "</table>";
echo $content;
echo "\n\t\t\t\t\t\t\t\t<p>\n\t\t\t\t\t\t\t\t<input type=button value=\"" . _('Add SMS autosend') . "\" onClick=\"javascript:linkto('index.php?app=menu&inc=feature_sms_autosend&op=sms_autosend_add')\" class=\"button\" />\n\t\t\t\t\t\t\t\t</p>\n\t\t\t\t\t\t\t\t";
break;
case "sms_autosend_view":
$autosend_id = $_REQUEST['autosend_id'];
if ($err) {
$content = "<div class=error_string>{$err}</div>";
}
$content .= "<h2>" . _('SMS autosend View') . "</h2>";
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutosend where autosend_id='{$autosend_id}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$owner = uid2username($db_row['uid']);
$send_to = $db_row['autosend_number'];
$autosend_status = "<font color=red>" . _('Disabled') . "</font>";
$message = $db_row['autosend_message'];
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutosend_time where autosend_id='{$autosend_id}'";
$db_result = dba_query($db_query);
$num_rows = dba_num_rows($db_query);
$db_row = dba_fetch_array($db_result);
$time = $db_row['autosend_time'];
if ($num_rows > "1") {
$repeat = $num_rows;
} else {
$repeat = _('Once');
}
$content .= "\n\t\t\t\t\t\t\t\t<table cellpadding=1 cellspacing=2 border=0 width=100%>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width=150>Owner</td><td width=5>:</td><td>{$owner}</td>\t\t \n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width=150>Message</td><td width=5>:</td><td>{$message}</td>\t\t \n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td width=150>Send to</td><td width=5>:</td><td>{$send_to}</td>\t\t \n\t\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<td>Repeat send</td><td width=5>:</td><td>{$repeat}</td>\t\t \n\t\t\t\t\t\t\t\t\t</tr>";
$db_result = dba_query($db_query);
示例15: _
if (!$data[$i]['started']) {
$c_started = $data[$i]['running'] == 2 ? "<a href='index.php?app=menu&inc=feature_sms_survey&op=start&sid=" . $c_sid . "'><font color='red'>" . _('restart') . "</font></a>" : "<a href='index.php?app=menu&inc=feature_sms_survey&op=start&sid=" . $c_sid . "'><font color='red'>" . _('no') . "</font></a>";
}
if (!$data[$i]['status']) {
$c_started = _('N/A');
}
$c_members = count(sms_survey_getmembers($c_sid));
$c_members = "<a href='index.php?app=menu&inc=feature_sms_survey&route=members&op=members&sid=" . $c_sid . "'>" . $c_members . "</a>";
$c_questions = count(sms_survey_getquestions($c_sid));
$c_questions = "<a href='index.php?app=menu&inc=feature_sms_survey&route=questions&op=questions&sid=" . $c_sid . "'>" . $c_questions . "</a>";
$c_action = "<a href='index.php?app=menu&inc=feature_sms_survey&op=edit&sid=" . $c_sid . "'>" . $icon_edit . "</a> ";
if (!$data[$i]['status']) {
$c_action .= "<a href='index.php?app=menu&inc=feature_sms_survey&op=del&sid=" . $c_sid . "'>" . $icon_delete . "</a> ";
}
$td_class = ($i + 1) % 2 ? "box_text_odd" : "box_text_even";
$content .= "\n\t\t\t\t<tr class='" . $td_class . "'>\n\t\t\t\t\t<td align='center'>" . ($i + 1) . ".</td>\n\t\t\t\t\t<td align='center'>" . uid2username($data[$i]['uid']) . "</td>\n\t\t\t\t\t<td align='center'>" . $data[$i]['keyword'] . "</td>\n\t\t\t\t\t<td align='center'>" . $data[$i]['title'] . "</td>\n\t\t\t\t\t<td align='center'>" . $c_members . "</td>\n\t\t\t\t\t<td align='center'>" . $c_questions . "</td>\n\t\t\t\t\t<td align='center'>" . $c_status . "</td>\n\t\t\t\t\t<td align='center'>" . $c_started . "</td>\n\t\t\t\t\t<td align='center'>" . $c_action . "</td>\n\t\t\t\t</tr>\n\t\t\t";
}
$content .= "\n\t\t\t</table>\n\t\t\t<form method='post' action='index.php?app=menu&inc=feature_sms_survey&op=add'>\n\t\t\t<p><input class='button' type='submit' value='" . _('Add survey') . "'></p>\n\t\t\t</form>\n\t\t";
echo $content;
break;
case 'add':
$content = '<h2>' . _('SMS Survey') . '</h2><p />';
if ($error_content) {
$content .= '<p>' . $error_content . '</p>';
}
$content .= '<h3>' . _('Add survey') . '</h3><p />';
$content .= "\n\t\t\t<form method='post' action='index.php?app=menu&inc=feature_sms_survey&op=add_submit'>\n\t\t\t<table cellpadding='1' cellspacing='2' border='0'>\n\t\t\t<tr><td>" . _('Keyword') . "</td><td>:</td><td><input type='text' name='keyword' maxlength='20' size='20'></td></tr>\n\t\t\t<tr><td>" . _('Title') . "</td><td>:</td><td><input type='text' name='title' maxlength='100' size='40'></td></tr>\n\t\t\t</table>\n\t\t\t<p><input class='button' type='submit' value='" . _('Submit') . "'></p>\n\t\t\t</form>\n\t\t";
echo $content;
break;
case 'add_submit':
$keyword = $_REQUEST['keyword'];