예제 #1
0
파일: Debug.php 프로젝트: hellocc2/crmht
 /**
  * 输出调试信息
  * @todo 完善各级别的调试信息输出
  */
 public static function outPut()
 {
     $contentType = \Helper\ResponseUtil::getHeader('content-type');
     $contentType = explode(';', $contentType);
     $contentType = trim($contentType[0]);
     if (DEBUG_LEVEL === 0) {
         self::$debugInfo['IncludedFiles'] = get_included_files();
     }
     switch ($contentType) {
         case 'text/html':
         case 'text/plain':
             continue;
         case 'application/json':
             $str = ob_get_contents();
             $debugStr = json_encode(self::$debugInfo);
             if (strpos($str, '[') === 0) {
                 $str = substr($str, 0, strlen($str) - 1) . ',{"debugInfo":' . $debugStr . '}]';
             } else {
                 if (strpos($str, '{') === 0) {
                     $str = substr($str, 0, strlen($str) - 1) . ',"debugInfo":' . $debugStr . '}';
                 } else {
                     $str = $debugStr;
                 }
             }
             ob_end_clean();
             echo $str;
             return;
             defautl:
             return;
     }
     $str = '<style type="text/css">@import url("' . IMAGE_URL . 'debug.css");</style>';
     if (DEBUG_LEVEL == 0 || DEBUG_LEVEL == 2) {
         $str .= '<div id="milanooDebugFrame">' . self::consumption() . self::infoToStr(self::$debugInfo);
     } else {
         if (DEBUG_LEVEL === 1) {
             $str .= '<div id="milanooDebugFrame">' . self::consumption();
         }
     }
     $str .= '</div>';
     echo $str;
 }
예제 #2
0
파일: SeoUrl.php 프로젝트: hellocc2/crmht
 /**
  * 根据后台设定和通用规则,对指定的当前页面进行30X 跳转. 来源:需求#6894
  * @param boolean $forceExit 是否强制终止程序
  */
 public function fix($forceExit = false)
 {
     $redirected = false;
     $m = new \Model\Redirect30X();
     $rules = $m->getRules();
     $requestUrl = \Helper\RequestUtil::getUrl();
     $key = md5($requestUrl . SELLER_LANG);
     //指定的规则优先与通用规则
     if (isset($rules[$key]['target_url'])) {
         //根据后台指定的规则进行修正
         $this->redirect($rules[$key]['target_url']);
         $redirected = true;
         $m->increaseClicks($rules[$key]['id']);
     } else {
         //通用规则跳转
         $params = Rq::getParams();
         if (isset($params->module) && $params->module == 'thing') {
             if (isset($params->action) && $params->action == 'glist' && isset($params->class) && empty($params->aparams)) {
                 $catId = $params->class;
                 $model = new \Model\Navigator();
                 $catInfo = $model->getNav($catId, '0:0:0');
                 if (isset($catInfo['code']) && $catInfo['code'] == 0) {
                     $seoUrl = Rp::rewrite(array('url' => '?module=thing&action=glist&class=' . $catId, 'isxs' => 'no', 'seo' => stripslashes($catInfo['selfCategory']['categoryName'])));
                     $origUrl = Rq::getUrl(false);
                     $origQueryStr = Rq::getRawQueryString();
                     if ($origUrl != $seoUrl) {
                         if ($origQueryStr) {
                             $seoUrl .= '?' . $origQueryStr;
                         }
                         $this->redirect($seoUrl);
                         $redirected = true;
                     }
                 }
             }
         }
     }
     if ($redirected && $forceExit) {
         die;
     }
 }
예제 #3
0
 public function __construct()
 {
     $productId = R::getParams('productId');
     $keyword = R::getParams('keyword');
     $page = R::getParams('page');
     $pageSize = R::getParams('pageSize');
     if (!empty($productId)) {
         $page = !empty($page) ? $page : 1;
         $keyword = !empty($keyword) ? $keyword : '';
         $pageSize = !empty($pageSize) ? $pageSize : 9;
         $searchTopQueryArray = array('productId' => $productId, 'searchContent' => $keyword, 'pageSize' => $pageSize, 'pageNo' => $page);
         $getTopQueryRecommend = new \Model\ItemOtherProducts();
         $topQueryData = $getTopQueryRecommend->getTopQuery($searchTopQueryArray);
         $html = '';
         if (!empty($topQueryData) && $topQueryData['code'] == 0) {
             header('Content-Type: text/html;charset=utf-8');
             if (!empty($topQueryData['listResults']['results'])) {
                 //去掉反斜杠
                 $topQueryData['listResults']['results'] = $this->dostrip($topQueryData['listResults']['results']);
                 foreach ($topQueryData['listResults']['results'] as $val) {
                     $html .= '<dl>';
                     if ($keyword) {
                         $html .= '<dt><a href="' . Rewrite::rewrite(array('url' => '?module=thing&action=item&id=' . $val['productId'], 'seo' => $val['productName'], 'isxs' => 'no')) . '?searchKeyword=' . $keyword . '"><img src="' . CDN_UPLOAD_URL . 'upen/m/' . $val['firstPictureUrl'] . '" width="66" height="89" /></a></dt>';
                     } else {
                         $html .= '<dt><a href="' . Rewrite::rewrite(array('url' => '?module=thing&action=item&id=' . $val['productId'], 'seo' => $val['productName'], 'isxs' => 'no')) . '"><img src="' . CDN_UPLOAD_URL . 'upen/m/' . $val['firstPictureUrl'] . '" width="66" height="89" /></a></dt>';
                     }
                     $html .= '<dd><b>' . Currency . \Lib\common\Language::priceByCurrency($val['productPrice']) . '</b></dd>';
                     $html .= '</dl>';
                 }
             }
             echo $html;
         } else {
             echo '';
         }
     } else {
         echo 'no productId';
     }
 }
예제 #4
0
 /**
  * 
  * 成功页面
  */
 public static function getPaypalData()
 {
     $req = 'cmd=_notify-synch';
     $tx_token = $_REQUEST['tx'];
     $auth_token = "h_CYbjUsWBv4NEwyPsmb91zXIpiB7zyPN54g33F8lFoTh5TPpmSdl1CGyoG";
     $req .= "&tx={$tx_token}&at={$auth_token}";
     // post back to PayPal system to validate
     $header .= "POST /cgi-bin/webscr HTTP/1.0\r\n";
     $header .= "Content-Type: application/x-www-form-urlencoded\r\n";
     $header .= "Content-Length: " . strlen($req) . "\r\n\r\n";
     $url = '';
     if ($isSandBox === true) {
         $url = self::$paypalSandBoxUrl;
     } else {
         $url = self::$paypalUrl;
     }
     $fp = fsockopen($url, 80, $errno, $errstr, 30);
     if ($fp) {
         fputs($fp, $header . $req);
         // read the body data
         $res = '';
         $headerdone = false;
         while (!feof($fp)) {
             $line = fgets($fp, 1024);
             if (strcmp($line, "\r\n") == 0) {
                 // read the header
                 $headerdone = true;
             } else {
                 if ($headerdone) {
                     // header has been read. now read the contents
                     $res .= $line;
                 }
             }
         }
         // parse the data
         $lines = explode("\n", $res);
         $keyarray = array();
         if (strcmp($lines[0], "SUCCESS") == 0) {
             for ($i = 1; $i < count($lines); $i++) {
                 list($key, $val) = explode("=", $lines[$i]);
                 $keyarray[urldecode($key)] = urldecode($val);
             }
             $invoice = $keyarray['invoice'];
             $mc_currency = $keyarray['mc_currency'];
             $payment_gross = $keyarray['mc_gross'];
             $custom = $keyarray['custom'];
             $mc_fee = $keyarray['mc_fee'];
             $receiver_email = urldecode($keyarray['receiver_email']);
             $payment_status = strtoupper($keyarray['payment_status']);
             $invoice_array = explode("_", $invoice);
             if ($payment_status == 'COMPLETED' && $receiver_email == self::$receiverEmail) {
                 $paytime = time();
                 $OrdersPayDetails = 'Payment:paypal|' . 'CurrencyCode:' . $mc_currency . '|' . 'amount:' . $payment_gross . '|' . 'REFERENCEID:' . $tx_token . '|' . 'Remarks:' . $Remarks . '|' . 'time:' . $paytime;
                 $shoppingProcess = new \Model\ShoppingProcess();
                 $lang = strtolower(substr(trim($invoice), 0, 5));
                 $orderInfoFromCid = $shoppingProcess->GetOrderByCid(array('cr.ordersCid' => $invoice, 'cr.lang' => $lang));
                 $orderFromCid = $orderInfoFromCid['orderInfo']['order'];
                 $response = $shoppingProcess->updateOrder(array('cr.ordersCid' => $invoice, 'cr.ordersPay' => 1, 'cr.ordersPayDetails' => $OrdersPayDetails, 'cr.cardType' => 'Paypal', 'cr.pamentToken' => $tx_token, 'cr.payTime' => $paytime, 'cr.payClass' => 'paypal', 'cr.ordersPayFeeamt' => $mc_fee, 'cr.endTime' => $paytime + ($orderFromCid['viewStock'] + $orderFromCid['expressTime']) * 24 * 3600));
                 header("Location:" . Rewrite::rewrite(array('url' => '?module=shop&action=Achieve&id=' . $response['ordersId'], 'isxs' => 'no')));
                 exit;
             }
         }
     }
 }
예제 #5
0
/**
 * Smarty {rewrite} function plugin
 *
 * Type:     function<br>
 * Name:     rewrite<br>
 * Purpose:  重写为符合SEO的URL地址
 * @param array $params 包含的属性为$url,<br />
 * 						$isxs='yes',返回重写后的值还是直接输入.默认为直接输出.<br />
 * 						$html='.html',生成的地址后缀.<br />
 * 					    $seo='',生成seo的字符.<br />
 * 						$IS_REWRITE_URL='',<br />
 * 						$rewriteDirName='',<br />
 * 						$force_seo=0,<br />
 * 						$forceNoDomainPrepend=0,是否强制不添加完整的域名.<br />
 * 						$domain 指定域名
 * 						$seoTargetLanguage 指定Seo目标语言
 * @param Smarty
 */
function smarty_function_rewrite($rawParams, &$smarty)
{
    return \Helper\ResponseUtil::rewrite($rawParams);
}
예제 #6
0
파일: Reg.php 프로젝트: hellocc2/crmht
 public function __construct()
 {
     $tpl = \Lib\common\Template::getSmarty();
     if ($_POST) {
         $loginmethod = R::getParams('loginmethod');
         $forward = R::getParams('forward');
         $Conditions = R::getParams('Conditions');
         if (!$Conditions && $loginmethod != 'cart') {
             \helper\Js::alertForward('noConditions', '', 1);
         }
         $UserPass = R::getParams('UserPass');
         $UserPass2 = R::getParams('UserPass2');
         $email = R::getParams('email');
         $describes = R::getParams('describes');
         $CompanyName = R::getParams('CompanyName');
         $KnowWeb = R::getParams('KnowWeb');
         $reg_array = array();
         if (!\helper\Verification::isemail($email)) {
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 4, 'msg' => \LangPack::$items['email1']);
                 echo json_encode($msg);
                 exit;
             } else {
                 \helper\Js::alertForward('email1', '', 1);
             }
         }
         $reg_array['member.email'] = $email;
         if (!$UserPass) {
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 1, 'msg' => \LangPack::$items['pass1']);
                 echo json_encode($msg);
                 exit;
             } else {
                 \helper\Js::alertForward('pass1', '', 1);
             }
         }
         if (!$UserPass || $UserPass != addslashes($UserPass)) {
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 2, 'msg' => \LangPack::$items['pass2']);
                 echo json_encode($msg);
                 exit;
             } else {
                 \helper\Js::alertForward('pass2', '', 1);
             }
         }
         if ($UserPass != $UserPass2) {
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 3, 'msg' => \LangPack::$items['pass3']);
                 echo json_encode($msg);
                 exit;
             } else {
                 \helper\Js::alertForward('pass3', '', 1);
             }
         }
         $UserPass = md5($UserPass . MD5_pass);
         $reg_array['member.userPass'] = $UserPass;
         $emailsDy = R::getParams('emailsDy');
         if (empty($emailsDy)) {
             $reg_array['member.emailsDy'] = $emailsDy;
         }
         if (empty($describes)) {
             $reg_array['member.describes'] = $describes;
         }
         if (empty($CompanyName)) {
             $reg_array['member.companyName'] = $CompanyName;
         }
         if (empty($KnowWeb)) {
             $reg_array['member.knowWeb'] = $KnowWeb;
         }
         $reg_array['member.userState'] = 1;
         $reg_array['member.integral'] = 0;
         $reg_array['member.type'] = 'Personal';
         $reg_array['member.loginTime'] = time();
         $reg_array['member.loginNum'] = 1;
         $reg_array['member.webSiteId'] = MAIN_WEBSITEID;
         $clientIp = \Helper\RequestUtil::getClientIp();
         $reg_array['member.loginIp'] = $clientIp;
         $reg_array['member.userTime'] = time();
         if (isset($_COOKIE['PromotionURL'])) {
             $reg_array['member.promotionURL'] = addslashes($_COOKIE['PromotionURL']);
         }
         $regObj = new \Model\Register();
         $data = $regObj->registerMember($reg_array);
         if (isset($data['addFlag']) && $data['addFlag'] == 2) {
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 5, 'msg' => \LangPack::$items['email2']);
                 echo json_encode($msg);
                 exit;
             } else {
                 \helper\Js::alertForward('email2', '', 1);
             }
         }
         if (isset($data['code']) && $data['code'] == 0) {
             /*统计代码需要记录第一次注册的操作*/
             $_SESSION[SESSION_PREFIX . "reg_record_once"] = 'reg';
             /*统计代码需要记录第一次注册的操作 end*/
             $_SESSION[SESSION_PREFIX . "MemberId"] = $data['id'];
             $_SESSION[SESSION_PREFIX . "MemberEmail"] = $email;
             $pos = strpos($forward, 'Step1');
             $loginType = 0;
             if ($pos !== false) {
                 $loginType = 1;
             }
             $cartParmas = array('cookieId' => isset($_COOKIE['CartId']) ? $_COOKIE['CartId'] : '', 'memberId' => $data['id'], 'loginType' => $loginType, 'languageCode' => SELLER_LANG);
             $cartObj = new \model\Cart();
             $cartObj->mergeShoppingCart($cartParmas);
             if ($loginmethod == 'cart') {
                 $msg = array('error_status' => 0, 'forward' => $forward);
                 echo json_encode($msg);
                 exit;
             } else {
                 if (!$forward) {
                     $forward = rew::rewrite(array('url' => '?module=index&action=index', 'isxs' => 'no'));
                 }
                 header("Location:" . $forward);
                 exit;
             }
         }
         return;
     } else {
         $forward = rew::rewrite(array('url' => '?module=member&action=login', 'isxs' => 'no'));
         header("Location:" . $forward);
         exit;
     }
 }