Exemple #1
1
 public function getSerial()
 {
     if (!isset(self::$_serial)) {
         $this->displayDebug('Création de l\'interface série sur le port : ' . $this->getConfiguration('port'));
         $serial = new phpSerial();
         $serial->deviceSet($this->getConfiguration('port'));
         $serial->confBaudRate(9600);
         $serial->confParity('none');
         $serial->confStopBits(1);
         $serial->confCharacterLength(8);
         $serial->confFlowControl('none');
         $serial->sendParameters("-ignbrk -hupcl -onlcr -echo -echok -echoctl -echoke");
         $serial->setValidOutputs(array('OK', 'ERROR', '+CPIN: SIM PIN', '+CPIN: READY', '>', 'COMMAND NOT SUPPORT', '+CMS ERROR: 305'));
         self::$_serial = $serial;
         $this->cleanDevice();
     }
     return self::$_serial;
 }
 function handle_inbox()
 {
     if (!$_REQUEST['msisdn']) {
         return;
     }
     extract($_REQUEST);
     $data = array('text' => $text, 'message_id' => $messageId, 'msisdn' => $msisdn, 'type' => $type, 'to' => $to, 'keyword' => $keyword, 'timestamp' => $_REQUEST['message-timestamp']);
     $sms = new sms($data);
     $sms->save_inbound();
     header("HTTP/1.1 200 OK");
     exit;
 }
 function index()
 {
     $variables = ORM::factory('private_gateway')->find_all();
     foreach ($variables as $variable) {
         $phonenumber = $variable->phonenumber_variable;
         $message = $variable->message_variable;
     }
     if (isset($_GET['key'])) {
         $private_gateway_key = $_GET['key'];
     }
     if (isset($_GET[$phonenumber])) {
         $message_from = $_GET[$phonenumber];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($_GET[$message])) {
         $message_description = $_GET[$message];
     }
     if (!empty($private_gateway_key) and !empty($message_from) and !empty($message_description)) {
         // Is this a valid sync Key?
         $keycheck = ORM::factory('private_gateway')->where('private_gateway_key', $private_gateway_key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description);
         }
     }
 }
Exemple #4
0
 /**
  * @param string $smsGatewayName
  */
 public static function sendSms($information = array())
 {
     $smsGatewayName = self::getSmsGateway();
     $option = self::getSmsGatewayOption($smsGatewayName);
     self::includeSmsGatewayClass($smsGatewayName);
     return sms::sendSms($information, $option);
 }
Exemple #5
0
 /**
  * Send The SMS Message Using Default Provider
  * @param to mixed	The destination address.
  * @param from mixed  The source/sender address
  * @param text mixed  The text content of the message
  *
  * @return mixed/bool (returns TRUE if sent FALSE or other text for fail)
  */
 public static function send($to = NULL, $from = NULL, $message = NULL)
 {
     if (!$to or !$message) {
         return "Missing Recipients and/or Message";
     }
     // 1. Do we have an SMS Provider?
     $provider = Kohana::config("settings.sms_provider");
     if ($provider) {
         // 2. Does the plugin exist, and if so, is it active?
         $plugin = ORM::factory("plugin")->where("plugin_name", $provider)->where("plugin_active", 1)->find();
         if ($plugin->loaded) {
             // Plugin exists and is active
             // 3. Does this plugin have the SMS Library in place?
             $class = ucfirst($provider) . '_SMS';
             $path = sms::find_provider($provider);
             if ($path) {
                 // File Exists
                 $sender = new $class();
                 // 4. Does the send method exist in this class?
                 if (method_exists($sender, 'send')) {
                     $response = $sender->send($to, $from, $message);
                     return $response;
                 }
             }
         }
     }
     return "No SMS Sending Provider In System";
 }
Exemple #6
0
 function index()
 {
     $secret = "";
     if (isset($this->request['secret'])) {
         $secret = $this->request['secret'];
     }
     if (isset($this->request['from'])) {
         $message_from = $this->request['from'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($this->request['message'])) {
         $message_description = $this->request['message'];
     }
     if (!empty($message_from) and !empty($message_description)) {
         $secret_match = TRUE;
         // Is this a valid Secret?
         $smssync = ORM::factory('smssync')->find(1);
         if ($smssync->loaded) {
             $smssync_secret = $smssync->secret;
             if ($smssync_secret and $secret != $smssync_secret) {
                 // A Secret has been set and they don't match
                 $secret_match = FALSE;
             }
         } else {
             // Can't load table
             $secret_match = FALSE;
         }
         if ($secret_match) {
             sms::add($message_from, $message_description);
         }
     }
 }
Exemple #7
0
 function index()
 {
     $xmlstr = file_get_contents('php://input');
     $messagein = new SimpleXMLElement($xmlstr);
     $message_from = $messagein->From;
     $message_to = $messagein->To;
     $message_txt = $messagein->MessageText;
     sms::add($message_from, "{$message_txt}");
 }
Exemple #8
0
	function index()
	{
		$secret = "";		
		if (isset($this->request['secret']))
		{
			$secret = $this->request['secret'];
		}
		
		if (isset($this->request['from']))
		{
			$message_from = $this->request['from'];
			// Remove non-numeric characters from string
			$message_from = preg_replace("#[^0-9]#", "", $message_from);
		}
		
		if (isset($this->request['message']))
		{
			$message_description = $this->request['message'];
		}
		
		if ( ! empty($message_from) AND ! empty($message_description))
		{
			$secret_match = TRUE;
			
			// Is this a valid Secret?
			$smssync = ORM::factory('smssync_settings')
				->find(1);
			
			if ($smssync->loaded)
			{
				$smssync_secret = $smssync->smssync_secret;
				if ($smssync_secret AND $secret != $smssync_secret)
				{ // A Secret has been set and they don't match
					$secret_match = FALSE;
				}
			}
			else
			{ // Can't load table
				$secret_match = FALSE;
			}
			
			if ($secret_match)
			{
				sms::add($message_from, $message_description);
				echo json_encode(array("payload" => array("success" => "true")));
			}
			else
			{
				echo json_encode(array("payload" => array("success" => "false")));
			}
		}
		else
		{
			echo json_encode(array("payload" => array("success" => "false")));
		}
	}
 public function SendCode()
 {
     $tel = I('tel');
     if (preg_match("/1[3458]{1}\\d{9}\$/", $tel)) {
         import('Vendor.Sms.sms');
         $sms = new \sms();
         $mobile_code = phone_random(0, 9);
         $content = "您的验证码是:" . $mobile_code . "。请不要把验证码泄露给其他人。";
         $result = $sms->sendTo($tel, $content);
         $date = array('tel' => $tel, 'authcode' => $mobile_code, 'create_time' => date("Y-m-d H:i:s"));
         if (2 == $result['code']) {
             M('t_authcode')->add($date);
             $this->ajaxReturn("1");
         } else {
             $this->ajaxReturn($result);
         }
     } else {
         $this->ajaxReturn('手机号码不正确');
     }
 }
Exemple #10
0
 function __construct()
 {
     global $prefix;
     $db_connection = new dbConnection();
     $this->link = $db_connection->connect();
     ini_set("soap.wsdl_cache_enabled", "0");
     self::$sms_client = new SoapClient('http://87.107.121.54/post/Send.asmx?wsdl', array('encoding' => 'UTF-8'));
     $this->parameters['username'] = "";
     $this->parameters['password'] = "";
     $this->parameters['from'] = "";
     return $this->link;
 }
Exemple #11
0
 private function _receive()
 {
     $secret = "";
     $success = "false";
     //Sometimes user send blank SMSs or GSM operators will
     //send promotional SMSs with no phone number, so this way
     //these messages will always end up on the backend and not float around
     //on the phones forever.
     $message_description = Kohana::lang("ui_main.empty");
     $message_from = "00000000";
     $non_numeric_source = false;
     if (isset($this->request['secret'])) {
         $secret = $this->request['secret'];
     }
     if (isset($this->request['from']) && strlen($this->request['from']) > 0) {
         $message_from = $this->request['from'];
         $original_from = $message_from;
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
         if (strlen($message_from) == 0) {
             $message_from = "00000000";
             $non_numeric_source = true;
         }
     }
     if (isset($this->request['message']) && strlen($this->request['message']) > 0) {
         $message_description = $this->request['message'];
     }
     if ($non_numeric_source) {
         $message_description = '<div style="color:red;">' . Kohana::lang("ui_main.message_non_numeric_source") . " \"" . $original_from . "\" </div>" . $message_description;
     }
     if (!empty($message_from) and !empty($message_description)) {
         $secret_match = TRUE;
         // Is this a valid Secret?
         $smssync = ORM::factory('smssync_settings')->find(1);
         if ($smssync->loaded) {
             $smssync_secret = $smssync->smssync_secret;
             if ($smssync_secret and $secret != $smssync_secret) {
                 // A Secret has been set and they don't match
                 $secret_match = FALSE;
             }
         } else {
             // No Secret Set
             $secret_match = TRUE;
         }
         if ($secret_match) {
             sms::add($message_from, $message_description);
             $success = "true";
         }
     }
     echo json_encode(array("payload" => array("success" => $success)));
 }
Exemple #12
0
 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;
 }
 /**
  * Processes incoming messages
  */
 public function inbound()
 {
     // Get the received data
     $data = array_merge($_GET, $_POST);
     // Verify the API key and incoming messageId parameters
     if (!empty($data['key']) and !empty($data['messageId']) and Nexmo_Model::is_valid_api_key($data['key'], 'inbound_message_key')) {
         // Extract fields from the submitted data
         $log_data = array('message_id' => $data['messageId'], 'message_type' => 1, 'message_sender' => $data['msisdn']);
         // Initialize model for updating the internal nexmo message log
         $log_entry = new Nexmo_Message_Log_Model();
         if ($log_entry->validate($log_data)) {
             // Success, save
             $log_entry->save();
         }
         //  Add entry to the main messages list
         sms::add($data['msisdn'], $data['text']);
     } else {
         Kohana::log('error', Kohana::lang('nexmo.invalid_url_auth_key'));
     }
 }
Exemple #14
0
 private function inputValidation($tag)
 {
     $okay = true;
     /*
      * Make sure tag is not empty
      */
     $okay = parent::checkHasContents($tag);
     if ($okay == false) {
         return false;
     }
     debug::output("Validated: Tag ({$tag}) is not empty.");
     /*
      * Make sure tag is in the correct format
      */
     $okay = parent::checkTagFormat($tag);
     if ($okay == false) {
         return false;
     }
     debug::output("Validated: Tag ({$tag}) is correctly formatted.");
     return true;
 }
Exemple #15
0
 function index()
 {
     if (isset($_GET['key'])) {
         $frontlinesms_key = $_GET['key'];
     }
     if (isset($_GET['s'])) {
         $message_from = $_GET['s'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($_GET['m'])) {
         $message_description = $_GET['m'];
     }
     if (!empty($frontlinesms_key) and !empty($message_from) and !empty($message_description)) {
         // Is this a valid FrontlineSMS Key?
         $keycheck = ORM::factory('frontlinesms')->where('frontlinesms_key', $frontlinesms_key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description);
         }
     }
 }
Exemple #16
0
 /**
  * Clickatell 2 way callback handler
  * @param string $key (Unique key that prevents unauthorized access)
  * @return void
  */
 function index($key = NULL)
 {
     if (isset($this->request['from'])) {
         $message_from = $this->request['from'];
         // Remove non-numeric characters from string
         $message_from = preg_replace("#[^0-9]#", "", $message_from);
     }
     if (isset($this->request['to'])) {
         $message_to = $this->request['to'];
         // Remove non-numeric characters from string
         $message_to = preg_replace("#[^0-9]#", "", $message_to);
     }
     if (isset($this->request['text'])) {
         $message_description = $this->request['text'];
     }
     if (!empty($message_from) and !empty($message_description)) {
         // Is this a valid Clickatell Key?
         $keycheck = ORM::factory('clickatell')->where('clickatell_key', $key)->find(1);
         if ($keycheck->loaded == TRUE) {
             sms::add($message_from, $message_description, $message_to);
         }
     }
 }
Exemple #17
0
 function sendsms()
 {
     $type = $_POST['type'];
     $amt = $_POST['amt'];
     $msg = $_POST['msg'];
     $when = $_POST['when'];
     // get numbers
     if ($type == "thai") {
         $query = $this->db->query('SELECT `id`,`name`,`number` FROM `contact_numbers` WHERE `status` = "1" AND `sent` != "1" LIMIT ' . $amt . '');
     }
     $contacts = $query->result();
     include "/home/www/xxxxxx.com/htdocs/js/sms/sms.class.php";
     $result_message = 'SMS RESULTS<br />';
     //print_r($contacts);
     foreach ($contacts as $c) {
         $username = '******';
         $password = '******';
         //$username = '******';
         //$password = '******';
         $ph = str_replace('+66', '0', $c->number);
         $msisdn = $ph;
         $message = str_replace('**NAME**', $c->name == "" ? '' : $c->name, $msg);
         $message = str_replace('**Name**', $c->name == "" ? '' : $c->name, $message);
         $message = str_replace('**name**', $c->name == "" ? '' : $c->name, $message);
         $sender = 'xxxxxx';
         //$sender = 'THAIBULKSMS';
         $ScheduledDelivery = $when;
         $force = 'standard';
         $result = sms::send_sms($username, $password, $msisdn, $message, $sender, $ScheduledDelivery, $force);
         $result_message .= 'Id: ' . $c->id . ' name: ' . $c->name . ' number: ' . $ph . ' result:' . $result . '<br /><br />';
         // update number
         $query = $this->db->query('UPDATE `contact_numbers` SET `sent` = 1 WHERE `id` = "' . $c->id . '"');
     }
     echo $result_message;
     exit;
 }
Exemple #18
0
<?php

define('IN_ECS', true);
require dirname(__FILE__) . '/includes/init.php';
require_once ROOT_PATH . 'includes/cls_sms.php';
$action = isset($_REQUEST['act']) ? $_REQUEST['act'] : 'display_my_info';
$sms = new sms();
switch ($action) {
    //    /* 注册短信服务。*/
    //    case 'register' :
    //        $email      = isset($_POST['email'])    ? $_POST['email']       : '';
    //        $password   = isset($_POST['password']) ? $_POST['password']    : '';
    //        $domain     = isset($_POST['domain'])   ? $_POST['domain']      : '';
    //        $phone      = isset($_POST['phone'])    ? $_POST['phone']       : '';
    //
    //        $result = $sms->register($email, $password, $domain, $phone);
    //
    //        $link[] = array('text'  =>  $_LANG['back'],
    //                        'href'  =>  'sms.php?act=display_my_info');
    //
    //        if ($result === true)//注册成功
    //        {
    //            sys_msg($_LANG['register_ok'], 0, $link);
    //        }
    //        else
    //        {
    //            @$error_detail = $_LANG['server_errors'][$sms->errors['server_errors']['error_no']]
    //                          . $_LANG['api_errors']['register'][$sms->errors['api_errors']['error_no']];
    //            sys_msg($_LANG['register_error'] . $error_detail, 1, $link);
    //        }
    //
Exemple #19
0
             $smarty->assign('order', $order);
             $smarty->assign('send_time', local_date($_CFG['time_format']));
             $smarty->assign('shop_name', $_CFG['shop_name']);
             $smarty->assign('send_date', local_date($_CFG['date_format']));
             $smarty->assign('sent_date', local_date($_CFG['date_format']));
             $smarty->assign('confirm_url', $ecs->url() . 'receive.php?id=' . $order['order_id'] . '&con=' . rawurlencode($order['consignee']));
             $smarty->assign('send_msg_url', $ecs->url() . 'user.php?act=message_list&order_id=' . $order['order_id']);
             $content = $smarty->fetch('str:' . $tpl['template_content']);
             if (!send_mail($order['consignee'], $order['email'], $tpl['template_subject'], $content, $tpl['is_html'])) {
                 $msg = $_LANG['send_mail_fail'];
             }
         }
         /* 如果需要,发短信 */
         if ($GLOBALS['_CFG']['sms_order_shipped'] == '1' && $order['mobile'] != '') {
             include_once '../includes/cls_sms.php';
             $sms = new sms();
             $sms->send($order['mobile'], sprintf($GLOBALS['_LANG']['order_shipped_sms'], $order['order_sn'], local_date($GLOBALS['_LANG']['sms_time_format']), $GLOBALS['_CFG']['shop_name']), 0);
         }
     }
     /* 清除缓存 */
     clear_cache_files();
     /* 操作成功 */
     $links[] = array('text' => $_LANG['09_delivery_order'], 'href' => 'order.php?act=delivery_list');
     $links[] = array('text' => $_LANG['delivery_sn'] . $_LANG['detail'], 'href' => 'order.php?act=delivery_info&delivery_id=' . $delivery_id);
     sys_msg($_LANG['act_ok'], 0, $links);
 } elseif ($_REQUEST['act'] == 'delivery_cancel_ship') {
     /* 检查权限 */
     admin_priv('delivery_view');
     /* 取得参数 */
     $delivery = '';
     $order_id = intval(trim($_REQUEST['order_id']));
Exemple #20
0
 $msisdn = $_REQUEST['msisdn'];
 $msg = $_REQUEST['message'];
 # # # # # # # # # LOG TO FILE # # # # # # # # #
 $stamp = date("Y-m-d H:i:s");
 $fp = fopen("sms.log", "a+");
 foreach ($_REQUEST as $k => $v) {
     fputs($fp, "[" . $stamp . "]" . $k . " => " . $v . "\n");
 }
 fclose($fp);
 echo "received";
 # # # # # # # # # END LOG TO FILE # # # # # # # # #
 # # # # # # # # # LOG TO DB # # # # # # # # #
 global $current_user;
 $current_user->retrieve(1);
 require_once "custom/sms/sms.php";
 $sms = new sms();
 $sms->retrieve_settings();
 require_once "modules/sugartalk_SMS/sugartalk_SMS.php";
 $sugartalk_SMS = new sugartalk_SMS();
 require_once "modules/Administration/sugartalk_smsPhone/sms_enzyme.php";
 $e = new sms_enzyme();
 $result = $e->parse_sms_macro($msg);
 if ($result['code'] != '') {
     # recreate $e and retrieve the module's id
     $e = new sms_enzyme($result['module']);
     include_once $e->mod_bean_files;
     $object = new $e->module_sing();
     $where_array = array($result['field'] => $result['code']);
     $object->retrieve_by_string_fields($where_array);
     $parent_id = $object->id;
     $parent_type = $result['module'];
/**
 * 修改订单的支付状态
 *
 * @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'];
            }
        }
    }
}
Exemple #22
0
 }
 /* 给商家发邮件 */
 /* 增加是否给客服发送邮件选项 */
 if ($_CFG['send_service_email'] && $_CFG['service_email'] != '') {
     $tpl = get_mail_template('remind_of_new_order');
     $smarty->assign('order', $order);
     $smarty->assign('goods_list', $cart_goods);
     $smarty->assign('shop_name', $_CFG['shop_name']);
     $smarty->assign('send_date', date($_CFG['time_format']));
     $content = $smarty->fetch('str:' . $tpl['template_content']);
     send_mail($_CFG['shop_name'], $_CFG['service_email'], $tpl['template_subject'], $content, $tpl['is_html']);
 }
 /* 如果需要,发短信 */
 if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '') {
     include_once 'includes/cls_sms.php';
     $sms = new sms();
     $msg = $order['pay_status'] == PS_UNPAYED ? $_LANG['order_placed_sms'] : $_LANG['order_placed_sms'] . '[' . $_LANG['sms_paid'] . ']';
     $sms->send($_CFG['sms_shop_mobile'], sprintf($msg, $order['consignee'], $order['tel']), 0);
 }
 /* 如果订单金额为0 处理虚拟卡 */
 if ($order['order_amount'] <= 0) {
     $sql = "SELECT goods_id, goods_name, goods_number AS num FROM " . $GLOBALS['ecs']->table('cart') . " WHERE is_real = 0 AND extension_code = 'virtual_card'" . " AND session_id = '" . SESS_ID . "' AND rec_type = '{$flow_type}'";
     $res = $GLOBALS['db']->getAll($sql);
     $virtual_goods = array();
     foreach ($res as $row) {
         $virtual_goods['virtual_card'][] = array('goods_id' => $row['goods_id'], 'goods_name' => $row['goods_name'], 'num' => $row['num']);
     }
     if ($virtual_goods and $flow_type != CART_GROUP_BUY_GOODS) {
         /* 虚拟卡发货 */
         if (virtual_goods_ship($virtual_goods, $msg, $order['order_sn'], true)) {
             /* 如果没有实体商品,修改发货状态,送积分和红包 */
Exemple #23
0
     }
 }
 $MsgCount = array_count_values($SendTo);
 $db->query("select SmsCredits, id from Members where UserName='******'");
 if ($db->next_record()) {
     $Credits = $db->f(0);
     $MemberID = $db->f(1);
 } else {
     $Credits = 0;
     echo "Can't find how many credits you have left. - Program Error please tell webmaster@nass.com.au";
     page_close();
     exit;
 }
 $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);
Exemple #24
0
 $smsid = '';
 $total = 0;
 $sql = "SELECT count(id) FROM orderd WHERE YEAR(data_create)='" . date('Y') . "' AND MONTH(data_create)='" . date('m') . "' AND DAY(data_create)='" . date('d') . "'";
 $db->query($sql);
 $val = $db->getValue();
 if ($val + 1 < 10) {
     $dopol = '00';
 } else {
     if ($val + 1 >= 10 and $val + 1 < 100) {
         $dopol = '0';
     } else {
         $dopol = '';
     }
 }
 $uid = date('ymd') . $dopol . $val + 1;
 $sms = new sms();
 $sms->setLogin('lyufari');
 $sms->setPass('zayaccool');
 $text_sms_manger = 'Бронь ';
 $text_sms_manger .= $_POST['roomtype'] == "delux" ? '"номер де люкс" ' : '"номер апартаменты" ';
 $text_sms_manger .= 'на сумму ' . $itogo . ' грн';
 if ($sms->auth()) {
     $phone_who = $_POST['phonecode'] . $_POST['phone'];
     $sms->sendsms('lyufari', $phone_who, "Спасибо. Бронь #" . $uid . "\nМы свяжемся с вами в ближайшее время.");
     $sms->sendsms('lyufari', '+380505870147', $text_sms_manger);
     $sms->sendsms('lyufari', '+380951727272', $text_sms_manger);
     //          $sms->sendsms('lyufari','+380951727272',"Бронь с сайта #".$uid." на сумму ".$itogo);
     $smsid = $sms->smsresultbynumb(1);
     //id
 }
 $sql = "INSERT INTO orderd (uid,smsid,data_create,date,name,phone,nameevent,peoplecount,comment,address,zakaz,type) VALUES('%s','%s','" . date('Y-m-d H:i:s') . "','','%s','" . $_POST['phonecode'] . $_POST['phone'] . "','','','','','','notrest')";
<?php

error_reporting(E_ALL);
ob_implicit_flush(true);
include_once "class.curl.php";
include_once "class.sms.php";
include_once "cprint.php";
$smsapp = new sms();
$smsapp->setGateway('way2sms');
$myno = $_POST['fromno'];
$p = $_POST['pass'];
$tonum = $_POST['tono'];
$mess = $_POST['message'];
cprint("Logging in ..\n");
$ret = $smsapp->login($myno, $p);
if (!$ret) {
    cprint("Error Logging In");
    exit(1);
}
print "Logged in Successfully\n";
print "Sending SMS ..\n";
$ret = $smsapp->send($tonum, $mess);
if (!$ret) {
    print "Error in sending message";
    exit(1);
}
print "Message sent";
 private function sendRejectMessageToUser($userPhone, $userName, $reason)
 {
     vendor("sms");
     $sms = new sms();
     $msg = $userName . ",您的订单商家被商家拒绝,商家拒绝理由为:" . $reason . "。欢迎您继续使用【点餐吧】";
     $sms->sendnote($userPhone, $msg);
     return true;
 }
Exemple #27
0
    //更新管理员信息
    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') {
    /* 检查权限 */
Exemple #28
0
 /**
  * Send A New Message Using Default SMS Provider
  */
 public function send()
 {
     $this->template = "";
     $this->auto_render = FALSE;
     // Setup and initialize form field names
     $form = array('to_id' => '', 'message' => '');
     //  Copy the form as errors, so the errors will be stored with keys
     //  corresponding to the form field names
     $errors = $form;
     $form_error = FALSE;
     // Check, has the form been submitted, if so, setup validation
     if ($_POST) {
         // Instantiate Validation, use $post, so we don't overwrite $_POST
         // fields with our own things
         $post = new Validation($_POST);
         // Add some filters
         $post->pre_filter('trim', TRUE);
         // Add some rules, the input field, followed by a list of checks, carried out in order
         $post->add_rules('to_id', 'required', 'numeric');
         $post->add_rules('message', 'required', 'length[1,160]');
         // Test to see if things passed the rule checks
         if ($post->validate()) {
             // Yes! everything is valid
             $reply_to = ORM::factory('message', $post->to_id);
             if ($reply_to->loaded == true) {
                 // Yes! Replyto Exists
                 // This is the message we're replying to
                 $sms_to = $reply_to->message_from;
                 //checks if the number is encrypted
                 if (preg_match("/([a-zA-Z])(\\D)/", $sms_to)) {
                     $this->decrypter = new Encrypt();
                     $sms_to = $this->decrypter->decode($sms_to);
                 } else {
                     $sms_to = $sms_to;
                 }
                 // Load Users Settings
                 $settings = Settings_Model::get_array();
                 if (!empty($settings)) {
                     // Get SMS Numbers
                     if (!empty($settings['sms_no1'])) {
                         $sms_from = $settings['sms_no1'];
                     } elseif (!empty($settings['sms_no2'])) {
                         $sms_from = $settings['sms_no2'];
                     } elseif (!empty($settings['sms_no3'])) {
                         $sms_from = $settings['sms_no3'];
                     } else {
                         // User needs to set up an SMS number
                         $sms_from = "000";
                     }
                     // Send Message
                     $response = sms::send($sms_to, $sms_from, $post->message);
                     // Message Went Through??
                     if ($response === TRUE) {
                         $message = ORM::factory('message');
                         $message->parent_id = $post->to_id;
                         // The parent message
                         $message->message_from = $sms_from;
                         $message->message_to = $sms_to;
                         $message->message = $post->message;
                         $message->message_type = 2;
                         // This is an outgoing message
                         $message->reporter_id = $reply_to->reporter_id;
                         $message->message_date = date("Y-m-d H:i:s", time());
                         $message->save();
                         echo json_encode(array("status" => "sent", "message" => Kohana::lang('ui_admin.message_sent')));
                     } else {
                         // Message Failed
                         echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_admin.error_msg') . " - " . $response));
                     }
                 } else {
                     echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_admin.error_msg') . Kohana::lang('ui_admin.check_sms_settings')));
                 }
             } else {
                 // Send_To Mobile Number Doesn't Exist
                 echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_admin.error_msg') . Kohana::lang('ui_admin.check_number')));
             }
         } else {
             // Populate the error fields, if any
             $errors = arr::overwrite($errors, $post->errors('messages'));
             echo json_encode(array("status" => "error", "message" => Kohana::lang('ui_admin.error_msg') . Kohana::lang('ui_admin.check_message_valid')));
         }
     }
 }
 /**
  * Receive SMS's via FrontlineSMS or via Mobile Phone Native Apps
  *
  * @return string
  */
 public function sms()
 {
     $reponse = array();
     // Validate User
     // Should either be authenticated or have app_key
     $username = isset($this->request['username']) ? $this->request['username'] : "";
     $password = isset($this->request['password']) ? $this->request['password'] : "";
     $app_key = isset($this->request['key']) ? $this->request['key'] : "";
     if ($user_id = $this->_login($username, $password)) {
         // Process POST
         // setup and initialize form field names
         $form = array('message_from' => '', 'message_description' => '', 'message_date' => '');
         /**
          * Instantiate Validation,
          * use $post, so we don't overwrite $_POST fields with our
          * own things
          */
         $post = Validation::factory($_POST);
         //  Add some filters
         $post->pre_filter('trim', TRUE);
         /**
          * Add some rules, the input field, followed by a list of
          * checks, carried out in order.
          */
         $post->add_rules('message_from', 'required', 'numeric', 'length[6,20]');
         $post->add_rules('message_description', 'required', 'length[3,300]');
         $post->add_rules('message_date', 'date_mmddyyyy');
         // Test to see if things passed the rule checks
         if ($post->validate()) {
             sms::add($post->message_from, $post->message_description);
             // success!
             $reponse = array("payload" => array("domain" => $this->domain, "success" => "true"), "error" => $this->api_service->get_error_msg(0));
         } else {
             // Required parameters are missing or invalid
             $reponse = array("payload" => array("domain" => $this->domain, "success" => "false"), "error" => $this->api_service->get_error_msg(02));
         }
     } else {
         // Authentication Failed. Invalid User or App Key
         $reponse = array("payload" => array("domain" => $this->domain, "success" => "false"), "error" => $this->api_service->get_error_msg(05));
     }
     // Set the response data
     $this->response_data = $this->response_type == 'json' ? $this->array_as_json($reponse) : $this->array_as_xml($reponse, array());
 }
Exemple #30
0
if (!defined('sugarEntry')) {
    define('sugarEntry', true);
}
include_once 'modules/Configurator/Configurator.php';
require_once 'custom/sms/sms.php';
include_once 'sugar_version.php';
if (!defined("MSG_UNVERIFIED")) {
    define("MSG_UNVERIFIED", "Невозможно подключить ваш аккаунт. Пожалуйста, повторите попытку или свяжитесь с провайдером для проверки.");
}
$sms = new sms();
$parent_link = "<a href='index.php?module=Administration&action=index'>Administration</a><span class='pointer'>&raquo;</span>";
if (isset($_GET['option'])) {
    switch ($_GET['option']) {
        case "smsUsage":
            require_once "custom/sms/sms.php";
            $sms = new sms();
            $usages = $sms->get_credit_usages();
            arsort($usages);
            if (sizeof($usages)) {
                echo "<div class='moduleTitle'><h2>{$parent_link}SMS Credit Usages</h2></div>";
                echo "<div class='dashletPanelMenu'>";
                echo "<div class='hd'><div class='tl'></div><div class='hd-center'></div><div class='tr'></div></div>";
                echo "<div class='bd'><div class='ml'></div><div class='bd-center'><div class='screen'>";
                echo "<table  border='0' cellspacing='1' cellpadding='0' class='list view' width='100%'>";
                echo "<tr><th>Date</th><td scope='col'>Description</td><td scope='col'>Amount</td></tr>";
                foreach ($usages as $val) {
                    echo "<tr><td>" . date("M d, Y", strtotime($val['date'])) . "</td>";
                    echo "<td>{$val['description']}</td>";
                    echo "<td>{$val['amount']}</td></tr>";
                }
                echo "</table>";