本文整理汇总了PHP中user_uid2username函数的典型用法代码示例。如果您正苦于以下问题:PHP user_uid2username函数的具体用法?PHP user_uid2username怎么用?PHP user_uid2username使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了user_uid2username函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_quiz_handle
function sms_quiz_handle($list, $sms_datetime, $sms_sender, $quiz_keyword, $quiz_param = '', $sms_receiver = '', $smsc = '', $raw_message = '')
{
global $core_config;
$ok = false;
$sms_to = $sms_sender;
// we are replying to this sender
$quiz_keyword = strtoupper(trim($quiz_keyword));
$quiz_param = strtoupper(trim($quiz_param));
if (($quiz_enable = $list['quiz_enable']) && $quiz_param) {
if (strtoupper($list['quiz_answer']) == $quiz_param) {
$message = $list['quiz_msg_correct'];
} else {
$message = $list['quiz_msg_incorrect'];
}
$quiz_id = $list['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}','" . core_get_datetime() . "')";
if ($logged = @dba_insert_id($db_query)) {
if ($message && ($username = user_uid2username($list['uid']))) {
$unicode = core_detect_unicode($message);
$message = addslashes($message);
list($ok, $to, $smslog_id, $queue) = sendsms_helper($username, $sms_to, $message, 'text', $unicode, $smsc);
}
$ok = true;
}
}
return $ok;
}
示例2: autorespond_hook_recvsms_intercept_after
function autorespond_hook_recvsms_intercept_after($sms_datetime, $sms_sender, $message, $sms_receiver, $feature, $status, $uid, $smsc)
{
$ret = array();
$hooked = FALSE;
// process only when the previous feature is not 'incoming'
if ($feature != 'incoming' && $status) {
return $ret;
}
if ($message) {
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureAutorespond WHERE flag_deleted='0'";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$continue = TRUE;
// only check sms receiver if set
if ($db_row['sms_receiver']) {
if ($sms_receiver != $db_row['sms_receiver']) {
$continue = FALSE;
}
}
if ($continue) {
// match SMS with regex
if (preg_match($db_row['regex'], $message)) {
// match found, send respond
$c_uid = $db_row['uid'];
$c_username = user_uid2username($c_uid);
$c_message = $db_row['message'];
if (core_detect_unicode($c_message)) {
$unicode = 1;
}
$smsc = gateway_decide_smsc($smsc, $db_row['smsc']);
_log("match found dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " uid:" . $c_uid . " username:" . $c_username . " service:[" . $db_row['service_name'] . "] regex:[" . $db_row['regex'] . "] m:[" . $message . "] smsc:" . $smsc, 3, "autorespond");
sendsms_helper($c_username, $sms_sender, $c_message, 'text', $unicode, $smsc);
// log it
$hooked = TRUE;
// found then stop
break;
}
}
}
}
if ($c_uid && $hooked) {
_log("hooked dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " uid:" . $c_uid . " username:" . $c_username . " service:[" . $db_row['service_name'] . "] regex:[" . $db_row['regex'] . "] m:[" . $message . "] smsc:" . $smsc, 3, "autorespond");
$ret['modified'] = TRUE;
$ret['param']['feature'] = 'autorespond';
$ret['param']['status'] = 1;
$ret['uid'] = $c_uid;
$ret['hooked'] = $hooked;
}
return $ret;
}
示例3: msgtemplate_hook_sendsms_intercept
function msgtemplate_hook_sendsms_intercept($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode, $smsc)
{
// parameters modified
$ret['modified'] = true;
// the modification to $sms_msg, case insensitive
$c_username = user_uid2username($uid);
$text = $sms_msg;
$text = str_ireplace('#NAME#', phonebook_number2name($sms_to, $c_username), $text);
$text = str_ireplace('#NUM#', $sms_to, $text);
$ret['param']['sms_msg'] = $text;
// log it
// logger_print("to:" . $sms_to . " msg:" . $sms_msg . " replacedby:" . $ret['param']['sms_msg'], 3, "msgtemplate");
return $ret;
}
示例4: stoplist_hook_blacklist_mobile_add
/**
* Add a mobile number to stoplist
*
* @param integer $uid
* User ID
* @param string $mobile
* single mobile number
* @return boolean TRUE on added
*/
function stoplist_hook_blacklist_mobile_add($uid, $mobile)
{
$ret = FALSE;
// if account exists
$uid = user_uid2username((int) $uid) ? (int) $uid : 1;
$items = array('uid' => $uid, 'mobile' => $mobile);
if (!blacklist_mobile_isexists(0, $mobile)) {
if ($new_id = dba_add(_DB_PREF_ . '_featureStoplist', $items)) {
_log('added mobile number to stoplist id:' . $new_id . ' mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_add');
$ret = TRUE;
}
} else {
_log('mobile number is already in stoplist mobile:' . $mobile . ' uid:' . $uid, 2, 'stoplist_hook_blacklist_mobile_remove');
$ret = TRUE;
}
return $ret;
}
示例5: sms_board_handle
function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '', $smsc = '', $raw_message = '')
{
global $web_title, $email_service, $email_footer;
$ok = false;
$board_keyword = strtoupper(trim($board_keyword));
$board_param = trim($board_param);
if ($sms_sender && $board_keyword && $board_param) {
// masked sender sets here
$masked_sender = substr_replace($sms_sender, 'xxxx', -4);
$db_query = "\n\t\t\tINSERT INTO " . _DB_PREF_ . "_featureBoard_log\n\t\t\t(in_gateway,in_sender,in_masked,in_keyword,in_msg,in_datetime)\n\t\t\tVALUES ('{$smsc}','{$sms_sender}','{$masked_sender}','{$board_keyword}','{$board_param}','" . core_get_datetime() . "')";
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 = user_uid2username($c_uid);
$c_name = phonebook_number2name($sms_sender, $c_username);
$sms_sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
$sms_datetime = core_display_datetime($sms_datetime);
$subject = "[" . $board_keyword . "] " . _('SMS board from') . " {$sms_sender}";
$body = $core_config['main']['web_title'] . "\n";
$body .= $core_config['http_path']['base'] . "\n\n";
$body .= _('Date and time') . ": {$sms_datetime}\n";
$body .= _('Sender') . ": {$sms_sender}\n";
$body .= _('Receiver') . ": {$sms_receiver}\n";
$body .= _('SMS board keyword') . ": {$board_keyword}\n\n";
$body .= _('Message') . ":\n{$board_param}\n\n";
$body .= $core_config['main']['email_footer'] . "\n\n";
$body = stripslashes($body);
$email_data = array('mail_from_name' => $core_config['main']['web_title'], 'mail_from' => $core_config['main']['email_service'], 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body);
sendmail($email_data);
}
$ok = true;
}
}
return $ok;
}
示例6: sms_custom_handle
function sms_custom_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $custom_keyword, $custom_param = '', $smsc = '', $raw_message = '')
{
$ok = false;
$custom_keyword = strtoupper(trim($custom_keyword));
$custom_param = trim($custom_param);
$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'];
$username = user_uid2username($db_row['uid']);
$custom_return_as_reply = $db_row['custom_return_as_reply'];
if ($custom_keyword && $custom_url && $username) {
$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);
$custom_url = str_replace("{CUSTOMRAW}", urlencode($raw_message), $custom_url);
logger_print("custom_url:" . $custom_url, 3, "sms custom");
$parsed_url = parse_url($custom_url);
$opts = array('http' => array('method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n", 'content' => $parsed_url['query']));
$context = stream_context_create($opts);
$server_url = explode('?', $custom_url);
$returns = file_get_contents($server_url[0], false, $context);
if ($custom_return_as_reply == 1) {
if ($returns = trim($returns)) {
$unicode = core_detect_unicode($returns);
$returns = addslashes($returns);
logger_print("returns:" . $returns, 3, "sms custom");
sendsms_helper($username, $sms_sender, $returns, 'text', $unicode, $smsc);
} else {
logger_print("returns empty", 3, "sms custom");
}
}
$ok = true;
}
return $ok;
}
示例7: sms_command_handle
function sms_command_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $command_keyword, $command_param = '', $smsc = '', $raw_message = '')
{
global $plugin_config;
$ok = false;
$command_keyword = strtoupper(trim($command_keyword));
$command_param = trim($command_param);
$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'];
$command_return_as_reply = $db_row['command_return_as_reply'];
$username = user_uid2username($db_row['uid']);
if ($command_keyword && $command_exec && $username) {
$sms_datetime = core_display_datetime($sms_datetime);
$command_exec = str_replace("{SMSDATETIME}", "\"{$sms_datetime}\"", $command_exec);
$command_exec = str_replace("{SMSSENDER}", escapeshellarg($sms_sender), $command_exec);
$command_exec = str_replace("{COMMANDKEYWORD}", escapeshellarg($command_keyword), $command_exec);
$command_exec = str_replace("{COMMANDPARAM}", escapeshellarg($command_param), $command_exec);
$command_exec = str_replace("{COMMANDRAW}", escapeshellarg($raw_message), $command_exec);
$command_exec = str_replace("/", "", $command_exec);
$command_exec = $plugin_config['sms_command']['bin'] . "/" . $db_row['uid'] . "/" . $command_exec;
$command_exec = escapeshellcmd($command_exec);
logger_print("command_exec:" . addslashes($command_exec), 3, "sms command");
$command_output = shell_exec($command_exec);
if ($command_return_as_reply == 1) {
$unicode = core_detect_unicode($command_output);
if ($command_output = addslashes(trim($command_output))) {
logger_print("command_output:" . $command_output, 3, "sms command");
sendsms_helper($username, $sms_sender, $command_output, 'text', $unicode, $smsc);
} else {
logger_print("command_output is empty", 3, "sms command");
}
}
$ok = true;
}
return $ok;
}
示例8: defined
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with playSMS. If not, see <http://www.gnu.org/licenses/>.
*/
defined('_SECURE_') or die('Forbidden');
if (!auth_isadmin()) {
auth_block();
}
$uid = $_REQUEST['uid'];
// if ban/unban action
if (_OP_ == 'unban') {
if (user_banned_remove($uid)) {
$_SESSION['dialog']['info'][] = _('Account has been unbanned') . ' (' . _('username') . ': ' . user_uid2username($uid) . ')';
} else {
$_SESSION['dialog']['info'][] = _('Unable to unban account') . ' (' . _('username') . ': ' . user_uid2username($uid) . ')';
}
header('Location: ' . _u('index.php?app=main&inc=feature_report&route=banned'));
exit;
}
// display whose online
if ($err = TRUE) {
$error_content = _dialog();
}
$tpl = array('name' => 'report_banned', 'vars' => array('Report' => _('Report'), 'Banned users list' => _('Banned users list'), 'DIALOG_DISPLAY' => $error_content, 'User' => _('User'), 'Email' => _('Email'), 'Ban date/time' => _('Ban date/time'), 'Action' => 'Action'));
// display admin users
$users = report_banned_admin();
foreach ($users as $user) {
$tpl['loops']['data'][] = array('tr_class' => $tr_class, 'username' => $user['username'], 'isadmin' => $user['icon_isadmin'], 'email' => $user['email'], 'bantime' => $user['bantime'], 'action' => $user['action_link']);
}
// display users
示例9: switch
switch (_OP_) {
case "stoplist_list":
$search_category = array(_('Mobile') => 'mobile', _('Username') => 'uid');
$base_url = 'index.php?app=main&inc=feature_stoplist&op=stoplist_list';
$search = themes_search($search_category, $base_url, array('uid' => 'user_username2uid'));
$keywords = $search['dba_keywords'];
$count = dba_count(_DB_PREF_ . '_featureStoplist', '', $keywords);
$nav = themes_nav($count, $search['url']);
$extras = array('ORDER BY' => 'uid', 'LIMIT' => $nav['limit'], 'OFFSET' => $nav['offset']);
$list = dba_search(_DB_PREF_ . '_featureStoplist', '*', '', $keywords, $extras);
$content = _dialog() . "\n\t\t\t<h2>" . _('Manage stoplist') . "</h2>\n\t\t\t<p>" . $search['form'] . "</p>\n\t\t\t<form name=fm_stoplist_list id=fm_stoplist_list action='index.php?app=main&inc=feature_stoplist&op=actions' method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=3>\n\t\t\t\t\t\t\t<div class=actions_box>\n\t\t\t\t\t\t\t\t<div class=pull-left>\n\t\t\t\t\t\t\t\t\t<a href='" . _u('index.php?app=main&inc=feature_stoplist&op=stoplist_add') . "'>" . $icon_config['add'] . "</a>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\t\t\t\t\t\$('#action_go').click(function(){\n\t\t\t\t\t\t\t\t\t\t\t\$('#fm_stoplist_list').submit();\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\t\t<div class=pull-right>\n\t\t\t\t\t\t\t\t\t<select name=go class=search_input_category>\n\t\t\t\t\t\t\t\t\t\t<option value=>" . _('Select') . "</option>\n\t\t\t\t\t\t\t\t\t\t<option value=delete>" . _('Delete') . "</option>\n\t\t\t\t\t\t\t\t\t</select>\n\t\t\t\t\t\t\t\t\t<a href='#' id=action_go>" . $icon_config['go'] . "</a>\n\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th width=45%>" . _('User') . "</th>\n\t\t\t\t\t\t<th width=50%>" . _('Blocked mobile') . "</th>\n\t\t\t\t\t\t<th width=5%><input type=checkbox onclick=CheckUncheckAll(document.fm_stoplist_list)></th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n\t\t\t<tbody>";
$i = $nav['top'];
$j = 0;
for ($j = 0; $j < count($list); $j++) {
$pid = $list[$j]['id'];
$username = user_uid2username($list[$j]['uid']);
$mobile = $list[$j]['mobile'];
$i--;
$c_i = "<a href=\"" . _u('index.php?app=main&inc=feature_stoplist&op=stoplist_edit&id=' . $pid) . "\">" . $i . ".</a>";
if ($list[$j]['uid'] == $user_config['uid']) {
$name = "<a href='" . _u('index.php?app=main&inc=feature_stoplist&op=stoplist_edit&pid=' . $pid) . "'>" . $name . "</a>";
}
$content .= "\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$username}</td>\n\t\t\t\t\t<td>{$mobile}</td>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<input type=hidden name=itemid[" . $j . "] value=\"{$pid}\">\n\t\t\t\t\t\t<input type=checkbox name=checkid[" . $j . "]>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>";
}
$content .= "\n\t\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t<div class=pull-right>" . $nav['form'] . "</div>\n\t\t\t</form>";
_p($content);
break;
case "actions":
$checkid = $_REQUEST['checkid'];
$itemid = $_REQUEST['itemid'];
$items = array();
示例10: dba_query
$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'];
$content .= "\n\t\t\t<h2>" . _('Manage autoreply') . "</h2>\n\t\t\t<p>" . _('SMS autoreply keyword') . ": " . $manage_autoreply_keyword . "</p>\n\t\t\t<p>" . _button('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_scenario_add&autoreply_id=' . $autoreply_id, _('Add SMS autoreply scenario')) . "</p>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead><tr>";
if (auth_isadmin()) {
$content .= "\n\t\t\t\t<th width=20%>" . _('SMS') . " " . _hint(_('SMS is case-insensitive')) . "</th>\n\t\t\t\t<th width=50%>" . _('Reply') . "</th>\n\t\t\t\t<th width=20%>" . _('User') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>";
} else {
$content .= "\n\t\t\t\t<th width=20%>" . _('SMS') . " " . _hint(_('SMS is case-insensitive')) . "</th>\n\t\t\t\t<th width=70%>" . _('Reply') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>";
}
$content .= "</tr></thead><tbody>";
$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)) {
if ($owner = user_uid2username($o_uid)) {
$list_of_param = "";
for ($i = 1; $i <= 7; $i++) {
$list_of_param .= $db_row['autoreply_scenario_param' . $i] . " ";
}
$action = "<a href=\"" . _u('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_scenario_edit&autoreply_id=' . $autoreply_id . '&autoreply_scenario_id=' . $db_row['autoreply_scenario_id']) . "\">" . $icon_config['edit'] . "</a>";
$action .= "<a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete this SMS autoreply scenario ?') . "','" . _u('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_scenario_del&autoreply_id=' . $autoreply_id . '&autoreply_scenario_id=' . $db_row['autoreply_scenario_id']) . "')\">" . $icon_config['delete'] . "</a>";
if (auth_isadmin()) {
$option_owner = "<td>" . $owner . "</td>";
}
$j++;
$content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $manage_autoreply_keyword . " " . $list_of_param . "</td>\n\t\t\t\t\t\t<td align=left>" . $db_row['autoreply_scenario_result'] . "</td>\n\t\t\t\t\t\t" . $option_owner . "\n\t\t\t\t\t\t<td>" . $action . "</td>\n\t\t\t\t\t</tr>";
}
}
$content .= "\n\t\t\t</tbody>\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t</form>\n\t\t\t<p>" . _button('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_scenario_add&autoreply_id=' . $autoreply_id, _('Add SMS autoreply scenario')) . "\n\t\t\t<p>" . _back('index.php?app=main&inc=feature_sms_autoreply&op=sms_autoreply_list');
if ($err = TRUE) {
示例11: dba_fetch_array
$db_row = dba_fetch_array($db_result);
$message = $db_row['msg'];
$counter = $db_row['counter'];
if ($err = $_SESSION['error_string']) {
$content = "<div class=error_string>{$err}</div>";
}
$content .= "\n\t\t\t<h2>" . _('Manage subscribe') . "</h2>\n\t\t\t<h3>" . _('Message detail') . "</h3>\n\t\t\t<form action=index.php?app=main&inc=feature_sms_subscribe&op=msg_send method=post>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<input type=hidden value={$message} name=msg>\n\t\t\t<input type=hidden value={$subscribe_id} name=subscribe_id>\n\t\t\t<input type=hidden value={$msg_id} name=msg_id>\n\t\t\t<table class=playsms-table>\n\t\t\t<tr><td class=label-sizer>" . _('SMS subscribe keyword') . "</td><td>{$subscribe_name}</td></tr>\n\t\t\t<tr><td>" . _('Message ID') . "</td><td>" . $msg_id . "</td></tr>\n\t\t\t<tr><td>" . _('Message') . "</td><td>" . $message . "</td></tr>\n\t\t\t<tr><td>" . _('Sent') . "</td><td>" . $counter . "</td></tr>\n\t\t\t</table>\n\t\t\t<br />\n\t\t\t<p>" . _('Send this message to all members') . "</p>\n\t\t\t<p><input type=submit value=\"" . _('Send') . "\" class=\"button\" />\n\t\t\t</form>\n\t\t\t<p>" . _back('index.php?app=main&inc=feature_sms_subscribe&op=msg_list&subscribe_id=' . $subscribe_id);
_p($content);
break;
case "msg_send":
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe WHERE subscribe_id='{$subscribe_id}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$smsc = $db_row['smsc'];
$c_uid = $db_row['uid'];
$username = user_uid2username($c_uid);
$msg_id = $_POST['msg_id'];
$db_query = "SELECT msg FROM " . _DB_PREF_ . "_featureSubscribe_msg WHERE subscribe_id='{$subscribe_id}' AND msg_id='{$msg_id}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$message = addslashes($db_row['msg']);
$counter = $db_row['counter'];
$db_query = "SELECT member_number FROM " . _DB_PREF_ . "_featureSubscribe_member WHERE subscribe_id='{$subscribe_id}'";
$db_result = dba_query($db_query);
$sms_to = '';
if ($message && $subscribe_id) {
while ($db_row = dba_fetch_array($db_result)) {
if ($member_number = $db_row['member_number']) {
$sms_to[] = $member_number;
}
}
示例12: mailsms_hook_playsmsd_once
function mailsms_hook_playsmsd_once($param)
{
if ($param != 'mailsms_fetch') {
return;
}
// get username
$username = user_uid2username($uid);
// _log('fetch uid:' . $uid . ' username:' . $username, 3, 'mailsms_hook_playsmsd_once');
$items_global = registry_search(0, 'features', 'mailsms');
$enable_fetch = $items_global['features']['mailsms']['enable_fetch'];
if (!$enable_fetch) {
return;
}
$ssl = $items_global['features']['mailsms']['ssl'] == 1 ? "/ssl" : "";
$novalidate_cert = $items_global['features']['mailsms']['novalidate_cert'] == 1 ? "/novalidate-cert" : "";
$email_hostname = '{' . $items_global['features']['mailsms']['server'] . ':' . $items_global['features']['mailsms']['port'] . '/' . $items_global['features']['mailsms']['protocol'] . $ssl . $novalidate_cert . '}INBOX';
$email_username = $items_global['features']['mailsms']['username'];
$email_password = $items_global['features']['mailsms']['password'];
// _log('fetch ' . $email_username . ' at ' . $email_hostname, 3, 'mailsms_hook_playsmsd_once');
// open mailbox
$inbox = imap_open($email_hostname, $email_username, $email_password);
if (!$inbox) {
$errors = imap_errors();
foreach ($errors as $error) {
// _log('error:' . $error, 3, 'mailsms_hook_playsmsd_once');
}
return;
}
$emails = imap_search($inbox, 'UNSEEN');
if (count($emails)) {
rsort($emails);
foreach ($emails as $email_number) {
$overview = imap_fetch_overview($inbox, $email_number, 0);
$email_subject = trim($overview[0]->subject);
$email_sender = trim($overview[0]->from);
$email_body = trim(imap_fetchbody($inbox, $email_number, 1));
_log('email from:[' . $email_sender . '] subject:[' . $email_subject . '] body:[' . $email_body . ']', 3, 'mailsms_hook_playsmsd');
$e = preg_replace('/\\s+/', ' ', trim($email_subject));
$f = preg_split('/ +/', $e);
$sender_username = str_replace('@', '', $f[0]);
// in case user use @username
$sender_pin = $f[1];
//$message = str_replace($sender_username . ' ' . $sender_pin . ' ', '', $email_subject);
$c_message = preg_split("/[\\s]+/", $email_subject, 3);
$message = $c_message[2];
$sender = user_getdatabyusername($sender_username);
if ($sender['uid']) {
$items = registry_search($sender['uid'], 'features', 'mailsms_user');
$pin = $items['features']['mailsms_user']['pin'];
if ($sender_pin && $pin && $sender_pin == $pin) {
if ($items_global['features']['mailsms']['check_sender']) {
preg_match('#\\<(.*?)\\>#', $email_sender, $match);
$sender_email = $match[1];
if ($sender['email'] != $sender_email) {
_log('check_sender:1 unknown sender from:' . $sender_email . ' uid:' . $sender['uid'] . ' e:' . $sender['email'], 3, 'mailsms_hook_playsmsd_once');
continue;
}
}
} else {
_log('invalid pin uid:' . $sender['uid'] . ' sender_pin:[' . $sender_pin . ']', 3, 'mailsms_hook_playsmsd_once');
continue;
}
} else {
_log('invalid username sender_username:[' . $sender_username . ']', 3, 'mailsms_hook_playsmsd_once');
continue;
}
// destination numbers is in array and retrieved from email body
// remove email footer/signiture
$sms_to = preg_replace('/--[\\r\\n]+.*/s', '', $email_body);
$sms_to = explode(',', $sms_to);
// sendsms
if ($sender_username && count($sms_to) && $message) {
_log('mailsms uid:' . $sender['uid'] . ' from:[' . $sender_email . '] username:[' . $sender_username . ']', 3, 'mailsms_hook_playsmsd_once');
list($ok, $to, $smslog_id, $queue, $counts, $sms_count, $sms_failed) = sendsms_helper($sender_username, $sms_to, $message, '', '', '', '', '', '', $reference_id);
}
}
}
// close mailbox
imap_close($inbox);
}
示例13: unset
unset($smsc_list);
$list = gateway_getall_smsc();
foreach ($list as $c_smsc) {
$smsc_list[] = $c_smsc['name'];
}
foreach ($smsc_list as $smsc_name) {
$select_smsc .= "<option>" . $smsc_name . "</option>";
}
$select_smsc .= "</select>";
$content .= "\n\t\t\t<h2>" . _('Route outgoing SMS') . "</h2>\n\t\t\t<h3>" . _('Add route') . "</h3>\n\t\t\t<form action='index.php?app=main&inc=feature_outgoing&op=outgoing_add_yes' method='post'>\n\t\t\t" . _CSRF_FORM_ . "\n\t\t\t<table class=playsms-table>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('User') . "</td><td>" . $select_users . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Destination name')) . "</td><td><input type='text' maxlength='30' name='add_dst' value=\"{$add_dst}\" required></td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _mandatory(_('Prefix')) . "</td><td><input type='text' maxlength=8 name='add_prefix' value=\"{$add_prefix}\" required> " . _hint(_('Maximum 8 digits numeric only')) . "</td>\n\t\t\t</tr>\n\t\t\t<tr>\n\t\t\t\t<td class=label-sizer>" . _('SMSC') . "</td><td>" . $select_smsc . "</td>\n\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<input type='submit' class='button' value='" . _('Save') . "'>\n\t\t\t</form>\n\t\t\t" . _back('index.php?app=main&inc=feature_outgoing&op=outgoing_list');
_p($content);
break;
case "outgoing_add_yes":
$add_uid = $_REQUEST['add_uid'];
if ($add_uid) {
$add_username = user_uid2username($add_uid);
if (!$add_username) {
$add_uid = 0;
}
}
$add_dst = $_POST['add_dst'];
$add_prefix = $_POST['add_prefix'];
$add_prefix = core_sanitize_numeric($add_prefix);
$add_prefix = (string) substr($add_prefix, 0, 8);
$add_smsc = $_POST['add_smsc'] ? $_POST['add_smsc'] : 'blocked';
if ($add_dst) {
$db_query = "\n\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_featureOutgoing (uid,dst,prefix,smsc)\n\t\t\t\t\tVALUES ('{$add_uid}','{$add_dst}','{$add_prefix}','{$add_smsc}')";
if ($new_uid = @dba_insert_id($db_query)) {
$_SESSION['error_string'] = _('Route has been added') . " (" . _('destination') . ": {$add_dst}, " . _('prefix') . ": {$add_prefix})";
}
} else {
示例14: array
$sms_sender = $r['from'];
$message = $r['message'];
$sms_receiver = $r['sent_to'];
$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");
示例15: queuelog_countall
$count = queuelog_countall();
if ($count) {
$content .= "<p><a href=\"javascript: ConfirmURL('" . addslashes(_("Are you sure you want to delete ALL queues")) . " ?','" . _u('index.php?app=main&inc=feature_queuelog&op=queuelog_delete_all') . "')\">" . $icon_config['delete'] . _("Delete ALL queues") . " ({$count})</a></p>";
}
$content .= "<div align=center>" . $nav['form'] . "</div>\n\t\t\t<div class=table-responsive>\n\t\t\t<table class=playsms-table-list>\n\t\t\t<thead>\n\t\t\t<tr>\n\t\t";
if (auth_isadmin()) {
$content .= "\n\t\t\t\t<th width=20%>" . _('Queue Code') . "</th>\n\t\t\t\t<th width=15%>" . _('User') . "</th>\n\t\t\t";
} else {
$content .= "\n\t\t\t\t<th width=30%>" . _('Queue Code') . "</th>\n\t\t\t";
}
$content .= "\n\t\t\t\t<th width=15%>" . _('Scheduled') . "</th>\n\t\t\t\t<th width=10%>" . _('Count') . "</th>\n\t\t\t\t<th width=30%>" . _('Message') . "</th>\n\t\t\t\t<th width=10%>" . _('Action') . "</th>\n\t\t\t</tr>\n\t\t\t</thead>\n\t\t\t<tbody>\n\t\t";
$data = queuelog_get($nav['limit'], $nav['offset']);
for ($c = count($data) - 1; $c >= 0; $c--) {
$c_queue_code = $data[$c]['queue_code'];
$c_datetime_scheduled = core_display_datetime($data[$c]['datetime_scheduled']);
$c_username = user_uid2username($data[$c]['uid']);
// total number of SMS in queue
$c_count = $data[$c]['sms_count'];
$c_message = stripslashes(core_display_text($data[$c]['message']));
$c_action = "<a href=\"javascript: ConfirmURL('" . addslashes(_("Are you sure you want to delete queue")) . " " . $c_queue_code . " ?','" . _u('index.php?app=main&inc=feature_queuelog&op=queuelog_delete&queue=' . $c_queue_code) . "')\">" . $icon_config['delete'] . "</a>";
$content .= "\n\t\t\t\t<tr>\n\t\t\t";
if (auth_isadmin()) {
$content .= "\n\t\t\t\t\t<td>" . $c_queue_code . "</td>\n\t\t\t\t\t<td>" . $c_username . "</td>\n\t\t\t\t";
} else {
$content .= "\n\t\t\t\t\t<td>" . $c_queue_code . "</td>\n\t\t\t\t";
}
$content .= "\n\t\t\t\t\t<td>" . $c_datetime_scheduled . "</td>\n\t\t\t\t\t<td>" . $c_count . "</td>\n\t\t\t\t\t<td>" . $c_message . "</td>\n\t\t\t\t\t<td>" . $c_action . "</td>\n\t\t\t\t</tr>\n\t\t\t";
}
$content .= "\n\t\t\t</tbody></table>\n\t\t\t</div>\n\t\t\t<div align=center>" . $nav['form'] . "</div>\n\t\t";
_p($content);
break;