本文整理汇总了PHP中ncReplaceText函数的典型用法代码示例。如果您正苦于以下问题:PHP ncReplaceText函数的具体用法?PHP ncReplaceText怎么用?PHP ncReplaceText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ncReplaceText函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send($param = array())
{
$msg_tpl = rkcache('store_msg_tpl', true);
if (!isset($msg_tpl[$this->code]) || $this->store_id <= 0) {
return false;
}
$tpl_info = $msg_tpl[$this->code];
$setting_info = Model('store_msg_setting')->getStoreMsgSettingInfo(array('smt_code' => $this->code, 'store_id' => $this->store_id));
// 发送站内信
if ($tpl_info['smt_message_switch'] && ($tpl_info['smt_message_forced'] || $setting_info['sms_message_switch'])) {
$message = ncReplaceText($tpl_info['smt_message_content'], $param);
$this->sendMessage($message);
}
// 发送短消息
if ($tpl_info['smt_short_switch'] && $setting_info['sms_short_number'] != '' && ($tpl_info['smt_short_forced'] || $setting_info['sms_short_switch'])) {
$param['site_name'] = C('site_name');
$message = ncReplaceText($tpl_info['smt_short_content'], $param);
$this->sendShort($setting_info['sms_short_number'], $message);
}
// 发送邮件
if ($tpl_info['smt_mail_switch'] && $setting_info['sms_mail_number'] != '' && ($tpl_info['smt_mail_forced'] || $setting_info['sms_mail_switch'])) {
$param['site_name'] = C('site_name');
$param['mail_send_time'] = date('Y-m-d H:i:s');
$subject = ncReplaceText($tpl_info['smt_mail_subject'], $param);
$message = ncReplaceText($tpl_info['smt_mail_content'], $param);
$this->sendMail($setting_info['sms_mail_number'], $subject, $message);
}
}
示例2: send_notice
/**
* 系统通知发送函数
*
* @param int $receiver_id 接受人编号
* @param string $tpl_code 模板标识码
* @param array $param 内容数组
* @param bool $flag 是否遵从系统设置
* @return boolean
*/
protected function send_notice($receiver_id, $tpl_code, $param, $flag = true)
{
$mail_tpl_model = Model('mail_templates');
$mail_tpl = $mail_tpl_model->getOneTemplates($tpl_code);
if (empty($mail_tpl) || $mail_tpl['mail_switch'] == 0) {
return false;
}
$member_model = Model('member');
$receiver = $member_model->infoMember(array('member_id' => $receiver_id));
if (empty($receiver)) {
return false;
}
$subject = ncReplaceText($mail_tpl['title'], $param);
$message = ncReplaceText($mail_tpl['content'], $param);
//根据模板里面确定的通知类型采用对应模式发送通知
$result = false;
switch ($mail_tpl['type']) {
case '0':
$email = new Email();
$result = true;
if ($flag and $GLOBALS['setting_config']['email_enabled'] == '1' or $flag == false) {
$result = $email->send_sys_email($receiver['member_email'], $subject, $message);
}
break;
case '1':
$model_message = Model('message');
$param = array('member_id' => $receiver_id, 'to_member_name' => $receiver['member_name'], 'msg_content' => $message, 'message_type' => 1);
$result = $model_message->saveMessage($param);
break;
}
return $result;
}
示例3: send
public function send($param = array())
{
$msg_tpl = rkcache('member_msg_tpl', true);
// if (!isset($msg_tpl[$this->code]) || $this->member_id <= 0) {
// return false;
// }
$this->pushAndroidAll($param);
$tpl_info = $msg_tpl[$this->code];
$setting_info = Model('member_msg_setting')->getMemberMsgSettingInfo(array('mmt_code' => $this->code, 'member_id' => $this->member_id), 'is_receive');
if (empty($setting_info) || $setting_info['is_receive']) {
// 发送站内信
if ($tpl_info['mmt_message_switch']) {
$message = ncReplaceText($tpl_info['mmt_message_content'], $param);
$this->sendMessage($message);
}
// 发送短消息
if ($tpl_info['mmt_short_switch']) {
$this->getMemberInfo();
if (!empty($this->mobile)) {
$this->member_info['member_mobile'] = $this->mobile;
}
if ($this->member_info['member_mobile_bind'] && !empty($this->member_info['member_mobile'])) {
$param['site_name'] = C('site_name');
$message = ncReplaceText($tpl_info['mmt_short_content'], $param);
$this->sendShort($this->member_info['member_mobile'], $message);
}
}
// 发送邮件
if ($tpl_info['mmt_mail_switch']) {
$this->getMemberInfo();
if (!empty($this->email)) {
$this->member_info['member_email'] = $this->email;
}
if ($this->member_info['member_email_bind'] && !empty($this->member_info['member_email'])) {
$param['site_name'] = C('site_name');
$param['mail_send_time'] = date('Y-m-d H:i:s');
$subject = ncReplaceText($tpl_info['mmt_mail_subject'], $param);
$message = ncReplaceText($tpl_info['mmt_mail_content'], $param);
$this->sendMail($this->member_info['member_email'], $subject, $message);
}
}
}
}
示例4: send_auth_codeOp
/**
* 统一发送身份验证码
*/
public function send_auth_codeOp()
{
if (!in_array($_GET['type'], array('email', 'mobile'))) {
exit;
}
$model_member = Model('member');
$member_info = $model_member->getMemberInfoByID($_SESSION['member_id'], 'member_email,member_mobile');
$verify_code = rand(100, 999) . rand(100, 999);
$data = array();
$data['auth_code'] = $verify_code;
$data['send_acode_time'] = TIMESTAMP;
$update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
if (!$update) {
exit(json_encode(array('state' => 'false', 'msg' => '系统发生错误,如有疑问请与管理员联系')));
}
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'authenticate'));
$param = array();
$param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
$param['verify_code'] = $verify_code;
$param['site_name'] = C('site_name');
$subject = ncReplaceText($tpl_info['title'], $param);
$message = ncReplaceText($tpl_info['content'], $param);
if ($_GET['type'] == 'email') {
$email = new Email();
$result = $email->send_sys_email($member_info["member_email"], $subject, $message);
} elseif ($_GET['type'] == 'mobile') {
$sms = new Sms();
$result = $sms->send($member_info["member_mobile"], $message);
}
if ($result) {
exit(json_encode(array('state' => 'true', 'msg' => '验证码已发出,请注意查收')));
} else {
exit(json_encode(array('state' => 'false', 'msg' => '验证码发送失败')));
}
}
示例5: send_modify_mobileOp
/**
* 修改手机号 - 发送验证码
*/
public function send_modify_mobileOp()
{
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_GET["mobile"], "require" => "true", 'validator' => 'mobile', "message" => '请正确填写手机号码'));
$error = $obj_validate->validate();
if ($error != '') {
output_error($error);
}
$model_member = Model('member');
//发送频率验证
$member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $this->member_info['member_id']));
if (!empty($member_common_info['send_mb_time'])) {
if (date('Ymd', $member_common_info['send_mb_time']) != date('Ymd', TIMESTAMP)) {
$data = array();
$data['send_mb_times'] = 0;
$update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
} else {
if (TIMESTAMP - $member_common_info['send_mb_time'] < 58) {
output_error('请60秒以后再次发送短信');
} else {
if ($member_common_info['send_mb_times'] >= 15) {
output_error('您今天发送短信已超过15条,今天将无法再次发送');
}
}
}
}
$condition = array();
$condition['member_mobile'] = $_GET['mobile'];
$condition['member_id'] = array('neq', $this->member_info['member_id']);
$member_info = $model_member->getMemberInfo($condition);
if ($member_info) {
print_r($member_info);
output_error('该手机号已被使用,请更换其它手机号');
}
if ($this->member_info['member_mobile_bind'] == 1) {
if ($this->member_info['member_mobile'] != $_GET['oldmobile']) {
output_error("原手机号码不正确");
}
}
$data = array();
$data['member_mobile'] = $_GET['mobile'];
$data['member_mobile_bind'] = 0;
$update = $model_member->editMember(array('member_id' => $this->member_info['member_id']), $data);
if (!$update) {
output_error('系统发生错误,如有疑问请与管理员联系');
}
$verify_code = rand(100, 999) . rand(100, 999);
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
$param = array();
$param['site_name'] = C('site_name');
$param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
$param['verify_code'] = $verify_code;
$message = ncReplaceText($tpl_info['content'], $param);
$sms = new Sms();
$result = $sms->send($_GET["mobile"], $message);
if ($result) {
$data = array();
$data['auth_code'] = $verify_code;
$data['send_acode_time'] = TIMESTAMP;
$data['send_mb_time'] = TIMESTAMP;
$data['send_mb_times'] = array('exp', 'send_mb_times+1');
$update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
if (!$update) {
output_error('系统发生错误,如有疑问请与管理员联系');
}
output_data("发送成功");
} else {
output_error('发送失败');
}
}
示例6: send_modify_mobileOp
/**
* 修改手机号 - 发送验证码
*/
public function send_modify_mobileOp()
{
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_GET["mobile"], "require" => "true", 'validator' => 'mobile', "message" => '请正确填写手机号码'));
$error = $obj_validate->validate();
if ($error != '') {
exit(json_encode(array('state' => 'false', 'msg' => $error)));
}
$model_member = Model('member');
$condition = array();
$condition['member_mobile'] = $_GET['mobile'];
$condition['member_id'] = array('neq', $_SESSION['member_id']);
$member_info = $model_member->getMemberInfo($condition, 'member_id');
if ($member_info) {
exit(json_encode(array('state' => 'false', 'msg' => '该手机号已被使用,请更换其它手机号')));
}
$update = $model_member->editMember(array('member_id' => $_SESSION['member_id']), array('member_mobile' => $_GET['mobile']));
if (!$update) {
exit(json_encode(array('state' => 'false', 'msg' => '系统发生错误,如有疑问请与管理员联系')));
}
$verify_code = rand(100, 999) . rand(100, 999);
$data = array();
$data['auth_code'] = $verify_code;
$data['send_acode_time'] = TIMESTAMP;
$update = $model_member->editMemberCommon($data, array('member_id' => $_SESSION['member_id']));
if (!$update) {
exit(json_encode(array('state' => 'false', 'msg' => '系统发生错误,如有疑问请与管理员联系')));
}
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
$param = array();
$param['site_name'] = C('site_name');
$param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
$param['verify_code'] = $verify_code;
$message = ncReplaceText($tpl_info['content'], $param);
$sms = new Sms();
$result = $sms->send($_GET["mobile"], $message);
if ($result) {
exit(json_encode(array('state' => 'true', 'msg' => '发送成功')));
} else {
exit(json_encode(array('state' => 'false', 'msg' => '发送失败')));
}
}
示例7: sendPickupcode
/**
* 发送提货码短信消息
*/
public function sendPickupcode($param)
{
$dorder_info = Model('delivery_order')->getDeliveryOrderInfo(array('order_id' => $param['order_id']), 'reciver_mobphone');
$tpl_info = Model('mail_templates')->getTplInfo(array('code' => 'send_pickup_code'));
$data = array();
$data['site_name'] = C('site_name');
$data['pickup_code'] = $param['pickup_code'];
$message = ncReplaceText($tpl_info['content'], $data);
$sms = new Sms();
$result = $sms->send($dorder_info['reciver_mobphone'], $message);
if (!$result) {
return callback(false, '发送提货码短信消息失败order_id:' . $param['order_id']);
} else {
return callback(true);
}
}
示例8: send_modify_mobileOp
/**
* 手机号发送验证码
*/
public function send_modify_mobileOp()
{
if ($_POST['mobile'] == '') {
output_data(array('state' => 'false', 'msg' => '手机号错误'));
}
$model_member = Model('member');
$condition = array();
$condition['member_mobile'] = $_POST['mobile'];
$condition['member_mobile_bind'] = 1;
$condition['member_id'] = array('neq', $this->member_info['member_id']);
$member_info = $model_member->getMemberInfo($condition, 'member_id');
if ($member_info) {
output_data(array('state' => 'false', 'msg' => '该手机号已被使用,请更换其它手机号'));
}
$verify_code = rand(100, 999) . rand(100, 999);
$data = array();
$data['auth_code'] = $verify_code;
$data['send_acode_time'] = TIMESTAMP;
$update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
if (!$update) {
output_data(array('state' => 'false', 'msg' => '系统发生错误,如有疑问请与管理员联系'));
}
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'modify_mobile'));
$param = array();
$param['site_name'] = C('site_name');
$param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
$param['verify_code'] = $verify_code;
$message = ncReplaceText($tpl_info['content'], $param);
$sms = new Sms();
$result = $sms->send($_POST["mobile"], $message);
if ($result) {
output_data(array('state' => 'true', 'msg' => '发送成功'));
} else {
output_data(array('state' => 'false', 'msg' => '发送失败'));
}
}
示例9: send_notice
/**
* 系统通知发送函数
*
* @param int $receiver_id 接受人编号
* @param string $tpl_code 模板标识码
* @param array $param 内容数组
* @return bool
*/
public function send_notice($receiver_id, $tpl_code, $param)
{
/**
* 获取通知内容模板
*/
$mail_tpl_model = Model('mail_templates');
$mail_tpl = $mail_tpl_model->getOneTemplates($tpl_code);
if (empty($mail_tpl) || $mail_tpl['mail_switch'] == 0) {
return false;
}
/**
* 获取接收人信息
*/
$member_model = Model('member');
$receiver = $member_model->infoMember(array('member_id' => $receiver_id));
if (empty($receiver)) {
return false;
}
/**
* 为通知模板的主题与内容中变量赋值
*/
$subject = ncReplaceText($mail_tpl['title'], $param);
$message = ncReplaceText($mail_tpl['content'], $param);
/**
* 根据模板里面确定的通知类型采用对应模式发送通知
*/
$result = false;
switch ($mail_tpl['type']) {
case '0':
$email = new Email();
$result = $email->send_sys_email($receiver['member_email'], $subject, $message);
break;
case '1':
$model_message = Model('message');
$param = array('member_id' => $receiver_id, 'to_member_name' => $receiver['member_name'], 'msg_content' => $message, 'message_type' => 1);
$result = $model_message->saveMessage($param);
break;
}
return $result;
}
示例10: modify_emailOp
/**
* 绑定邮箱
* @return [type] [description]
*/
public function modify_emailOp()
{
$model_member = Model('member');
$obj_validate = new Validate();
$obj_validate->validateparam = array(array("input" => $_POST["email"], "require" => "true", 'validator' => 'email', "message" => '请正确填写邮箱地址'));
$error = $obj_validate->validate();
if ($error != '') {
output_error($error);
}
if ($this->member_info['member_email_bind'] == 1) {
if (empty($_POST['captcha'])) {
output_error("请正确填写手机验证码");
}
$result_checkcode = self::checkCode(intval($_POST['captcha']));
if ($result_checkcode['result'] != 'succ') {
output_error($result_checkcode['message']);
}
}
//发送频率验证
$member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $this->member_info['member_id']));
if (!empty($member_common_info['send_email_time']) && TIMESTAMP - $member_common_info['send_email_time'] < 58) {
output_error('请60秒以后再次发送邮件');
}
$condition = array();
$condition['member_email'] = $_POST['email'];
$condition['member_id'] = array('neq', $this->member_info['member_id']);
$member_info = $model_member->getMemberInfo($condition, 'member_id');
if ($member_info) {
output_error('该邮箱已被使用');
}
$data = array();
$data['member_email'] = $_POST['email'];
$data['member_email_bind'] = 0;
$update = $model_member->editMember(array('member_id' => $this->member_info['member_id']), $data);
if (!$update) {
output_error('系统发生错误,如有疑问请与管理员联系');
}
$seed = random(6);
$data = array();
$data['auth_code'] = $seed;
$data['send_acode_time'] = TIMESTAMP;
$data['send_email_time'] = TIMESTAMP;
$data['send_acode_times'] = array('exp', 'send_acode_times+1');
$update = $model_member->editMemberCommon($data, array('member_id' => $this->member_info['member_id']));
if (!$update) {
output_error('系统发生错误,如有疑问请与管理员联系');
}
$uid = base64_encode(encrypt($this->member_info['member_id'] . ' ' . $_POST["email"]));
$verify_url = SHOP_SITE_URL . '/index.php?act=login&op=bind_email&uid=' . $uid . '&hash=' . md5($seed);
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'bind_email'));
$param = array();
$param['site_name'] = C('site_name');
$param['user_name'] = $this->member_info['member_name'];
$param['verify_url'] = $verify_url;
$subject = ncReplaceText($tpl_info['title'], $param);
$message = ncReplaceText($tpl_info['content'], $param);
\Shopnc\Lib::messager()->send($_POST["email"], $subject, $message);
output_data("验证邮件已经发送至您的邮箱,请于24小时内登录邮箱并完成验证!如果您始终未收到邮件,请于60秒后重新发送" . $verify_url);
}
示例11: find_passwordOp
/**
* 找回密码的发邮件处理
*/
public function find_passwordOp()
{
Language::read('home_login_register');
$lang = Language::getLangContent();
$result = chksubmit(true, true, 'num');
if ($result !== false) {
if ($result === -11) {
showDialog('非法提交');
} elseif ($result === -12) {
showDialog('验证码错误');
}
}
if (empty($_POST['username'])) {
showDialog($lang['login_password_input_username']);
}
if (process::islock('forget')) {
showDialog($lang['nc_common_op_repeat'], 'reload');
}
$member_model = Model('member');
$member = $member_model->getMemberInfo(array('member_name' => $_POST['username']));
if (empty($member) or !is_array($member)) {
process::addprocess('forget');
showDialog($lang['login_password_username_not_exists'], 'reload');
}
if (empty($_POST['email'])) {
showDialog($lang['login_password_input_email'], 'reload');
}
if (strtoupper($_POST['email']) != strtoupper($member['member_email'])) {
process::addprocess('forget');
showDialog($lang['login_password_email_not_exists'], 'reload');
}
process::clear('forget');
//产生密码
$new_password = random(15);
if (!$member_model->editMember(array('member_id' => $member['member_id']), array('member_passwd' => md5($new_password)))) {
showDialog($lang['login_password_email_fail'], 'reload');
}
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'reset_pwd'));
$param = array();
$param['site_name'] = C('site_name');
$param['user_name'] = $_POST['username'];
$param['new_password'] = $new_password;
$param['site_url'] = SHOP_SITE_URL;
$subject = ncReplaceText($tpl_info['title'], $param);
$message = ncReplaceText($tpl_info['content'], $param);
$email = new Email();
$result = $email->send_sys_email($_POST["email"], $subject, $message);
showDialog('新密码已经发送至您的邮箱,请尽快登录并更改密码!', '', 'succ', '', 5);
}
示例12: sendmbcodeOp
public function sendmbcodeOp()
{
if (empty($_GET['mobile'])) {
exit(json_encode(array('state' => 'false', 'msg' => '请输入手机号码')));
}
$member_mobile = trim($_GET['mobile']);
$member_model = Model('member');
$member = $member_model->getMemberInfo(array('member_mobile' => $member_mobile));
if (!empty($member) && $member["member_id"] > 0) {
exit(json_encode(array('state' => 'false', 'msg' => '该手机号已被使用,请更换其它手机号')));
}
$verify_code = rand(1, 9) . rand(100, 999);
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'authenticate'));
$param = array();
$param['site_name'] = C('site_name');
$param['send_time'] = date('Y-m-d H:i', TIMESTAMP);
$param['verify_code'] = $verify_code;
$message = ncReplaceText($tpl_info['content'], $param);
$sms = new Sms();
$result = $sms->send($_GET["mobile"], $message);
if ($result) {
$_SESSION['mobile_auth_code'] = $verify_code;
$_SESSION['reg_mobile_code'] = $member_mobile;
echo 1;
// exit(json_encode(array('state'=>'true','msg'=>'发送成功')));
} else {
$_SESSION['mobile_auth_code'] = '';
$_SESSION['reg_mobile_code'] = '';
echo 0;
// exit(json_encode(array('state'=>'false','msg'=>'发送失败')));
}
}
示例13: send_emailOp
/**
* 找回密码的发邮件处理
*/
public function send_emailOp()
{
$email = $_POST['email'];
if (empty($email)) {
output_error('邮箱不能为空');
}
$model_member = Model('member');
$member = $model_member->getMemberInfo(array('member_email' => $email));
if (empty($member) or !is_array($member)) {
output_error('该邮箱未被注册');
}
//发送频率验证
$member_common_info = $model_member->getMemberCommonInfo(array('member_id' => $member['member_id']));
if (!empty($member_common_info['send_email_time']) && TIMESTAMP - $member_common_info['send_email_time'] < 58) {
output_error('请60秒以后再次发送邮件');
}
$seed = random(6);
$data = array();
$data['auth_code'] = $seed;
$data['send_acode_time'] = TIMESTAMP;
$data['send_email_time'] = TIMESTAMP;
$data['send_acode_times'] = array('exp', 'send_acode_times+1');
$update = $model_member->editMemberCommon($data, array('member_id' => $member['member_id']));
if (!$update) {
output_error('系统发生错误,如有疑问请与管理员联系');
}
$model_tpl = Model('mail_templates');
$tpl_info = $model_tpl->getTplInfo(array('code' => 'reset_pwd'));
$param = array();
$param['site_name'] = C('site_name');
$param['user_name'] = $member['member_name'];
$param['site_url'] = $_POST['site_url'];
$param['verify_url'] = $param['site_url'] . '/login/find_password_email.html?uid=' . base64_encode(encrypt($member['member_id'] . ' ' . $email)) . '&hash=' . md5($seed);
$subject = ncReplaceText($tpl_info['title'], $param);
$message = ncReplaceText($tpl_info['content'], $param);
\Shopnc\Lib::messager()->send($email, $subject, $message);
output_data('成功发送找回密码邮件,请登录邮箱及时查收', true);
}