예제 #1
0
 public function discount($price)
 {
     $discount_enable = GetSettValue('discount_enable');
     //判断是否有折扣
     $discount = 1;
     $r = array();
     if ($discount_enable) {
         $model = D('Discount');
         $list = $model->findall();
         foreach ($list as $k => $v) {
             if ($price >= $v['minmoney'] && $price <= $v['maxmoney']) {
                 $discount = $v['discount'];
                 break;
             }
         }
     }
     if ($discount < 1) {
         $r['price'] = round($price * $discount, 2);
         //保留两位
         $r['text'] = getprice_str($price) . '*<Span style="color:red;font-weight:bold;">' . $discount * 100 . '%</span>=' . getprice_str($r['price']);
     } else {
         $r['price'] = $price;
         $r['text'] = "";
     }
     return $r;
 }
예제 #2
0
 public function index()
 {
     $citys = GetSettValue("ipblock_city");
     $cityinfo = unserialize($citys);
     $this->cityinfo = $cityinfo;
     $this->citylist = rtrim(implode(',', $cityinfo), ',');
     $this->display();
 }
예제 #3
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $pname = get_class($this);
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $this->add_field('v_mid', GetSettValue($pname . "_id"));
     //商户编号
     $this->add_field('v_oid', date('Ymd') . '-' . GetSettValue($pname . "_id") . '-' . $list['sn']);
     //订单编号
     $this->add_field('v_rcvname', $list['delivery_firstname'] . " " . $list['delivery_lastname']);
     //收货人姓名
     $this->add_field('v_rcvaddr', $list['delivery_address']);
     //收货人地址
     $this->add_field('v_rcvtel', $list['delivery_telephone']);
     //收货人电话
     $this->add_field('v_rcvpost', $list['delivery_zip']);
     //收货人邮编
     $this->add_field('v_amount', $list['orders_total']);
     //订单总金额
     //$this->add_field('v_language','en');//订单语言
     $this->add_field('v_ymd', date('Ymd', $list['dateline']));
     //订单产生日期
     $this->add_field('v_orderstatus', 1);
     //配货状态
     $this->add_field('v_ordername', $list['delivery_firstname'] . " " . $list['delivery_lastname']);
     //订货人姓名
     $this->add_field('v_moneytype', 1);
     //币种,0为人民币,1为美元,2为欧元,3为英镑,4为日元,5为韩元,6为澳大利亚元
     $this->add_field('v_url', $this_script . U('Payment/payeasy_return'));
     //支付动作完成后返回到该url,支付结果以GET方式发送
     $this->add_field('v_md5info', bin2hex(mhash(MHASH_MD5, "1" . date('Ymd', $list['dateline']) . $list['orders_total'] . $list['delivery_firstname'] . " " . $list['delivery_lastname'] . date('Ymd') . '-' . GetSettValue($pname . "_id") . '-' . $list['sn'] . GetSettValue($pname . "_id") . $this_script . U('Payment/payeasy_return'), GetSettValue($pname . "_key"))));
     //订单数字指纹
     $this->add_field('v_shipstreet', $list['delivery_address']);
     //送货街道地址
     $this->add_field('v_shipcity', $list['delivery_city']);
     //送货城市
     //$this->add_field('v_shipstate',$_POST['']);//送货省/州
     $this->add_field('v_shippost', $list['delivery_zip']);
     //送货邮编
     //$this->add_field('v_shipcountry','840');//送货国家
     $this->add_field('v_shipphone', $list['delivery_telephone']);
     //送货电话
     $this->add_field('v_shipemail', $list['delivery_email']);
     //送货Email
     $this->form .= "<form method=\"post\" name=\"pay_form\" ";
     $this->form .= "action=\"" . $this->submit_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $this->form .= "</form>\n";
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
 /**
  * 分页
  *
  * @param Model $model
  * @param Array $map
  * @param String $sortBy
  * @param Boolean $asc
  */
 public function _list($view, $map, $sortBy = '', $asc = true)
 {
     //排序字段 默认为主键名
     if (isset($_REQUEST['order'])) {
         $order = $_REQUEST['order'];
     } else {
         $order = !empty($sortBy) ? $sortBy : $model->getPk();
     }
     //排序方式默认按照倒序排列
     //接受 sost参数 0 表示倒序 非0都 表示正序
     if (isset($_REQUEST['sort'])) {
         $sort = $_REQUEST['sort'] ? 'asc' : 'desc';
     } else {
         $sort = $asc ? 'asc' : 'desc';
     }
     //取得满足条件的记录数
     if (!empty($_SESSION['map']) && 'Search' == MODULE_NAME) {
         $map = $_SESSION['map'];
     }
     if (isset($_REQUEST['pr']) && isset($_REQUEST['pr2'])) {
         $map['pricespe'] = array('between', "{$_REQUEST['pr']},{$_REQUEST['pr2']}");
     } elseif (isset($_REQUEST['pr']) && !isset($_REQUEST['pr2'])) {
         $map['pricespe'] = array('gt', $_REQUEST['pr']);
     }
     !empty($_REQUEST['type']) && ($map[$_REQUEST['type']] = 1);
     $count = $this->where($map)->count();
     $pages = array('totalRows' => 0, 'totalPages' => 0, 'startRow' => 0, 'endRow' => 1, 'list' => null, "page" => null);
     if ($count > 0) {
         import("ORG.Util.Page");
         //创建分页数量
         if ('Search' == MODULE_NAME) {
             $pro_num = GetSettValue('search_num');
         } elseif (strpos($_SERVER['REQUEST_URI'], 'cid-') > 0) {
             $pro_num = GetSettValue('cate_num');
         } elseif ('Pro' == MODULE_NAME) {
             $pro_num = GetSettValue('pro_num');
         }
         if (!$pro_num) {
             $pro_num = 21;
         }
         $p = new Page($count, $pro_num);
         //分页查询数据
         $voList = $this->where($map)->order("`Products`.`{$order}` {$sort},`id` desc")->limit($p->firstRow . ',' . $p->listRows)->findAll();
         //分页显示
         $page = $p->show();
         $pages['totalRows'] = $p->totalRows;
         $pages['totalPages'] = $p->totalPages;
         $pages['startRow'] = $p->firstRow + 1;
         $pages['endRow'] = ($p->nowPage > 1 ? $p->nowPage : 1) * $p->listRows;
         $pages['endRow'] = $pages['endRow'] > $pages['totalRows'] ? $pages['totalRows'] : $pages['endRow'];
         $pages['list'] = $voList;
         $pages['page'] = $page;
     }
     $view->assign($pages);
     return null;
 }
예제 #5
0
 public function dologin()
 {
     if (GetSettValue('ipblock_pwd') == $_POST['password']) {
         setcookie("ipblock", 0, time() + 3600 * 6, "/");
         $this->redirect('Index/index');
     } else {
         setcookie("ipblock", 1, time() + 3600 * 6, "/");
         $this->redirect('Ipblock/login');
     }
 }
예제 #6
0
 public function nodelist()
 {
     if ($this->isPost()) {
         $access = $_POST['access'];
         SetSettValue('accessmode', $access);
         cleanCache();
         $this->success("修改成功!");
     }
     $this->access = GetSettValue('accessmode') ? GetSettValue('accessmode') : 'module';
     $this->display();
 }
예제 #7
0
 public function getlist()
 {
     $list = $this->order('sort desc')->findAll();
     $array = array();
     for ($row = 0; $row < count($list); $row++) {
         $status = GetSettValue($list[$row]['name'] . "_status");
         if ($status) {
             $array[] = $list[$row];
         }
     }
     return $array;
 }
예제 #8
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $pname = "alipay";
     //支付宝
     $parameter = array("service" => "trade_create_by_buyer", "payment_type" => "1", "partner" => GetSettValue($pname . "_" . "partner"), "seller_email" => GetSettValue($pname . "_" . "seller_email"), "return_url" => $this_script, "notify_url" => $this_script . U('Payment/Pin', array("type" => "Alipay")), "_input_charset" => GetSettValue($pname . "_" . "input_charset"), "show_url" => $this_script, "out_trade_no" => $list['sn'], "subject" => $list['sn'], "body" => "无", "price" => $list['orders_total'], "quantity" => "1", "logistics_fee" => "0", "logistics_type" => "EXPRESS", "logistics_payment" => "BUYER_PAY");
     $this->setconig($parameter, GetSettValue($pname . "_security_code"), "MD5");
     //$this->mysign = "";
     $this->form .= $this->build_postform();
     $pname = get_class($this);
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
 function _initialize()
 {
     header("Content-Type:text/html; charset=utf-8");
     //获取国家列表
     self::$Model = D("Region");
     $this->Countries = self::$Model->where("type=0")->order('name asc')->findall();
     //主题
     if ($this->theme = GetSettValue('theme')) {
     } else {
         $this->theme = 'default';
     }
     //货币
     L('_OPERATION_SUCCESS_', "Operation Success");
     L('_OPERATION_FAIL_', 'Operation Fail');
     //$this->currencies=get_currencies_arr();
     //生产一个唯一的session id
     $this->sessionID = Session::get('sessionID');
     if (!$this->sessionID) {
         $this->sessionID = md5(uniqid(rand()));
         Session::set('sessionID', $this->sessionID);
     }
     //读取用户id
     $this->memberID = Session::get('memberID');
     if (!$this->memberID) {
         $this->memberID = 0;
         Session::set('back', $_SERVER['REQUEST_URI']);
         $this->redirect("Public/Login");
     } else {
         //读取用户信息
         $this->mid = $this->memberID;
         self::$Model = D("Members");
         $this->member_Info = $this->memberInfo = self::$Model->where("id=" . $this->memberID)->find();
         self::$Model = D("Shippingaddress");
         $this->memberShippingAddress = self::$Model->where("id=" . $this->memberID)->find();
     }
     if (F('Common_Cache')) {
         $this->assign(F('Common_Cache'));
     }
 }
예제 #10
0
 function index()
 {
     if ($this->isPost()) {
         SetSettValue('365webcall_name', rawurlencode($_POST['365webcall_name']));
         SetSettValue('365webcall_email', $_POST['365webcall_email']);
         SetSettValue('365webcall_accountid', '0594trade');
         SetSettValue('365webcall_status', $_POST['365webcall_status']);
         SetSettValue('365webcall_password', rawurlencode($_POST['365webcall_password']));
         SetSettValue('365webcall_url', $_SERVER['HTTP_HOST']);
         cleanCache();
         $this->success('操作成功!');
     } else {
         $this->name = GetSettValue('365webcall_name');
         $this->email = GetSettValue('365webcall_email');
         $this->accountid = GetSettValue('365webcall_accountid');
         $this->pwd = GetSettValue('365webcall_password');
         $this->url = GetSettValue('365webcall_url');
         $this->name2 = rawurldecode(GetSettValue('365webcall_name'));
         $this->email2 = GetSettValue('365webcall_email');
         $this->accountid2 = GetSettValue('365webcall_accountid');
         $this->pwd2 = rawurldecode(GetSettValue('365webcall_accountid'));
         $this->display();
     }
 }
예제 #11
0
 function do_img()
 {
     header("Content-Type:text/html; charset=utf-8");
     import("ORG.Util.Image");
     $model = D('Products');
     $imagetype = $_REQUEST['imagetype'];
     switch ($imagetype) {
         case 'big':
             $field = 'bigimage';
             break;
         case 'small':
             $field = 'smallimage';
             break;
     }
     $page = $_REQUEST['page'];
     $ImgWaterPath = __ROOT__ . GetSettValue('ImgWaterPath');
     $ImgWaterPos = GetSettValue('ImgWaterPos');
     $ImageWaterAlpha = GetSettValue('ImageWaterAlpha') ? GetSettValue('ImageWaterAlpha') : 80;
     $start = $_REQUEST['start'] ? $_REQUEST['start'] : 0;
     $list = $model->limit("{$start},{$page}")->findall();
     $i = $start;
     if ($list) {
         foreach ($list as $v) {
             $image = $v[$field];
             if (file_exists(__ROOT__ . $image)) {
                 $i++;
                 $this->do_it($image, $ImgWaterPath, $ImgWaterPos, $ImageWaterAlpha, $i);
             }
         }
         redirect(U('Water/do_img', array('imagetype' => $imagetype, 'page' => $page, 'start' => $start + $page)));
     } else {
         echo "处理完毕!<br/>";
         flush();
         ob_flush();
     }
 }
예제 #12
0
 function __construct()
 {
     redirect(GetSettValue("Payments_url"), 3, 'Your order has been submitted successfully!');
 }
예제 #13
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $pname = get_class($this);
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $Version = '2.0.0';
     $pMerchantCode = trim(GetSettValue($pname . "_mer"));
     $pMerchantKey = trim(GetSettValue($pname . "_key"));
     $pMerchantTransactionTime = date('YmdHis');
     $pMerchantOrderNum = getOrderSN();
     $pLanguage = 'EN';
     $pOrderCurrency = 'CNY';
     $pOrderAmount = number_format($list['orders_total'] * GetSettValue($pname . "_rate"), 2, '.', '');
     $pDisplayAmount = '$' . $list['orders_total'];
     $pProductName = "Products";
     $pProductDescription = '';
     $pAttach = '';
     $pSuccessReturnUrl = $this_script;
     $pS2SReturnUrl = $this_script . U('Index/Index');
     $pResHashArithmetic = 12;
     $pResType = 1;
     $pEnableFraudGuard = 1;
     $pICPayReq = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><IPSReqRoot><ICPay><Version><![CDATA[{$Version}]]></Version><StandardPaymentReq><pMerchantOrderNum><![CDATA[{$pMerchantOrderNum}]]></pMerchantOrderNum><pOrderAmount><![CDATA[{$pOrderAmount}]]></pOrderAmount><pDisplayAmount><![CDATA[{$pDisplayAmount}]]></pDisplayAmount><pMerchantTransactionTime><![CDATA[{$pMerchantTransactionTime}]]></pMerchantTransactionTime><pOrderCurrency><![CDATA[{$pOrderCurrency}]]></pOrderCurrency><pLanguage><![CDATA[{$pLanguage}]]></pLanguage><pSuccessReturnUrl><![CDATA[{$pSuccessReturnUrl}]]></pSuccessReturnUrl><pFailReturnUrl><![CDATA[{$pFailReturnUrl}]]></pFailReturnUrl><pErrorReturnUrl><![CDATA[{$pErrorReturnUrl}]]></pErrorReturnUrl><pS2SReturnUrl><![CDATA[{$pS2SReturnUrl}]]></pS2SReturnUrl><pResType><![CDATA[{$pResType}]]></pResType><pResHashArithmetic><![CDATA[{$pResHashArithmetic}]]></pResHashArithmetic><pProductName><![CDATA[{$pProductName}]]></pProductName><pProductDescription><![CDATA[{$pProductDescription}]]></pProductDescription><pAttach><![CDATA[{$pAttach}]]></pAttach><pEnableFraudGuard><![CDATA[{$pEnableFraudGuard}]]></pEnableFraudGuard></StandardPaymentReq></ICPay></IPSReqRoot>";
     $pICPayReqB64 = base64_encode($pICPayReq);
     $pICPayReqHashValue = md5($pICPayReq . $pMerchantKey);
     //00518847228994856151214381286034373160268923638865209509623755128452179689329064232083487454640280528679651027955842303507571503
     $this->add_field('pMerchantCode', $pMerchantCode);
     //222378
     $this->add_field('pICPayReq', $pICPayReqB64);
     $this->add_field('pICPayReqHashValue', $pICPayReqHashValue);
     //反欺诈验证信息:
     //持卡人信息
     $pAccID = '';
     $pAccEMail = '';
     $pAccLoginIP = '';
     $pAccLoginDate = '';
     $pAccLoginDevice = '';
     $pAccRegisterDate = '';
     $pAccRegisterDevice = '';
     $pAccRegisterIP = '';
     //帐单信息
     $pBillFName = $_POST['pBillFName'];
     $pBillMName = $_POST['pBillMName'];
     $pBillLName = $_POST['pBillLName'];
     $pBillStreet = $_POST['pBillStreet'];
     $pBillCity = $_POST['pBillCity'];
     $pBillState = $_POST['pBillState'];
     $pBillCountry = strtolower($_POST['pBillCountry']);
     //请使用国家/地区的小写二字英文代码
     $pBillZIP = $_POST['pBillZIP'];
     $pBillEmail = $_POST['pBillEmail'];
     $pBillPhone = $_POST['pBillPhone'];
     //产品信息
     $pProductData1 = $_POST['pProductData1'];
     $pProductData2 = $_POST['pProductData2'];
     $pProductData3 = $_POST['pProductData3'];
     $pProductData4 = $_POST['pProductData4'];
     $pProductData5 = $_POST['pProductData5'];
     $pProductData6 = $_POST['pProductData6'];
     $pProductType = $_POST['pProductType'];
     //货运信息
     $pShipFName = $_POST['pShipFName'];
     $pShipMName = $_POST['pShipMName'];
     $pShipLName = $_POST['pShipLName'];
     $pShipStreet = $_POST['pShipStreet'];
     $pShipCity = $_POST['pShipCity'];
     $pShipState = $_POST['pShipState'];
     $pShipCountry = strtolower($_POST['pShipCountry']);
     //请使用国家/地区的小写二字英文代码
     $pShipZIP = $_POST['pShipZIP'];
     $pShipEmail = $_POST['pShipEmail'];
     $pShipPhone = $_POST['pShipPhone'];
     //使用接口版本号(*):请固定使用“1.0.0”
     $fVersion = '1.0.0';
     //指定使用验证规则库的编号,默认为1
     $pCheckRuleBaseID = '1';
     //反欺诈信息按接口文档中格式写成XML(*)
     $pAFSReq = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><IPSReqRoot><AFS><Version><![CDATA[{$fVersion}]]></Version><cBasicParameters><pCheckRuleBaseID><![CDATA[{$pCheckRuleBaseID}]]></pCheckRuleBaseID></cBasicParameters><StandardPaymentReq><cBillParameters><pBillFName><![CDATA[{$pBillFName}]]></pBillFName><pBillMName><![CDATA[{$pBillMName}]]></pBillMName><pBillLName><![CDATA[{$pBillLName}]]></pBillLName><pBillStreet><![CDATA[{$pBillStreet}]]></pBillStreet><pBillCity><![CDATA[{$pBillCity}]]></pBillCity><pBillState><![CDATA[{$pBillState}]]></pBillState><pBillCountry><![CDATA[{$pBillCountry}]]></pBillCountry><pBillZIP><![CDATA[{$pBillZIP}]]></pBillZIP><pBillEmail><![CDATA[{$pBillEmail}]]></pBillEmail><pBillPhone><![CDATA[{$pBillPhone}]]></pBillPhone></cBillParameters><cShipParameters><pShipFName><![CDATA[{$pShipFName}]]></pShipFName><pShipMName><![CDATA[{$pShipMName}]]></pShipMName><pShipLName><![CDATA[{$pShipLName}]]></pShipLName><pShipStreet><![CDATA[{$pShipStreet}]]></pShipStreet><pShipCity><![CDATA[{$pShipCity}]]></pShipCity><pShipState><![CDATA[{$pShipState}]]></pShipState><pShipCountry><![CDATA[{$pShipCountry}]]></pShipCountry><pShipZIP><![CDATA[{$pShipZIP}]]></pShipZIP><pShipEmail><![CDATA[{$pShipEmail}]]></pShipEmail><pShipPhone><![CDATA[{$pShipPhone}]]></pShipPhone></cShipParameters><cProductParameters><pProductType><![CDATA[{$pProductType}]]></pProductType><pProductName><![CDATA[{$pProductName}]]></pProductName><pProductData1><![CDATA[{$pProductData1}]]></pProductData1><pProductData2><![CDATA[{$pProductData2}]]></pProductData2><pProductData3><![CDATA[{$pProductData3}]]></pProductData3><pProductData4><![CDATA[{$pProductData4}]]></pProductData4><pProductData5><![CDATA[{$pProductData5}]]></pProductData5><pProductData6><![CDATA[{$pProductData6}]]></pProductData6></cProductParameters><cAccountParameters><pAccID><![CDATA[{$pAccID}]]></pAccID><pAccEMail><![CDATA[{$pAccEMail}]]></pAccEMail><pAccRegisterIP><![CDATA[{$pAccRegisterIP}]]></pAccRegisterIP><pAccLoginIP><![CDATA[{$pAccLoginIP}]]></pAccLoginIP><pAccRegisterDate><![CDATA[{$pAccRegisterDate}]]></pAccRegisterDate><pAccLoginDate><![CDATA[{$pAccLoginDate}]]></pAccLoginDate><pAccRegisterDevice><![CDATA[{$pAccRegisterDevice}]]></pAccRegisterDevice><pAccLoginDevice><![CDATA[{$pAccLoginDevice}]]></pAccLoginDevice></cAccountParameters></StandardPaymentReq></AFS></IPSReqRoot>";
     //对反欺诈信息进行base64_encode(*)
     $pAFSReqB64 = base64_encode($pAFSReq);
     //反欺诈签名验证串(*):MD5原文=反欺诈信息+商户证书
     $pAFSReqHashValue = md5($pAFSReq . $pMerchantKey);
     $this->add_field('pAFSReq', $pAFSReqB64);
     $this->add_field('pAFSReqHashValue', $pAFSReqHashValue);
     $this->form .= "<form method=\"post\" name=\"pay_form\" ";
     $this->form .= "action=\"" . $this->submit_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $this->form .= "</form>\n";
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
		auto:2000
	});
});
</script>
</head>





<body>

  <div id="page">
    <div id="header">
      <div class="logo"><a href="/"><img src="__ROOT__/<?php 
echo GetSettValue('sitelogo');
?>
" alt="" border="0" /></a></div>
      <div class="top">
        <div class="shopping">
          <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="100">&nbsp;</td>
    <td width="100" align="left">
      <a href="<?php 
echo U('Cart/disp');
?>
">Shopping Cart</a><br />Now in your cart<br /><a href="<?php 
echo U('Cart/disp');
?>
" style="color:#CC9900"><?php 
} else {
    echo "";
}
?>
            
            
          </div>
        </div>
      </div>

<link rel="stylesheet" rev="stylesheet" href="../Public/css/fancybox/jquery.fancybox-1.3.4.css" />
<link rel="stylesheet" rev="stylesheet" href="../Public/Js/disp.css" />
<script language="JavaScript" type="text/javascript" src="../Public/css/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
<script type="text/javascript">
var isAjaxLogin = Boolean(parseInt("<?php 
echo GetSettValue('isAjaxLogin');
?>
"));
var CartUrl='<?php 
echo U('Cart/disp');
?>
';
</script>
<script language="JavaScript" type="text/javascript" src="../Public/Js/jqdisp.js"></script>
  

 <div class="col2">
        <div class="list1">
          <div class="list1_title"><a href="/">Home</a> <?php 
if (is_array($catep)) {
    $i = 0;
예제 #16
0
 public function disporders()
 {
     if ($this->memberID <= 0 && GetSettValue('quickbuy') == 1) {
         Session::set('back', U('Member-Public/disporders'));
         $this->redirect('Member-Public/Login');
     }
     if ($_REQUEST['id']) {
         $map['id'] = $_REQUEST['id'];
     }
     if ($_REQUEST['sn']) {
         $map['sn'] = trim($_REQUEST['sn']);
         //特殊要求
         isset($_REQUEST['key']) ? $map['key'] = trim(strtoupper($_REQUEST['key'])) : '';
         //如果按sn查询删除按id查询
         unset($map['id']);
     }
     if (isset($_REQUEST['sn']) && empty($map['sn'])) {
         $this->error('please input order sn');
     }
     if (isset($_REQUEST['key']) && empty($map['key'])) {
         $this->error('please input order key');
     }
     self::$Model = D("Orders");
     $this->shippingInfo = $shippingInfo = self::$Model->where($map)->find();
     if (!$shippingInfo) {
         $this->error('The order information does not exist, please try again');
     }
     $orders_id = $shippingInfo['id'];
     self::$Model = D("Orders_products");
     $list = self::$Model->query("select a.*,b.smallimage from __TABLE__ a left join " . C('DB_PREFIX') . "products b on a.products_id=b.id where a.orders_id=" . $orders_id);
     $this->total_weight = $shippingInfo['total_weight'];
     //总重量
     for ($row = 0; $count = count($list), $row < $count; $row++) {
         $list[$row]['products_model'] = unserialize($list[$row]['products_model']);
     }
     $orders_products_Model = D('Orders_products');
     $this->products_total = $orders_products_Model->where("orders_id=" . $orders_id)->sum('products_total');
     $this->products_sum = $orders_products_Model->where("orders_id=" . $orders_id)->sum('products_quantity');
     $this->list = $list;
     $this->top();
     $this->left();
     $this->display();
     $this->footer();
 }
예제 #17
0
 /**
  * 未使用
  *
  */
 function getShippingFee()
 {
     $dao = D("Shipping");
     $list = $dao->where("code='" . $_REQUEST["code"] . "'")->find();
     $fee = get_orders_Fees($_REQUEST["total"]);
     //echo $dao->getlastsql();
     if ($list) {
         $r = get_shipping_fee($list["id"], $_REQUEST["country"], $_REQUEST["state"], $_REQUEST["weight"]);
         $fee["Shipping_money"] = $r;
         $fee["Shipping_money_str"] = getprice_str($r);
         $fee['procuts_total'] = $_REQUEST["total"] + $r;
         if ($fee['procuts_total'] <= GetSettValue("min_freepaymoney")) {
             $fee['procuts_total'] = $fee['insurance'] + $fee['procuts_total'];
             $fee['paymoney'] = number_format((double) $fee['procuts_total'] * (double) GetSettValue("paymoney"), 2, '.', '');
         } else {
             $fee['paymoney'] = 0;
         }
         //$fee ['procuts_total']=$f;
         $fee['paymoney_str'] = getprice_str($fee['paymoney']);
         $fee['procuts_total_str'] = getprice_str($fee['procuts_total'] + $fee["paymoney"]);
         $fee['procuts_total'] = $fee['procuts_total'] + $fee["paymoney"];
         echo json_encode($fee);
     } else {
         echo json_encode("error");
     }
 }
예제 #18
0
 private function _Products_Cache()
 {
     $newpro_num = GetSettValue('newpro_num') ? GetSettValue('newpro_num') : 9;
     $recpro_num = GetSettValue('recpro_num') ? GetSettValue('recpro_num') : 9;
     $hotpro_num = GetSettValue('hotpro_num') ? GetSettValue('hotpro_num') : 9;
     $spepro_num = GetSettValue('spepro_num') ? GetSettValue('spepro_num') : 9;
     $Products_Cache['FeaturedProducts'] = $this->ProModel->where("isrec=1 and isdown!=1")->order("sort desc,id desc")->limit("0,{$recpro_num}")->findall();
     $Products_Cache['HotProducts'] = $this->ProModel->where("ishot=1 and isdown!=1")->order("sort desc,id desc")->limit("0,{$hotpro_num}")->findall();
     $Products_Cache['NewProducts'] = $this->ProModel->where("isnew=1 and isdown!=1")->order("sort desc,id desc")->limit("0,{$newpro_num}")->findall();
     $Products_Cache['SpeProducts'] = $this->ProModel->where("isprice=1 and isdown!=1")->order("sort desc,id desc")->limit("0,{$spepro_num}")->findall();
     return $Products_Cache;
 }
예제 #19
0
 function processfile($dir, $file, $cateid, $pid = 0)
 {
     $cate_model = D('Cate');
     $pro_model = D('Products');
     $extend = pathinfo($file);
     //扩展名
     $extend = $extend["extension"];
     $pro = $pro_model->create();
     //自动命名
     if ($_POST['autoReName'] == 1) {
         $k = $this->get_auto_increment('count', $cateid);
         //根据产品数量自动命名
         $autoname = $this->GetCateName($cateid) . "-" . $k;
         $pro['name'] = $autoname;
     } else {
         $pro['name'] = str_replace(".{$extend}", '', auto_charset(basename($file), 'gbk', 'utf-8'));
     }
     if (!$cateid) {
         $pro['cateid'] = $pid;
     } else {
         $pro['cateid'] = $cateid;
     }
     $pro['bigimage'] = $this->products_image_path . '/' . toDate(time(), 'Ymd') . "/" . $pro['name'] . '.' . $extend;
     $new_path = dirname($pro['bigimage']) . '/';
     if (!file_exists($new_path)) {
         mkdir($new_path);
     }
     $new_name = $new_path . $pro['name'] . ".{$extend}";
     //处理中文
     $old_name = $dir . "/" . $file;
     $new_name = auto_charset($new_name, 'utf-8', 'gbk');
     rename($old_name, $new_name);
     //原图,文件名,格式,宽,高,隔行扫描
     $thumbname = Image::thumb($new_name, dirname($new_name) . '/thumb_' . basename($new_name), '', GetSettValue('ImgThumbW'), GetSettValue('ImgThumbH'), true, '');
     $pthumbname = pathinfo($thumbname);
     $pro['smallimage'] = $new_path . auto_charset($pthumbname['filename'], 'gbk', 'utf-8') . "." . $pthumbname['extension'];
     $pro['dateline'] = time();
     $id = $pro_model->add($pro);
     if ($pro['cateid']) {
         $this->batch_attr($id);
         //属性
     }
     //添加缩略图
     $model = D("Products_gallery");
     $data = array();
     $data['pid'] = $id;
     $data['img_url'] = $pro['bigimage'];
     $data['thumb_url'] = $pro['smallimage'];
     $model->add($data);
     //提示
     $this->showjsmessage("正在导入" . auto_charset($file, 'gbk', 'utf-8'));
 }
예제 #20
0
 function good($pid)
 {
     $dao = D("Products");
     if (isset($_POST['id'])) {
         $pid = intval($_POST['id']);
     }
     $list = $dao->where("id=" . $pid)->find();
     if ($list) {
         $dao->viewcounts($pid);
         //添加用户最近浏览的产品
         if (!isset($_SESSION['product_history'])) {
             $_SESSION['product_history'] = $pid;
         } else {
             if (!($broswer_history_num = GetSettValue('broswer_history_num'))) {
                 $broswer_history_num = 100;
             }
             $history_array = explode(',', $_SESSION['product_history']);
             array_push($history_array, (int) $pid);
             $history_array = array_unique($history_array);
             if (count($history_array) > $broswer_history_num) {
                 array_shift($history_array);
             }
             $_SESSION['product_history'] = implode(',', $history_array);
         }
         //ajax属性价格
         if (isset($_POST['attr_id'])) {
             $products_attr_model = D("Products_attr");
             $map['id'] = array('in', $_POST['attr_id']);
             $products_attr = $products_attr_model->where($map)->findall();
             $attrs = array();
             if ($products_attr) {
                 $attrs['price'] = 0;
                 foreach ($products_attr as $attr) {
                     $attrs['price'] += $attr['attr_price'];
                 }
                 if ($attrs['price']) {
                     $attrs['product_price'] = getprice_str(VipPrice($list['pricespe']) + $attrs['price']);
                     $attrs['attr_price'] = '(' . getprice_str(VipPrice($list['pricespe'])) . ($attrs['price'] > 0 ? '+' : '') . getprice_str($attrs['price']) . ')';
                 } else {
                     $attrs['product_price'] = getprice_str($list['pricespe']);
                     $attrs['attr_price'] = '';
                 }
                 die(json_encode($attrs));
             }
         }
         //产品主图、细节图片、详情图片   start
         $zoomcount = productzoompiccount($list);
         //  产品放大镜图片数量
         $list["zoomcount"] = $zoomcount;
         $tempzoompics = array();
         for ($i = 1; $i <= $zoomcount; $i++) {
             $tempzoompics[$i - 1] = productzoompicpath($list, $i);
         }
         $list["tempzoompics"] = $tempzoompics;
         //	dump($tempzoompics);
         $detailcount = productdetailpiccount($list);
         //产品详细图片数量
         $list["detailcount"] = $detailcount;
         $tempdetailpics = array();
         for ($i = 1; $i <= $detailcount; $i++) {
             $tempdetailpics[$i - 1] = productdetailpicpath($list, $i);
         }
         $list["tempdetailpics"] = $tempdetailpics;
         //产品主图、细节图片、详情图片   end
         $this->list = $list;
         //获取Vip价格
         $this->vipPrice = VipPrice(get_real_price($list["price"], $list["pricespe"]));
         //上一产品,下一产品
         $prev = $dao->where(array("id" => array("lt", $pid), 'cateid' => $list['cateid']))->order('id desc')->find();
         $next = $dao->where(array("id" => array("gt", $pid), 'cateid' => $list['cateid']))->order('id asc')->find();
         if ($prev) {
             $this->prev = build_url($prev, 'pro_url');
         }
         if ($next) {
             $this->next = build_url($next, 'pro_url');
         }
         //获取产品属性
         $attrlist = $dao->get_attrs($list['cateid'], $pid);
         if (!$attrlist[0]['attrs']) {
             $attrlist[0]['name'] = 'size';
             $attrlist[0]['value'] = array('nosize');
             $attrlist[0]['values_count'] = 1;
             $attrlist[0]['attrs'] = array(0 => array('attr_value' => 'nosize'));
         }
         $this->attrlist = $attrlist;
         $this->attrcount = count($attrlist[0]['attrs']);
         if (!($realted_num = GetSettValue('realted_num'))) {
             $realted_num = 6;
         }
         //相同尺码相同颜色
         $Pro_attrView = D('Pro_attrView');
         $att_values = implode(',', array_map('reset', $Pro_attrView->field('attr_value')->where(array('products_id' => $pid))->findall()));
         $attrs = array();
         foreach ($attrlist as $k => $attr) {
             $attrs[$k]['name'] = $attr['name'];
             $attrs[$k]['pro'] = $Pro_attrView->where(array('attr_value' => array('in', $att_values), 'cateid' => $list['cateid']))->group('id')->limit(5)->findall();
         }
         $this->attrs = $attrs;
         //获取同类产品,用户还买了什么产品
         $sameclass = $dao->where(array('cateid' => $list['cateid']))->limit($realted_num)->findall();
         $sameclass = $dao->rand($sameclass);
         //类别产品数量
         $this->cate_count = $dao->where(array('cateid' => $list['cateid']))->count();
         //产品位置
         $this->postion = reset($dao->field('count(*)+1 as postion')->where("id<'" . $pid . "' and cateid='" . $list['cateid'] . "'")->order('id desc')->find());
         //获取关联产品
         $Products_related_Model = D('Products_related');
         $related = $Products_related_Model->field('b.*')->table(C('DB_PREFIX') . 'products_related a')->join(C('DB_PREFIX') . 'products b on a.related_products_id=b.id')->where(array('a.products_id' => $pid))->limit($realted_num)->findall();
         empty($related) ? $related = $sameclass : ($related = $dao->rand($related));
         $this->related = $related;
         $this->sameclass = $sameclass;
         //欢迎词
         $dao = D('Ad');
         $this->welcome = $dao->where(array('remark' => '产品内页欢迎词'))->getField('content');
         //获取产品
         //相册
         $dao = D("Products_gallery");
         $gallerys = $dao->where("pid=" . $pid)->order("sort desc")->findAll();
         if (GetSettValue('auto_find_gallery')) {
             if (file_exists(__ROOT__ . $list['bigimage'])) {
                 $bigimage = pathinfo(__ROOT__ . $list['bigimage']);
                 $filename = $bigimage['filename'];
                 $dirname = $bigimage['dirname'];
                 $files = glob($dirname . '/' . $filename . '_*');
                 foreach ($files as $f) {
                     $gallerys[]['img_url'] = $f;
                 }
             }
         }
         $this->gallerys = $gallerys;
         $this->catep = get_catep_arr($list['cateid']);
         $classModel = D("Cate");
         //类别信息
         $this->cate = $cate = $classModel->where(array('id' => $list['cateid']))->find();
         $classid = $list['cateid'];
         $this->cateid = $classid;
         //SEO相关
         if (!empty($list['pagekey']) || !$classid) {
             $this->assign('pagekeywords', $list['pagekey']);
         } else {
             $this->assign('pagekeywords', $classModel->getKeywords($classid));
         }
         if (!empty($list['pagedec']) || !$classid) {
             $this->assign('pagedesc', $list['pagedec']);
         } else {
             $this->assign('pagedesc', $classModel->getDescription($classid));
         }
         if (!empty($list['pagetitle']) || !$classid) {
             $this->assign('pagetitle', $list['pagetitle']);
         } else {
             $this->assign('pagetitle', $classModel->getPageTitle($classid));
         }
         //评论数
         $products_ask = D('Products_ask');
         $this->review_num = $products_ask->where('products_id=' . $pid)->count();
         $this->review_list = $products_ask->where('products_id=' . $pid)->findall();
         if (in_array($list['activity'], array('1'))) {
             switch ($list['activity']) {
                 case 1:
                     $PL_model = D('Products_lot');
                     $PL = array();
                     $PL['list'] = $PL_model->where("product_id={$pid}")->order('mincount asc')->findall();
                     if ($PL['list']) {
                         $PL['minprice'] = $PL_model->where("product_id={$pid}")->order("maxcount desc")->getField('price');
                         $PL['maxprice'] = $PL_model->where("product_id={$pid}")->order("mincount asc")->getField('price');
                         $this->assign("PL", $PL);
                         $this->display('disp_lot');
                         die;
                     }
                     break;
             }
         }
         $this->display("disp");
     } else {
         $this->redirect('Index/index');
     }
 }
예제 #21
0
 /**
 +----------------------------------------------------------
 * 取得当前认证号的所有权限列表
 +----------------------------------------------------------
 * @param integer $authId 用户ID
 +----------------------------------------------------------
 * @access public
 +----------------------------------------------------------
 */
 public static function getAccessList($authId)
 {
     // Db方式权限数据
     $db = Db::getInstance(C('RBAC_DB_DSN'));
     $table = array('role' => C('DB_PREFIX') . C('RBAC_ROLE_TABLE'), 'user' => C('DB_PREFIX') . C('RBAC_USER_TABLE'), 'access' => C('DB_PREFIX') . C('RBAC_ACCESS_TABLE'), 'node' => C('DB_PREFIX') . C('RBAC_NODE_TABLE'));
     $sql = "select node.id,node.name from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access ," . $table['node'] . " as node " . "where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=1 and node.status=1";
     $apps = $db->query($sql);
     $access = array();
     foreach ($apps as $key => $app) {
         $appId = $app['id'];
         $appName = $app['name'];
         // 读取项目的模块权限
         $access[strtoupper($appName)] = array();
         $accessmode = GetSettValue('accessmode');
         if ($accessmode == 'action') {
             $sql = "select node.id,node.name from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access ," . $table['node'] . " as node " . "where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=2 and node.pid={$appId} and node.status=1";
         } else {
             $sql = "select node.id,node.name from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access ," . $table['node'] . " as node " . "where user.user_id='{$authId}' and user.role_id=role.id and access.role_id=role.id and role.status=1 and access.node_id=node.id and node.level=2 and node.pid={$appId} and node.status=1";
         }
         $modules = $db->query($sql);
         // 判断是否存在公共模块的权限
         $publicAction = array();
         foreach ($modules as $key => $module) {
             $moduleId = $module['id'];
             $moduleName = $module['name'];
             if ('PUBLIC' == strtoupper($moduleName)) {
                 $sql = "select node.id,node.name from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access ," . $table['node'] . " as node " . "where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=3 and node.pid={$moduleId} and node.status=1";
                 $rs = $db->query($sql);
                 foreach ($rs as $a) {
                     $publicAction[$a['name']] = $a['id'];
                 }
                 unset($modules[$key]);
                 break;
             }
         }
         // 依次读取模块的操作权限
         foreach ($modules as $key => $module) {
             $moduleId = $module['id'];
             $moduleName = $module['name'];
             $sql = "select node.id,node.name from " . $table['role'] . " as role," . $table['user'] . " as user," . $table['access'] . " as access ," . $table['node'] . " as node " . "where user.user_id='{$authId}' and user.role_id=role.id and ( access.role_id=role.id  or (access.role_id=role.pid and role.pid!=0 ) ) and role.status=1 and access.node_id=node.id and node.level=3 and node.pid={$moduleId} and node.status=1";
             $rs = $db->query($sql);
             $action = array();
             foreach ($rs as $a) {
                 $action[$a['name']] = $a['id'];
             }
             // 和公共模块的操作权限合并
             $action += $publicAction;
             $access[strtoupper($appName)][strtoupper($moduleName)] = array_change_key_case($action, CASE_UPPER);
         }
     }
     return $access;
 }
예제 #22
0
 /**
  * 留言板,产品评论
  *
  */
 public function insert_ask()
 {
     self::$Model = D("Products_ask");
     $this->jumpUrl = U('Pro/guestbook');
     if ($list = self::$Model->create()) {
         $list['status'] = 1;
         //是否审核
         $list['ip'] = get_client_ip();
         $list['dateline'] = time();
         import("ORG.Util.Input");
         $list['content'] = Input::safeHtml($list['content']);
         //是否产品的评论
         $id = intval($list['products_id']);
         if (!empty($id)) {
             $pro = D('Products')->find($id);
             $this->jumpUrl = build_url($pro, 'pro_url');
         }
         if (self::$Model->add($list)) {
             $ask_mail_enable = GetSettValue('ask_mail_enable');
             $ask_mail = GetSettValue('ask_mail');
             if ($ask_mail_enable && $ask_mail) {
                 $sendto = array($ask_mail, GetSettValue('mailcopyTo'));
                 //抄送
                 if ($pro) {
                     $products_id = "(products name:" . $pro['name'] . ",products id:" . $pro['id'] . ")";
                 } else {
                     $products_id = "";
                 }
                 sendmail($sendto, "你的网站 " . GetSettValue('sitename') . " 有一个新的评论!", "<table><tr><td>星级:</td><td>{$list['star']}星</td></tr><tr><td>类型:</td><td>{$list['type']}{$products_id}</td></tr><tr><td>邮箱:</td><td>{$list['email']}</td><tr><td>昵称:</td><td>{$list['name']}</td></tr><tr><td>标题:</td><td>{$list['title']}</td></tr><tr><td>内容:</td><td>{$list['content']}</td></tr><tr><td>IP地址:</td><td>{$list['ip']}</td></tr></table>");
             }
             $this->success('Your message has been submitted!');
         } else {
             $this->error('Failure to submit your message!');
         }
     } else {
         $this->redirect("Index/index");
     }
 }
예제 #23
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $pname = get_class($this);
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $this->add_field('MerNo', GetSettValue($pname . "_no"));
     //商号
     $MD5key = GetSettValue($pname . "_key");
     //私钥
     $this->add_field('Currency', 1);
     $this->add_field('BillNo', $list['sn']);
     $this->add_field('Amount', $list['orders_total']);
     $this->add_field('ReturnURL', $this_script . U('Payment/return_95pay'));
     $this->add_field('Language', 'en');
     $this->add_field('MD5info', strtoupper(md5($this->fields['MerNo'] . $this->fields['BillNo'] . $this->fields['Currency'] . $this->fields['Amount'] . $this->fields['Language'] . $this->fields['ReturnURL'] . $MD5key)));
     $this->add_field('Remark', $list['BuyNote']);
     $this->add_field('MerWebsite', $this_script);
     $this->form .= "<form method=\"post\" name=\"pay_form\" ";
     $this->form .= "action=\"" . $this->submit_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $this->form .= "</form>\n";
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
    echo "";
}
?>
            
            
          </div>
        </div>
      </div>



 <div class="col2">
  <div id="home_txt">
 <div class="home_title">INFORMATION</div>
 <?php 
echo GetSettValue('hottitle');
?>
 </div>
        <div class="ad">
          <div class="midd_ad">
         
        <div>
<script type="text/javascript">
var swf_width=470;
var swf_height=327;
var files="<?php 
echo $flashpic;
?>
";
var links='<?php 
echo $flashlink;
예제 #25
0
 public function sendgoods()
 {
     if (!GetSettValue('sender_sname')) {
         $this->jumpUrl = U('Setting/ShippingAddress');
         $this->error('请先完善您的发货地址!');
     } else {
         $map['id'] = $_GET['id'];
         $list = $this->dao->where($map)->find();
         if (!$list) {
             $this->error('对不起,没有该订单信息!');
         }
         self::$Model = D("Orders_shippingbills");
         $express = self::$Model->where(array('order_id' => $list['id']))->find();
         if ($express) {
             $this->expressSN = $express['ExpressSN'];
             $this->id = $express['id'];
         }
         $this->list = $list;
         $this->display();
     }
 }
예제 #26
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $pname = get_class($this);
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $MD5key = GetSettValue($pname . "_Md5Key");
     $MerNo = GetSettValue($pname . "_MerNo");
     $BillNo = $list['sn'];
     $Amount = $list['orders_total'];
     $OrderDesc = $list['BuyNote'];
     $Currency = "1";
     $Language = "2";
     $ReturnURL = $this_script . U('Payment/wedopay_return');
     $md5src = $MerNo . $BillNo . $Currency . $Amount . $Language . $ReturnURL . $MD5key;
     //校验源字符串
     $MD5info = strtoupper(md5($md5src));
     //MD5检验结果
     $this->add_field('MerNo', $MerNo);
     $this->add_field('Currency', $Currency);
     $this->add_field('BillNo', $BillNo);
     $this->add_field('Amount', $Amount);
     $this->add_field('ReturnURL', $ReturnURL);
     $this->add_field('Language', $Language);
     $this->add_field('MD5info', $MD5info);
     $this->add_field('Remark', '');
     $this->add_field('shippingFirstName', $list['delivery_firstname']);
     $this->add_field('shippingLastName', $list['delivery_lastname']);
     $this->add_field('shippingEmail', $list['member_email']);
     $this->add_field('shippingPhone', $list['delivery_telephone']);
     $this->add_field('shippingZipcode', $list['delivery_zip']);
     $this->add_field('shippingAddress', $list['delivery_address']);
     $this->add_field('shippingCity', $list['delivery_city']);
     $this->add_field('shippingSstate', $list['delivery_state']);
     $this->add_field('shippingCountry', $list['delivery_country']);
     $this->add_field('products', 'products');
     $this->form .= "<form method=\"post\" name=\"pay_form\" ";
     $this->form .= "action=\"" . $this->submit_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $this->form .= "</form>\n";
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
예제 #27
0
 /**
  * 新增
  */
 function create_form($list)
 {
     $pname = get_class($this);
     $this_script = "http://{$_SERVER['HTTP_HOST']}";
     $this->add_field('siteID', GetSettValue($pname . "_Site_Id"));
     $this->add_field('orderID', $list['sn']);
     $this->add_field('Amount[1]', $list['orders_total']);
     $this->add_field('ApproveURL', $this_script);
     $this->add_field('Qty[1]', 1);
     $this->add_field('OrderDescription[1]', "The Order's Sn is" . $list['sn']);
     $this->add_field('customerFullName', $list['member_firstname'] . " " . $list['member_lastname']);
     $this->add_field('customerAddress', $list['member_address']);
     $this->add_field('customerCity', $list['member_city']);
     $this->add_field('customerZip', $list['member_zip']);
     $this->add_field('customerCountry', $list['member_country']);
     $this->add_field('customerEmail', $list['member_email']);
     $this->add_field('customerPhone', $list['member_telephone']);
     //$this->add_field('TransactionMode',"test");
     $this->add_field('ApproveURL', $this_script . U('Payment/gspay_success'));
     $this->add_field('DeclineURL', $this_script . U('Payment/gspay_error'));
     //$this->add_field('returnUrl',$this_script.U('Payment/gspay_return'));
     $this->form .= "<form method=\"post\" name=\"pay_form\" ";
     $this->form .= "action=\"" . $this->submit_url . "\">\n";
     foreach ($this->fields as $name => $value) {
         $this->form .= "<input type=\"hidden\" name=\"{$name}\" value=\"{$value}\"/>\n";
     }
     $this->form .= "</form>\n";
     if (GetSettValue($list['payment_module_code'] . '_autosubmit') == 1) {
         $delay = GetSettValue($list['payment_module_code'] . '_delay');
         $delay = $delay ? $delay : 5;
         $this->form .= $this->submit($delay);
         //是否自动提交,延迟5秒
     }
     return $this->form;
 }
예제 #28
0
 public function payment()
 {
     //如果是快速购物则强制登录
     if ($this->memberID <= 0 && GetSettValue('quickbuy') == 0 && !$_SESSION['guest']) {
         Session::set('back', U('Cart/checked_payment'));
         $this->redirect('Member-Public/Login');
     }
     $orders_id = $_GET['id'];
     if (get_orders_status($orders_id) == L("orders_status_2")) {
         $this->error(L("orders_error_paied"));
     }
     //读取支付代码
     self::$Model = D("Orders");
     $list = self::$Model->where("id=" . $orders_id)->find();
     //转化成美元支付
     /*if($_SESSION ['currency']['symbol']!='USD'){
     		self::$Model=D('Currencies');
     		$rate=self::$Model->get_usd_rate();
     		$list['orders_total']=$list['orders_total']*$rate;
     		}*/
     if (!$list) {
         $this->redirect('Index/index');
     }
     $list['orders_total'] = round($list['orders_total'], 2);
     //四舍五入保留两位
     /**
      * 在线支付
      */
     $pname = $list['payment_module_code'];
     self::$Model = D('Payment');
     $payment_title = self::$Model->where(array('name' => $pname))->getField('title');
     //模板变量
     $this->title = ucwords($payment_title) . ' Payment';
     //标题
     $this->list = $list;
     import('@.ORG.Payment.' . $pname);
     if (class_exists($pname)) {
         $p = new $pname();
         $content = $p->create_form($list);
         //创建表单
         $this->content = $content;
         //用户说明
         $remark = GetSettValue($pname . '_desc');
         if ($remark) {
             $remark = str_replace(array('{sn}', '{time}', '{payname}', '{total}', '{go}', '{admin_email}'), array($list['sn'], toDate($list['dateline']), $list['payment_module_code'], getprice_str($list['orders_total']), "<input type=\"button\" value=\"Click Here\" onclick=\"document.forms['pay_form'].submit();\" />", GetSettValue('email')), $remark);
         }
         $this->remark = $remark;
         $this->display();
     } else {
         $this->error('Please select a payment method!');
     }
 }
예제 #29
0
 function _list($map = null, $firstRow, $firstRow)
 {
     //排序字段
     if (isset($_REQUEST['order'])) {
         $this->sort = $_REQUEST['order'] ? $_REQUEST['order'] : 'sort';
     }
     //排序方式默认按照倒序排列
     //接受 sost参数 0 表示倒序 非0都 表示正序
     if (isset($_REQUEST['sort'])) {
         $this->sort = $this->sort . ' ' . ($_REQUEST['sort'] ? 'asc' : 'desc');
     }
     if (!$this->sort) {
         $this->sort = "id desc";
     }
     if (!empty($_REQUEST['listRows'])) {
         $listRows = $_REQUEST['listRows'];
         SetSettValue('listRows', $listRows);
     } elseif (GetSettValue('listRows', false)) {
         $listRows = GetSettValue('listRows', false);
     } else {
         $listRows = 20;
     }
     $count = $this->dao->where($map)->count();
     import('ORG.Util.Page');
     $page = new Page($count, $listRows);
     /*foreach ( $map as $key => $val ) {
     		$page->parameter .= "key=" . urlencode ( $val ) . "&";
     		}*/
     $list = $this->dao->where($map)->order($this->sort)->limit($firstRow . ',' . $firstRow)->findall();
     if ($list) {
         $res['show'] = $page->show();
         $res['list'] = $list;
         $res['msg'] = '';
         $res['code'] = 0;
         return $res;
     } else {
         $res['msg'] = '没有记录';
         $res['code'] = 1;
         return $res;
     }
 }
예제 #30
0
function sendmail($sendTo, $subject, $body)
{
    $body = eregi_replace("[\\]", '', $body);
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=utf-8\r\n";
    if (GetSettValue("sendemailtype") == "smtp") {
        foreach ($sendTo as $key => $val) {
            mail($val, $subject, $body, $headers);
        }
    }
    if (GetSettValue("sendemailtype") == "phpmail") {
        import("@.ORG.phpmailer");
        $mail = new PHPMailer();
        $mail->IsSMTP();
        $mail->SMTPDebug = false;
        $mail->SMTPAuth = true;
        if (GetSettValue("smtpisssl") == "1") {
            $mail->SMTPSecure = "ssl";
        }
        $mail->Host = GetSettValue('smtphost');
        $mail->Port = GetSettValue('smtpport');
        $mail->Username = GetSettValue('smtpusername');
        $mail->Password = GetSettValue('smtppassword');
        // GMAIL password
        if (empty($mail->Host) || empty($mail->Port) || empty($mail->Username) || empty($mail->Password)) {
            return;
        }
        $mail->SetFrom(GetSettValue('mailfrom'), GetSettValue('siteurl'));
        $mail->Subject = $subject;
        $mail->AltBody = "To view the message, please use an HTML compatible email viewer!";
        $mail->MsgHTML($body);
        foreach ($sendTo as $key => $val) {
            $mail->AddAddress($val);
        }
        $mail->Send();
    }
}