本文整理汇总了PHP中dba_num_rows函数的典型用法代码示例。如果您正苦于以下问题:PHP dba_num_rows函数的具体用法?PHP dba_num_rows怎么用?PHP dba_num_rows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dba_num_rows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sms_custom_hook_keyword_isavail
/**
* Implementations of hook keyword_isavail()
*
* @param string $keyword
* Keyword
* @param string $sms_receiver
* Receiver number
* @return boolean TRUE if keyword is available
*/
function sms_custom_hook_keyword_isavail($keyword, $sms_receiver)
{
$found = FALSE;
$keyword = trim(strtoupper($keyword));
$sms_receiver = trim($sms_receiver);
// check with receiver number empty, a catchall
$db_query = "SELECT custom_id FROM " . _DB_PREF_ . "_featureCustom WHERE (custom_keyword='{$keyword}' OR custom_keyword LIKE '{$keyword} %' OR custom_keyword LIKE '% {$keyword}' OR custom_keyword LIKE '% {$keyword} %') AND sms_receiver=''";
if ($db_result = dba_num_rows($db_query)) {
$found = TRUE;
}
// if no cathall
if (!$found) {
if ($sms_receiver) {
$db_query = "SELECT custom_id FROM " . _DB_PREF_ . "_featureCustom WHERE (custom_keyword='{$keyword}' OR custom_keyword LIKE '{$keyword} %' OR custom_keyword LIKE '% {$keyword}' OR custom_keyword LIKE '% {$keyword} %') AND sms_receiver='{$sms_receiver}'";
} else {
$db_query = "SELECT custom_id FROM " . _DB_PREF_ . "_featureCustom WHERE (custom_keyword='{$keyword}' OR custom_keyword LIKE '{$keyword} %' OR custom_keyword LIKE '% {$keyword}' OR custom_keyword LIKE '% {$keyword} %')";
}
if ($db_result = dba_num_rows($db_query)) {
$found = TRUE;
}
}
// found means not available
$ret = !$found;
return $ret;
}
示例2: inboxgroup_hook_checkavailablekeyword
function inboxgroup_hook_checkavailablekeyword($keyword)
{
$ok = true;
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featureInboxgroup WHERE keywords LIKE '%{$keyword}%'";
if ($db_result = dba_num_rows($db_query)) {
$ok = false;
}
return $ok;
}
示例3: sms_autoreply_hook_checkavailablekeyword
function sms_autoreply_hook_checkavailablekeyword($keyword)
{
$ok = true;
$db_query = "SELECT autoreply_id FROM " . _DB_PREF_ . "_featureAutoreply WHERE autoreply_keyword='{$keyword}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = false;
}
return $ok;
}
示例4: sms_quiz_hook_keyword_isavail
/**
* Implementations of hook keyword_isavail()
*
* @param $keyword keyword_isavail()
* will insert keyword for checking to the hook here
* @return TRUE if keyword is available
*/
function sms_quiz_hook_keyword_isavail($keyword)
{
$ok = true;
$db_query = "SELECT quiz_id FROM " . _DB_PREF_ . "_featureQuiz WHERE quiz_keyword='{$keyword}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = false;
}
return $ok;
}
示例5: sms_board_hook_checkavailablekeyword
function sms_board_hook_checkavailablekeyword($keyword)
{
$ok = true;
$db_query = "SELECT board_id FROM " . _DB_PREF_ . "_featureBoard WHERE board_keyword='{$keyword}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = false;
}
return $ok;
}
示例6: inboxgroup_hook_keyword_isavail
function inboxgroup_hook_keyword_isavail($keyword)
{
$ok = true;
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featureInboxgroup WHERE keywords LIKE '%{$keyword}%' AND deleted='0'";
if ($db_result = dba_num_rows($db_query)) {
$ok = false;
}
return $ok;
}
示例7: sms_poll_hook_webservices_output
function sms_poll_hook_webservices_output($ta, $requests)
{
global $http_path, $themes_module;
$keyword = $requests['keyword'];
$db_query = "SELECT poll_id,poll_title FROM " . _DB_PREF_ . "_featurePoll WHERE poll_keyword='{$keyword}'";
$db_result = dba_query($db_query);
$db_row = dba_fetch_array($db_result);
$poll_id = $db_row['poll_id'];
$poll_title = $db_row['poll_title'];
$db_query = "SELECT result_id FROM " . _DB_PREF_ . "_featurePoll_log WHERE poll_id='{$poll_id}'";
$total_voters = @dba_num_rows($db_query);
if ($poll_id) {
$mult = $requests['mult'];
$bodybgcolor = $requests['bodybgcolor'];
if (!isset($mult)) {
$mult = "2";
}
if (!isset($bodybgcolor)) {
$bodybgcolor = "#FEFEFE";
}
$content = "\n\t <html>\n\t <head>\n\t <title>{$web_title}</title>\n\t <meta name=\"author\" content=\"http://playsms.org\">\n\t <link rel=\"stylesheet\" type=\"text/css\" href=\"" . $http_path['themes'] . "/" . $themes_module . "/jscss/common.css\">\n\t </head>\n\t <body bgcolor=\"{$bodybgcolor}\" topmargin=\"0\" leftmargin\"0\">\n\t <table cellpadding=1 cellspacing=1 border=0>\n\t <tr><td colspan=2 width=100% class=box_text><font size=-2>{$poll_title}</font></td></tr>\n\t";
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featurePoll_choice WHERE poll_id='{$poll_id}' ORDER BY choice_keyword";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$choice_id = $db_row['choice_id'];
$choice_title = $db_row['choice_title'];
$choice_keyword = $db_row['choice_keyword'];
$db_query1 = "SELECT result_id FROM " . _DB_PREF_ . "_featurePoll_log WHERE poll_id='{$poll_id}' AND choice_id='{$choice_id}'";
$choice_voted = @dba_num_rows($db_query1);
if ($total_voters) {
$percentage = round($choice_voted / $total_voters * 100);
} else {
$percentage = "0";
}
$content .= "\n\t\t<tr>\n\t\t <td width=90% nowrap class=box_text valign=middle align=left>\n\t\t\t<font size=-2>[' <b>{$choice_keyword}</b> '] {$choice_title}</font>\n\t\t </td>\n\t\t <td width=10% nowrap class=box_text valign=middle align=right>\n\t\t\t<font size=-2>{$percentage}%, {$choice_voted}</font>\n\t\t </td>\n\t\t</tr>\n\t\t<tr>\n\t\t <td width=100% nowrap class=box_text valign=middle align=left colspan=2>\n\t\t\t<img src=\"" . $http_path['themes'] . "/" . $themes_module . "/images/bar.gif\" height=\"12\" width=\"" . $mult * $percentage . "\" alt=\"" . $percentage . "% ({$choice_voted})\"></font><br>\n\t\t </td>\n\t\t</tr>\n\t ";
}
$content .= "\n\t <tr><td colspan=2><font size=-2><b>Total: {$total_voters}</b></font></td></tr>\n\t </table>\n\t </body>\n\t </html>\n\t";
$ret = $content;
}
return $ret;
}
示例8: dba_query
$content .= "\n\t\t\t</tr></thead>\n\t\t\t<tbody>";
$i = 0;
if (!auth_isadmin()) {
$query_user_only = "WHERE uid='" . $user_config['uid'] . "'";
}
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe " . $query_user_only . " ORDER BY subscribe_id";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
if ($owner = user_uid2username($db_row['uid'])) {
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe_member WHERE subscribe_id = '" . $db_row['subscribe_id'] . "'";
$members = @dba_num_rows($db_query);
if (!$members) {
$members = 0;
}
$db_query = "SELECT * FROM " . _DB_PREF_ . "_featureSubscribe_msg WHERE subscribe_id = '" . $db_row['subscribe_id'] . "'";
$messages = @dba_num_rows($db_query);
if (!$messages) {
$messages = 0;
}
$subscribe_status = "<a href=\"" . _u('index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_status&subscribe_id=' . $db_row['subscribe_id'] . '&ps=1') . "\"><span class=status_disabled /></a>";
if ($db_row['subscribe_enable']) {
$subscribe_status = "<a href=\"" . _u('index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_status&subscribe_id=' . $db_row['subscribe_id'] . '&ps=0') . "\"><span class=status_enabled /></a>";
}
$action = "<a href=\"" . _u('index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_edit&subscribe_id=' . $db_row['subscribe_id']) . "\">" . $icon_config['edit'] . "</a> ";
$action .= "<a href=\"javascript: ConfirmURL('" . _('Are you sure you want to delete SMS subscribe ?') . " (" . _('keyword') . ": " . $db_row['subscribe_keyword'] . ")','" . _u('index.php?app=main&inc=feature_sms_subscribe&op=sms_subscribe_del&subscribe_id=' . $db_row['subscribe_id']) . "')\">" . $icon_config['delete'] . "</a>";
if (auth_isadmin()) {
$option_owner = "<td>{$owner}</td>";
}
$i++;
$content .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td>" . $db_row['subscribe_keyword'] . "</td>\n\t\t\t\t\t\t<td><a href=\"" . _u('index.php?app=main&inc=feature_sms_subscribe&op=mbr_list&subscribe_id=' . $db_row['subscribe_id']) . "\">" . $members . "</a></td>\n\t\t\t\t\t\t<td><a href=\"" . _u('index.php?app=main&inc=feature_sms_subscribe&op=msg_list&subscribe_id=' . $db_row['subscribe_id']) . "\">" . $messages . "</a></td>\n\t\t\t\t\t\t" . $option_owner . "\n\t\t\t\t\t\t<td>{$subscribe_status}</td>\n\t\t\t\t\t\t<td>{$action}</td>\n\t\t\t\t\t</tr>";
}
示例9: dba_query
$db_query1 = "SELECT * FROM playsms_tblUserPhonebook WHERE gpid='$gpid' AND uid='$uid'";
$db_result1 = dba_query($db_query1);
while ($db_row1 = dba_fetch_array($db_result1))
{
$list_of_phonenumber .= "[<a href=\"javascript:ConfirmURL('Are you sure you want to delete mobiles number `$db_row1[p_num]` owned by `$db_row1[p_desc]` ?','menu.php?inc=phone_del&op=user&pid=$db_row1[pid]')\">x</a>] <font size=-1>Number: <font color=darkgreen>$db_row1[p_num]</font> - Owner: <font color=darkgreen>$db_row1[p_desc]</font> [<a href=\"javascript: PopupSendSms('PV','$db_row1[p_num]')\">send</a>]<br>\n";
}
$list_of_phonenumber .= "<br>";
}
*/
$db_query = "SELECT * FROM playsms_tblUserGroupPhonebook WHERE uid='{$uid}' ORDER BY gp_name";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$gpid = $db_row[gpid];
$fm_name = "fm_phonebook_" . $db_row[gp_code];
$db_query1 = "SELECT gpidpublic FROM playsms_tblUserGroupPhonebook_public WHERE uid='{$uid}' AND gpid='{$gpid}'";
$db_result1 = dba_num_rows($db_query1);
if ($db_result1 > 0) {
$option_public = "<a href=\"menu.php?inc=phonebook&op=hide_from_public&gpid={$gpid}\">[ hide from public ]</a>";
} else {
$option_public = "<a href=\"menu.php?inc=phonebook&op=share_this_group&gpid={$gpid}\">[ share this group ]</a>";
}
$option_group_edit = "<a href=\"menu.php?inc=dir_edit&op=edit&gpid={$gpid}\">[ edit ]</a>";
// WWW 041208
$option_group_export = "<a href=\"menu.php?inc=phonebook_exim&op=export&gpid={$gpid}\">[ export ]</a>";
$option_group_import = "<a href=\"menu.php?inc=phonebook_exim&op=import&gpid={$gpid}\">[ import ]</a>";
$list_of_phonenumber .= "\r\n\t\t<form name=\"{$fm_name}\" action=\"menu.php?inc=phonebook\" method=post>\r\n\t\t<p>[<a href=\"javascript:ConfirmURL('Are you sure you want to delete group `{$db_row['gp_name']}` with all its members ?','menu.php?inc=phone_del&op=group&gpid={$gpid}')\">x</a>] Group: {$db_row['gp_name']} - code: {$db_row['gp_code']} <a href=\"javascript: PopupSendSms('BC','{$db_row['gp_code']}')\">[ send ]</a> {$option_public} {$option_group_edit} {$option_group_export} {$option_group_import}\r\n\t\t<table width=100% cellpadding=0 cellspacing=0 border=1>\r\n\t\t<tr>\r\n\t\t <td class=box_title width=4> * </td>\r\n\t\t <td class=box_title width=35%>Owner</td>\r\n\t\t <td class=box_title width=25%>Number</td>\r\n\t\t <td class=box_title width=40%>Email</td>\r\n\t\t <td class=box_title width=4><input type=checkbox onclick=CheckUncheckAll(document." . $fm_name . ")></td>\r\n\t\t</tr>\r\n\t ";
$db_query1 = "SELECT * FROM playsms_tblUserPhonebook WHERE gpid='{$gpid}' AND uid='{$uid}' ORDER BY p_desc";
$db_result1 = dba_query($db_query1);
$i = 0;
while ($db_row1 = dba_fetch_array($db_result1)) {
// $list_of_phonenumber .= "[<a href=\"javascript:ConfirmURL('Are you sure you want to delete mobiles number `$db_row1[p_num]` owned by `$db_row1[p_desc]` ?','menu.php?inc=phone_del&op=user&pid=$db_row1[pid]')\">x</a>] <font size=-1>Number: <font color=darkgreen>$db_row1[p_num]</font> - Owner: <font color=darkgreen>$db_row1[p_desc]</font> [<a href=\"javascript: PopupSendSms('PV','$db_row1[p_num]')\">send</a>]<br>\n";
示例10: array
}
} else {
$items = array('uid' => $uid, 'name' => $name, 'mobile' => sendsms_getvalidnumber($mobile), 'email' => $email, 'tags' => $tags);
if ($c_pid = dba_add(_DB_PREF_ . '_featurePhonebook', $items)) {
if ($gpid) {
$save_to_group = TRUE;
} else {
_log('contact added pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
}
} else {
_log('fail to add contact pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email . ' tags:[' . $tags . ']', 3, 'phonebook_add');
}
}
if ($save_to_group && $gpid) {
$db_query = "SELECT id FROM " . _DB_PREF_ . "_featurePhonebook_group_contacts WHERE gpid='" . $gpid . "' AND pid='" . $c_pid . "' LIMIT 1";
if (dba_num_rows($db_query) > 0) {
_log('contact already in the group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
} else {
$items = array('gpid' => $gpid, 'pid' => $c_pid);
if (dba_add(_DB_PREF_ . '_featurePhonebook_group_contacts', $items)) {
_log('contact added to group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
} else {
_log('contact added but fail to save in group gpid:' . $gpid . ' pid:' . $c_pid . ' m:' . $mobile . ' n:' . $name . ' e:' . $email, 3, 'phonebook_add');
}
}
}
// $i++;
// _log("no:".$i." gpid:".$gpid." uid:".$uid." name:".$name." mobile:".$mobile." email:".$email, 3, "phonebook import");
}
unset($gpid);
}
示例11: _
$poll_title = $db_row['poll_title'];
if ($poll_title) {
$db_query = "DELETE FROM " . _DB_PREF_ . "_featurePoll WHERE poll_title='{$poll_title}'";
if (@dba_affected_rows($db_query)) {
$error_string = _('SMS poll with all its messages has been deleted') . " (" . _('title') . ": `{$poll_title}`)";
}
}
header("Location: index.php?app=menu&inc=feature_sms_poll&op=sms_poll_list&err=" . urlencode($error_string));
break;
case "sms_poll_choice_add":
$poll_id = $_POST['poll_id'];
$add_choice_title = $_POST['add_choice_title'];
$add_choice_keyword = strtoupper($_POST['add_choice_keyword']);
if ($poll_id && $add_choice_title && $add_choice_keyword) {
$db_query = "SELECT choice_id FROM " . _DB_PREF_ . "_featurePoll_choice WHERE poll_id='{$poll_id}' AND choice_keyword='{$add_choice_keyword}'";
$db_result = @dba_num_rows($db_query);
if (!$db_result) {
$db_query = "\n\t\t INSERT INTO " . _DB_PREF_ . "_featurePoll_choice \n\t\t (poll_id,choice_title,choice_keyword)\n\t\t VALUES ('{$poll_id}','{$add_choice_title}','{$add_choice_keyword}')\n\t\t";
if ($db_result = @dba_insert_id($db_query)) {
$error_string = _('Choice has been added') . " (" . _('keyword') . ": `{$add_choice_keyword}`)";
}
} else {
$error_string = _('Choice already exists') . " (" . _('keyword') . ": `{$add_choice_keyword}`)";
}
} else {
$error_string = _('You must fill all fields');
}
header("Location: index.php?app=menu&inc=feature_sms_poll&op=sms_poll_edit&poll_id={$poll_id}&err=" . urlencode($error_string));
break;
case "sms_poll_choice_del":
$poll_id = $_REQUEST['poll_id'];
示例12: kannel_gw_set_delivery_status
function kannel_gw_set_delivery_status($smslog_id, $uid, $kannel_dlr)
{
$playsms_dlr = convertKannelDlrToPlaysmsDlr($kannel_dlr);
setsmsdeliverystatus($smslog_id, $uid, $playsms_dlr);
// log dlr
$db_query = "SELECT kannel_dlr_id FROM playsms_gwmodKannel_dlr WHERE smslog_id='{$smslog_id}'";
$db_result = dba_num_rows($db_query);
if ($db_result > 0) {
$db_query = "UPDATE playsms_gwmodKannel_dlr SET kannel_dlr_type='{$kannel_dlr}' WHERE smslog_id='{$smslog_id}'";
$db_result = dba_query($db_query);
} else {
$db_query = "INSERT INTO playsms_gwmodKannel_dlr (smslog_id,kannel_dlr_type) VALUES ('{$smslog_id}','{$kannel_dlr}')";
$db_result = dba_query($db_query);
}
}
示例13: dba_query
$bodybgcolor = $_GET[bodybgcolor];
if (!isset($mult)) {
$mult = "2";
}
if (!isset($bodybgcolor)) {
$bodybgcolor = "#FEFEFE";
}
$content = "\n\t\t\t\t<html>\n\t\t\t\t<head>\n\t\t\t\t<title>{$web_title}</title>\n\t\t\t\t<meta name=\"author\" content=\"http://playsms.sourceforge.net\">\n\t\t\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"./inc/jscss/common.css\">\n\t\t\t\t</head>\n\t\t\t\t<body bgcolor=\"{$bodybgcolor}\" topmargin=\"0\" leftmargin\"0\">\n\t\t\t\t<table cellpadding=1 cellspacing=1 border=0>\n\t\t\t\t<tr><td colspan=2 width=100% class=box_text><font size=-2>{$poll_title}</font></td></tr>\n\t\t\t ";
$db_query = "SELECT * FROM playsms_featPoll_choice WHERE poll_id='{$poll_id}' ORDER BY choice_code";
$db_result = dba_query($db_query);
while ($db_row = dba_fetch_array($db_result)) {
$choice_id = $db_row[choice_id];
$choice_title = $db_row[choice_title];
$choice_code = $db_row[choice_code];
$db_query1 = "SELECT result_id FROM playsms_featPoll_result WHERE poll_id='{$poll_id}' AND choice_id='{$choice_id}'";
$choice_voted = @dba_num_rows($db_query1);
if ($total_voters) {
$percentage = round($choice_voted / $total_voters * 100);
} else {
$percentage = "0";
}
$content .= "\n\t\t\t\t\t <tr>\n\t\t\t\t\t\t<td width=90% nowrap class=box_text valign=middle align=left>\n\t\t\t\t\t\t <font size=-2>[ <b>{$choice_code}</b> ] {$choice_title}</font>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t\t<td width=10% nowrap class=box_text valign=middle align=right>\n\t\t\t\t\t\t <font size=-2>{$percentage}%, {$choice_voted}</font>\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<td width=100% nowrap class=box_text valign=middle align=left colspan=2>\n\t\t\t\t\t\t <img src=\"./images/bar.gif\" height=\"12\" width=\"" . $mult * $percentage . "\" alt=\"" . $percentage . "% ({$choice_voted})\"></font><br>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t </tr>\n\t\t\t\t\t";
}
$content .= "\n\t\t\t\t<tr><td colspan=2><font size=-2><b>Total: {$total_voters}</b></font></td></tr>\n\t\t\t\t</table>\n\t\t\t\t</body>\n\t\t\t\t</html>\n\t\t\t ";
echo $content;
}
break;
case "board":
default:
// Use code, tag deprecated
$code = $_GET[code];
示例14: setsmsincomingaction
function setsmsincomingaction($sms_datetime, $sms_sender, $message)
{
global $system_from;
$ok = false;
$keywords = explode(' ', $message);
$target_code = strtoupper($keywords[0]);
switch ($target_code) {
case 'BC':
$array_target_group = explode(" ", $message);
$target_group = strtoupper(trim($array_target_group[0]));
$message = $array_target_group[1];
for ($i = 2; $i < count($array_target_group); $i++) {
$message .= " " . $array_target_group[$i];
}
if (send2group($sms_sender, $target_group, $message)) {
$ok = true;
}
break;
case 'PV':
$array_target_user = explode(" ", $message);
$target_user = strtoupper(trim($array_target_user[0]));
$message = $array_target_user[1];
for ($i = 2; $i < count($array_target_user); $i++) {
$message .= " " . $array_target_user[$i];
}
if (insertsmstoinbox($sms_datetime, $sms_sender, $target_user, $message)) {
$ok = true;
}
break;
default:
// try as autoreply
$ok = processAutoreply($sms_datetime, $sms_sender, $message);
// maybe its for sms poll
if (!$ok) {
$db_query = "SELECT poll_id FROM playsms_featPoll WHERE poll_code='{$target_code}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = savepoll($sms_sender, $target_code, $message);
}
}
// or maybe its for sms command
if (!$ok) {
$db_query = "SELECT command_id FROM playsms_featCommand WHERE command_code='{$target_code}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = execcommand($sms_datetime, $sms_sender, $target_code, $message);
}
}
// or maybe its for sms custom
if (!$ok) {
$db_query = "SELECT custom_id FROM playsms_featCustom WHERE custom_code='{$target_code}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = processcustom($sms_datetime, $sms_sender, $target_code, $message);
}
}
// its for sms board
if (!$ok) {
$db_query = "SELECT board_id FROM playsms_featBoard WHERE board_code='{$target_code}'";
if ($db_result = dba_num_rows($db_query)) {
$ok = insertsmstodb($sms_datetime, $sms_sender, $target_code, $message);
}
}
// if its from the known system messsage sender,
// then process it as a system message
$syssenders = explode(',', $system_from);
foreach ($syssenders as $syssender) {
if (0 == strcasecmp($sms_sender, $syssender)) {
$saveToInbox = true;
$ok = processSystemMessage($sms_sender, "{$target_code} {$message}");
}
}
break;
}
if (!$ok) {
$saveToInbox = true;
// If all else failed, then check the autoreplies again,
// this time with a more sophisticated match.
//
// Note that since this can result in autoreply error messages,
// we only do this if its a regular number, not a shortcode or
// some special cell provider number
// (if we don't check we can get into an infinite loop, us
// sending an error message to another autmoated system, which
// sends us an error message...)
if (strlen($sms_sender) > 4 && ereg('^\\+?[0-9]+$', $sms_sender)) {
$ok = processAutoreply($sms_datetime, $sms_sender, $message, false);
$saveToInbox = !$ok;
}
}
if ($saveToInbox) {
error_log("saving to inbox...");
if (insertsmstoinbox($sms_datetime, $sms_sender, "admin", $message)) {
$ok = true;
}
}
return $ok;
}
示例15: 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":
//.........这里部分代码省略.........