Example #1
0
 /**
  * 发送短信
  *
  * @access public
  * @return boolean
  */
 public function index()
 {
     $start_time = strtotime('-1 day 16:00');
     $end_time = 0;
     if (date('H') <= '11:10') {
         if (date('w') == 1 && (time() >= 1443628800 && time() < 1444492800)) {
             $start_time = strtotime('last Friday 16:00');
         }
         $end_time = strtotime('today 11:01');
     } else {
         $start_time = strtotime('today 11:01:01');
         $end_time = strtotime('today 16:01');
     }
     $this->load->model('Cash_order_model', 'cash_order');
     $report = $this->cash_order->sum(array('money'), array('start_time' => date("Y-m-d H:i:s", $start_time), 'end_time' => date("Y-m-d H:i:s", $end_time), 'status' => 'pending'));
     $report['money'] = !empty($report['money']) ? $report['money'] : 0;
     $content = date('m月d日 H:i', $start_time) . ' 至 ' . date('m月d日 H:i', $end_time) . " 提现统计:";
     $content .= "¥{$report['money']}元";
     $content .= '【图腾贷】';
     $phone_arr = $this->phone;
     foreach ($phone_arr as $ph) {
         send_sms($ph, array('template' => 'cashreport_template', 'start_time' => date('m月d日H:i', $start_time), 'end_time' => date('m月d日H:i', $end_time), 'money' => $report['money']));
     }
     $msg = '-----------------' . date('Y-m-d H:i:s') . '提现统计-----------------';
     $msg .= "\n{$content}";
     //记录日志
     log_message('error', $msg, 'cash_report');
     return true;
 }
Example #2
0
function error_handler($errno, $errstr, $errfile, $errline)
{
    $dt_tm = date("Y-m-d H:i:s");
    $log = "[{$dt_tm}] {$errstr} in  {$errfile} at {$errline}\n";
    file_put_contents("/var/www/test/update/log/errors.log", $log, FILE_APPEND);
    $err_return;
    switch ($errno) {
        case E_USER_ERROR:
        case E_ERROR:
            $err_return = "[{$dt_tm}]\nError: {$errstr} in file {$errfile} at {$errline}";
            send_sms($err_return, $errfile, $errline);
            exit(1);
            break;
        case E_USER_WARNING:
        case E_WARNING:
            $err_return = "[{$dt_tm}]\nWarning: {$errstr} in file {$errfile} at {$errline}";
            break;
        case E_USER_NOTICE:
        case E_NOTICE:
            $err_return = "[{$dt_tm}]\nNotice: {$errstr} on line {$errline} at {$errfile}\n";
            break;
        default:
            $err_return = "[{$dt_tm}]\n{$errstr} in {$errfile} at {$errline}";
            break;
    }
    send_sms($err_return, $errfile, $errline);
    return true;
}
Example #3
0
 /**
  * 发送手机短信
  * @param unknown $mobile 手机号
  * @param unknown $content 短信内容
  */
 public function send($mobile, $content)
 {
     $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', C('sms.plugin'))));
     if (!empty($plugin)) {
         define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
         require_once PLUGIN_ROOT . DS . $plugin . DS . 'Send.php';
         return send_sms($content, $mobile);
     }
     return $this->_sendEmay($mobile, $content);
 }
Example #4
0
 public function send_sms()
 {
     if (!IS_SAE && !C('SAE_AKEY')) {
         exit('在本地执行发送短信函数,需要配置SAE_AKEY和SAE_SKEY<br />');
     }
     $ret = send_sms(18611052787, '发送一条短信');
     if (!$ret) {
         $this->show('短信发送失败,请在trace信息中看失败原因');
     } else {
         $this->show('短信发送成功');
     }
 }
 /**
  *短信验证处理
  *
  *Return $msg,ok为正常处理,pass为次数超出 ,having 为已经注册了,time 为时间限定条件,三分钟内不发
  */
 public function phonecodesend()
 {
     $phone = I('param.phone', 'null');
     $code = strtolower(randCode());
     //随机验证码
     $condition['telephone'] = $phone;
     $usercheck = M('user', 'yijiayi.')->where($condition)->find();
     //用户是否存在
     $sessionValue = array('phone' => $phone, 'time' => time(), 'value' => $code, 'number' => '1');
     //缓存数据设置
     $checktruecode = session('getsession');
     $codeTime = date("d", $checktruecode['time']);
     $nowTime = date("d", time());
     /**
      *判定是否存在session 空,发
      *判定session时间有效性
      */
     $tpl_value = '【一家依】您的验证码是' . $code;
     //发送信息的母板
     if (empty($usercheck)) {
         if (empty($checktruecode)) {
             //session 为空
             echo 'need to setting session';
             $_SESSION['getsession'] = $sessionValue;
             send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
             //发送信息
             $res_code = "ok";
             //操作成功标注
         } else {
             if ($codeTime != $nowTime) {
                 //当天没发送记录
                 send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
                 $_SESSION['getsession'] = $sessionValue;
                 $res_code = "ok";
             } else {
                 if ($checktruecode['number'] <= '5') {
                     //当天没发送记录>5
                     $setNumber = $checktruecode['number'] + "1";
                     $_SESSION['getsession'] = array('phone' => $phone, 'time' => time(), 'value' => $code, 'number' => $setNumber);
                     send_sms('cf34160f4719430181a3d387f9dda3c8', $tpl_value, $phone);
                     $type = "ok";
                 } else {
                     $type = "pass";
                 }
                 $res_code = $type;
             }
         }
     } else {
         $res_code = "having";
     }
     $res_data['msg'] = $res_code;
     $this->ajaxReturn($res_data);
 }
function notifications($type, $recipients, $subject, $message)
{
    if ($type == "both") {
        send_sms($recipients, $subject, $message);
        send_email($recipients, $subject, $message);
    } else {
        if ($type == "sms") {
            send_sms($recipients, $subject, $message);
        } else {
            if ($type == "email") {
                send_email($recipients, $subject, $message);
            }
        }
    }
}
Example #7
0
 public function sendsms()
 {
     $end = session('smstime') + 90 - time();
     if ($end > 1) {
         $this->error('距离上一次发送还有' . $end . '秒');
     } else {
         $phone = session('user.phone');
         $code = rand(10000, 99999);
         session('smscode', $code, 90);
         session('smstime', time());
         if (is_sms()) {
             $sms_message = '验证码:' . $code;
             send_sms($phone, $sms_message);
             $this->success('短信已发送至手机!');
         } else {
             $this->success($code);
         }
     }
 }
Example #8
0
function send_notice($username, $subject, $body)
{
    global $DT, $msg, $eml, $sms, $wec;
    if (!$username || !$subject || !$body) {
        return;
    }
    if (isset($msg)) {
        send_message($username, $subject, $body);
    }
    if (isset($wec)) {
        send_weixin($username, $subject);
    }
    if (isset($eml) || isset($sms)) {
        $user = userinfo($username);
        if (isset($eml)) {
            send_mail($user['email'], $subject, $body);
        }
        if (isset($sms)) {
            send_sms($user['mobile'], $subject . $DT['sms_sign']);
        }
    }
}
 public function send($message, $tonumbers)
 {
     if (!is_array($tonumbers)) {
         $tonumbers = array($tonumbers);
     }
     $sender = $this->getParameter(self::SENDER_PARAM);
     $message = iconv('UTF-8', 'CP1251', htmlspecialchars($message));
     $results = array();
     foreach ($tonumbers as $to) {
         $result = array();
         if (!empty($to)) {
             $result = send_sms($to, $message, 0, 0, 0, 0, $sender, "fmt=1", $this->_username, $this->_password);
             $sms_id = $result[0];
             $result['to'] = $to;
             if (!empty($sms_id)) {
                 $result['id'] = $sms_id . ":::" . $to;
                 $status = get_status($sms_id, $to, 0, $this->_username, $this->_password);
                 $result['status'] = self::MSG_STATUS_PROCESSING;
                 if (count($status) > 2) {
                     $result['statusmessage'] = $this->_msg_status[$status[0]];
                 } else {
                     $result['statusmessage'] = $this->_msg_status[substr($status[1], 1)];
                 }
             } else {
                 $result['error'] = true;
                 $result['status'] = self::MSG_STATUS_ERROR;
                 $result['statusmessage'] = $this->_msg_error[substr($result[1], 1)];
             }
         } else {
             $result['to'] = 'Incorrect phone';
             $result['error'] = true;
             $result['status'] = self::MSG_STATUS_ERROR;
             $result['statusmessage'] = 'Ошибочный номер телефона';
         }
         $results[] = $result;
     }
     return $results;
 }
Example #10
0
} elseif ($act == 'set_teaallow') {
    $templates = label_replace($SMStemplates['set_teaallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_teanotallow') {
    $templates = label_replace($SMStemplates['set_teanotallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_couallow') {
    $templates = label_replace($SMStemplates['set_couallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_counotallow') {
    $templates = label_replace($SMStemplates['set_counotallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_applycou') {
    $templates = label_replace($SMStemplates['set_applycou']);
    send_sms($_GET['mobile'], $templates);
} elseif ($act == 'set_downapp') {
    $templates = label_replace($SMStemplates['set_downapp']);
    send_sms($_GET['mobile'], $templates);
} elseif ($act == 'set_hunallow') {
    $templates = label_replace($SMStemplates['set_hunallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunnotallow') {
    $templates = label_replace($SMStemplates['set_hunnotallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunjobsallow') {
    $templates = label_replace($SMStemplates['set_hunjobsallow']);
    send_sms($userinfo['mobile'], $templates);
} elseif ($act == 'set_hunjobsnotallow') {
    $templates = label_replace($SMStemplates['set_hunjobsnotallow']);
    send_sms($userinfo['mobile'], $templates);
}
Example #11
0
            send_mobile_sms_user($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $USER_ID_STR, $SMS_CONTENT, 1);
        }
    }
    include_once "inc/itask/itask.php";
    mobile_push_notification(userid2uid($USER_ID_STR), $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查看公告通知") . _("标题:") . csubstr($SUBJECT, 0, 20), "notify");
    $WX_OPTIONS = array("module" => "notify", "module_action" => "notify.read", "user" => $USER_ID_STR, "content" => $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查看公告通知") . _("标题:") . csubstr($SUBJECT, 0, 20), "params" => array("NOTIFY_ID" => $NOTIFY_ID));
    wxqy_sms($WX_OPTIONS);
}
if ($PUBLISH == "2") {
    $SMS_CONTENT = _("请审批公告通知!") . "\n" . _("标题:") . csubstr($SUBJECT, 0, 100);
    if (compare_date($BEGIN_DATE1, $CUR_DATE) == 1) {
        $SEND_TIME = $BEGIN_DATE1;
    }
    $REMIND_URL = "1:notify/auditing/unaudited.php";
    if ($SMS_REMIND == "on" && $AUDITER != "" && $AUDITER != $_SESSION['LOGIN_USER_ID']) {
        send_sms($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $AUDITER, 1, $SMS_CONTENT, $REMIND_URL);
    }
    if ($SMS2_REMIND == "on") {
        $SMS_CONTENT = sprintf(_("请审批OA公告,来自%s"), $_SESSION['LOGIN_USER_NAME'] . ":" . $SUBJECT);
        if ($SUMMARY) {
            $SMS_CONTENT .= _("内容简介:") . $SUMMARY;
        }
        if ($AUDITER != "" && $AUDITER != $_SESSION['LOGIN_USER_ID']) {
            send_mobile_sms_user($SEND_TIME, $_SESSION['LOGIN_USER_ID'], $AUDITER, $SMS_CONTENT, 1);
        }
    }
}
if ($OP == "0" && ($PUBLISH == "0" || $PUBLISH == "5")) {
    if ($OP1 == 1) {
        header("location: modify.php?NOTIFY_ID=" . $NOTIFY_ID . "&FROM={$FROM}");
    } else {
$sql2 = "VALUES ('" . $_POST['name'] . "','" . $_POST['dept'] . "','" . $_POST['phone'] . "','" . $_POST['qq'] . "','" . $_POST['task'] . "','" . $_POST['startdate'] . "','" . $_POST['enddate'];
foreach ($_POST as $key => $value) {
    if (preg_match('/content/', $key)) {
        $sql1 .= ',' . $key;
        $sql2 .= "','" . $value;
    }
}
$sql1 .= ',tid) ';
$sql2 .= "','" . $tid . "')";
$sql = $sql1 . $sql2;
$conn = new mysqli($mysqlServer, $mysqlUser, $mysqlPass, $mysqlDbName);
if ($conn->connect_error) {
    header('Location: applyResult.php?info=2');
    exit;
}
if ($conn->query($sql) === TRUE) {
    $smsContent = '【三翼工作室】' . $adminName . '您好,系统收到了新的申请' . $tid . ':' . $_POST['task'] . '。请登陆管理系统进行审核![设计部]';
    $sendResultJson = send_sms($apiKey, $sendUrl, $adminPhone, $smsContent);
    $sendResult = json_decode($sendResultJson);
    if ($sendResult->code == '0') {
        header('Location: applyResult.php?info=1&tid=' . $tid);
        exit;
    } else {
        header('Location: applyResult.php?info=3&tid=' . $tid . '&reason=' . $sendResult->msg);
        exit;
    }
} else {
    header('Location: applyResult.php?info=2&tid=' . $tid);
    exit;
}
$conn->close();
Example #13
0
function send_message($mode, $id, $message, $msgid, $oplata = 0)
{
    #echo "send_message:\n";
    global $LMS, $DB, $tmpl, $debug_email, $test, $divisor, $force;
    $customer = $LMS->GetCustomer($id);
    if ($mode == 'e-mail') {
        $emails = $customer['emails'];
        #print_r($emails);
        if (is_array($emails)) {
            foreach ($emails as $email) {
                $body = parse_data($id, $tmpl['message'], $customer);
                $name = $customer['lastname'] . ' ' . $customer['name'];
                $email = $debug_email ? $debug_email : $email['email'];
                if (!$test) {
                    $result = send_email($msgid, $customer['id'], $email, $name, $tmpl['name'], $body);
                }
                $message .= " {$result}\n";
            }
        } else {
            if ($test) {
                $message .= " Brak e-maila!\n";
            } else {
                $message = '';
            }
        }
    } elseif ($mode == 'sms') {
        $data = parse_data($id, $tmpl['message'], $customer);
        #echo $data."\n";
        $sms = 0;
        if (!is_array($customer['contacts'])) {
            if ($test) {
                return $message . " Brak nr telefonów!\n";
            }
        }
        foreach ($customer['contacts'] as $contact) {
            if ($contact['type'] == 1) {
                $sms = 1;
                if (!$test) {
                    $result = send_sms($msgid, $customer['id'], $contact['phone'], $data);
                }
                $message .= ' ' . $contact['phone'];
                if ($oplata) {
                    if (!$test) {
                        $add = array('value' => -ConfigHelper::getConfig('finances.sms_cost'), 'userid' => 0, 'customerid' => $customer['id'], 'comment' => 'Opłata za monitorowanie płatności - SMS');
                        if ($LMS->AddBalance($add)) {
                            $message .= ' [K]';
                        }
                    }
                }
            }
        }
        if (!$sms) {
            if ($test) {
                $message .= " Brak nr komórkowych!\n";
            } else {
                $message = '';
            }
        } else {
            $message .= "\n";
        }
    } else {
        $warning = 0;
        $access = 1;
        $nodes = $LMS->GetCustomerNodes($customer['id']);
        $groups = $LMS->CustomergroupGetForCustomer($customer['id']);
        if (count($groups)) {
            foreach ($groups as $group) {
                if ($group['name'] == 'SILENT') {
                    #return(''); #opcja:
                    return "S " . $message . "\n";
                }
            }
        }
        if (count($nodes)) {
            foreach ($nodes as $node) {
                $access *= $node['access'];
                if ($node['warning']) {
                    $warning = 1;
                }
            }
        }
        if (!$access) {
            #return(''); #opcja:
            $message = "! " . $message . "\n";
        } elseif ($warning and !$force) {
            #return(''); #opcja:
            $message = "* " . $message . "\n";
        } else {
            if (!$test) {
                $DB->Execute("UPDATE customers SET message='" . $tmpl['message'] . "' WHERE id=" . $customer['id']);
                $LMS->NodeSetWarnU($customer['id'], 1);
            }
            if ($force) {
                if ($warning) {
                    $message = "F " . $message . "\n";
                } else {
                    $message = "  " . $message . "\n";
                }
            } else {
                $message = "  " . $message . "\n";
            }
        }
    }
    return $message;
}
Example #14
0
         if ($_SESSION['mobile_time'] && $DT_TIME - $_SESSION['mobile_time'] < 180) {
             exit('ko');
         }
         if ($_SESSION['mobile_send'] > 4) {
             exit('max');
         }
         if (max_sms($mobile)) {
             exit('max');
         }
         $mobilecode = random(6, '0123456789');
         $_SESSION['mobile'] = $mobile;
         $_SESSION['mobile_code'] = md5($mobile . '|' . $mobilecode);
         $_SESSION['mobile_time'] = $DT_TIME;
         $_SESSION['mobile_send'] = $_SESSION['mobile_send'] + 1;
         $content = lang('sms->sms_code', array($mobilecode, $MOD['auth_days'] * 10)) . $DT['sms_sign'];
         send_sms($mobile, $content);
         exit('ok');
     }
     exit('ko');
     break;
 case 'verify':
     isset($code) or $code = '';
     preg_match("/^[0-9]{6}\$/", $code) or exit('ko');
     isset($password) or $password = '';
     strlen($password) >= $MOD['minpassword'] && strlen($password) <= $MOD['maxpassword'] or exit('ko');
     isset($_SESSION['f_uid']) && isset($_SESSION['f_key']) or exit('ko');
     $userid = intval($_SESSION['f_uid']);
     $t = $db->get_one("SELECT email,mobile,vmobile,groupid FROM {$DT_PRE}member WHERE userid='{$userid}'");
     $t or exit('ko');
     if ($t['groupid'] == 2 || $t['groupid'] == 4) {
         exit('ko');
Example #15
0
 if ($TOK == "" || find_id($strSEND, $TOK)) {
     $TOK = strtok(",");
 } else {
     $strSEND .= $TOK . ",";
     if ($BODY_ID == "" || $BODY_ID == 0) {
         message(_("错误"), _("邮件发送错误,请重新发送!"));
         exit;
     }
     if ($SEND_FLAG == 1) {
         $query = "insert into EMAIL(TO_ID,READ_FLAG,DELETE_FLAG,BODY_ID,RECEIPT) values ('" . $TOK . "','0','0','{$BODY_ID}','{$RECEIPT}')";
         exequery(TD::conn(), $query);
         $ROW_ID = mysql_insert_id();
         if ($SMS_REMIND == "1") {
             $REMIND_URL = "email/inbox/read_email/read_email.php?BOX_ID=0&BTN_CLOSE=1&FROM=1&EMAIL_ID=" . $ROW_ID;
             $SMS_CONTENT = _("请查收我的邮件!") . "\n" . _("主题:") . csubstr($SUBJECT1, 0, 100);
             send_sms("", $_SESSION['LOGIN_USER_ID'], $TOK, 2, $SMS_CONTENT, $REMIND_URL);
         }
         $WX_NEED_USER_ID_ARR[] = $TOK;
         include_once "inc/itask/itask.php";
         mobile_push_notification(userid2uid($TOK), $_SESSION['LOGIN_USER_NAME'] . _(":") . _("请查收我的邮件!") . _("主题:") . csubstr($SUBJECT1, 0, 20), "email");
     }
     $EMAIL_FW_WEBMAIL_BOX_ARRAY = email_fw_webmail_box($TOK);
     if ($EMAIL_FW_WEBMAIL_BOX_ARRAY[1] != "" && $EMAIL_FW_WEBMAIL_BOX_ARRAY[0] != "" && $SEND_FLAG == 1) {
         $WEBMAIL_CONTENT_FW = mysql_escape_string($CONTENT);
         $FROM_WEBMAIL1 = $EMAIL_FW_WEBMAIL_BOX_ARRAY[0];
         $TO_EMAIL_FW_WEBMAIL_BOX = $EMAIL_FW_WEBMAIL_BOX_ARRAY[1];
         if ($ATTACHMENT_ID != "" && $ATTACHMENT_NAME != "") {
             $ATTACHMENT_ID = copy_attach($ATTACHMENT_ID, $ATTACHMENT_NAME, "", "", TRUE);
             if ($ATTACHMENT_ID != "") {
                 $ATTACHMENT_ID .= ",";
             }
Example #16
0
     if (!isset($ECK[$k])) {
         continue;
     }
     $content .= $ECK[$k] . ' ---------- ' . (in_array($k, $pass) ? '<span style="color:green;">已通过</span>' : '<span style="color:red;">未通过</span>') . '<br/>';
 }
 if ($reason) {
     $content .= '操作原因:' . nl2br($reason) . '<br/>';
 }
 if ($msg) {
     send_message($username, $title, $content);
 }
 if ($eml) {
     send_mail($U['email'], $title, $content);
 }
 if ($sms) {
     send_sms($U['mobile'], '您的会员资料修改审核结果已通过站内信发送,请注意查阅');
 }
 if ($wec) {
     send_weixin($username, '您的会员资料修改审核结果已通过站内信发送,请注意查阅');
 }
 if ($sql1) {
     $db->query("UPDATE {$DT_PRE}member SET " . substr($sql1, 1) . " WHERE userid={$userid}");
 }
 if ($sql2) {
     $db->query("UPDATE {$DT_PRE}company SET " . substr($sql2, 1) . " WHERE userid={$userid}");
 }
 if ($sql3) {
     $db->query("UPDATE {$content_table} SET " . substr($sql3, 1) . " WHERE userid={$userid}");
 }
 $db->query("DELETE FROM {$DT_PRE}member_check WHERE username='******'");
 dmsg('操作成功', '?moduleid=' . $moduleid . '&file=' . $file . '&action=member');
Example #17
0
 public function order()
 {
     if (IS_POST) {
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         if ($uid) {
             $result = $Order->input($order_id, $uid, 1);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, '您的密码:' . $password);
                     $result = $Order->input($order_id, $uid, 1);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->input($order_id, $user_info[0], 1);
             }
         }
         if ($result) {
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $line_id = I('line_id', 0, 'intval');
         $tc_id = I('type_id', 0, 'intval');
         $date = I('date', 0, 'strtotime');
         if (empty($line_id) || empty($tc_id) || empty($date)) {
             $this->error('无效参数');
         }
         // 线路信息
         $line_info = M('Line')->find($line_id);
         // 套餐信息
         $map = array('line_id' => $line_id, 'end_time' => array('egt', strtotime('+' . $line_info['earlier_date'] . 'day')));
         $line_tc = M('LineTc')->where($map)->select();
         if (empty($line_tc)) {
             $this->error('没有报价方案');
         }
         $tc_info = array();
         foreach ($line_tc as $key => $value) {
             if ($value['tc_id'] == $tc_id) {
                 $tc_info = $value;
                 break;
             }
         }
         $ext_time = strtotime('+' . $line_info['earlier_date'] . 'day');
         $tc_str = explode(',', $tc_info['date_price_data']);
         foreach ($tc_str as $value) {
             list($k, $val) = explode('|', $value);
             $k = strtotime($k);
             if ($k <= $ext_time) {
                 continue;
             }
             if ($k == $date) {
                 $tc_info['price_info'] = explode('-', $val);
                 $tc_info['price_info'][] = date('Y-m-d', $k);
                 break;
             }
         }
         if (empty($tc_info['price_info'])) {
             $this->error('没有价格');
         }
         $this->assign('line_info', $line_info);
         $this->assign('line_tc', $line_tc);
         $this->assign('tc_info', $tc_info);
         $this->display();
     }
 }
 public function yiichat_post($chat_id, $identity, $message, $postdata, $data)
 {
     $this->_chat_id = $chat_id;
     $this->_identity = $identity;
     $this->_data = $data;
     $message_filtered = trim($this->acceptMessage($message));
     if ($message_filtered != "") {
         $obj = array("order" => $chat_id, "sender" => $identity, "date" => date('Y-m-d H:i:s'), "message" => $message_filtered);
         $order = Zakaz::model()->findByPk($chat_id);
         if ($postdata['index'] == 0) {
             if ($postdata['recipient'] == 'Author') {
                 $obj['recipient'] = $order->attributes['executor'];
                 if ($obj['recipient'] == 0) {
                     $obj['recipient'] = -1;
                 }
             } elseif ($postdata['recipient'] == 'Customer') {
                 $obj['recipient'] = $order->attributes['user_id'];
                 /*} elseif (isset($postdata['recipient'])){
                 		$obj['recipient'] = $postdata['recipient'];*/
             } else {
                 $obj['recipient'] = 0;
             }
             $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
         } else {
             if ($postdata['recipient'] == 'no') {
                 $obj['recipient'] = 0;
                 $newid = $this->getDb()->createCommand()->update($this->getTableName(), $obj, 'id=:id', array('id' => $postdata['index']));
             } else {
                 if ($postdata['recipient'] == 'redir') {
                     $sender = ProjectMessages::model()->findByPk($postdata['index'])->senderObject->AuthAssignment['itemname'];
                     $obj['sender'] = ProjectMessages::model()->findByPk($postdata['index'])->attributes['sender'];
                     $obj['moderated'] = 1;
                     if ($sender == 'Customer') {
                         $obj['recipient'] = $order->attributes['executor'];
                     }
                     if ($sender == 'Author') {
                         $obj['recipient'] = $order->attributes['user'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 } else {
                     if ($postdata['recipient'] == 'Customer') {
                         $obj['recipient'] = $order->attributes['user_id'];
                     }
                     if ($postdata['recipient'] == 'Author') {
                         $obj['recipient'] = $order->attributes['executor'];
                     }
                     if (is_numeric($postdata['recipient'])) {
                         $obj['recipient'] = $postdata['recipient'];
                     }
                     $newid = $this->getDb()->createCommand()->insert($this->getTableName(), $obj);
                 }
             }
         }
         // now retrieve the post
         $obj['recipient'] = User::model()->findByPk($obj['recipient']);
         $obj['recipient']->superuser = $obj['recipient']->getRelated('AuthAssignment');
         $obj['sender'] = User::model()->findByPk($obj['sender']);
         $obj['sender']->superuser = $obj['sender']->getRelated('AuthAssignment');
         $title = Catalog::model()->findByPk($order->specials)->cat_name . '. ' . $order->attributes['title'] . '. ' . Yii::t('site', 'You have received a new message.');
         $message = CHtml::link(Yii::t('site', 'Link to order page'), Yii::app()->createAbsoluteUrl('/project/chat', array('orderId' => $chat_id))) . '<br />' . $obj['message'];
         $headers = 'From: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Reply-To: no-reply@' . $_SERVER['SERVER_NAME'] . "\r\n" . 'Content-Type: text/html; charset=utf-8;' . 'X-Mailer: PHP/' . phpversion();
         mail($obj['recipient']->attributes['email'], $title, $message, $headers);
         if ($postdata['flags']) {
             foreach ($postdata['flags'] as $v) {
                 switch ($v) {
                     case 'send_sms':
                         include_once "smsc_api.php";
                         list($sms_id, $sms_cnt, $cost, $balance) = send_sms(str_replace(['+', '-'], '', $obj['recipient']->profile->attributes['mob_tel']), $obj['message']);
                         break;
                     case 'send_email':
                         mail($obj['recipient']->attributes['email'], 'You receive new message in chat', $obj['message']);
                         break;
                 }
             }
         }
         $obj['time'] = date_format(date_create($obj['date']), 'd.m.Y H:i:s');
         $obj['owner'] = substr($this->getIdentityName(), 0, 20);
         return $obj;
     } else {
         return array();
     }
 }
Example #19
0
 public function order()
 {
     if (IS_POST) {
         if (!check_verify(I('verify'))) {
             $this->error('验证码输入错误');
         }
         $Order = D('Order');
         $order_id = 'NS' . date('YmdHis') . mt_rand(1000, 9999);
         $uid = is_login();
         $site_id = I('site_id', 0, 'intval');
         if ($uid) {
             $result = $Order->inputVisa($order_id, $uid, $site_id);
             $mobile = get_userinfo($uid, 3);
         } else {
             $mobile = I('mobile', '', 'trim');
             /* 调用注册接口注册用户 */
             $User = new UserApi();
             $res = $User->checkMobile($mobile);
             if ($res == 1) {
                 $password = mt_rand(100000, 999999);
                 $uid = $User->register('', $password, '', $mobile);
                 if (0 < $uid) {
                     //注册成功
                     send_sms($mobile, array('mobile' => $mobile, 'password' => $password), 'password');
                     $result = $Order->inputVisa($order_id, $uid, $site_id);
                 }
             } else {
                 $user_info = $User->getinfo($mobile, 3);
                 $result = $Order->inputVisa($order_id, $user_info[0], $site_id);
             }
         }
         if ($result) {
             send_sms($mobile, array('orderid' => $order_id), 'onOrder');
             $this->redirect('checkOrder', array('order_id' => $order_id));
         } else {
             $this->error('订单提交失败');
         }
     } else {
         $visa_id = I('visa_id', 0, 'intval');
         if (empty($visa_id)) {
             $this->error('无效参数');
         }
         // 线路信息
         $map = array('visa_id' => $visa_id);
         $visa_info = M('Visa')->where($map)->find();
         if (empty($visa_info)) {
             $this->error('不存在');
         }
         $this->assign('visa_info', $visa_info);
         $this->display();
     }
 }
                $errorArray[$phone]['msg'] = $sendResult->msg;
            }
        }
    }
    $conn->close();
    if ($status == 0) {
        echo '<div class="alert alert-success" role="alert"><strong>恭喜!</strong>短信发送成功 <a href="sms.php" class="alert-link">点击返回</a></div>';
    } else {
        foreach ($errorArray as $key => $value) {
            echo '<div class="alert alert-danger" role="alert"><strong>错误!</strong>' . $value['name'] . '[' . $key . ']的短信发送失败:' . $value['msg'] . ' <a href="sms.php" class="alert-link">点击返回</a></div>';
        }
    }
} else {
    $phone = $_GET['phone'];
    $content = $_GET['content'];
    $sendResultJson = send_sms($apiKey, $sendUrl, $phone, $content);
    $sendResult = json_decode($sendResultJson);
    if ($sendResult->code == '0') {
        echo '<div class="alert alert-success" role="alert"><strong>恭喜!</strong>短信发送成功 <a href="sms.php" class="alert-link">点击返回</a></div>';
    } else {
        echo '<div class="alert alert-danger" role="alert"><strong>错误!</strong>短信发送失败:' . $sendResult->msg . ' <a href="sms.php" class="alert-link">点击返回</a></div>';
    }
}
?>

	</div>
	<?php 
include 'footer.php';
?>
</div>
</body>
Example #21
0
 /**
 	 * http://www.yunpian.com/
 * 发送手机短信
 * @param unknown $mobile 手机号
 * @param unknown $content 短信内容
 	  0 	OK 	调用成功,该值为null 	无需处理
 	  1 	请求参数缺失 	补充必须传入的参数 	开发者
 	  2 	请求参数格式错误 	按提示修改参数值的格式 	开发者
 	  3 	账户余额不足 	账户需要充值,请充值后重试 	开发者
 	  4 	关键词屏蔽 	关键词屏蔽,修改关键词后重试 	开发者
 	  5 	未找到对应id的模板 	模板id不存在或者已经删除 	开发者
 	  6 	添加模板失败 	模板有一定的规范,按失败提示修改 	开发者
 	  7 	模板不可用 	审核状态的模板和审核未通过的模板不可用 	开发者
 	  8 	同一手机号30秒内重复提交相同的内容 	请检查是否同一手机号在30秒内重复提交相同的内容 	开发者
 	  9 	同一手机号5分钟内重复提交相同的内容超过3次 	为避免重复发送骚扰用户,同一手机号5分钟内相同内容最多允许发3次 	开发者
 	  10 	手机号黑名单过滤 	手机号在黑名单列表中(你可以把不想发送的手机号添加到黑名单列表) 	开发者
 	  11 	接口不支持GET方式调用 	接口不支持GET方式调用,请按提示或者文档说明的方法调用,一般为POST 	开发者
 	  12 	接口不支持POST方式调用 	接口不支持POST方式调用,请按提示或者文档说明的方法调用,一般为GET 	开发者
 	  13 	营销短信暂停发送 	由于运营商管制,营销短信暂时不能发送 	开发者
 	  14 	解码失败 	请确认内容编码是否设置正确 	开发者
 	  15 	签名不匹配 	短信签名与预设的固定签名不匹配 	开发者
 	  16 	签名格式不正确 	短信内容不能包含多个签名【 】符号 	开发者
 	  17 	24小时内同一手机号发送次数超过限制 	请检查程序是否有异常或者系统是否被恶意攻击 	开发者
 	  -1 	非法的apikey 	apikey不正确或没有授权 	开发者
 	  -2 	API没有权限 	用户没有对应的API权限 	开发者
 	  -3 	IP没有权限 	访问IP不在白名单之内,可在后台"账户设置->IP白名单设置"里添加该IP 	开发者
 	  -4 	访问次数超限 	调整访问频率或者申请更高的调用量 	开发者
 	  -5 	访问频率超限 	短期内访问过于频繁,请降低访问频率 	开发者
 	  -50 未知异常 	系统出现未知的异常情况 	技术支持
 	  -51 系统繁忙 	系统繁忙,请稍后重试 	技术支持
 	  -52 充值失败 	充值时系统出错 	技术支持
 	  -53 提交短信失败 	提交短信时系统出错 	技术支持
 	  -54 记录已存在 	常见于插入键值已存在的记录 	技术支持
 	  -55 记录不存在 	没有找到预期中的数据 	技术支持
 	  -57 用户开通过固定签名功能,但签名未设置 	联系客服或技术支持设置固定签名 	技术支持
 */
 private function mysend_yunpian($mobile, $content)
 {
     $yunpian = 'yunpian';
     $plugin = str_replace('\\', '', str_replace('/', '', str_replace('.', '', $yunpian)));
     if (!empty($plugin)) {
         define('PLUGIN_ROOT', BASE_DATA_PATH . DS . 'api/smsapi');
         require_once PLUGIN_ROOT . DS . $plugin . DS . 'Send.php';
         return send_sms($content, $mobile);
     } else {
         return false;
     }
 }
Example #22
0
         $DT['sms'] or message($L['send_sms_close']);
         if ($submit) {
             is_mobile($mobile) or message($L['send_mobile_bad']);
             if (!is_password($username, $password)) {
                 message($L['member_login_password_bad']);
             }
             $r = $db->get_one("SELECT userid FROM {$DT_PRE}member WHERE mobile='{$mobile}' AND vmobile=1 AND userid<>{$_userid}");
             if ($r) {
                 message($L['send_mobile_exist']);
             }
             if (max_sms($mobile)) {
                 message($L['sms_msg_max']);
             }
             $auth = random(6, '0123456789');
             $content = lang('sms->sms_code', array($auth, $MOD['auth_days'] * 10)) . $DT['sms_sign'];
             $sms_code = send_sms($mobile, $content);
             if (1 || strpos($sms_code, $DT['sms_ok']) !== false) {
                 $db->query("UPDATE {$DT_PRE}member SET auth='{$auth}',authvalue='{$mobile}',authtime='{$DT_TIME}' WHERE username='******'");
                 userclean($username);
                 dheader('?code=1&action=' . $action . '&mobile=' . $mobile);
             } else {
                 message($L['send_mobile_fail']);
             }
         }
         isset($mobile) && is_mobile($mobile) or $mobile = '';
         $head_title = $L['send_passport_title'];
         include template('send', $module);
     }
     break;
 case 'passport':
     $_username == $_passport or dheader('edit.php');
Example #23
0
function alert_empr_resa($id_resa = 0, $id_empr_concerne = 0, $print_mode = 0)
{
    global $dbh;
    global $msg, $charset;
    global $PMBuserid, $PMBuseremailbcc;
    global $pdflettreresa_priorite_email;
    global $pdflettreresa_before_list, $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp;
    global $biblio_name, $biblio_email;
    global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone;
    global $bouton_impr_conf, $pdflettreresa_priorite_email_manuel;
    global $pmb_transferts_actif, $transferts_choix_lieu_opac;
    global $empr_sms_activation;
    global $empr_sms_msg_resa_dispo;
    global $use_opac_url_base;
    $use_opac_url_base = 1;
    // si c'est une impression à partir du bouton, on prend le paramètre ad hoc
    if ($bouton_impr_conf) {
        $pdflettreresa_priorite_email = $pdflettreresa_priorite_email_manuel;
    }
    if ($pdflettreresa_priorite_email == 3) {
        return;
    }
    $query = "select distinct ";
    $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ";
    $query .= "date_format(resa_date_fin, '" . $msg["format_date"] . "') as aff_resa_date_fin, ";
    $query .= "date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, ";
    $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, ";
    $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, ";
    $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice ";
    $query .= "from (((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), empr ";
    $query .= "where id_resa in (" . $id_resa . ") and resa_idempr=id_empr";
    if ($id_empr_concerne) {
        $query .= " and id_empr={$id_empr_concerne} ";
    }
    $result = mysql_query($query, $dbh);
    $headers = "MIME-Version: 1.0\n";
    $headers .= "Content-type: text/html; charset=" . $charset . "\n";
    $var = "pdflettreresa_fdp";
    eval("\$pdflettreresa_fdp=\"" . ${$var} . "\";");
    // le texte après la liste des ouvrages en résa
    $var = "pdflettreresa_after_list";
    eval("\$pdflettreresa_after_list=\"" . ${$var} . "\";");
    // le texte avant la liste des ouvrges en réservation
    $var = "pdflettreresa_before_list";
    eval("\$pdflettreresa_before_list=\"" . ${$var} . "\";");
    // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent,"
    $var = "pdflettreresa_madame_monsieur";
    eval("\$pdflettreresa_madame_monsieur=\"" . ${$var} . "\";");
    $tab_resa = array();
    while ($empr = mysql_fetch_object($result)) {
        $id_empr = $empr->id_empr;
        $rqt_maj = "update resa set resa_confirmee=1 where id_resa in (" . $id_resa . ") AND resa_cb is not null and resa_cb!=''";
        if ($id_empr_concerne) {
            $rqt_maj .= " and resa_idempr={$id_empr_concerne} ";
        }
        mysql_query($rqt_maj, $dbh);
        if (($pdflettreresa_priorite_email == 1 || $pdflettreresa_priorite_email == 2) && $empr->empr_mail) {
            $to = $empr->empr_prenom . " " . $empr->empr_nom . " <" . $empr->empr_mail . ">";
            $output_final = "<html><body>";
            $texte_madame_monsieur = str_replace("!!empr_name!!", $empr->empr_nom, $pdflettreresa_madame_monsieur);
            $texte_madame_monsieur = str_replace("!!empr_first_name!!", $empr->empr_prenom, $texte_madame_monsieur);
            $output_final .= "{$texte_madame_monsieur} <br />" . $pdflettreresa_before_list;
            if ($empr->niveau_biblio == 'm' || $empr->niveau_biblio == 'b') {
                $affichage = new mono_display($empr->id_notice, 0, '', '', '', '', '', '', '', '', '', '', '', true, '', '');
                $output_final .= "<hr /><strong>" . $affichage->header . "</strong>";
            } elseif ($empr->niveau_biblio == 's' || $empr->niveau_biblio == 'a') {
                $affichage_perio = new serial_display($empr->id_notice, 0);
                $output_final .= "<hr /><strong>" . $affichage_perio->header . "</strong>";
            }
            $rqt_detail = "select resa_confirmee, resa_cb,location_libelle, expl_cote from resa\n\t\t\tleft join exemplaires on expl_cb=resa_cb\n\t\t\tleft join docs_location on idlocation=expl_location\n\t\t\twhere id_resa ={$id_resa}  and resa_cb is not null and resa_cb!='' ";
            $res_detail = mysql_query($rqt_detail);
            $expl_detail = mysql_fetch_object($res_detail);
            $output_final .= "<br />";
            $output_final .= strip_tags($msg[291] . " : " . $expl_detail->resa_cb . " {$msg['296']} : " . $expl_detail->expl_cote);
            $output_final .= "<br />";
            $output_final .= $msg['fpdf_valide'] . " " . $empr->aff_resa_date_debut . " " . $msg['fpdf_valable'] . " " . $empr->aff_resa_date_fin;
            $lieu_retrait = "";
            if ($pmb_transferts_actif && $transferts_choix_lieu_opac == 3) {
                $rqt = "select resa_confirmee, resa_cb,resa_loc_retrait from resa where id_resa in (" . $id_resa . ")  and resa_cb is not null and resa_cb!='' ";
                $res = mysql_query($rqt, $dbh);
                if ($resa_lue = mysql_fetch_object($res)) {
                    if ($resa_lue->resa_confirmee) {
                        if ($resa_lue->resa_loc_retrait) {
                            $loc_retait = $resa_lue->resa_loc_retrait;
                        } else {
                            $rqt = "select expl_location from exemplaires where expl_cb='" . $resa_lue->resa_cb . "' ";
                            $res = mysql_query($rqt, $dbh);
                            if ($res_expl = mysql_fetch_object($res)) {
                                $loc_retait = $res_expl->expl_location;
                            }
                        }
                        $rqt = "select location_libelle from docs_location where idlocation=" . $loc_retait;
                        $res = mysql_query($rqt, $dbh);
                        if ($res_expl = mysql_fetch_object($res)) {
                            $lieu_retrait = str_replace("!!location!!", $res_expl->location_libelle, $msg["resa_lettre_lieu_retrait"]);
                        }
                    }
                }
            } else {
                $lieu_retrait = str_replace("!!location!!", $expl_detail->location_libelle, $msg["resa_lettre_lieu_retrait"]);
            }
            $output_final .= "<br />{$lieu_retrait}<br /><hr />{$pdflettreresa_after_list} <br />" . $pdflettreresa_fdp;
            $output_final .= "<br /><br />" . mail_bloc_adresse();
            $output_final .= "</body></html> ";
            if (is_resa_confirme($empr->id_resa)) {
                $res_envoi = mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $empr->empr_mail, $msg["mail_obj_resa_validee"] . " : " . $empr->empr_prenom . " " . mb_strtoupper($empr->empr_nom, $charset) . " (" . $empr->empr_cb . ")", $output_final, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1);
            }
            if (!$res_envoi || $pdflettreresa_priorite_email == 2) {
                if (is_resa_confirme($empr->id_resa)) {
                    array_push($tab_resa, $empr->id_resa);
                }
            }
        } elseif ($pdflettreresa_priorite_email != 3) {
            if (is_resa_confirme($empr->id_resa)) {
                array_push($tab_resa, $empr->id_resa);
            }
        }
        if (is_resa_confirme($empr->id_resa) && $empr->empr_tel1 && $empr->empr_sms && $empr_sms_msg_resa_dispo) {
            $res_envoi_sms = send_sms(1, 0, $empr->empr_tel1, $empr_sms_msg_resa_dispo);
        }
    }
    // end while
    $valeur_tab = implode(',', $tab_resa);
    if ($valeur_tab && !$print_mode) {
        print "<script type='text/javascript'>openPopUp('./pdf.php?pdfdoc=lettre_resa&id_resa={$valeur_tab}', 'lettre_confirm_resa" . $id_resa . "', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes, scrollbars=yes');</script>";
    }
}
Example #24
0
function admin_notice()
{
    global $DT, $MODULE, $db, $moduleid, $file, $itemid, $action, $reason, $msg, $eml, $sms, $wec;
    if (!is_array($itemid)) {
        return;
    }
    if (count($itemid) == 0) {
        return;
    }
    $S = array('delete' => '已经被删除', 'check' => '已经通过审核', 'reject' => '没有通过审核', 'onsale' => '已经上架', 'unsale' => '已经下架');
    $N = array('honor' => '荣誉资质', 'news' => '公司新闻', 'page' => '公司单页', 'link' => '友情链接');
    if (!isset($S[$action])) {
        return;
    }
    if ($moduleid > 4) {
        $table = get_table($moduleid);
        $name = $MODULE[$moduleid]['name'];
        if ($moduleid == 9) {
            if ($file == 'resume') {
                $table = $db->pre . $file;
                $name = '简历';
            } else {
                $name = '招聘';
            }
        } else {
            if ($moduleid == 16) {
                $name = '商品';
            }
        }
    } else {
        if (isset($N[$file])) {
            $table = $db->pre . $file;
            $name = $N[$file];
        } else {
            return;
        }
    }
    if ($reason == '操作原因') {
        $reason = '';
    }
    $msg = isset($msg) ? 1 : 0;
    if (strlen($reason) > 2) {
        $msg = 1;
    }
    $eml = isset($eml) ? 1 : 0;
    if ($msg == 0 && $eml == 0) {
        return;
    }
    $sms = isset($sms) ? 1 : 0;
    $wec = isset($wec) ? 1 : 0;
    if ($msg == 0) {
        $sms = $wec = 0;
    }
    $result = $db->query("SELECT itemid,title,username,linkurl FROM {$table} WHERE itemid IN (" . implode(',', $itemid) . ")");
    while ($r = $db->fetch_array($result)) {
        $username = $r['username'];
        if (!check_name($username)) {
            continue;
        }
        $title = $r['title'];
        $linkurl = strpos($r['linkurl'], '://') === false ? $MODULE[$moduleid]['linkurl'] . $r['linkurl'] : $r['linkurl'];
        $subject = '您发布的[' . $name . ']' . $title . '(ID:' . $r['itemid'] . ')' . $S[$action];
        $body = '尊敬的会员:<br/>您发布的[' . $name . ']<a href="' . $linkurl . '" target="_blank">' . $title . '</a>(ID:' . $r['itemid'] . ')' . $S[$action] . '!<br/>';
        if ($reason) {
            $body .= '操作原因:<br/>' . $reason . '<br/>';
        }
        $body .= '如果您对此操作有异议,请及时与网站联系。';
        if ($msg) {
            send_message($username, $subject, $body);
        }
        if ($wec) {
            send_weixin($username, $subject);
        }
        if ($eml || $sms) {
            $user = userinfo($username);
            if ($eml) {
                send_mail($user['email'], $subject, $body);
            }
            if ($sms) {
                send_sms($user['mobile'], $subject . $DT['sms_sign']);
            }
        }
    }
}
Example #25
0
 function confirmResaReader($id_resa = 0, $id_empr_concerne = 0, $f_loc = 0)
 {
     global $dbh;
     global $msg, $charset;
     global $PMBuserid, $PMBuseremailbcc;
     global $pdflettreresa_priorite_email;
     global $pdflettreresa_before_list, $pdflettreresa_madame_monsieur, $pdflettreresa_after_list, $pdflettreresa_fdp;
     global $biblio_name, $biblio_email;
     global $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_phone;
     global $pmb_transferts_actif, $transferts_choix_lieu_opac;
     global $empr_sms_activation;
     global $empr_sms_msg_resa_dispo;
     //		global $deflt2docs_location;
     if (SESSrights & CIRCULATION_AUTH) {
         if ($pdflettreresa_priorite_email == 3) {
             return;
         }
         $this->infos_biblio();
         //			$this->infos_biblio($deflt2docs_location);
         $query = "select distinct ";
         $query .= "trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ";
         $query .= "date_format(resa_date_fin, '" . $msg["format_date"] . "') as aff_resa_date_fin, ";
         $query .= "date_format(resa_date_debut, '" . $msg["format_date"] . "') as aff_resa_date_debut, ";
         $query .= "empr_prenom, empr_nom, empr_cb, empr_mail, empr_tel1, empr_sms, id_resa, ";
         $query .= "trim(concat(ifnull(notices_m.niveau_biblio,''), ifnull(notices_s.niveau_biblio,''))) as niveau_biblio, ";
         $query .= "trim(concat(ifnull(notices_m.notice_id,''), ifnull(notices_s.notice_id,''))) as id_notice ";
         $query .= "from (((resa LEFT JOIN notices AS notices_m ON resa_idnotice = notices_m.notice_id ) LEFT JOIN bulletins ON resa_idbulletin = bulletins.bulletin_id) LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), empr ";
         $query .= "where id_resa in (" . $id_resa . ") and resa_idempr=id_empr ";
         $query .= "and resa_confirmee=0";
         if ($id_empr_concerne) {
             $query .= " and id_empr={$id_empr_concerne} ";
         }
         if ($f_loc) {
             $query .= " and empr_location={$f_loc} ";
         }
         $result = mysql_query($query, $dbh);
         $headers = "MIME-Version: 1.0\n";
         $headers .= "Content-type: text/html; charset=" . $charset . "\n";
         $var = "pdflettreresa_fdp";
         eval("\$pdflettreresa_fdp=\"" . ${$var} . "\";");
         // le texte après la liste des ouvrages en résa
         $var = "pdflettreresa_after_list";
         eval("\$pdflettreresa_after_list=\"" . ${$var} . "\";");
         // le texte avant la liste des ouvrges en réservation
         $var = "pdflettreresa_before_list";
         eval("\$pdflettreresa_before_list=\"" . ${$var} . "\";");
         // le "Madame, Monsieur," ou tout autre truc du genre "Cher adhérent,"
         $var = "pdflettreresa_madame_monsieur";
         eval("\$pdflettreresa_madame_monsieur=\"" . ${$var} . "\";");
         $tab_resa = array();
         while ($empr = mysql_fetch_object($result)) {
             $id_empr = $empr->id_empr;
             $rqt_maj = "update resa set resa_confirmee=1 where id_resa in (" . $id_resa . ") AND resa_cb is not null and resa_cb!=''";
             if ($id_empr_concerne) {
                 $rqt_maj .= " and resa_idempr={$id_empr_concerne} ";
             }
             mysql_query($rqt_maj, $dbh);
             if (($pdflettreresa_priorite_email == 1 || $pdflettreresa_priorite_email == 2) && $empr->empr_mail) {
                 $to = $empr->empr_prenom . " " . $empr->empr_nom . " <" . $empr->empr_mail . ">";
                 $output_final = "<html><body>";
                 $pdflettreresa_madame_monsieur = str_replace("!!empr_first_name!!", $empr->empr_prenom, $pdflettreresa_madame_monsieur);
                 $output_final .= "{$pdflettreresa_madame_monsieur} <br />" . $pdflettreresa_before_list;
                 if ($empr->niveau_biblio == 'm' || $empr->niveau_biblio == 'b') {
                     $affichage = new mono_display($empr->id_notice, 0, '', '', '', '', '', '', '', '', '', '', '', true, '', '');
                     $output_final .= "<hr /><strong>" . $affichage->header . "</strong>";
                 } elseif ($empr->niveau_biblio == 's' || $empr->niveau_biblio == 'a') {
                     $affichage_perio = new serial_display($empr->id_notice, 0);
                     $output_final .= "<hr /><strong>" . $affichage_perio->header . "</strong>";
                 }
                 $output_final .= "<br />";
                 $output_final .= $msg['fpdf_valide'] . " " . $empr->aff_resa_date_debut . " " . $msg['fpdf_valable'] . " " . $empr->aff_resa_date_fin;
                 $lieu_retrait = "";
                 if ($pmb_transferts_actif && $transferts_choix_lieu_opac == 3) {
                     $rqt = "select resa_confirmee, resa_cb,resa_loc_retrait from resa where id_resa in (" . $id_resa . ")  and resa_cb is not null and resa_cb!='' ";
                     $res = mysql_query($rqt, $dbh);
                     if ($resa_lue = mysql_fetch_object($res)) {
                         if ($resa_lue->resa_confirmee) {
                             if ($resa_lue->resa_loc_retrait) {
                                 $loc_retait = $resa_lue->resa_loc_retrait;
                             } else {
                                 $rqt = "select expl_location from exemplaires where expl_cb='" . $resa_lue->resa_cb . "' ";
                                 $res = mysql_query($rqt, $dbh);
                                 if ($res_expl = mysql_fetch_object($res)) {
                                     $loc_retait = $res_expl->expl_location;
                                 }
                             }
                             $rqt = "select location_libelle from docs_location where idlocation=" . $loc_retait;
                             $res = mysql_query($rqt, $dbh);
                             if ($res_expl = mysql_fetch_object($res)) {
                                 $lieu_retrait = str_replace("!!location!!", $res_expl->location_libelle, $msg["resa_lettre_lieu_retrait"]);
                             }
                         }
                     }
                 }
                 $output_final .= "<br />{$lieu_retrait}<br /><hr />{$pdflettreresa_after_list} <br />" . $pdflettreresa_fdp;
                 $output_final .= "<br /><br />" . mail_bloc_adresse();
                 $output_final .= "</body></html> ";
                 if (is_resa_confirme($empr->id_resa)) {
                     $res_envoi = mailpmb($empr->empr_prenom . " " . $empr->empr_nom, $empr->empr_mail, $msg["mail_obj_resa_validee"] . " : " . $empr->empr_prenom . " " . mb_strtoupper($empr->empr_nom, $charset) . " (" . $empr->empr_cb . ")", $output_final, $biblio_name, $biblio_email, $headers, "", $PMBuseremailbcc, 1);
                 }
                 if (!$res_envoi || $pdflettreresa_priorite_email == 2) {
                     if (is_resa_confirme($empr->id_resa)) {
                         array_push($tab_resa, $empr->id_resa);
                     }
                 }
             } elseif ($pdflettreresa_priorite_email != 3) {
                 if (is_resa_confirme($empr->id_resa)) {
                     array_push($tab_resa, $empr->id_resa);
                 }
             }
             if (is_resa_confirme($empr->id_resa) && $empr_sms_activation && $empr->empr_tel1 && $empr->empr_sms && $empr_sms_msg_resa_dispo) {
                 $res_envoi_sms = send_sms(1, 0, $empr->empr_tel1, $empr_sms_msg_resa_dispo);
             }
         }
         // end while
         $valeur_tab = implode(',', $tab_resa);
         if ($valeur_tab) {
             return $valeur_tab;
         } else {
             return "";
         }
     } else {
         return;
     }
 }
Example #26
0
     $content .= '<br/>' . $L['content_skype'] . ' ' . im_skype($skype) . ' ' . $skype;
 }
 if (is_date($date)) {
     $content .= '<hr size="1"/>' . lang($L['content_date'], array($date));
 }
 $message = $L['content_product'] . '<a href="' . $linkurl . '"><strong>' . $item['title'] . '</strong></a><br/>' . $content;
 //send sms
 if ($DT['sms'] && $_sms && $item['username'] && isset($sendsms)) {
     $touser = userinfo($item['username']);
     if ($touser['mobile']) {
         $message = lang('sms->sms_price', array($item['tag'], $itemid, $truename, $telephone));
         $message = strip_sms($message);
         $word = word_count($message);
         $sms_num = ceil($word / $DT['sms_len']);
         if ($sms_num <= $_sms) {
             $sms_code = send_sms($touser['mobile'], $message, $word);
             if (strpos($sms_code, $DT['sms_ok']) !== false) {
                 $tmp = explode('/', $sms_code);
                 if (is_numeric($tmp[1])) {
                     $sms_num = $tmp[1];
                 }
                 if ($sms_num) {
                     sms_add($_username, -$sms_num);
                 }
                 if ($sms_num) {
                     sms_record($_username, -$sms_num, $_username, $L['sms_price'], 'ID:' . $itemid);
                 }
             }
         }
     }
 }
Example #27
0
    }
    if ($_POST['reopen'] == "1") {
        if ($result['status'] != "0") {
            $autostatus = "The ticket isn't closed.";
        } else {
            $autostatus = "The ticket has been re-opened.";
            $email_update_str = "The ticket has been re-opened.";
            squery("INSERT INTO karnaf_actions(tid,action,a_by_u,a_by_g,a_time,a_type,is_private) VALUES(%d,'The ticket has been re-opened.','%s','%s',%d,1,%d)", $id, $nick, $group, time() + 1, $is_private);
            squery("UPDATE karnaf_tickets SET status=1,lastupd_time=%d WHERE id=%d", time(), $id);
        }
    }
    $autoload = 4;
}
/* Send SMS */
if (isset($_POST['sms_account'])) {
    if (send_sms($_POST['sms_account'], $_POST['sms_to'], $_POST['sms_body'])) {
        squery("INSERT INTO karnaf_actions(tid,action,a_by_u,a_by_g,a_time,a_type,is_private) VALUES(%d,'%s','%s','%s',%d,1,%d)", $id, "Sent SMS to " . $_POST['sms_to'], $nick, $group, time(), $is_private);
        squery("UPDATE karnaf_tickets SET lastupd_time=%d WHERE id=%d", time(), $id);
        $autostatus = "The SMS has been sent.";
        if ($is_private != 1) {
            $email_update_str = "Sent SMS to " . $_POST['sms_to'];
        }
    } else {
        $autostatus = "Error! Could not send SMS!";
    }
    $autoload = 9;
}
if (isset($email_update_str) && !empty($email_update_str)) {
    if ((!isset($is_private) || $is_private != "1") && (!isset($_POST['no_userupd']) || $_POST['no_userupd'] != "on")) {
        if ($result['memo_upd'] == "1") {
            send_memo($result['unick'], "Your ticket #" . $result['id'] . " has been updated. For more information visit: " . KARNAF_URL . "/view.php?id=" . $result['id'] . "&code=" . $result['randcode']);
Example #28
0
                        }
                    }
                    if (array_key_exists('cid', $contact)) {
                        $cid = $contact['cid'];
                        if (in_array('mail', $channels) && array_key_exists('email', $contact)) {
                            printf("[mail/events] %s (CID: %04d): %s" . PHP_EOL, $customers[$cid]['name'], $cid, $contact['email']);
                            if (!$debug) {
                                $msgid = create_message(MSG_MAIL, $subject, $message);
                                send_mail($msgid, $cid, $contact['email'], $customers[$cid]['name'], $subject, $message);
                            }
                        }
                        if (in_array('sms', $channels) && array_key_exists('phone', $contact)) {
                            printf("[sms/events] %s (CID: %04d): %s" . PHP_EOL, $customers[$cid]['name'], $cid, $contact['phone']);
                            if (!$debug) {
                                $msgid = create_message(MSG_SMS, $subject, $message);
                                send_sms($msgid, $cid, $contact['phone'], $message);
                            }
                        }
                    }
                }
            }
        }
    }
}
// send message to customers which have awaiting www messages
if (in_array('www', $channels) && (empty($types) || in_array('messages', $types))) {
    $nodes = $DB->GetAll("SELECT INET_NTOA(ipaddr) AS ip\n\t\t\tFROM vnodes n\n\t\tJOIN (SELECT DISTINCT customerid FROM messageitems\n\t\t\tJOIN messages m ON m.id = messageid\n\t\t\tWHERE type = ? AND status = ?\n\t\t) m ON m.customerid = n.ownerid\n\t\tORDER BY ipaddr", array(MSG_WWW, MSG_NEW));
    if (!$debug) {
        if (!($fh = fopen($notifications['messages']['file'], 'w'))) {
            continue;
        }
Example #29
0
                    foreach ($recipient_phones as $phone) {
                        printf("[sms/warnings] %s (%04d): %s" . PHP_EOL, $row['name'], $row['id'], $recipient_phone);
                    }
                }
            }
            if (!$debug) {
                if (in_array('mail', $channels) && !empty($recipient_mails)) {
                    $msgid = create_message(MSG_MAIL, $subject, $message);
                    foreach ($recipient_mails as $recipient_mail) {
                        send_mail($msgid, $row['id'], $recipient_mail, $row['name'], $subject, $message);
                    }
                }
                if (in_array('sms', $channels) && !empty($recipient_phones)) {
                    $msgid = create_message(MSG_SMS, $subject, $message);
                    foreach ($recipient_phones as $phone) {
                        send_sms($msgid, $row['id'], $phone, $message);
                    }
                }
            }
        }
    }
}
// send message to customers which have awaiting www messages
if (in_array('www', $channels) && (empty($types) || in_array('messages', $types))) {
    $nodes = $DB->GetAll("SELECT INET_NTOA(ipaddr) AS ip\n\t\t\tFROM nodes n\n\t\tJOIN (SELECT DISTINCT customerid FROM messageitems\n\t\t\tJOIN messages m ON m.id = messageid\n\t\t\tWHERE type = ? AND status = ?\n\t\t) m ON m.customerid = n.ownerid\n\t\tORDER BY ipaddr", array(MSG_WWW, MSG_NEW));
    if (!empty($nodes)) {
        if (!$debug) {
            if (!($fh = fopen($notifications['messages']['file'], 'w'))) {
                continue;
            }
            fwrite($fh, str_replace("\\n", PHP_EOL, $notifications['messages']['header']));
Example #30
0
 if ($del_patent_id > 0) {
     $sql = "delete from " . $GLOBALS['ecs']->table('order_info') . " where order_id='{$del_patent_id}' ";
     $GLOBALS['db']->query($sql);
 }
 /* 代码增加_start  By  www.68ecshop.com */
 //$split_order = split_order($new_order_id);
 $smarty->assign('split_order', $split_order);
 /* 如果需要,发短信 */
 if (count($split_order['suborder_list']) > 0) {
     foreach ($split_order['suborder_list'] as $key => $val) {
         $supplier_ids[$key] = $val['order_sn'];
     }
 }
 //$supplier_ids = array_keys();
 include_once 'send.php';
 send_sms($supplier_ids, '您有一条新订单,订单号为:ordersn请注意查看。【shopname】', 1);
 $order['order_amount'] = $all_order_amount;
 //替换为总金额去支付
 /* 取得支付信息,生成支付代码 */
 if ($split_order['sub_order_count'] > 1) {
     $order['order_sn'] = $parent_order_id;
     /* 插入支付日志 */
     $order['log_id'] = insert_pay_log($order['order_sn'], $order['order_amount'], PAY_ORDER);
 } else {
     /* 插入支付日志 */
     //$order['log_id'] = insert_pay_log($order['order_id'], $order['order_amount'], PAY_ORDER);
 }
 if ($order['order_amount'] > 0) {
     $payment = payment_info($order['pay_id']);
     include_once 'includes/modules/payment/' . $payment['pay_code'] . '.php';
     $pay_obj = new $payment['pay_code']();