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


PHP get_mail_template函数代码示例

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


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

示例1: update

 function update()
 {
     $this->load->helper('html2text');
     $id = $this->input->post('id');
     $subject = $this->input->post('subject');
     $htmlbody = $this->input->post('htmlbody');
     $textbody = html_to_plaintext($htmlbody);
     $attachments = $this->input->post('attachment');
     $db = new DbConn();
     if (!$id) {
         // New template
         $db->exec('insert into mail_templates () values ()');
         $id = $db->last_insert_id();
     }
     $rows = $db->exec('insert into mail_template_versions (templateid, subject, html, plaintext, datecreated, creator)
                    values (?, ?, ?, ?, ?, ?)', (int) $id, $subject, $htmlbody, $textbody, date_create(), $this->admin->id());
     if ($rows != 1) {
         throw new RuntimeException("Insertion failed!");
     }
     $newId = $db->last_insert_id();
     // process attachments
     if ($attachments) {
         foreach ($attachments as $attachId) {
             $attachId = (int) $attachId;
             $db->exec('insert into templatevers_to_attachments (templateverid, attachmentid) values (?, ?)', $newId, $attachId);
         }
     }
     $template = get_mail_template($id);
     $role = $template ? $template->role : '(unknown)';
     log_event(LOG_MAIL_TEMPLATE_EDITED, NULL, $role);
     redirect("admin/emails/index/{$id}");
 }
开发者ID:jcheng5,项目名称:vteer,代码行数:32,代码来源:emails.php

示例2: schedule_mail

/**
 * @param  $user_id
 * @param  $mail_id
 * @param DateTime $when The approximate date/time the e-mail should be sent
 * @param bool $allow_duplicates If false, won't schedule this e-mail if it has already been sent
 *    in the past, or if it's currently scheduled to be sent. If true, will schedule the e-mail
 *    no matter what. If NULL (or omitted) then the mail template's preferred setting will be used
 * @return void
 */
function schedule_mail($user_id, $mail_id, $when = FALSE, $allow_duplicates = NULL)
{
    $db = new DbConn();
    $template = get_mail_template($mail_id, TRUE);
    if ($allow_duplicates === FALSE || is_null($allow_duplicates) && !$template->allowdupes) {
        $results = $db->query('select *
                           from mails_sent as ms, mail_template_versions as mtv
                           where ms.templateverid = mtv.id
                             and mtv.templateid = ?
                             and userid = ?', $mail_id, $user_id);
        if ($results->length > 0) {
            return FALSE;
        }
        $results = $db->query('select * from mails_scheduled where userid = ? and mailid = ?', $user_id, $mail_id);
        if ($results->length > 0) {
            return FALSE;
        }
    }
    if (!$when) {
        send_user_mail($template, $user_id);
        return TRUE;
    } else {
        $db->exec('insert into mails_scheduled (userid, mailid, due) values (?, ?, ?)', $user_id, $mail_id, $when);
        return TRUE;
    }
}
开发者ID:jcheng5,项目名称:vteer,代码行数:35,代码来源:mail_helper.php

示例3: compile_mail_template

/**
* useful templating functions from an older project of mine, hacked for Moodle
* @param template the template's file name from $CFG->sitedir
* @param infomap a hash containing pairs of parm => data to replace in template
* @return a fully resolved template where all data has been injected
*/
function compile_mail_template($template, $infomap, $module = 'tracker')
{
    $notification = implode('', get_mail_template($template, $module));
    foreach ($infomap as $aKey => $aValue) {
        $notification = str_replace("<%%{$aKey}%%>", $aValue, $notification);
    }
    return $notification;
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:14,代码来源:mailtemplatelib.php

示例4: action_send_email_code

/**
 * 发送邮箱验证所需的验证码
 */
function action_send_email_code()
{
    $_LANG = $GLOBALS['_LANG'];
    $_CFG = $GLOBALS['_CFG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    require_once ROOT_PATH . 'includes/lib_validate_record.php';
    $email = trim($_SESSION[VT_EMAIL_VALIDATE]);
    if (empty($email)) {
        exit("邮箱不能为空");
        return;
    } else {
        if (!is_email($email)) {
            exit("邮箱格式不正确");
            return;
        } else {
            if (check_validate_record_exist($email)) {
                $record = get_validate_record($email);
                /**
                 * 检查是过了限制发送邮件的时间
                 */
                if (time() - $record['last_send_time'] < 60) {
                    echo "每60秒内只能发送一次注册邮箱验证码,请稍候重试";
                    return;
                }
            }
        }
    }
    require_once ROOT_PATH . 'includes/lib_passport.php';
    /* 设置验证邮件模板所需要的内容信息 */
    $template = get_mail_template('email_validate');
    // 生成邮箱验证码
    $email_code = rand_number(6);
    $GLOBALS['smarty']->assign('email_code', $email_code);
    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date', date($GLOBALS['_CFG']['date_format']));
    $content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);
    /* 发送激活验证邮件 */
    $result = send_mail($email, $email, $template['template_subject'], $content, $template['is_html']);
    if ($result) {
        // 保存验证码到Session中
        $_SESSION[VT_EMAIL_VALIDATE] = $email;
        // 保存验证记录
        save_validate_record($email, $email_code, VT_EMAIL_VALIDATE, time(), time() + 30 * 60);
        echo 'ok';
    } else {
        echo '邮箱验证码发送失败';
    }
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:53,代码来源:validate.php

示例5: index

 function index()
 {
     $this->load->helper('mail');
     $db = new DbConn();
     $mails = $db->query('select * from mails_scheduled where due <= NOW()');
     while ($mail = $mails->next()) {
         $user_id = $mail->userid;
         $mail_id = $mail->mailid;
         $template = get_mail_template($mail_id, false);
         if (!$template) {
             continue;
         }
         send_user_mail($template, $user_id);
         $db->exec('delete from mails_scheduled where id = ?', $mail->id);
     }
 }
开发者ID:jcheng5,项目名称:vteer,代码行数:16,代码来源:cron.php

示例6: action_act_update_email

function action_act_update_email()
{
    // 获取全局变量
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $_SESSION['user_id'];
    include_once ROOT_PATH . 'includes/lib_passport.php';
    if (empty($_POST['v_captcha'])) {
        show_message('验证码不能为空!', '返回', 'user.php?act=update_email', 'error');
    }
    /* 检查验证码 */
    include_once 'includes/cls_captcha.php';
    $validator = new captcha();
    $validator->session_word = 'captcha_login';
    if (!$validator->check_word($_POST['v_captcha'])) {
        show_message($_LANG['invalid_captcha'], '返回', 'user.php?act=update_email', 'error');
    } else {
        $sql = "select email,user_name from " . $GLOBALS['ecs']->table('users') . " where user_id = '" . $_SESSION['user_id'] . "'";
        $rows = $GLOBALS['db']->getRow($sql);
        $tpl = get_mail_template('verify_mail');
        $run = "0123456789abcdefghijklmnopqrstuvwxyz";
        $hash = mc_random(16, $run);
        $email = $GLOBALS['ecs']->url() . 'user.php?act=valid_email&hash=' . $hash;
        $smarty->assign('shop_name', $_CFG['shop_name']);
        $smarty->assign('send_date', date($_CFG['time_format']));
        $smarty->assign('user_name', $rows['user_name']);
        $smarty->assign('email', $email);
        $smarty->assign('v_email', $rows['email']);
        $content = $smarty->fetch('str:' . $tpl['template_content']);
        $result = send_mail($_CFG['shop_name'], $rows['email'], $tpl['template_subject'], $content, $tpl['is_html']);
        if ($result == true) {
            $add_time = time();
            $sql = "insert into " . $GLOBALS['ecs']->table('email') . "(`email`,`hash`,`add_time`,`user_id`) values('" . $rows['email'] . "','{$hash}','{$add_time}','" . $_SESSION['user_id'] . "')";
            $GLOBALS['db']->query($sql);
            $smarty->display('user_transaction.dwt');
        } else {
            show_message('邮件发送失败!');
        }
    }
}
开发者ID:seanguo166,项目名称:yinoos,代码行数:44,代码来源:user.php

示例7: send_order_bonus

/**
 * 发红包:发货时发红包
 * @param   int     $order_id   订单号
 * @return  bool
 */
function send_order_bonus($order_id)
{
    /* 取得订单应该发放的红包 */
    $bonus_list = order_bonus($order_id);
    /* 如果有红包,统计并发送 */
    if ($bonus_list) {
        /* 用户信息 */
        $sql = "SELECT u.user_id, u.user_name, u.email " . "FROM " . $GLOBALS['ecs']->table('order_info') . " AS o, " . $GLOBALS['ecs']->table('users') . " AS u " . "WHERE o.order_id = '{$order_id}' " . "AND o.user_id = u.user_id ";
        $user = $GLOBALS['db']->getRow($sql);
        /* 统计 */
        $count = 0;
        $money = '';
        foreach ($bonus_list as $bonus) {
            $count += $bonus['number'];
            $money .= price_format($bonus['type_money']) . ' [' . $bonus['number'] . '], ';
            /* 修改用户红包 */
            $sql = "INSERT INTO " . $GLOBALS['ecs']->table('user_bonus') . " (bonus_type_id, user_id) " . "VALUES('{$bonus['type_id']}', '{$user['user_id']}')";
            for ($i = 0; $i < $bonus['number']; $i++) {
                if (!$GLOBALS['db']->query($sql)) {
                    return $GLOBALS['db']->errorMsg();
                }
            }
        }
        /* 如果有红包,发送邮件 */
        if ($count > 0) {
            $tpl = get_mail_template('send_bonus');
            $GLOBALS['smarty']->assign('user_name', $user['user_name']);
            $GLOBALS['smarty']->assign('count', $count);
            $GLOBALS['smarty']->assign('money', $money);
            $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
            $GLOBALS['smarty']->assign('send_date', local_date($GLOBALS['_CFG']['date_format']));
            $GLOBALS['smarty']->assign('sent_date', local_date($GLOBALS['_CFG']['date_format']));
            $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']);
            send_mail($user['user_name'], $user['email'], $tpl['template_subject'], $content, $tpl['is_html']);
        }
    }
    return true;
}
开发者ID:dlpc,项目名称:ecshop,代码行数:43,代码来源:lib_order.php

示例8: get_mail_template

<?php

require_once 'common.inc';
$id = $_REQUEST["id"];
if ($id) {
    $id = (int) $id;
    $mail_template = get_mail_template($id, true);
}
$verb = $mail_template ? "Edit" : "Create New";
vt_header("{$verb} E-mail");
vt_require_yui();
?>
<script type="text/javascript" src="../../javascripts/ckeditor/ckeditor_basic.js"></script>
<script type="text/javascript" src="compose.js"></script>
<style type="text/css">
#subject {
   width: 100%;
}
</style>

<form name="email" method="POST" action="update.php">

<?php 
if ($mail_template) {
    ?>
<input type="hidden" name="id" value="<?php 
    echo (int) $id;
    ?>
" />
<?php 
}
开发者ID:jcheng5,项目名称:vteer,代码行数:31,代码来源:compose.php

示例9: clear_cache_files

     /* 修改团购活动状态为失败,记录失败原因(活动说明) */
     $sql = "UPDATE " . $ecs->table('goods_activity') . " SET is_finished = '" . GBS_FAIL . "', " . "act_desc = '{$_POST['act_desc']}' " . "WHERE act_id = '{$group_buy_id}' LIMIT 1";
     $db->query($sql);
     /* 清除缓存 */
     clear_cache_files();
     /* 提示信息 */
     $links = array(array('href' => 'group_buy.php?act=list', 'text' => $_LANG['back_list']));
     sys_msg($_LANG['edit_success'], 0, $links);
 } elseif (isset($_POST['mail'])) {
     /* 发送通知邮件 */
     /* 判断订单状态 */
     if ($group_buy['status'] != GBS_SUCCEED) {
         sys_msg($_LANG['error_status'], 1);
     }
     /* 取得邮件模板 */
     $tpl = get_mail_template('group_buy');
     /* 初始化订单数和成功发送邮件数 */
     $count = 0;
     $send_count = 0;
     /* 取得有效订单 */
     $sql = "SELECT o.consignee, o.add_time, g.goods_number, o.order_sn, " . "o.order_amount, o.order_id, o.email " . "FROM " . $ecs->table('order_info') . " AS o, " . $ecs->table('order_goods') . " AS g " . "WHERE o.order_id = g.order_id " . "AND o.extension_code = 'group_buy' " . "AND o.extension_id = '{$group_buy_id}' " . "AND o.order_status = '" . OS_CONFIRMED . "'";
     $res = $db->query($sql);
     while ($order = $db->fetchRow($res)) {
         /* 邮件模板赋值 */
         $smarty->assign('consignee', $order['consignee']);
         $smarty->assign('add_time', local_date($_CFG['time_format'], $order['add_time']));
         $smarty->assign('goods_name', $group_buy['goods_name']);
         $smarty->assign('goods_number', $order['goods_number']);
         $smarty->assign('order_sn', $order['order_sn']);
         $smarty->assign('order_amount', price_format($order['order_amount']));
         $smarty->assign('shop_url', $ecs->url() . 'user.php?act=order_detail&order_id=' . $order['order_id']);
开发者ID:BGCX261,项目名称:zishashop-svn-to-git,代码行数:31,代码来源:group_buy.php

示例10: send_regiter_hash

/**
 *  发送激活验证邮件
 *
 * @access  public
 * @param   int     $user_id        用户ID
 *
 * @return boolen
 */
function send_regiter_hash($user_id)
{
    /* 设置验证邮件模板所需要的内容信息 */
    $template = get_mail_template('register_validate');
    $hash = register_hash('encode', $user_id);
    $validate_email = $GLOBALS['ecs']->url() . 'user.php?act=validate_email&hash=' . $hash;
    $sql = "SELECT user_name, email FROM " . $GLOBALS['ecs']->table('users') . " WHERE user_id = '{$user_id}'";
    $row = $GLOBALS['db']->getRow($sql);
    $GLOBALS['smarty']->assign('user_name', $row['user_name']);
    $GLOBALS['smarty']->assign('validate_email', $validate_email);
    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date', date($GLOBALS['_CFG']['date_format']));
    $content = $GLOBALS['smarty']->fetch('str:' . $template['template_content']);
    /* 发送激活验证邮件 */
    if (send_mail($row['user_name'], $row['email'], $template['template_subject'], $content, $template['is_html'])) {
        return true;
    } else {
        return false;
    }
}
开发者ID:seanguo166,项目名称:microdistribution,代码行数:28,代码来源:lib_passport.php

示例11: trim

 if (!empty($_POST['action']) && $_POST['action'] == 'get_pwd') {
     $admin_username = !empty($_POST['user_name']) ? trim($_POST['user_name']) : '';
     $admin_email = !empty($_POST['email']) ? trim($_POST['email']) : '';
     if (empty($admin_username) || empty($admin_email)) {
         ecs_header("Location: privilege.php?act=login\n");
         exit;
     }
     /* 管理员用户名和邮件地址是否匹配,并取得原密码 */
     $sql = 'SELECT user_id, password FROM ' . $ecs->table('admin_user') . " WHERE user_name = '{$admin_username}' AND email = '{$admin_email}'";
     $admin_info = $db->getRow($sql);
     if (!empty($admin_info)) {
         /* 生成验证的code */
         $admin_id = $admin_info['user_id'];
         $code = md5($admin_id . $admin_info['password']);
         /* 设置重置邮件模板所需要的内容信息 */
         $template = get_mail_template('send_password');
         $reset_email = $ecs->url() . ADMIN_PATH . '/get_password.php?act=reset_pwd&uid=' . $admin_id . '&code=' . $code;
         $smarty->assign('user_name', $admin_username);
         $smarty->assign('reset_email', $reset_email);
         $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']));
         $content = $smarty->fetch('str:' . $template['template_content']);
         /* 发送确认重置密码的确认邮件 */
         if (send_mail($admin_username, $admin_email, $template['template_subject'], $content, $template['is_html'])) {
             //提示信息
             $link[0]['text'] = $_LANG['back'];
             $link[0]['href'] = 'privilege.php?act=login';
             sys_msg($_LANG['send_success'] . $admin_email, 0, $link);
         } else {
             sys_msg($_LANG['send_mail_error'], 1);
开发者ID:nirvana-info,项目名称:old_bak,代码行数:31,代码来源:get_password.php

示例12: set_user_on_env_nbm

function set_user_on_env_nbm(&$nbm_user, $is_action_send)
{
    global $user, $lang, $lang_info, $env_nbm;
    $user = build_user($nbm_user['user_id'], true);
    switch_lang_to($user['language']);
    if ($is_action_send) {
        $env_nbm['mail_template'] = get_mail_template($env_nbm['email_format']);
        $env_nbm['mail_template']->set_filename('notification_by_mail', 'notification_by_mail.tpl');
    }
}
开发者ID:lcorbasson,项目名称:Piwigo,代码行数:10,代码来源:functions_notification_by_mail.inc.php

示例13: done


//.........这里部分代码省略.........
	    /* 修改拍卖活动状态 */
	    if ($order['extension_code']=='auction')
	    {
	        $sql = "UPDATE ". $ecs->table('goods_activity') ." SET is_finished='2' WHERE act_id=".$order['extension_id'];
	        $db->query($sql);
	    }
	
	    /* 处理余额、积分、红包 */
	    if ($order['user_id'] > 0 && $order['surplus'] > 0)
	    {
	        log_account_change($order['user_id'], $order['surplus'] * (-1), 0, 0, 0, sprintf($_LANG['pay_order'], $order['order_sn']));
	    }
	    if ($order['user_id'] > 0 && $order['integral'] > 0)
	    {
	        log_account_change($order['user_id'], 0, 0, 0, $order['integral'] * (-1), sprintf($_LANG['pay_order'], $order['order_sn']));
	    }
	
	    if ($order['bonus_id'] > 0 && $temp_amout > 0)
	    {
	        use_bonus($order['bonus_id'], $new_order_id);
	    }
	
	    /* 如果使用库存,且下订单时减库存,则减少库存 */
	    if ($_CFG['use_storage'] == '1' && $_CFG['stock_dec_time'] == SDT_PLACE)
	    {
	        //change_order_goods_storage($order['order_id'], true, SDT_PLACE);
	    }
	error_log('1',3,'flow.log');
	    /* 给商家发邮件 */
	    /* 增加是否给客服发送邮件选项 */
	    if ($_CFG['send_service_email'] && $_CFG['service_email'] != '')
	    {
	    	error_log('2',3,'flow.log');
	        $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']);
	    }
	error_log('2',3,'flow.log');
	    /* 如果需要,发短信 */
	    if ($_CFG['sms_order_placed'] == '1' && $_CFG['sms_shop_mobile'] != '')
	    {
	        include_once(RPC_ROOT.'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);
	    }
	error_log('3',3,'flow.log');
	    /* 如果订单金额为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);
	error_log('4',3,'flow.log');
	        $virtual_goods = array();
	        foreach ($res AS $row)
	        {
开发者ID:noikiy,项目名称:mdwp,代码行数:67,代码来源:flow.action.php

示例14: virtual_goods_shipping

/**
 *  虚拟商品
 * @param type $goods
 * @param type $order_sn
 * @param type $msg
 * @param type $process
 * @return boolean
 */
function virtual_goods_shipping($goods, $order_sn, &$msg, $process = 'other')
{
    /* 代码增加_虚拟团购_START  www.68ecshop.com */
    for ($i = 0; $i < $goods['num']; $i++) {
        $coded_card_sn = rand(1000, 9999) . $i . gmtime();
        $add_date = gmtime();
        $end_date = $goods['valid_date'];
        $supplier_id = $goods['supplier_id'];
        $goods_attr_id = $goods['goods_attr_id'];
        $sql = "INSERT INTO " . $GLOBALS['ecs']->table('virtual_goods_card') . " (goods_id, card_sn, end_date, add_date, supplier_id, is_verification) " . "VALUES ('{$goods['goods_id']}', '{$coded_card_sn}', '{$end_date}', '{$add_date}', '{$supplier_id}', '0')";
        $GLOBALS['db']->query($sql);
    }
    /* 代码增加_虚拟团购_END  www.68ecshop.com */
    /* 取出卡片信息 */
    $sql = "SELECT card_id, card_sn, end_date,buy_date,supplier_id,is_verification  FROM " . $GLOBALS['ecs']->table('virtual_goods_card') . " WHERE goods_id = '{$goods['goods_id']}' AND is_saled = 0  LIMIT " . $goods['num'];
    $arr = $GLOBALS['db']->getAll($sql);
    $card_ids = array();
    $cards = array();
    foreach ($arr as $virtual_card) {
        $card_info = array();
        $card_info['end_date'] = date($GLOBALS['_CFG']['date_format'], $virtual_card['end_date']);
        $card_ids[] = $virtual_card['card_id'];
        $cards[] = $card_info;
    }
    /* 标记已经取出的卡片 */
    $sql = "UPDATE " . $GLOBALS['ecs']->table('virtual_goods_card') . " SET " . "is_saled = 1 ," . "order_sn = '{$order_sn}' " . "WHERE " . db_create_in($card_ids, 'card_id');
    if (!$GLOBALS['db']->query($sql, 'SILENT')) {
        $msg .= $GLOBALS['db']->error();
        return false;
    }
    /* 更新库存 */
    if (empty($goods_attr_id)) {
        $sql = "UPDATE " . $GLOBALS['ecs']->table('goods') . " SET goods_number = goods_number - '{$goods['num']}' WHERE goods_id = '{$goods['goods_id']}'";
    } else {
        $goods_attr_id = str_replace(",", "|", $goods_attr_id);
        $sql = "UPDATE " . $GLOBALS['ecs']->table('products') . "set product_number = product_number - '{$goods['num']}'  where goods_id = '{$goods['goods_id']}' and goods_attr='{$goods_attr_id}'";
    }
    $GLOBALS['db']->query($sql);
    if (true) {
        /* 获取订单信息 */
        $sql = "SELECT order_id, order_sn, consignee, email FROM " . $GLOBALS['ecs']->table('order_info') . " WHERE order_sn = '{$order_sn}'";
        $order = $GLOBALS['db']->GetRow($sql);
        /* 更新订单信息 */
        if ($process == 'split') {
            $sql = "UPDATE " . $GLOBALS['ecs']->table('order_goods') . "\n                    SET send_number = send_number + '" . $goods['num'] . "'\n                    WHERE order_id = '" . $order['order_id'] . "'\n                    AND goods_id = '" . $goods['goods_id'] . "' ";
        } else {
            $sql = "UPDATE " . $GLOBALS['ecs']->table('order_goods') . "\n                    SET send_number = '" . $goods['num'] . "'\n                    WHERE order_id = '" . $order['order_id'] . "'\n                    AND goods_id = '" . $goods['goods_id'] . "' ";
        }
        if (!$GLOBALS['db']->query($sql, 'SILENT')) {
            $msg .= $GLOBALS['db']->error();
            return false;
        }
    }
    /*发送手机验证码*/
    //    require('lib_sms.php');
    //    $mobile_phone = $goods['mobile_phone'];
    //    foreach($arr as $v){
    //        $content = '您的验证码:'.$v['card_sn'].', 请在 '.local_date('Y-m-d',$v['end_date']).' 之前使用';
    //        sendsms($mobile_phone,$content);
    //    }
    /* 发送邮件 */
    $GLOBALS['smarty']->assign('virtual_card', $cards);
    $GLOBALS['smarty']->assign('order', $order);
    $GLOBALS['smarty']->assign('goods', $goods);
    $GLOBALS['smarty']->assign('send_time', date('Y-m-d H:i:s'));
    $GLOBALS['smarty']->assign('shop_name', $GLOBALS['_CFG']['shop_name']);
    $GLOBALS['smarty']->assign('send_date', date('Y-m-d'));
    $GLOBALS['smarty']->assign('sent_date', date('Y-m-d'));
    $tpl = get_mail_template('virtual_card');
    $content = $GLOBALS['smarty']->fetch('str:' . $tpl['template_content']);
    send_mail($order['consignee'], $order['email'], $tpl['template_subject'], $content, $tpl['is_html']);
    return true;
}
开发者ID:firsteam,项目名称:falcons,代码行数:81,代码来源:lib_common.php

示例15: action_act_forget_surplus_password

function action_act_forget_surplus_password()
{
    $user = $GLOBALS['user'];
    $_CFG = $GLOBALS['_CFG'];
    $_LANG = $GLOBALS['_LANG'];
    $smarty = $GLOBALS['smarty'];
    $db = $GLOBALS['db'];
    $ecs = $GLOBALS['ecs'];
    $user_id = $GLOBALS['user_id'];
    if (empty($_POST['verify_method'])) {
        show_message('未知错误!', '返回', 'user.php?act=forget_surplus_password', 'error');
    } else {
        $verify_method = $_REQUEST['verify_method'];
        if ($verify_method == 'phone') {
            if (empty($_REQUEST['v_code'])) {
                show_message('请输入手机验证码!', '返回', 'user.php?act=forget_surplus_password', 'error');
            }
            if (empty($_REQUEST['v_phone'])) {
                show_message('请输入手机号!', '返回', 'user.php?act=forget_surplus_password', 'error');
            }
            $v_code = $_REQUEST['v_code'];
            $v_phone = $_REQUEST['v_phone'];
            $sql = 'SELECT COUNT(*) FROM ' . $GLOBALS['ecs']->table('verifycode') . ' WHERE `mobile` = \'' . $v_phone . '\' AND `verifycode` = \'' . $v_code . '\' AND `status` = 1' . ' AND dateline + 86400 > \'' . gmtime() . '\'';
            if ($GLOBALS['db']->getOne($sql) == 0) {
                show_message('手机号和验证码不匹配,请重新输入!');
            } else {
                $smarty->assign('verify_method', 'phone');
                $smarty->assign('v_code', $v_code);
                $smarty->assign('action', 'reset_surplus_password');
                $smarty->assign('validated', 1);
                $smarty->display('user_transaction.dwt');
            }
        } elseif ($verify_method == 'email') {
            if (empty($_REQUEST['v_captcha'])) {
                show_message('请输入验证码!', '返回', 'user.php?act=forget_surplus_password', 'error');
            }
            if (empty($_REQUEST['v_email'])) {
                show_message('请输入邮箱!', '返回', 'user.php?act=forget_surplus_password', 'error');
            }
            $v_captcha = trim($_REQUEST['v_captcha']);
            $v_email = trim($_REQUEST['v_email']);
            include_once 'includes/cls_captcha.php';
            $validator = new captcha();
            $validator->session_word = 'captcha_login';
            if (!$validator->check_word($v_captcha)) {
                show_message($_LANG['invalid_captcha'], $_LANG['back_up_page'], 'user.php?act=forget_surplus_password', 'error');
            } else {
                $sql = 'SELECT `user_name`,`email` ' . ' FROM ' . $GLOBALS['ecs']->table('users') . ' WHERE `user_id` = \'' . $user_id . '\'';
                $row = $GLOBALS['db']->getRow($sql);
                if ($row['email'] != $v_email) {
                    show_message('邮箱输入错误!', '返回', 'user.php?act=forget_surplus_password', 'error');
                }
                $template = get_mail_template('reset_surplus_password');
                $scope = '02456789abdefghjknoqrstwyz13u';
                $hash = mc_random(16, $scope);
                $reset_link = $GLOBALS['ecs']->url() . 'user.php?act=verify_reset_surplus_email' . '&hash=' . $hash;
                $user_name = $row['user_name'];
                $smarty->assign('user_name', $user_name);
                $smarty->assign('reset_link', $reset_link);
                $smarty->assign('shop_name', $_CFG['shop_name']);
                $smarty->assign('send_date', date($_CFG['time_format']));
                $content = $smarty->fetch('str:' . $template['template_content']);
                $result = send_mail($_CFG['shop_name'], $v_email, $template['template_subject'], $content, $template['is_html']);
                if ($result == true) {
                    $add_time = gmtime();
                    $sql = 'INSERT INTO ' . $GLOBALS['ecs']->table('email') . '(`email`,`hash`,`add_time`,`user_id`)' . 'VALUES(\'' . $v_email . '\',\'' . $hash . '\',\'' . $add_time . '\',\'' . $user_id . '\')';
                    $GLOBALS['db']->query($sql);
                    if ($GLOBALS['db']->affected_rows() == 1) {
                        show_message('已发送邮件,请前往邮箱点击链接完成密码重置!', '返回', 'user.php?act=account_security', 'success');
                    } else {
                        show_message('发送邮件失败!');
                    }
                } else {
                    show_message('发送邮件失败!');
                }
            }
        } else {
            show_message('未知错误!', '返回', 'user.php?act=forget_surplus_password', 'error');
        }
    }
}
开发者ID:moonlight-wang,项目名称:feilun,代码行数:81,代码来源:user9-9.php


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