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


PHP sms::send方法代码示例

本文整理汇总了PHP中sms::send方法的典型用法代码示例。如果您正苦于以下问题:PHP sms::send方法的具体用法?PHP sms::send怎么用?PHP sms::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sms的用法示例。


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

示例1: _send_mobile_alert

 public static function _send_mobile_alert($post)
 {
     // For Mobile Alerts, Confirmation Code
     $alert_mobile = $post->alert_mobile;
     $alert_lon = $post->alert_lon;
     $alert_lat = $post->alert_lat;
     $alert_radius = $post->alert_radius;
     // Should be 6 distinct characters
     $alert_code = text::random('distinct', 8);
     $settings = ORM::factory('settings', 1);
     if (!$settings->loaded) {
         return FALSE;
     }
     // Get SMS Numbers
     if (!empty($settings->sms_no3)) {
         $sms_from = $settings->sms_no3;
     } elseif (!empty($settings->sms_no2)) {
         $sms_from = $settings->sms_no2;
     } elseif (!empty($settings->sms_no1)) {
         $sms_from = $settings->sms_no1;
     } else {
         $sms_from = "000";
         // User needs to set up an SMS number
     }
     $message = Kohana::lang('ui_admin.confirmation_code') . $alert_code . '.' . Kohana::lang('ui_admin.not_case_sensitive');
     if (sms::send($alert_mobile, $sms_from, $message) === true) {
         $alert = ORM::factory('alert');
         $alert->alert_type = self::MOBILE_ALERT;
         $alert->alert_recipient = $alert_mobile;
         $alert->alert_code = $alert_code;
         $alert->alert_lon = $alert_lon;
         $alert->alert_lat = $alert_lat;
         $alert->alert_radius = $alert_radius;
         if (isset($_SESSION['auth_user'])) {
             $alert->user_id = $_SESSION['auth_user']->id;
         }
         $alert->save();
         self::_add_categories($alert, $post);
         return TRUE;
     }
     return FALSE;
 }
开发者ID:rabbit09,项目名称:Taarifa_Web,代码行数:42,代码来源:alert.php

示例2: sms

 } else {
     $MsgType = "SMS_TEXT";
 }
 if ($Credits > $MsgCount || !$perm->have_perm("guest")) {
     $mysms = new sms();
     $startBalance = $mysms->getbalance();
     foreach ($SendTo as $Recipient) {
         $db->query("select * from SmsAddressBook where id='" . $Recipient . "'");
         if ($db->next_record()) {
             $name = $db->f("Name");
             $cc = $db->f("CountryCode");
             $ac = $db->f("AreaCode");
             $num = $db->f("Number");
             printf("<br>Sending SMS to %s, +%s %s %s ", $name, $cc, $ac, $num);
             $MobileNumber = $cc . $ac . $num;
             $output = $mysms->send($MobileNumber, $SenderNum, $Message, $Flash);
             printf($output);
             $UN = $auth->auth["uname"];
             $trk = $mysms->trackingNo;
             if ($output) {
                 $id = $db->nextid("SmsLog_sequence");
                 $sql = "INSERT INTO SmsLog (";
                 $sql .= "id,UserName,Result,RecipientName,RecipientNumber,SenderNumber,Message,MsgType,DateTime,Tracking";
                 $sql .= ") VALUES (";
                 $sql .= "'{$id}','{$UN}','{$output}','{$name}','{$MobileNumber}','{$SenderNum}','{$Message}','{$MsgType}',now(),'{$trk}'";
                 $sql .= ")";
                 $db->query($sql);
                 $OkCount++;
             }
         }
     }
开发者ID:TaylorMonacelli,项目名称:phplib,代码行数:31,代码来源:SMS.php

示例3: while

         }
         $row = $db->query($sql);
         while ($rank_rs = $db->fetch_array($row)) {
             $value[] = $rank_rs['mobile_phone'];
         }
     }
     if (isset($value)) {
         $phone .= implode(',', $value);
     }
 }
 $msg = isset($_POST['msg']) ? $_POST['msg'] : '';
 if (EC_CHARSET != 'utf-8') {
     $msg = ecs_iconv(EC_CHARSET, 'utf-8', $msg);
 }
 $send_date = isset($_POST['send_date']) ? $_POST['send_date'] : '';
 $result = $sms->send($phone, $msg, $send_date, $send_num = 13);
 $link[] = array('text' => $_LANG['back'] . $_LANG['03_sms_send'], 'href' => 'sms.php?act=display_send_ui');
 if ($result === true) {
     sys_msg($_LANG['send_ok'], 0, $link);
 } else {
     @($error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] . $_LANG['api_errors']['send'][$sms->errors['api_errors']['error_no']]);
     sys_msg($_LANG['send_error'] . $error_detail, 1, $link);
 }
 break;
 //    /* 显示发送记录的查询界面,如果尚未注册或启用短信服务则显示注册界面。 */
 //    case 'display_send_history_ui' :
 //        /* 检查权限 */
 //         admin_priv('send_history');
 //        if ($sms->has_registered())
 //        {
 //            $smarty->assign('ur_here', $_LANG['05_sms_send_history']);
开发者ID:a494008974,项目名称:bzbshop,代码行数:31,代码来源:sms.php

示例4: order_paid

/**
 * 修改订单的支付状态
 *
 * @access  public
 * @param   string  $log_id     支付编号
 * @param   integer $pay_status 状态
 * @param   string  $note       备注
 * @return  void
 */
function order_paid($log_id, $pay_status = PS_PAYED, $note = '')
{
    /* 取得支付编号 */
    $log_id = intval($log_id);
    if ($log_id > 0) {
        /* 取得要修改的支付记录信息 */
        $sql = "SELECT * FROM " . $GLOBALS['ecs']->table('pay_log') . " WHERE log_id = '{$log_id}'";
        $pay_log = $GLOBALS['db']->getRow($sql);
        if ($pay_log && $pay_log['is_paid'] == 0) {
            /* 修改此次支付操作的状态为已付款 */
            $sql = 'UPDATE ' . $GLOBALS['ecs']->table('pay_log') . " SET is_paid = '1' WHERE log_id = '{$log_id}'";
            $GLOBALS['db']->query($sql);
            /* 根据记录类型做相应处理 */
            if ($pay_log['order_type'] == PAY_ORDER) {
                /* 取得订单信息 */
                $sql = 'SELECT order_id, order_sn, consignee, address, tel, shipping_id ' . 'FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$pay_log['order_id']}'";
                $order = $GLOBALS['db']->getRow($sql);
                $order_id = $order['order_id'];
                $order_sn = $order['order_sn'];
                /* 修改订单状态为已付款 */
                $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET order_status = '" . OS_CONFIRMED . "', " . " confirm_time = '" . gmtime() . "', " . " pay_status = '{$pay_status}', " . " pay_time = '" . gmtime() . "', " . " money_paid = order_amount," . " order_amount = 0 " . "WHERE order_id = '{$order_id}'";
                $GLOBALS['db']->query($sql);
                /* 记录订单操作记录 */
                order_action($order_sn, OS_CONFIRMED, SS_UNSHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
                /* 如果需要,发短信 */
                if ($GLOBALS['_CFG']['sms_order_payed'] == '1' && $GLOBALS['_CFG']['sms_shop_mobile'] != '') {
                    include_once ROOT_PATH . 'includes/cls_sms.php';
                    $sms = new sms();
                    $sms->send($GLOBALS['_CFG']['sms_shop_mobile'], sprintf($GLOBALS['_LANG']['order_payed_sms'], $order_sn, $order['consignee'], $order['tel']), 0);
                }
                /* 对虚拟商品的支持 */
                $virtual_goods = get_virtual_goods($order_id);
                if (!empty($virtual_goods)) {
                    $msg = '';
                    if (!virtual_goods_ship($virtual_goods, $msg, $order_sn, true)) {
                        $GLOBALS['_LANG']['pay_success'] .= '<div style="color:red;">' . $msg . '</div>' . $GLOBALS['_LANG']['virtual_goods_ship_fail'];
                    }
                    /* 如果订单没有配送方式,自动完成发货操作 */
                    if ($order['shipping_id'] == -1) {
                        /* 将订单标识为已发货状态,并记录发货记录 */
                        $sql = 'UPDATE ' . $GLOBALS['ecs']->table('order_info') . " SET shipping_status = '" . SS_SHIPPED . "', shipping_time = '" . gmtime() . "'" . " WHERE order_id = '{$order_id}'";
                        $GLOBALS['db']->query($sql);
                        /* 记录订单操作记录 */
                        order_action($order_sn, OS_CONFIRMED, SS_SHIPPED, $pay_status, $note, $GLOBALS['_LANG']['buyer']);
                    }
                }
            } elseif ($pay_log['order_type'] == PAY_SURPLUS) {
                /* 更新会员预付款的到款状态 */
                $sql = 'UPDATE ' . $GLOBALS['ecs']->table('user_account') . " SET paid_time = '" . gmtime() . "', is_paid = 1" . " WHERE id = '{$pay_log['order_id']}' LIMIT 1";
                $GLOBALS['db']->query($sql);
                /* 取得添加预付款的用户以及金额 */
                $sql = "SELECT user_id, amount FROM " . $GLOBALS['ecs']->table('user_account') . " WHERE id = '{$pay_log['order_id']}'";
                $arr = $GLOBALS['db']->getRow($sql);
                /* 修改会员帐户金额 */
                $_LANG = array();
                include_once ROOT_PATH . 'languages/' . $GLOBALS['_CFG']['lang'] . '/user.php';
                log_account_change($arr['user_id'], $arr['amount'], 0, 0, 0, $_LANG['surplus_type_0'], ACT_SAVING);
            }
        } else {
            /* 取得已发货的虚拟商品信息 */
            $post_virtual_goods = get_virtual_goods($pay_log['order_id'], true);
            /* 有已发货的虚拟商品 */
            if (!empty($post_virtual_goods)) {
                $msg = '';
                /* 检查两次刷新时间有无超过12小时 */
                $sql = 'SELECT pay_time, order_sn FROM ' . $GLOBALS['ecs']->table('order_info') . " WHERE order_id = '{$pay_log['order_id']}'";
                $row = $GLOBALS['db']->getRow($sql);
                $intval_time = gmtime() - $row['pay_time'];
                if ($intval_time > 0 && $intval_time < 3600 * 12) {
                    $virtual_card = array();
                    foreach ($post_virtual_goods as $code => $goods_list) {
                        /* 只处理虚拟卡 */
                        if ($code == 'virtual_card') {
                            foreach ($goods_list as $goods) {
                                if ($info = virtual_card_result($row['order_sn'], $goods)) {
                                    $virtual_card[] = array('goods_id' => $goods['goods_id'], 'goods_name' => $goods['goods_name'], 'info' => $info);
                                }
                            }
                            $GLOBALS['smarty']->assign('virtual_card', $virtual_card);
                        }
                    }
                } else {
                    $msg = '<div>' . $GLOBALS['_LANG']['please_view_order_detail'] . '</div>';
                }
                $GLOBALS['_LANG']['pay_success'] .= $msg;
            }
            /* 取得未发货虚拟商品 */
            $virtual_goods = get_virtual_goods($pay_log['order_id'], false);
            if (!empty($virtual_goods)) {
                $GLOBALS['_LANG']['pay_success'] .= '<br />' . $GLOBALS['_LANG']['virtual_goods_ship_fail'];
            }
//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:101,代码来源:lib_payment.php

示例5: sms

 $OkCount = 0;
 if ($Credits > $MsgCount || !$perm->have_perm("guest")) {
     $mysms = new sms();
     $Date = substr($db->f(0), 0, 8);
     $Time = substr($db->f(0), 8, 6);
     $startBalance = $mysms->getbalance();
     foreach ($SendTo as $Recipient) {
         $db->query("select * from SmsAddressBook where id='" . $Recipient . "'");
         if ($db->next_record()) {
             $name = $db->f("Name");
             $cc = $db->f("CountryCode");
             $ac = $db->f("AreaCode");
             $num = $db->f("Number");
             printf("<br>Sending Nokia RTTTL SMS to %s, +%s %s %s ", $name, $cc, $ac, $num);
             $number = $cc . $ac . $num;
             $output = $mysms->send($number, 'RTTTL', $RingTone);
             $UN = $auth->auth["uname"];
             printf($output);
             $trk = $mysms->trackingNo;
             if ($output == "OK") {
                 $id = $db->nextid("SmsLog_sequence");
                 $sql = "INSERT INTO SmsLog (";
                 $sql .= "id,UserName,Result,RecipientName,RecipientNumber,SenderNumber,Message,MsgType,DateTime,Tracking";
                 $sql .= ") VALUES (";
                 $sql .= "'{$id}','{$UN}','{$output}','{$name}','{$number}','RTTTL','{$RingTone}','SMS_NOKIA_RTTTL',now(),'{$trk}'";
                 $sql .= ")";
                 $db->query($sql);
                 $OkCount++;
             }
         }
     }
开发者ID:TaylorMonacelli,项目名称:phplib,代码行数:31,代码来源:RingTones.php

示例6: empty

    if ($pwd_modified) {
        $sql = "UPDATE " . $table . " SET " . "user_name = '{$admin_name}', " . "name = '{$name}', " . "email = '{$admin_email}', " . "cellphone = '{$admin_cellphone}', " . "class_code = '{$admin_class_code}', " . "ec_salt = '{$ec_salt}' " . $password . "WHERE user_id = '{$admin_id}'";
    } else {
        $sql = "UPDATE " . $table . " SET " . "user_name = '{$admin_name}', " . "name = '{$name}', " . "email = '{$admin_email}', " . "cellphone = '{$admin_cellphone}', " . "class_code = '{$admin_class_code}' " . "WHERE user_id = '{$admin_id}'";
    }
    $db->query($sql);
    /* 记录管理员操作 */
    admin_log($_POST['user_name'], 'edit', 'classAdmin');
    /* 如果修改了密码,则需要将session中该管理员的数据清空 */
    $msg = "修改“" . $_POST['user_name'] . "”管理员信息成功!";
    //发生短信逻辑
    $smskey = empty($_POST['sms']) ? '' : trim($_POST['sms']);
    if ($smskey == 'send') {
        $content = $name . "您好!您的账号已被重置:" . trim($_REQUEST['user_name']) . "/" . $_POST['new_password'];
        $sms = new sms();
        $result = $sms->send($admin_cellphone, $content, "", "", $_SESSION["admin_name"]);
        if ($result["error"] != 0) {
            $msg .= $result["msg"];
        } else {
            $msg .= "并且短信发生成功!";
        }
    }
    /* 提示信息 */
    $links[0]['text'] = $_LANG['goto_list'];
    $links[0]['href'] = 'classAdmin.php?act=list&' . list_link_postfix();
    $links[1]['text'] = $_LANG['go_back'];
    $links[1]['href'] = 'javascript:history.back()';
    sys_msg($msg, 0, $links);
} elseif ($_REQUEST['act'] == 'edit_name') {
    /* 检查权限 */
    check_authz_json('classAdmin_manage');
开发者ID:dalinhuang,项目名称:hteacher,代码行数:31,代码来源:classAdmin.php

示例7: mobile_alerts_unsubscribe

 /**
  * This handles unsubscription from alerts via the mobile phone
  * 
  * @param string $message_from Phone number of subscriber
  * @param string $message_description Message content
  * @return bool
  */
 public static function mobile_alerts_unsubscribe($message_from, $message_description)
 {
     // Validate parameters
     if (empty($message_from) or empty($message_description)) {
         // Log the error
         Kohana::log('info', 'Cannot unsubscribe from alerts via the mobile phone - insufficient data');
         // Return
         return FALSE;
     }
     $settings = ORM::factory('settings', 1);
     if (!$settings->loaded) {
         return FALSE;
     }
     // Get SMS Numbers
     if (!empty($settings->sms_no3)) {
         $sms_from = $settings->sms_no3;
     } elseif (!empty($settings->sms_no2)) {
         $sms_from = $settings->sms_no2;
     } elseif (!empty($settings->sms_no1)) {
         $sms_from = $settings->sms_no1;
     } else {
         $sms_from = "000";
         // User needs to set up an SMS number
     }
     $site_name = $settings->site_name;
     $message = Kohana::lang('ui_admin.unsubscribe_message') . ' ' . $site_name;
     if (sms::send($message_from, $sms_from, $message) === true) {
         // Fetch all alerts with the specified code
         $alerts = ORM::factory('alert')->where('alert_recipient', $message_from)->find_all();
         foreach ($alerts as $alert) {
             // Delete all alert categories with the specified phone number
             ORM::factory('alert_category')->where('alert_id', $alert->id)->delete_all();
             $alert->delete();
         }
         return TRUE;
     }
     return FALSE;
 }
开发者ID:neumicro,项目名称:Ushahidi_Web_Dev,代码行数:45,代码来源:alert.php

示例8: elseif

        show_message($_LANG['username_no_email'], $_LANG['back_page_up'], '', 'info');
    }
} elseif ($action == 'send_pwd_sms') {
    include_once ROOT_PATH . 'include/lib_passport.php';
    /* 初始化会员手机 */
    $mobile = !empty($_POST['mobile']) ? trim($_POST['mobile']) : '';
    $sql = "SELECT user_id FROM " . $ecs->table('users') . " WHERE mobile_phone='{$mobile}'";
    $user_id = $db->getOne($sql);
    if ($user_id > 0) {
        //生成新密码
        $newPwd = random(6, 1);
        $message = "您的新密码是:" . $newPwd . ",请不要把密码泄露给其他人,如非本人操作,可不用理会!";
        include ROOT_PATH . 'include/cls_sms.php';
        $sms = new sms();
        $sms_error = array();
        if ($sms->send($mobile, $message, $sms_error)) {
            $sql = "UPDATE " . $ecs->table('users') . "SET `ec_salt`='0',password='" . md5($newPwd) . "' WHERE mobile_phone= '" . $mobile . "'";
            $db->query($sql);
            show_message($_LANG['send_success_sms'] . $mobile, $_LANG['relogin_lnk'], './user.php', 'info');
        } else {
            //var_dump($sms_error);
            //发送邮件出错
            show_message($sms_error, $_LANG['back_page_up'], './', 'info');
        }
    } else {
        //不存在
        show_message($_LANG['username_no_mobile'], $_LANG['back_page_up'], '', 'info');
    }
} elseif ($action == 'reset_password') {
    //显示重置密码的表单
    $smarty->display('user_passport.dwt');
开发者ID:seanguo166,项目名称:microdistribution,代码行数:31,代码来源:distribute.php

示例9: isset

         assign_query_info();
         $smarty->display('sms_send_ui.htm');
     } else {
         $smarty->assign('ur_here', $_LANG['register_sms']);
         $smarty->assign('sms_site_info', $sms->get_site_info());
         assign_query_info();
         $smarty->display('sms_register_ui.htm');
     }
     break;
     /* 发送短信 */
 /* 发送短信 */
 case 'send_sms':
     $phone = isset($_POST['phone']) ? $_POST['phone'] : '';
     $msg = isset($_POST['msg']) ? $_POST['msg'] : '';
     $send_date = isset($_POST['send_date']) ? $_POST['send_date'] : '';
     $result = $sms->send($phone, $msg, $send_date);
     $link[] = array('text' => $_LANG['back'] . $_LANG['03_sms_send'], 'href' => 'sms.php?act=display_send_ui');
     if ($result === true) {
         sys_msg($_LANG['send_ok'], 0, $link);
     } else {
         @($error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] . $_LANG['api_errors']['send'][$sms->errors['api_errors']['error_no']]);
         sys_msg($_LANG['send_error'] . $error_detail, 1, $link);
     }
     break;
     /* 显示发送记录的查询界面,如果尚未注册或启用短信服务则显示注册界面。 */
 /* 显示发送记录的查询界面,如果尚未注册或启用短信服务则显示注册界面。 */
 case 'display_send_history_ui':
     /* 检查权限 */
     admin_priv('send_history');
     if ($sms->has_registered()) {
         $smarty->assign('ur_here', $_LANG['05_sms_send_history']);
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:sms.php

示例10: isset

$text[2] = "Soobwaem Vam, chto voznagrazhdenie v razmere nabrannyh Vami ballov v proekte SSP kompanii ROMIR za 4-ij kvartal 2007 g. nachisleno na Vash schet 18 janvarja 2008g. Spasibo za sotrudnichestvo.";
$text[3] = "Soobwaem Vam, chto voznagrazhdenie v razmere nabrannyh Vami ballov v proekte SSP kompanii ROMIR za 4-ij kvartal 2007 g. nachisleno na Vash schet 21 janvarja 2008g. Spasibo za sotrudnichestvo.";
$from = "SSP";
$test_mode = isset($argv[1]) && $argv[1] == 'go' ? FALSE : TRUE;
if ($test_mode) {
    echo "TEST MODE!\n";
}
foreach (file(dirname(__FILE__) . '/numbers.txt') as $line) {
    $parts = explode("\t", $line);
    //	$parts[1]=$line;
    if (count($parts) < 3) {
        print "Bad line {$line}\n";
        var_dump($parts);
    }
    $to = "7" . $parts[0];
    //	$to="79267797306";
    $price = trim($parts[1]);
    //	$price=1;
    if (!isset($text[$price])) {
        print "Unkown price |" . $price . "|\n";
    }
    print "sent to user " . $to . "\n";
    if ($test_mode) {
        print $to . "\t=>\t" . $text[$price] . "\n";
    } else {
        $oSMS = new sms();
        $oSMS->send($to, $from, $text[$price]);
    }
    //	var_dump($to, $from, $text[$price]);
    //	exit;
}
开发者ID:evilgeny,项目名称:bob,代码行数:31,代码来源:send.php

示例11: index

 public function index()
 {
     $settings = kohana::config('settings');
     $site_name = $settings['site_name'];
     $alerts_email = $settings['alerts_email'] ? $settings['alerts_email'] : $settings['site_email'];
     $unsubscribe_message = Kohana::lang('alerts.unsubscribe') . url::site() . 'alerts/unsubscribe/';
     $database_settings = kohana::config('database');
     //around line 33
     $this->table_prefix = $database_settings['default']['table_prefix'];
     //around line 34
     $settings = NULL;
     $sms_from = NULL;
     $db = new Database();
     /* Find All Alerts with the following parameters
     		- incident_active = 1 -- An approved incident
     		- incident_alert_status = 1 -- Incident has been tagged for sending
     		
     		Incident Alert Statuses
     		  - 0, Incident has not been tagged for sending. Ensures old incidents are not sent out as alerts
     		  - 1, Incident has been tagged for sending by updating it with 'approved' or 'verified'
     		  - 2, Incident has been tagged as sent. No need to resend again
     		*/
     $incidents = $db->query("SELECT i.id, incident_title, \n\t\t\tincident_description, incident_verified, \n\t\t\tl.latitude, l.longitude, a.alert_id, a.incident_id\n\t\t\tFROM " . $this->table_prefix . "incident AS i INNER JOIN " . $this->table_prefix . "location AS l ON i.location_id = l.id\n\t\t\tLEFT OUTER JOIN " . $this->table_prefix . "alert_sent AS a ON i.id = a.incident_id WHERE\n\t\t\ti.incident_active=1 AND i.incident_alert_status = 1 ");
     foreach ($incidents as $incident) {
         // ** Pre-Formatting Message ** //
         // Convert HTML to Text
         $incident_description = $incident->incident_description;
         $html2text = new Html2Text($incident_description);
         $incident_description = $html2text->get_text();
         // EMAIL MESSAGE
         $email_message = $incident_description;
         // SMS MESSAGE
         $sms_message = $incident_description;
         // Remove line breaks
         $sms_message = str_replace("\n", " ", $sms_message);
         // Shorten to text message size
         $sms_message = text::limit_chars($sms_message, 150, "...");
         $latitude = (double) $incident->latitude;
         $longitude = (double) $incident->longitude;
         // Find all the catecories including parents
         $category_ids = $this->_find_categories($incident->id);
         // Get all alertees
         $alertees = ORM::factory('alert')->where('alert_confirmed', '1')->find_all();
         foreach ($alertees as $alertee) {
             // Has this alert been sent to this alertee?
             if ($alertee->id == $incident->alert_id) {
                 continue;
             }
             // Check the categories
             if (!$this->_check_categories($alertee, $category_ids)) {
                 continue;
             }
             $alert_radius = (int) $alertee->alert_radius;
             $alert_type = (int) $alertee->alert_type;
             $latitude2 = (double) $alertee->alert_lat;
             $longitude2 = (double) $alertee->alert_lon;
             $distance = (string) new Distance($latitude, $longitude, $latitude2, $longitude2);
             // If the calculated distance between the incident and the alert fits...
             if ($distance <= $alert_radius) {
                 if ($alert_type == 1) {
                     // Get SMS Numbers
                     if (Kohana::config("settings.sms_no3")) {
                         $sms_from = Kohana::config("settings.sms_no3");
                     } elseif (Kohana::config("settings.sms_no2")) {
                         $sms_from = Kohana::config("settings.sms_no2");
                     } elseif (Kohana::config("settings.sms_no1")) {
                         $sms_from = Kohana::config("settings.sms_no1");
                     } else {
                         $sms_from = "12053705050";
                     }
                     // Admin needs to set up an SMS number
                     if ($response = sms::send($alertee->alert_recipient, $sms_from, $sms_message) === true) {
                         $alert = ORM::factory('alert_sent');
                         $alert->alert_id = $alertee->id;
                         $alert->incident_id = $incident->id;
                         $alert->alert_date = date("Y-m-d H:i:s");
                         $alert->save();
                     } else {
                         // The gateway couldn't send for some reason
                         // in future we'll keep a record of this
                     }
                 } elseif ($alert_type == 2) {
                     $to = $alertee->alert_recipient;
                     $from = array();
                     $from[] = $alerts_email;
                     $from[] = $site_name;
                     $subject = "[{$site_name}] " . $incident->incident_title;
                     $message = $email_message . "\n\n" . $unsubscribe_message . $alertee->alert_code . "\n";
                     if (email::send($to, $from, $subject, $message, FALSE) == 1) {
                         $alert = ORM::factory('alert_sent');
                         $alert->alert_id = $alertee->id;
                         $alert->incident_id = $incident->id;
                         $alert->alert_date = date("Y-m-d H:i:s");
                         $alert->save();
                     }
                 }
             }
         }
         // End For Each Loop
         // Update Incident - All Alerts Have Been Sent!
//.........这里部分代码省略.........
开发者ID:kjgarza,项目名称:thrasos,代码行数:101,代码来源:s_alerts.php

示例12: save

 /**
  * Saves the record
  */
 function save()
 {
     global $mainframe;
     // Check for request forgeries
     JRequest::checkToken() or jexit('Invalid Token');
     $option = JRequest::getCmd('option');
     // Initialize some variables
     $db =& JFactory::getDBO();
     $me =& JFactory::getUser();
     $acl =& JFactory::getACL();
     $MailFrom = $mainframe->getCfg('mailfrom');
     $FromName = $mainframe->getCfg('fromname');
     $SiteName = $mainframe->getCfg('sitename');
     // Create a new JUser object
     $user = new JUser(JRequest::getVar('id', 0, 'post', 'int'));
     $original_gid = $user->get('gid');
     $post = JRequest::get('post');
     $post['username'] = JRequest::getVar('username', '', 'post', 'username');
     $post['password'] = JRequest::getVar('password', '', 'post', 'string', JREQUEST_ALLOWRAW);
     $post['password2'] = JRequest::getVar('password2', '', 'post', 'string', JREQUEST_ALLOWRAW);
     if (!$user->bind($post)) {
         $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
         $mainframe->enqueueMessage($user->getError(), 'error');
         //$mainframe->redirect( 'index.php?option=com_users', $user->getError() );
         //return false;
         return $this->execute('edit');
     }
     $objectID = $acl->get_object_id('users', $user->get('id'), 'ARO');
     $groups = $acl->get_object_groups($objectID, 'ARO');
     $this_group = strtolower($acl->get_group_name($groups[0], 'ARO'));
     if ($user->get('id') == $me->get('id') && $user->get('block') == 1) {
         $msg = JText::_('You cannot block Yourself!');
         $mainframe->enqueueMessage($msg, 'message');
         return $this->execute('edit');
     } else {
         if ($this_group == 'super administrator' && $user->get('block') == 1) {
             $msg = JText::_('You cannot block a Super Administrator');
             $mainframe->enqueueMessage($msg, 'message');
             return $this->execute('edit');
         } else {
             if ($this_group == 'administrator' && $me->get('gid') == 24 && $user->get('block') == 1) {
                 $msg = JText::_('WARNBLOCK');
                 $mainframe->enqueueMessage($msg, 'message');
                 return $this->execute('edit');
             } else {
                 if ($this_group == 'super administrator' && $me->get('gid') != 25) {
                     $msg = JText::_('You cannot edit a super administrator account');
                     $mainframe->enqueueMessage($msg, 'message');
                     return $this->execute('edit');
                 }
             }
         }
     }
     // Are we dealing with a new user which we need to create?
     $isNew = $user->get('id') < 1;
     if (!$isNew) {
         // if group has been changed and where original group was a Super Admin
         if ($user->get('gid') != $original_gid && $original_gid == 25) {
             // count number of active super admins
             $query = 'SELECT COUNT( id )' . ' FROM #__users' . ' WHERE gid = 25' . ' AND block = 0';
             $db->setQuery($query);
             $count = $db->loadResult();
             if ($count <= 1) {
                 // disallow change if only one Super Admin exists
                 $this->setRedirect('index.php?option=com_users', JText::_('WARN_ONLY_SUPER'));
                 return false;
             }
         }
     }
     /*
      * Lets save the JUser object
      */
     if (!$user->save()) {
         $mainframe->enqueueMessage(JText::_('CANNOT SAVE THE USER INFORMATION'), 'message');
         $mainframe->enqueueMessage($user->getError(), 'error');
         return $this->execute('edit');
     }
     /*
      * Time for the email magic so get ready to sprinkle the magic dust...
      */
     if ($isNew) {
         $adminEmail = $me->get('email');
         $adminName = $me->get('name');
         $subject = JText::_('NEW_USER_MESSAGE_SUBJECT');
         $message = sprintf(JText::_('NEW_USER_MESSAGE'), $user->get('name'), $SiteName, JURI::root(), $user->get('username'), $user->password_clear);
         if ($MailFrom != '' && $FromName != '') {
             $adminName = $FromName;
             $adminEmail = $MailFrom;
         }
         JUtility::sendMail($adminEmail, $adminName, $user->get('email'), $subject, $message);
         // Send activation SMS
         require_once JPATH_SITE . DS . 'libraries' . DS . 'sms_api.php';
         $mysms = new sms();
         $mobile = $user->get('mobile');
         $smsBody = sprintf(JText::_('NEW_USER_SMS'), $SiteName);
         $mysms->send($mobile, "Kmit", $smsBody);
     } else {
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:101,代码来源:controller.php

示例13: sprintf

 function _sendMail(&$user, $password)
 {
     global $mainframe;
     $db =& JFactory::getDBO();
     $name = $user->get('name');
     $email = $user->get('email');
     $username = $user->get('username');
     $usersConfig =& JComponentHelper::getParams('com_users');
     $sitename = $mainframe->getCfg('sitename');
     $useractivation = $usersConfig->get('useractivation');
     $mailfrom = $mainframe->getCfg('mailfrom');
     $fromname = $mainframe->getCfg('fromname');
     $siteURL = JURI::base();
     $subject = sprintf(JText::_('Account details for'), $name, $sitename);
     $subject = html_entity_decode($subject, ENT_QUOTES);
     if ($useractivation == 1) {
         $message = sprintf(JText::_('SEND_MSG_ACTIVATE'), $name, $sitename, $siteURL . "index.php?option=com_user&task=activate&activation=" . $user->get('activation'), $siteURL, $username, $password);
     } else {
         $message = sprintf(JText::_('SEND_MSG'), $name, $sitename, $siteURL);
     }
     $message = html_entity_decode($message, ENT_QUOTES);
     //get all super administrator
     $query = 'SELECT name, email, sendEmail' . ' FROM #__users' . ' WHERE LOWER( usertype ) = "super administrator"';
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     // Send email to user
     if (!$mailfrom || !$fromname) {
         $fromname = $rows[0]->name;
         $mailfrom = $rows[0]->email;
     }
     JUtility::sendMail($mailfrom, $fromname, $email, $subject, $message);
     // Send notification to all administrators
     $subject2 = sprintf(JText::_('Account details for'), $name, $sitename);
     $subject2 = html_entity_decode($subject2, ENT_QUOTES);
     // get superadministrators id
     foreach ($rows as $row) {
         if ($row->sendEmail) {
             $message2 = sprintf(JText::_('SEND_MSG_ADMIN'), $row->name, $sitename, $name, $email, $username);
             $message2 = html_entity_decode($message2, ENT_QUOTES);
             JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
         }
     }
     // Send activation SMS
     require_once JPATH_SITE . DS . 'libraries' . DS . 'sms_api.php';
     $mysms = new sms();
     $mobile = $user->get('mobile');
     $smsBody = JText::_('REG_COMPLETE_ACTIVATE_SMS');
     $mysms->send($mobile, "Kmit", $smsBody);
 }
开发者ID:BackupTheBerlios,项目名称:kmit-svn,代码行数:49,代码来源:controller.php

示例14: forgetPwd_changePwd_admin

function forgetPwd_changePwd_admin($admin, $password)
{
    $newPass = '';
    if (!empty($admin["ec_salt"])) {
        $newPass = md5(md5($password) . $admin["ec_salt"]);
    } else {
        $newPass = md5($password);
    }
    $table = "hteacher.ht_admin_user";
    $sql = "update " . $table . " set password='" . $newPass . "' where user_id=" . $admin['user_id'];
    $GLOBALS["db"]->query($sql);
    //发送短信提醒
    require_once ROOT_PATH . '/includes/cls_sms.php';
    $content = sms_tmp_change_pwd_by_phone_admin($admin, $password);
    $sms = new sms();
    $res = $sms->send($admin["cellphone"], $content, $admin["school_code"], $admin["class_code"], "system");
    $res["sql"] = $sql;
    return $res;
}
开发者ID:dalinhuang,项目名称:hteacher,代码行数:19,代码来源:login.php

示例15: implode

         $phone .= implode(',', $value);
     }
 }
 $msg = isset($_POST['msg']) ? $_POST['msg'] : '';
 $send_date = isset($_POST['send_date']) ? $_POST['send_date'] : '';
 $phone_tmp = explode(',', substr($phone, 1));
 $phone_num = count($phone_tmp);
 $kjrs_offset = 100;
 //每次发送短信的条数
 if ($phone_num > $kjrs_offset) {
     $kjrs_sendTime = ceil($phone_num / $kjrs_offset);
     //短信发送功能彻底通过测试后,可删除下行代码
     for ($i = 0; $i < $kjrs_sendTime; $i++) {
         if ($phone = array_slice($phone_tmp, $i * $kjrs_offset, $kjrs_offset)) {
             $phone = implode(',', $phone);
             $result = $sms->send($phone, $msg, $send_date, $send_num = 13, $username);
         }
     }
 } else {
     $result = $sms->send($phone, $msg, $send_date, $send_num = 13, $username);
 }
 $link[] = array('text' => $_LANG['back'] . $_LANG['03_sms_send'], 'href' => 'sms.php?act=display_send_ui');
 if ($result === true) {
     $words_num = strlen($msg);
     $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('sms_log') . '(phone_num, province, city, district, customer_type, sms_content, is_plus_user, send_time, admin_id, words_num)VALUES(' . "'{$phone_num}', '{$_POST['province']}', '{$_POST['city']}', '{$_POST['district']}', RIGHT('{$_POST['send_rank']}' , 1), '{$msg}', '{$_POST['plus_name']}', UNIX_TIMESTAMP(NOW()), {$_SESSION['admin_id']}, {$words_num} )";
     $GLOBALS['db']->query($sql);
     sys_msg($_LANG['send_ok'], 0, $link);
 } else {
     @($error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']] . $_LANG['api_errors']['send'][$sms->errors['api_errors']['error_no']]);
     sys_msg($_LANG['send_error'] . $error_detail, 1, $link);
 }
开发者ID:554119220,项目名称:kjrscrm,代码行数:31,代码来源:sms.php


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