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


PHP phonebook_number2name函数代码示例

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


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

示例1: 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;
}
开发者ID:ranakhurram,项目名称:playSMS,代码行数:33,代码来源:fn.php

示例2: msgtemplate_hook_interceptsendsms

function msgtemplate_hook_interceptsendsms($mobile_sender, $sms_sender, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode)
{
    // parameters modified
    $ret['modified'] = true;
    // the modification to $sms_msg
    $text = $sms_msg;
    $text = str_replace('#NAME#', phonebook_number2name($sms_to), $text);
    $text = str_replace('#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;
}
开发者ID:ranakhurram,项目名称:playSMS,代码行数:13,代码来源:fn.php

示例3: msgtemplate_hook_sendsms_intercept

function msgtemplate_hook_sendsms_intercept($sms_sender, $sms_footer, $sms_to, $sms_msg, $uid, $gpid, $sms_type, $unicode, $queue_code, $smsc)
{
    // parameters modified
    $ret['modified'] = true;
    // the modification to $sms_msg, case insensitive
    $text = $sms_msg;
    $text = str_ireplace('#NAME#', phonebook_number2name($uid, $sms_to), $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;
}
开发者ID:10corp,项目名称:playSMS,代码行数:13,代码来源:fn.php

示例4: sms_board_handle

function sms_board_handle($c_uid, $sms_datetime, $sms_sender, $sms_receiver, $board_keyword, $board_param = '', $smsc = '', $raw_message = '')
{
    global $core_config;
    $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_name = phonebook_number2name($c_uid, $sms_sender);
                $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";
                // fixme anton - ran by playsmsd, no http address, disabled for now looking for solution
                // $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;
}
开发者ID:10corp,项目名称:playSMS,代码行数:39,代码来源:fn.php

示例5: dba_fetch_array

 $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_outgoing&op=all_outgoing", $page);
 $limit = ($page - 1) * $line_per_page;
 $content = "\n\t    <h2>" . _('All outgoing SMS') . "</h2>\n\t    <p>{$nav_pages}</p>\n\t    <form name=\"fm_outgoing\" action=\"index.php?app=menu&inc=all_outgoing&op=act_del\" method=post onSubmit=\"return SureConfirm()\">\n\t    <table width=100% cellpadding=1 cellspacing=2 border=0 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%>" . _('Gateway') . "</th>\n\t      <th align=center width=10%>" . _('Receiver') . "</th>\n\t      <th align=center width=40%>" . _('Message') . "</th>\n\t      <th align=center width=10%>" . _('Status') . "</th>\n\t      <th align=center width=4>" . _('Group') . "</th>\n\t      <th align=center width=4 class=\"sorttable_nosort\">" . _('Action') . "</th>\n\t      <th width=4 class=\"sorttable_nosort\"><input type=checkbox onclick=CheckUncheckAll(document.fm_outgoing)></td>\n\t    </tr>\n        </thead>\n        <tbody>\n\t";
 $db_query = "SELECT * FROM " . _DB_PREF_ . "_tblSMSOutgoing WHERE flag_deleted='0' ORDER BY smslog_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++;
     $current_slid = $db_row['smslog_id'];
     $p_username = uid2username($db_row['uid']);
     $p_dst = $db_row['p_dst'];
     $p_desc = phonebook_number2name($p_dst);
     $current_p_dst = $p_dst;
     if ($p_desc) {
         $current_p_dst = "{$p_dst}<br>({$p_desc})";
     }
     $hide_p_dst = $p_dst;
     if ($p_desc) {
         $hide_p_dst = "{$p_dst} ({$p_desc})";
     }
     $p_sms_type = $db_row['p_sms_type'];
     $hide_p_dst = str_replace("\\'", "", $hide_p_dst);
     $hide_p_dst = str_replace("\"", "", $hide_p_dst);
     $p_msg = core_display_text($db_row['p_msg'], 25);
     if (($p_footer = $db_row['p_footer']) && ($p_sms_type == "text" || $p_sms_type == "flash")) {
         $p_msg = $p_msg . " {$p_footer}";
     }
开发者ID:ranakhurram,项目名称:playSMS,代码行数:31,代码来源:all_outgoing.php

示例6: recvsms_inbox_add

function recvsms_inbox_add($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver = "", $reference_id = '')
{
    global $core_config;
    // sms to inbox will be handled by plugins first
    $ret_intercept = recvsms_inbox_add_intercept($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver, $reference_id);
    if ($ret_intercept['param_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;
        $target_user = $ret_intercept['param']['target_user'] ? $ret_intercept['param']['target_user'] : $target_user;
        $message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message;
        $sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver;
        $reference_id = $ret_intercept['param']['reference_id'] ? $ret_intercept['param']['reference_id'] : $reference_id;
    }
    $ok = FALSE;
    if ($sms_sender && $target_user && $message) {
        $user = user_getdatabyusername($target_user);
        if ($uid = $user['uid']) {
            // discard if banned
            if (user_banned_get($uid)) {
                logger_print("user banned, message ignored uid:" . $uid, 2, "recvsms_inbox_add");
                return FALSE;
            }
            // get name from target_user's phonebook
            $c_name = '';
            if (substr($sms_sender, 0, 1) == '@') {
                $c_username = str_replace('@', '', $sms_sender);
                $c_name = user_getfieldbyusername($c_username, 'name');
            } else {
                $c_name = phonebook_number2name($uid, $sms_sender);
            }
            $sender = $c_name ? $c_name . ' (' . $sms_sender . ')' : $sms_sender;
            // forward to Inbox
            if ($fwd_to_inbox = $user['fwd_to_inbox']) {
                $db_query = "\n\t\t\t\t\tINSERT INTO " . _DB_PREF_ . "_tblSMSInbox\n\t\t\t\t\t(in_sender,in_receiver,in_uid,in_msg,in_datetime,reference_id)\n\t\t\t\t\tVALUES ('{$sms_sender}','{$sms_receiver}','{$uid}','{$message}','" . core_adjust_datetime($sms_datetime) . "','{$reference_id}')\n\t\t\t\t";
                logger_print("saving sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user . " reference_id:" . $reference_id, 2, "recvsms_inbox_add");
                if ($inbox_id = @dba_insert_id($db_query)) {
                    logger_print("saved id:" . $inbox_id . " sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 2, "recvsms_inbox_add");
                    $ok = TRUE;
                }
            }
            // forward to email, consider site config too
            if ($parent_uid = user_getparentbyuid($uid)) {
                $site_config = site_config_get($parent_uid);
            }
            $web_title = $site_config['web_title'] ? $site_config['web_title'] : $core_config['main']['web_title'];
            $email_service = $site_config['email_service'] ? $site_config['email_service'] : $core_config['main']['email_service'];
            $email_footer = $site_config['email_footer'] ? $site_config['email_footer'] : $core_config['main']['email_footer'];
            $sms_receiver = $sms_receiver ? $sms_receiver : '-';
            if ($fwd_to_email = $user['fwd_to_email']) {
                if ($email = $user['email']) {
                    $subject = _('Message from') . " " . $sender;
                    $body = $web_title . "\n\n";
                    $body .= _('Message received at') . " " . $sms_receiver . " " . _('on') . " " . $sms_datetime . "\n\n";
                    $body .= _('From') . " " . $sender . "\n\n";
                    $body .= $message . "\n\n--\n";
                    $body .= $email_footer . "\n\n";
                    $body = stripslashes($body);
                    logger_print("send email from:" . $email_service . " to:" . $email . " message:[" . $message . "]", 3, "recvsms_inbox_add");
                    $data = array('mail_from_name' => $web_title, 'mail_from' => $email_service, 'mail_to' => $email, 'mail_subject' => $subject, 'mail_body' => $body);
                    sendmail($data);
                    logger_print("sent email from:" . $email_service . " to:" . $email, 3, "recvsms_inbox_add");
                }
            }
            // forward to mobile
            if ($fwd_to_mobile = $user['fwd_to_mobile']) {
                if ($mobile = $user['mobile']) {
                    // fixme anton
                    $c_message = $message . ' ' . $sender;
                    if ($sender_uid = user_mobile2uid($sms_sender)) {
                        if ($sender_username = user_uid2username($sender_uid)) {
                            $c_message = $message . ' ' . '@' . $sender_username;
                        }
                    }
                    $message = $c_message;
                    $unicode = core_detect_unicode($message);
                    $nofooter = TRUE;
                    logger_print("send to mobile:" . $mobile . " from:" . $sms_sender . " user:" . $target_user . " message:" . $message, 3, "recvsms_inbox_add");
                    list($ok, $to, $smslog_id, $queue) = sendsms($target_user, $mobile, $message, 'text', $unicode, '', $nofooter);
                    if ($ok[0] == 1) {
                        logger_print("sent to mobile:" . $mobile . " from:" . $sms_sender . " user:" . $target_user, 2, "recvsms_inbox_add");
                    }
                }
            }
        }
    }
    return $ok;
}
开发者ID:10corp,项目名称:playSMS,代码行数:87,代码来源:fn.php

示例7: dba_query

 $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=user_inbox&op=user_inbox", $page);
 $limit = ($page - 1) * $line_per_page;
 $content = "\n\t    <h2>" . _('Inbox') . "</h2>\n\t    <p>{$nav_pages}</p>\n\t    <form name=\"fm_inbox\" action=\"index.php?app=menu&inc=user_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=20%>" . _('Time') . "</th>\n\t      <th align=center width=10%>" . _('From') . "</th>\n\t      <th align=center width=70%>" . _('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_uid='{$uid}' AND 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_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 width=4>{$i}.</td>\n\t          <td valign=top class={$td_class} align=center width=20%>{$in_datetime}</td>\n\t          <td valign=top class={$td_class} align=center width=20%>{$current_sender}</td>\n\t          <td valign=top class={$td_class} align=left width=60%>{$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=user_inbox&op=user_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>\n    </form>\n    <p>{$nav_pages}</p>\n    ";
 if ($err) {
     echo "<div class=error_string>{$err}</div><br><br>";
 }
开发者ID:rohith222,项目名称:playSMS,代码行数:31,代码来源:user_inbox.php

示例8: insertsmstoinbox

function insertsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver = "")
{
    global $core_config, $web_title, $email_service, $email_footer;
    // sms to inbox will be handled by plugin/tools/* first
    $ret_intercept = interceptsmstoinbox($sms_datetime, $sms_sender, $target_user, $message, $sms_receiver);
    if ($ret_intercept['param_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;
        $target_user = $ret_intercept['param']['target_user'] ? $ret_intercept['param']['target_user'] : $target_user;
        $message = $ret_intercept['param']['message'] ? $ret_intercept['param']['message'] : $message;
        $sms_receiver = $ret_intercept['param']['sms_receiver'] ? $ret_intercept['param']['sms_receiver'] : $sms_receiver;
    }
    $ok = false;
    if ($sms_sender && $target_user && $message) {
        $user = user_getdatabyusername($target_user);
        if ($uid = $user['uid']) {
            // forward to Inbox
            if ($fwd_to_inbox = $user['fwd_to_inbox']) {
                $db_query = "\n\t\t    INSERT INTO " . _DB_PREF_ . "_tblUserInbox\n\t\t    (in_sender,in_receiver,in_uid,in_msg,in_datetime) \n\t\t    VALUES ('{$sms_sender}','{$sms_receiver}','{$uid}','{$message}','{$sms_datetime}')\n\t\t";
                logger_print("saving sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                if ($cek_ok = @dba_insert_id($db_query)) {
                    logger_print("saved sender:" . $sms_sender . " receiver:" . $sms_receiver . " target:" . $target_user, 3, "insertsmstoinbox");
                }
            }
            // forward to email
            if ($fwd_to_email = $user['fwd_to_email']) {
                if ($email = $user['email']) {
                    // make sure sms_datetime is in supported format and in user's timezone
                    $sms_datetime = core_display_datetime($sms_datetime);
                    // get name from target_user's phonebook
                    $c_name = phonebook_number2name($sms_sender, $target_user);
                    $sender = $c_name ? $c_name . ' <' . $sms_sender . '>' : $sms_sender;
                    // fixme anton - slash maddess
                    $message = stripslashes($message);
                    $subject = "[SMSGW-PV] " . _('from') . " {$sms_sender}";
                    $body = _('Forward Private WebSMS') . " ({$web_title})\n\n";
                    $body .= _('Date time') . ": {$sms_datetime}\n";
                    $body .= _('Sender') . ": {$sender}\n";
                    $body .= _('Receiver') . ": {$sms_receiver}\n\n";
                    $body .= _('Message') . ":\n{$message}\n\n";
                    $body .= $email_footer . "\n\n";
                    logger_print("send email from:" . $email_service . " to:" . $email, 3, "insertsmstoinbox");
                    sendmail($email_service, $email, $subject, $body);
                    logger_print("sent email from:" . $email_service . " to:" . $email, 3, "insertsmstoinbox");
                }
                $ok = true;
            }
            // forward to mobile
            if ($fwd_to_mobile = $user['fwd_to_mobile']) {
                if ($mobile = $user['mobile']) {
                    $unicode = 0;
                    if (function_exists('mb_detect_encoding')) {
                        $encoding = mb_detect_encoding($message, 'auto');
                        if ($encoding != 'ASCII') {
                            $unicode = 1;
                        }
                    }
                    $message = $sender . ' ' . $message;
                    logger_print("send to mobile:" . $mobile . " from:" . $sender . " user:" . $target_user, 3, "insertsmstoinbox");
                    list($ok, $to, $smslog_id) = sendsms_pv($target_user, $mobile, $message, 'text', $unicode);
                    if ($ok[0]) {
                        logger_print("sent to mobile:" . $mobile . " from:" . $sender . " user:" . $target_user, 3, "insertsmstoinbox");
                    }
                }
            }
        }
    }
    return $ok;
}
开发者ID:rohith222,项目名称:playSMS,代码行数:69,代码来源:fn_core.php

示例9: 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;
}
开发者ID:erdincay,项目名称:playSMS-extra-plugin,代码行数:67,代码来源:fn.php

示例10: phonebook_hook_phonebook_search_user

function phonebook_hook_phonebook_search_user($uid, $keyword = "", $count = 0, $exact = FALSE)
{
    $ret = array();
    $keywords = $keyword;
    $fields = 'username, name, mobile, email';
    if ((int) $count) {
        $extras = 'LIMIT ' . (int) $count;
    }
    $users = user_search($keywords, $fields, $extras, $exact);
    foreach ($users as $user) {
        if ($name = phonebook_number2name($uid, $user['mobile'])) {
            $user['name'] = $name . '/' . $user['name'];
        }
        if (auth_isadmin()) {
            $ret[] = $user;
        } else {
            if ($name) {
                $ret[] = $user;
            }
        }
    }
    return $ret;
}
开发者ID:10corp,项目名称:playSMS,代码行数:23,代码来源:fn.php

示例11: report_resolve_sender

/**
 * Resolve sender number or name to contact name or account's name
 *
 * @param integer $uid
 * @param string $sender
 * @return string
 */
function report_resolve_sender($uid, $sender)
{
    $final_sender = "<div class='report_sender'>" . $sender . "</div>";
    if (substr($sender, 0, 1) == '@') {
        $sender = core_sanitize_username($sender);
        $desc = user_getfieldbyusername($sender, 'name');
    } else {
        $desc = phonebook_number2name($uid, $sender);
    }
    if ($desc) {
        $final_sender .= "<div class='report_sender_description'>" . $desc . "</div>";
    }
    return $final_sender;
}
开发者ID:10corp,项目名称:playSMS,代码行数:21,代码来源:fn.php

示例12: incoming_hook_recvsms_intercept

/**
 * Intercept on before-process stage for incoming SMS
 *
 * @param $sms_datetime incoming
 *        	SMS date/time
 * @param $sms_sender incoming
 *        	SMS sender
 * @param $message incoming
 *        	SMS message before interepted
 * @param $sms_receiver receiver
 *        	number that is receiving incoming SMS
 * @param $reference_id reference_id
 *        	data
 * @return array $ret
 */
function incoming_hook_recvsms_intercept($sms_datetime, $sms_sender, $message, $sms_receiver, $reference_id)
{
    $ret = array();
    $found_bc = FALSE;
    $found_pv = FALSE;
    // continue only when keyword does not exists
    $m = explode(' ', $message);
    if (!checkavailablekeyword($m[0])) {
        return $ret;
    }
    // get settings
    $settings = incoming_settings_get();
    // get post rules
    $pre_rules = incoming_pre_rules_get();
    // scan for #<sender's phonebook group code> and @<username> according to pre rules
    $msg = explode(' ', $message);
    if (count($msg) > 0) {
        $bc = array();
        $pv = array();
        for ($i = 0; $i < count($msg); $i++) {
            $c_text = trim($msg[$i]);
            // scan message for @username
            if ($pre_rules['match_username']) {
                if (substr($c_text, 0, 1) === '@') {
                    $pv[] = strtolower(substr($c_text, 1));
                    $found_pv = TRUE;
                }
            }
            // scan message for #groupcode
            if ($pre_rules['match_groupcode']) {
                if (substr($c_text, 0, 1) === '#') {
                    $bc[] = strtoupper(substr($c_text, 1));
                    $found_bc = TRUE;
                }
            }
        }
    }
    if ($found_bc || $found_pv) {
        _log("recvsms_intercept dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " m:" . $message, 3, 'incoming recvsms_intercept');
    }
    if ($found_bc) {
        $groups = array_unique($bc);
        foreach ($groups as $key => $c_group_code) {
            $c_group_code = strtoupper($c_group_code);
            $c_group_code = core_sanitize_alphanumeric($c_group_code);
            $c_uid = user_mobile2uid($sms_sender);
            if ($c_uid && ($c_gpid = phonebook_groupcode2id($c_uid, $c_group_code))) {
                $c_username = user_uid2username($c_uid);
                _log("bc g:" . $c_group_code . " gpid:" . $c_gpid . " uid:" . $c_uid . " dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " m:" . $message, 3, 'incoming recvsms_intercept');
                sendsms_bc($c_username, $c_gpid, $message);
                _log("bc end", 3, 'incoming recvsms_intercept');
                $ret['uid'] = $c_uid;
                $ret['hooked'] = true;
            } else {
                // check the group_code for flag_sender<>0
                $db_query = "SELECT id,uid,flag_sender FROM " . _DB_PREF_ . "_featurePhonebook_group WHERE code='{$c_group_code}' AND flag_sender<>0";
                $db_result = dba_query($db_query);
                if ($db_row = dba_fetch_array($db_result)) {
                    $c_gpid = $db_row['id'];
                    $c_uid = $db_row['uid'];
                    $c_flag_sender = $db_row['flag_sender'];
                    if ($c_flag_sender == 2) {
                        $c_username = user_uid2username($c_uid);
                        _log("bc mobile flag_sender:" . $c_flag_sender . " username:" . $c_username . " uid:" . $c_uid . " g:" . $c_group_code . " gpid:" . $c_gpid . " uid:" . $c_uid . " dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " m:" . $message, 3, 'incoming recvsms_intercept');
                        $sender = trim(phonebook_number2name($sms_sender, $c_username));
                        $sender = $sender ? $sender : $sms_sender;
                        sendsms_bc($c_username, $c_gpid, $sender . ":" . $message);
                        _log("bc mobile end", 3, 'incoming recvsms_intercept');
                        $ret['uid'] = $c_uid;
                        $ret['hooked'] = true;
                    } else {
                        if ($c_flag_sender == 1) {
                            // check whether sms_sender belongs to c_group_code
                            $db_query = "SELECT B.id AS id FROM " . _DB_PREF_ . "_featurePhonebook AS A\n\t\t\t\t\t\t\t\tLEFT JOIN playsms.playsms_featurePhonebook_group_contacts AS C ON A.id=C.pid\n\t\t\t\t\t\t\t\tLEFT JOIN playsms.playsms_featurePhonebook_group AS B ON B.id=C.gpid\n\t\t\t\t\t\t\t\tWHERE A.mobile LIKE '%" . substr($sms_sender, 3) . "' AND B.code='" . $c_group_code . "'";
                            $db_result = dba_query($db_query);
                            if ($db_row = dba_fetch_array($db_result)) {
                                $c_username = user_uid2username($c_uid);
                                _log("bc mobile flag_sender:" . $c_flag_sender . " username:" . $c_username . " uid:" . $c_uid . " g:" . $c_group_code . " gpid:" . $c_gpid . " uid:" . $c_uid . " dt:" . $sms_datetime . " s:" . $sms_sender . " r:" . $sms_receiver . " m:" . $message, 3, 'incoming recvsms_intercept');
                                $sender = trim(phonebook_number2name($sms_sender, $c_username));
                                $sender = $sender ? $sender : $sms_sender;
                                sendsms_bc($c_username, $c_gpid, $sender . ":" . $message);
                                _log("bc mobile end", 3, 'incoming recvsms_intercept');
                                $ret['uid'] = $c_uid;
                                $ret['hooked'] = true;
                            }
//.........这里部分代码省略.........
开发者ID:yrahman,项目名称:playSMS,代码行数:101,代码来源:fn.php


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