Ejemplo n.º 1
0
function wsnotify($resultStr, $class_act, $cert_md5)
{
    $pMerCode = $resultStr["pMerCode"];
    $pErrCode = $resultStr["pErrCode"];
    $pErrMsg = $resultStr["pErrMsg"];
    $p3DesXmlPara = $resultStr["p3DesXmlPara"];
    $pSign = $resultStr["pSign"];
    $signPlainText = $pMerCode . $pErrCode . $pErrMsg . $p3DesXmlPara . $cert_md5;
    $localSign = md5($signPlainText);
    if ($localSign == $pSign) {
        //file_put_contents(PATH_LOG_FILE,PATH."--".date('YmdHis')."	验签通过"."\r\n",FILE_APPEND);
        $Crypt3Des = new Crypt3Des();
        //new 3des class
        $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara);
        //3des解密
        if (empty($str3XmlParaInfo)) {
            //file_put_contents(PATH_LOG_FILE,PATH."--".date('YmdHis')."	3DES解密失败"."\r\n",FILE_APPEND);
            return;
        } else {
            require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
            $str3ParaInfo = @XML_unserialize($str3XmlParaInfo);
            $str3Req = $str3ParaInfo['pReq'];
            if ($class_act == 'GuaranteeUnfreeze') {
                require_once APP_ROOT_PATH . 'system/collocation/ips/GuaranteeUnfreeze.php';
                GuaranteeUnfreezeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT);
            }
            if ($class_act == 'Transfer') {
                require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php';
                TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                showSuccess($pErrMsg, 0, SITE_DOMAIN . APP_ROOT);
            }
        }
    }
}
Ejemplo n.º 2
0
	private function __cddata()
	{
		if (post('receive_address'))
		{
			include_once dirname(__FILE__).'/alipay.function.php';
			$pdata = XML_unserialize(post('receive_address'));
			$this->adata = $pdata['receiveAddress'];
		}
	}
Ejemplo n.º 3
0
function QueryForAccBalance($user_id, $platformNo, $post_url)
{
    /* 请求参数 */
    $req = "<request platformNo=\"{$platformNo}\"><platformUserNo>{$user_id}</platformUserNo></request>";
    /* 签名数据 */
    $sign = "xxxx";
    /* 调用账户查询服务 */
    $service = "ACCOUNT_INFO";
    $ch = curl_init($post_url . "/bhaexter/bhaController");
    curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
    $resultStr = curl_exec($ch);
    //print($result);
    if (empty($resultStr)) {
        $result = array();
        $result['pErrCode'] = 9999;
        $result['pErrMsg'] = '返回出错';
        $result['pIpsAcctNo'] = '';
        $result['pBalance'] = 0;
        $result['pLock'] = 0;
        $result['pNeedstl'] = 0;
    } else {
        require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
        $str3ParaInfo = @XML_unserialize($resultStr);
        //print_r($str3ParaInfo);exit;
        $str3Req = $str3ParaInfo['response'];
        $result = array();
        if ($str3Req["code"] == 1) {
            $result['pErrCode'] = "0000";
        } else {
            $result['pErrCode'] = $str3Req["code"];
        }
        $result['pErrMsg'] = $str3Req["description"];
        $result['pIpsAcctNo'] = $user_id;
        $result['pBalance'] = $str3Req["balance"] - $str3Req["freezeAmount"];
        $result['pLock'] = $str3Req["freezeAmount"];
        $result['pNeedstl'] = 0;
        // $str3Req["availableAmount"];
    }
    return $result;
    /*
    * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <response platformNo="10040011137">
        <code>1</code>
        <description>操作成功</description>
        <memberType>PERSONAL</memberType>
        <activeStatus>ACTIVATED</activeStatus>
        <balance>9980.98</balance>
        <availableAmount>9980.98</availableAmount>
        <freezeAmount>0.00</freezeAmount>
        <cardNo>********5512</cardNo>
        <cardStatus>VERIFIED</cardStatus>
        <bank>CCB</bank>
        <autoTender>false</autoTender>
    </response>
    */
}
Ejemplo n.º 4
0
/**
 * 标的登记 及 流标
 * @param int $deal_id
 * @param int $pOperationType 标的操作类型,1:新增,2:结束 “新增”代表新增标的,“结束”代表标的正常还清、丌 需要再还款戒者标的流标等情况。标的“结束”后,投资 人投标冻结金额、担保方保证金、借款人保证金均自劢解 冻
 * @param int $status; 0:新增; 2:流标结束
 * @param string $status_msg 主要是status_msg=2时记录的,流标原因
 * @param unknown_type $platformNo
 * @param unknown_type $post_url
 * @return string
 */
function DoBids($deal_id, $pOperationType, $status, $status_msg, $platformNo, $post_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=yeepay&class_act=DoBids";
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=yeepay&class_act=DoBids";
    //s2s方式返回
    //$requestNo = $GLOBALS['db']->getOne("select * from ".DB_PREFIX."yeepay_cp_transaction where is_callback = 1 and code = 1 and tenderOrderNo = '".$deal_id."'");
    $t_arr = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "yeepay_cp_transaction where is_callback = 1 and tenderOrderNo = " . $deal_id . " and bizType = 'TENDER'");
    $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id);
    $err_count = 0;
    foreach ($t_arr as $k => $v) {
        $data = array();
        $data['requestNo'] = $v["requestNo"];
        //请求流水号
        $data['platformNo'] = $platformNo;
        // 商户编号
        $data['mode'] = "CANCEL";
        /* 请求参数 */
        $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo=\"" . $platformNo . "\">" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<mode>" . $data['mode'] . "</mode>" . "<notifyUrl><![CDATA[" . $pS2SUrl . "]]></notifyUrl>" . "</request>";
        /* 签名数据 */
        $sign = "xxxx";
        $yeepay_log = array();
        $yeepay_log['code'] = 'COMPLETE_TRANSACTION';
        $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
        $yeepay_log['strxml'] = $req;
        $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
        //$id = $GLOBALS['db']->insert_id();
        /* 调用账户查询服务 */
        $service = "COMPLETE_TRANSACTION";
        $ch = curl_init($post_url . "/bhaexter/bhaController");
        curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
        $resultStr = curl_exec($ch);
        if (empty($resultStr)) {
            $err_count++;
        } else {
            require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
            $str3ParaInfo = @XML_unserialize($resultStr);
            //print_r($str3ParaInfo);exit;
            $str3Req = $str3ParaInfo['response'];
            $result['pErrCode'] = $str3Req["code"];
            $result['pErrMsg'] = $str3Req["description"];
            //$result['pIpsAcctNo'] = $user_id;
            if ($str3Req["code"] == 1) {
                $requestNo = $str3Req['requestNo'];
                $t_data = array();
                $t_data["is_complete_transaction"] = 1;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $t_data, 'UPDATE', " requestNo = '" . $requestNo . "'");
                return array("info" => '操作成功');
            }
        }
    }
    //showIpsInfo('同步成功',"");
}
 /**
  * 用于防钓鱼,调用接口query_timestamp来获取时间戳的处理函数
  * 注意:若要使用远程HTTP获取数据,必须开通SSL服务,该服务请找到php.ini配置文件设置开启,建议与您的网络管理员联系解决。
  * return 时间戳字符串
  */
 function query_timestamp()
 {
     $url = $this->alipay_gateway_new . "service=query_timestamp&partner=" . trim($this->aliapy_config['partner']);
     $encrypt_key = "";
     //获取远程数据
     $xml_data = getHttpResponse($url);
     //解析XML数据
     $para_data = @XML_unserialize($xml_data);
     //获取时间戳
     $encrypt_key = $para_data['alipay']['response']['timestamp']['encrypt_key'];
     return $encrypt_key;
 }
 /**
  * 构造模拟远程HTTP的POST请求,获取支付宝的返回XML处理结果
  * @param $para_temp 请求参数数组
  * @param $gateway 网关地址
  * @param $aliapy_config 基本配置信息数组
  * @return 支付宝返回XML处理结果
  */
 function sendPostInfo($para_temp, $gateway, $aliapy_config)
 {
     $xml_str = '';
     //待请求参数数组字符串
     $request_data = $this->buildRequestParaToString($para_temp, $aliapy_config);
     //请求的url完整链接
     $url = $gateway . $request_data;
     //远程获取数据
     $xml_data = getHttpResponse($url, trim(strtolower($aliapy_config['input_charset'])));
     //解析XML
     $para_data = @XML_unserialize($xml_data);
     return $para_data;
 }
Ejemplo n.º 7
0
    /**
     * 获取订单当前收款的邮箱
     * @param int $itemid
     * @return array
     * @author lzx
     */
    public function getPayPalEmailAddress($itemid)
    {
        $requestXmlBody = ' <?xml version="1.0" encoding="utf-8"?>
			<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
				<RequesterCredentials>
					<eBayAuthToken>' . $this->token . '</eBayAuthToken>
				</RequesterCredentials>
				<OutputSelector>Item.PayPalEmailAddress</OutputSelector>
				<ItemID>' . $itemid . '</ItemID>
				<WarningLevel>High</WarningLevel>
			</' . $this->verb . 'Request>';
        return XML_unserialize($this->sendHttpRequest($requestXmlBody));
    }
Ejemplo n.º 8
0
 public function fetchMessageBody($messageid, $account)
 {
     /*----- 加载token文件 -----*/
     $tokenfile = WEB_PATH . 'lib/ebaylibrary/keys/keys_' . $account . '.php';
     if (!file_exists($tokenfile)) {
         //授权文件不存在
         self::$errCode = 10050;
         self::$errMsg = '账号授权文件不存在';
         return FALSE;
     }
     include_once '' . $tokenfile;
     /*----- 导出为全局变量 ugly code -----*/
     $GLOBALS['siteID'] = $siteID;
     $GLOBALS['production'] = $production;
     $GLOBALS['compatabilityLevel'] = $compatabilityLevel;
     $GLOBALS['devID'] = $devID;
     $GLOBALS['appID'] = $appID;
     $GLOBALS['certID'] = $certID;
     $GLOBALS['serverUrl'] = $serverUrl;
     $GLOBALS['userToken'] = $userToken;
     /*----- 导出为全局变量 -----*/
     /*----- 加载token文件 -----*/
     $getmsgobj = new GetMemberMessagesAPI($account);
     $responseXml = $getmsgobj->requestMessagesID($messageid);
     //var_dump($responseXml);exit;
     if (stristr($responseXml, 'HTTP 404') || $responseXml == '') {
         self::$errCode = 10051;
         self::$errMsg = '获取失败!';
         return FALSE;
     }
     $responseDoc = new DomDocument();
     $responseDoc->loadXML($responseXml);
     $data = XML_unserialize($responseXml);
     //print_r($data);exit;
     $Content = $data['GetMyMessagesResponse']['Messages']['Message']['Text'];
     if (empty($Content)) {
         self::$errCode = 10051;
         self::$errMsg = '获取失败!';
         return FALSE;
     }
     $date = date('Y-m-d', time());
     $filepath = MSGBODYSAVEPATH . $account . '/' . $date . '/' . $messageid . '.html';
     if (write_a_file(MSGREALPREFIX . $filepath, $Content) === false) {
         self::$errCode = 10052;
         self::$errMsg = 'message文件保存失败!';
         return FALSE;
     }
     return $filepath;
 }
function SincerityGoldUnfreeze($user_id, $platformNo, $freezeRequestNo, $deal_id, $post_url, $sys = 'pc')
{
    //$pWebUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=response&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//web方式返回
    //$pS2SUrl= SITE_DOMAIN.APP_ROOT."/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=SincerityGoldUnfreeze&from=".$_REQUEST['from'];//s2s方式返回
    $yeepay_log = array();
    $yeepay_log['code'] = 'UNFREEZE';
    $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s');
    $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
    $requestNo = $GLOBALS['db']->insert_id();
    $data = array();
    $data['platformNo'] = $platformNo;
    // 商户编号
    $data['freezeRequestNo'] = $freezeRequestNo;
    $data['expired'] = NOW_TIME;
    //到期自劢解冻时间
    //	$strxml = SincerityGoldUnfreezeXml($data,$pWebUrl,$pS2SUrl);
    /* 请求参数 */
    $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo='" . $data['platformNo'] . "'>" . "<freezeRequestNo>" . $data['freezeRequestNo'] . "</freezeRequestNo>" . "</request>";
    /* 签名数据 */
    $sign = cfca($req);
    /* 调用账户查询服务 */
    $service = "UNFREEZE";
    $ch = curl_init($post_url . "/bhaexter/bhaController");
    curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
    $resultStr = curl_exec($ch);
    if (empty($resultStr)) {
        //$err_count ++ ;
    } else {
        require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
        $str3ParaInfo = @XML_unserialize($resultStr);
        $str3Req = $str3ParaInfo['response'];
        $result['pErrCode'] = $str3Req["code"];
        $result['pErrMsg'] = $str3Req["description"];
        if ($str3Req["code"] == 1) {
            //操作成功
            $where = " platformUserNo=" . $user_id . " and deal_id =" . $deal_id . " and requestNo=" . $freezeRequestNo;
            $data['status'] = 2;
            $data['create_time'] = NOW_TIME;
            if (isset($str3Req['description'])) {
                $data['description'] = $str3Req["description"];
            }
            $GLOBALS['db']->autoExecute(DB_PREFIX . "money_freeze", $data, 'UPDATE', $where);
            showIpsInfo('诚意金解冻成功', get_domain() . APP_ROOT . '/m.php?m=UserFreeze&a=index&');
        }
    }
}
Ejemplo n.º 10
0
 function load_theme($url, $skip_file = false)
 {
     $this->error(false);
     ob_start();
     $xml = file_get_contents($url);
     //, false, null, 0, 4*1024); // 5 paramater format only works in PHP5
     $err = ob_get_contents();
     if (!empty($err)) {
         // cleanup the error a little bit so it's a little easier to tell what happened
         $err = str_replace(' [function.file-get-contents]', '', strip_tags($err));
     }
     ob_end_clean();
     $this->headers = $this->parse_headers($http_response_header);
     $this->xml = array();
     $data = array();
     if ($xml !== false) {
         // make sure the content-type returned is something reasonable (and not an image, etc).
         if ($this->is_xml()) {
             $data = XML_unserialize($xml);
             if ($data and is_array($data['theme'])) {
                 $xml2 = simple_interpolate($xml, $data['theme'], true);
                 if ($xml2 != $xml) {
                     // unserialize the data once more since it had $vars in the XML
                     $data = XML_unserialize($xml2);
                 }
                 $this->xml = $data['theme'];
                 array_walk($this->xml, array(&$this, '_fix_xml_attrib'));
             } else {
                 $this->error("Invalid theme XML format loaded from {$url}", PSTHEME_ERR_XML);
             }
         } else {
             $this->error("Invalid content-type returned for XML (" . $this->headers['content-type'] . ")", PSTHEME_ERR_CONTENT);
         }
     } else {
         $this->error($err, PSTHEME_ERR_NOTFOUND);
     }
     $ok = false;
     if (!$this->error() and $this->xml) {
         $ok = $this->validate_theme($skip_file);
         if ($ok and file_exists(catfile($this->template_dir, $this->xml['name']))) {
             $this->xml['theme_exists'] = true;
         }
     }
     return $ok;
 }
Ejemplo n.º 11
0
    /**
     * 从交易信息获取发货地址
     * @param string $orderid
     * @return array
     * @author lzx
     */
    public function getSellerTransactions($orderid)
    {
        $requestXmlBody = ' <?xml version="1.0" encoding="utf-8"?>
			<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
			<RequesterCredentials>
				<eBayAuthToken>' . $this->token . '</eBayAuthToken>
			</RequesterCredentials>
			<DetailLevel>ReturnAll</DetailLevel>
			<OutputSelector>OrderArray.Order.TransactionArray.Transaction.Buyer.BuyerInfo.ShippingAddress</OutputSelector>
			<IncludeFinalValueFee>true</IncludeFinalValueFee>
			<OrderRole>Seller</OrderRole>
			<OrderStatus>Completed</OrderStatus>
			<OrderIDArray>
				<OrderID>' . $orderid . '</OrderID>
			</OrderIDArray>
			</' . $this->verb . 'Request>';
        return XML_unserialize($this->sendHttpRequest($requestXmlBody));
    }
Ejemplo n.º 12
0
    /**
     * 获取订单详情
     * @param array $order_ids
     * @return array
     * @author lzx
     */
    public function getOrderLists($order_ids)
    {
        $order_ids = array_filter($order_ids, create_function('$orderid', 'return preg_match("/^\\d{12}(|\\-\\d{12,14}|\\-0)$/i", $orderid)>0;'));
        if (count($order_ids) == 0) {
            return false;
        }
        $valid_orderids = array_map(create_function('$a', 'return "<OrderID>".$a."</OrderID>";'), $order_ids);
        $requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
			<' . $this->verb . 'Request xmlns="urn:ebay:apis:eBLBaseComponents">
				<RequesterCredentials>
					<eBayAuthToken>' . $this->requestToken . '</eBayAuthToken>
				</RequesterCredentials>  
				<DetailLevel>ReturnAll</DetailLevel>
				<IncludeFinalValueFee>true</IncludeFinalValueFee>
				<OrderRole>Seller</OrderRole>
				<OrderStatus>Completed</OrderStatus>
				<OrderIDArray>' . "\n" . implode("\n\t", $valid_orderids) . "\n" . '</OrderIDArray>
			</' . $this->verb . 'Request>';
        return XML_unserialize($this->sendHttpRequest($requestXmlBody));
    }
Ejemplo n.º 13
0
/**
 * 商户端获取银行列表查询(WS) 
 * @param int $MerCode
 * @param unknown_type $cert_md5
 * @param unknown_type $ws_url
 * @return  
 * 		  pMerCode 6 “平台”账号 否 由IPS颁发的商户号 pErrCode 4 返回状态 否 0000成功; 9999失败;
 * 		  pErrMsg 100 返回信息 否 状态0000:成功 除此乊外:反馈实际原因 
 * 		  pBankList 银行名称|银行卡别名|银行卡编号#银行名称|银行卡别名|银行卡编号
 * 		  BankList[] = array('name'=>银行名称,'sub_name'=>银行卡别名,'id'=>银行卡编号);
 */
function GetBankList($MerCode, $cert_md5, $ws_url)
{
    $str = $MerCode . $cert_md5;
    $pSign = md5($str);
    try {
        $url = $ws_url;
        $client = new SoapClient($url);
        // 接口方法:public string GetBankList(string argMerCode, string argSign)
        $param = array('argMerCode' => $MerCode, 'argSign' => $pSign);
        $arrResult = $client->GetBankList($param);
        $resultStr = $arrResult->GetBankListResult;
        /*
         * pMerCode 6 “平台”账号 否 由IPS颁发的商户号 pErrCode 4 返回状态 否 0000成功; 9999失败;
         * pErrMsg 100 返回信息 否 状态0000:成功 除此乊外:反馈实际原因 
         * pBankList 银行名称|银行卡别名|银行卡编号#银行名称|银行卡别名|银行卡编号
         */
        require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
        $str3ParaInfo = @XML_unserialize($resultStr);
        //print_r($str3ParaInfo);exit;
        $str3Req = $str3ParaInfo['pReq'];
        $result = array();
        $result['pErrCode'] = $str3Req["pErrCode"];
        $result['pErrMsg'] = $str3Req["pErrMsg"];
        $result['pBankList'] = $str3Req["pBankList"];
        $list = explode('#', $result['pBankList']);
        $BankList = array();
        foreach ($list as $bank) {
            $b = explode('|', $bank);
            if (count($b) >= 3) {
                $BankList[] = array('name' => $b[0], 'sub_name' => $b[1], 'id' => $b[2]);
            }
        }
        $result['BankList'] = $BankList;
    } catch (SOAPFault $e) {
        $result = array();
        $result['pErrCode'] = 9999;
        $result['pErrMsg'] = print_r($e, 1);
        $result['pBankList'] = '';
    }
    return $result;
}
Ejemplo n.º 14
0
    public function sendEbayCsMail($itemId, $buyerId, $sendContent, $subject)
    {
        include_once WEB_PATH . 'lib/ebaylibrary/eBaySession.php';
        global $devID, $appID, $certID, $serverUrl, $siteID, $compatabilityLevel, $userToken;
        $verb = 'AddMemberMessageAAQToPartner';
        $session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
        $requestXML = <<<EOF
        <?xml version="1.0" encoding="utf-8"?>
        <AddMemberMessageAAQToPartnerRequest xmlns="urn:ebay:apis:eBLBaseComponents">
          <RequesterCredentials>
            <eBayAuthToken>{$userToken}</eBayAuthToken>
          </RequesterCredentials>
          <ItemID>{$itemId}</ItemID>
          <MemberMessage>
            <Subject>{$subject}</Subject>
            <Body>{$sendContent}</Body>
            <EmailCopyToSender>true</EmailCopyToSender>
            <QuestionType>General</QuestionType>
            <RecipientID>{$buyerId}</RecipientID>
          </MemberMessage>
        </AddMemberMessageAAQToPartnerRequest>
EOF;
        $responseXml = $session->sendHttpRequest($requestXML);
        if (stristr($responseXml, 'HTTP 404') || $responseXml == '' || $responseXml === FALSE) {
            self::$errMsg = __METHOD__ . '发送请求失败! in line ' . __LINE__;
            return FALSE;
        }
        $data = XML_unserialize($responseXml);
        $ack = $data['AddMemberMessageAAQToPartnerResponse'];
        $ack = $ack['Ack'];
        if ($ack == 'Success') {
            return TRUE;
        } else {
            $err = $data['AddMemberMessageAAQToPartnerResponse']['Errors']['LongMessage'];
            self::$errMsg = '处理失败 ::ERR INFO ==> ' . $err;
            return FALSE;
        }
    }
Ejemplo n.º 15
0
/**
 * 解冻保证金
 * @param int $deal_id 标的号
 * @param int $pUnfreezenType 解冻类型 否 1#解冻借款方;2#解冻担保方
 * @param float $money 解冻金额;默认为0时,则解冻所有未解冻的金额
 * @param unknown_type $MerCode
 * @param unknown_type $cert_md5
 * @param unknown_type $post_url
 * @return string
 */
function GuaranteeUnfreeze($deal_id, $pUnfreezenType, $money, $MerCode, $cert_md5, $ws_url)
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=Ips&class_act=GuaranteeUnfreeze";
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Ips&class_act=GuaranteeUnfreeze";
    //s2s方式返回
    $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id);
    if ($pUnfreezenType == 1) {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($deal['user_id']));
    } else {
        $user = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where id = " . intval($deal['agency_id']));
    }
    $data = array();
    $data['deal_id'] = $deal_id;
    $data['pMerCode'] = $MerCode;
    // '“平台”账号 否 由IPS颁发的商户号 ',
    $data['pMerBillNo'] = $deal_id . 'U' . get_gmtime();
    //商户系统唯一丌重复 ',
    $data['pBidNo'] = $deal_id;
    //'标的号,商户系统唯一丌重复',
    $data['pUnfreezeDate'] = to_date(get_gmtime(), 'Ymd');
    //'解冻日期格 式:yyyymmdd',
    $data['pUnfreezenType'] = $pUnfreezenType;
    //'解冻类型 否 1#解冻借款方;2#解冻担保方',
    $money = floatval($money);
    if ($money == 0) {
        if ($pUnfreezenType == 1) {
            $money = $deal['real_freezen_amt'] - $deal['un_real_freezen_amt'];
            //'解冻金额 金额单位,丌能为负,丌允许为0 累计解冻金额  <= 当时冻结时的保证金',
        } else {
            $money = $deal['guarantor_real_freezen_amt'] - $deal['un_guarantor_real_freezen_amt'];
        }
    }
    $data['pUnfreezeAmt'] = str_replace(',', '', number_format($money, 2));
    $data['pAcctType'] = 1;
    //'解冻者账户类型 否 0#机构;1#个人',
    $data['pIdentNo'] = $user['idno'];
    //'解冻者证件号码 是/否 解冻者账户类型1时:真实身份证(个人),必填 解冻账户类型0时:为空处理 ',
    $data['pRealName'] = $user['real_name'];
    //'解冻者姓名 否 账户类型为1时,真实姓名(中文) 账户类型为0时,开户时在IPS登记的商户名称 '
    $data['pIpsAcctNo'] = $user['ips_acct_no'];
    //'解冻者IPS账号 否 账户类型为1时,IPS个人托管账户号 账户类型为0时,由IPS颁发的商户号',
    $GLOBALS['db']->autoExecute(DB_PREFIX . "ips_guarantee_unfreeze", $data, 'INSERT');
    $id = $GLOBALS['db']->insert_id();
    $strxml = GuaranteeUnfreezeXml($data, $pWebUrl, $pS2SUrl);
    //echo $strxml;exit;
    $Crypt3Des = new Crypt3Des();
    //new 3des class
    $p3DesXmlPara = $Crypt3Des->DESEncrypt($strxml);
    //3des 加密
    $str = $MerCode . $p3DesXmlPara . $cert_md5;
    $pSign = md5($str);
    try {
        $url = $ws_url;
        $client = new SoapClient($url);
        $param = array('argMerCode' => $MerCode, 'arg3DesXmlPara' => $p3DesXmlPara, 'argSign' => $pSign);
        $arrResult = $client->GuaranteeUnfreeze($param);
        $resultStr = $arrResult->GuaranteeUnfreezeResult;
        require_once APP_ROOT_PATH . 'system/collocation/ips/ips.php';
        require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
        $result = @XML_unserialize($resultStr);
        $result = $result['pReq'];
        wsnotify($result, 'GuaranteeUnfreeze', $cert_md5);
        $result['resultStr'] = $resultStr;
        return $result;
    } catch (SOAPFault $e) {
        print $e;
        //file_put_contents(PATH_LOG_FILE,PATH.$e."\r\n",FILE_APPEND);
    }
}
Ejemplo n.º 16
0
 /**
  * sendRequest
  *
  * @param $method(string), $args(array), $postmethod(string / post,get)
  * @return array or xml
  */
 function sendRequest($method = null, $args = null, $postmethod = 'get', $use_ssl = false)
 {
     // Convert array to string
     $reqURL = ($use_ssl ? $this->cmsRESTSSL : $this->cmsREST) . '?api_key=' . $this->apiKey . '&return=json&method=' . $method;
     // If there is a session, pass the info along
     if ($this->sessionid != '') {
         $args['sessionid'] = (string) urlencode($this->sessionid);
     }
     if ($postmethod == 'get') {
         if (is_array($args)) {
             $getArgs = $this->buildArguments($args);
         } else {
             $getArgs = $args;
         }
         $reqURL .= '&' . $getArgs;
     }
     if ($postmethod == 'post' && !empty($args['sessionid'])) {
         $reqURL .= '&sessionid=' . $args['sessionid'];
     }
     $curl_handle = curl_init();
     curl_setopt($curl_handle, CURLOPT_URL, $reqURL);
     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 1);
     curl_setopt($curl_handle, CURLOPT_HEADER, 0);
     curl_setopt($curl_handle, CURLOPT_TIMEOUT, 0);
     curl_setopt($curl_handle, CURLOPT_SSLVERSION, 3);
     curl_setopt($curl_handle, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
     curl_setopt($curl_handle, CURLOPT_REFERER, 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
     // Set the custom HTTP Headers
     $http_header = array();
     $http_header[] = 'X-Api-Key: ' . $this->apiKey;
     $http_header[] = 'X-Return: json';
     if (isset($args['sessionid'])) {
         $http_header[] = 'X-Sessionid: ' . $args['sessionid'];
     }
     curl_setopt($curl_handle, CURLOPT_HTTPHEADER, $http_header);
     if ($postmethod == 'post') {
         curl_setopt($curl_handle, CURLOPT_POST, 1);
         if ($method == 'cms.file.upload') {
             curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $args);
         } else {
             curl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->buildArguments($args));
         }
     }
     // Debug?
     if ($this->debug) {
         echo '<pre>';
         print_r($reqURL);
         print_r($http_header);
         print_r($this->buildArguments($args));
         echo '</pre>';
     }
     $response = curl_exec($curl_handle);
     if (!$response) {
         $response = curl_error($curl_handle);
     }
     curl_close($curl_handle);
     // Debug?
     if ($this->debug) {
         echo '<pre>';
         print_r($response);
         echo '</pre>';
     }
     // Return array or XML
     if ($this->parser == 'xml') {
         return XML_unserialize($response);
     } else {
         if ($this->parser == 'json') {
             return json_decode($response, true);
         } else {
             return $response;
         }
     }
 }
Ejemplo n.º 17
0
function GetSellerTransactions($ebay_starttime, $ebay_endtime, $ebay_account, $type, $id)
{
    global $api_gst, $oa, $user;
    global $dbConn, $mctime, $defaultstoreid;
    $pcount = 1;
    $errors = 1;
    do {
        echo "抓取....\t";
        $responseXml = $api_gst->request($ebay_starttime, $ebay_endtime, $pcount);
        if (empty($responseXml)) {
            echo "Return Empty...Sleep 10 seconds..";
            sleep(10);
            $hasmore = true;
            continue;
        }
        //网络出现代理Proxy error 脚本休眠20秒
        $poxy_error_p = '#Proxy\\s*Error#i';
        if (preg_match($poxy_error_p, $responseXml)) {
            echo "Proxy Error...Sleep 20 seconds..";
            sleep(20);
            $hasmore = true;
            continue;
        }
        echo "\n";
        $data = XML_unserialize($responseXml);
        $responseXml = null;
        unset($responseXml);
        $getorder = $data['GetSellerTransactionsResponse'];
        $data = null;
        unset($data);
        $TotalNumberOfPages = @$getorder['PaginationResult']['TotalNumberOfPages'];
        $TotalNumberOfEntries = @$getorder['PaginationResult']['TotalNumberOfEntries'];
        $hasmore = @$getorder['HasMoreTransactions'];
        $strline = $TotalNumberOfPages . '/' . $TotalNumberOfEntries;
        $Ack = @$getorder['Ack'];
        echo "正在请求:{$pcount}/{$TotalNumberOfPages} \t记录数[ {$TotalNumberOfEntries} ]\t\n\t\t\t\t  同步状态: {$Ack} 还有更多: {$hasmore} \n";
        if ($id == '' && $type == '1') {
            if ($Ack == '') {
                $ss = "insert into errors_ack(ebay_account,starttime,endtime,status,notes) \n\t\t\t\t\t\t\tvalues('{$ebay_account}','{$ebay_starttime}','{$ebay_endtime}','0','Ack False')";
                $dbConn->query($ss);
            }
            if ($hasmore == '' || $Ack == '') {
                $ss = "insert into errors_ack(ebay_account,starttime,endtime,status,notes) \n\t\t\t\t\t\t\tvalues('{$ebay_account}','{$ebay_starttime}','{$ebay_endtime}','0','Ack False')";
                $dbConn->query($ss);
            }
        }
        if ($id > 0) {
            if ($Ack == 'Success') {
                $gg = "update errors_ack set status = 1 where id='{$id}' ";
            } else {
                $gg = "update errors_ack set status = 0 where id='{$id}' ";
            }
            $dbConn->query($gg);
        }
        /**/
        $log_name = '同步订单';
        $log_operationtime = $mctime;
        $log_notes = $ebay_account . ":{$pcount}/{$TotalNumberOfPages} ,Ack={$Ack}";
        addlogs($log_name, $log_operationtime, 0, $log_notes, $user, $ebay_account, $ebay_starttime, $ebay_endtime, $type);
        /**/
        $Trans = @$getorder['TransactionArray']['Transaction'];
        $ReturnedTransactionCountActual = @$getorder['ReturnedTransactionCountActual'];
        if ($ReturnedTransactionCountActual == 1) {
            $Trans = array();
            $Trans[0] = $getorder['TransactionArray']['Transaction'];
        }
        $getorder = null;
        unset($getorder);
        foreach ((array) $Trans as $Transaction) {
            //每笔记录编号
            $tran_recordnumber = $Transaction['ShippingDetails']['SellingManagerSalesRecordNumber'];
            //交易状态
            $LastTimeModified = strtotime($Transaction['Status']['LastTimeModified']);
            $eBayPaymentStatus = $Transaction['Status']['eBayPaymentStatus'];
            $CompleteStatus = $Transaction['Status']['CompleteStatus'];
            $CheckStatus = $Transaction['Status']['CompleteStatus'];
            //其他交易信息比如payapl整合到ebay
            $ptid = @$Transaction['ExternalTransaction']['ExternalTransactionID'];
            $FeeOrCreditAmount = @$Transaction['ExternalTransaction']['FeeOrCreditAmount'];
            $FinalValueFee = $Transaction['FinalValueFee'];
            $tid = $Transaction['TransactionID'];
            //ebay 交易号
            $AmountPaid = @$Transaction['AmountPaid'];
            $Buyer = str_rep(@$Transaction['Buyer']);
            $Email = str_rep(@$Buyer['Email']);
            //email
            $UserID = str_rep(@$Buyer['UserID']);
            //userid
            $BuyerInfo = $Buyer['BuyerInfo']['ShippingAddress'];
            $Name = str_rep($BuyerInfo['Name']);
            $Name = mysql_real_escape_string($Name);
            $Street1 = str_rep($BuyerInfo['Street1']);
            $Street2 = str_rep(@$BuyerInfo['Street2']);
            $CityName = str_rep(@$BuyerInfo['CityName']);
            $StateOrProvince = str_rep(@$BuyerInfo['StateOrProvince']);
            $Country = str_rep(@$BuyerInfo['Country']);
            $CountryName = str_rep(@$BuyerInfo['CountryName']);
            $PostalCode = str_rep(@$BuyerInfo['PostalCode']);
            $Phone = @$BuyerInfo['Phone'];
            //该交易的物品信息
            $Item = $Transaction['Item'];
            $CategoryID = $Item['PrimaryCategory']['CategoryID'];
            //ebay刊登物品的分类ID,备用字段
            $Currency = $Item['Currency'];
            //货币类型
            $ItemID = $Item['ItemID'];
            //ebay物品id
            $ListingType = $Item['ListingType'];
            $Title = str_rep($Item['Title']);
            //ebay物品标题
            $sku = str_rep($Item['SKU']);
            $site = $Item['Site'];
            $CurrentPrice = $Item['SellingStatus']['CurrentPrice'];
            //产品当前价格
            $QuantityPurchased = $Transaction['QuantityPurchased'];
            //购买数量
            $PaidTime = strtotime($Transaction['PaidTime']);
            //付款时间
            $CreatedDate = strtotime($Transaction['CreatedDate']);
            //交易创建时间...********多个产品订单每个产品的创建时间不同判依据
            $ShippedTime = strtotime($Transaction['ShippedTime']);
            $shipingservice = $Transaction['ShippingServiceSelected']['ShippingService'];
            $shipingfee = $Transaction['ShippingServiceSelected']['ShippingServiceCost'];
            $containing_order = @$Transaction['ContainingOrder'];
            $combined_recordnumber = @$containing_order['ShippingDetails']['SellingManagerSalesRecordNumber'];
            //合并后的recordnumber
            $orderid = 0;
            if ($combined_recordnumber != '') {
                $orderid = @$containing_order['OrderID'];
            } else {
                $orderid = $ItemID . '-' . $tid;
            }
            $BuyerCheckoutMessage = str_rep($Transaction['BuyerCheckoutMessage']);
            //顾客购买留言
            $BuyerCheckoutMessage = str_replace('<![CDATA[', '', $BuyerCheckoutMessage);
            $BuyerCheckoutMessage = str_replace(']]>', '', $BuyerCheckoutMessage);
            //店铺收款paypal account
            $PayPalEmailAddress = $Transaction['PayPalEmailAddress'];
            $addrecordnumber = $tran_recordnumber;
            if ($combined_recordnumber != '') {
                $addrecordnumber = $combined_recordnumber;
            }
            if ($CompleteStatus == "Complete" && $eBayPaymentStatus == "NoPaymentFailure" && $PaidTime > 0) {
                $orderstatus = 1;
            }
            if ($ShippedTime > 0) {
                $orderstatus = 2;
            }
            //已经发货
            ################################
            $RefundAmount = 0;
            //表示未垦退款
            if ($orderstatus == 1 && $ShippedTime <= 0 && $PaidTime > 0) {
                echo "销售编号[{$addrecordnumber}]有效";
                //检查汇总表该 recordnumber是否已经存在
                //主要是避免multiple line item 这种情况 造成重复添加 汇总数据
                $check_ordersn = CheckOrderSN($addrecordnumber, $ebay_account);
                $new_ebay_id = true;
                if ($check_ordersn == "0") {
                    //该交易还无汇总数据	添加订单汇总
                    /* 生成一个本地系统订单号 */
                    $our_sys_ordersn = date('Y-m-d-His') . mt_rand(100, 999) . $addrecordnumber;
                    $order_no = '';
                    //已废弃
                    $obj_order = new eBayOrder();
                    $obj_order_data = array('ebay_paystatus' => $CompleteStatus, 'ebay_ordersn' => $our_sys_ordersn, 'ebay_tid' => $tid, 'ebay_ptid' => $ptid, 'ebay_orderid' => $orderid, 'ebay_createdtime' => $CreatedDate, 'ebay_paidtime' => $PaidTime, 'ebay_userid' => $UserID, 'ebay_username' => $Name, 'ebay_usermail' => $Email, 'ebay_street' => $Street1, 'ebay_street1' => $Street2, 'ebay_city' => $CityName, 'ebay_state' => $StateOrProvince, 'ebay_couny' => $Country, 'ebay_countryname' => $CountryName, 'ebay_postcode' => $PostalCode, 'ebay_phone' => $Phone, 'ebay_currency' => $Currency, 'ebay_total' => $AmountPaid, 'ebay_status' => $orderstatus, 'ebay_user' => $user, 'ebay_shipfee' => $shipingfee, 'ebay_account' => $ebay_account, 'recordnumber' => $addrecordnumber, 'ebay_addtime' => $mctime, 'ebay_note' => $BuyerCheckoutMessage, 'ebay_site' => $site, 'eBayPaymentStatus' => $eBayPaymentStatus, 'PayPalEmailAddress' => $PayPalEmailAddress, 'ShippedTime' => $ShippedTime, 'RefundAmount' => $RefundAmount, 'ebay_warehouse' => $defaultstoreid, 'order_no' => $order_no);
                    $obj_order->init($obj_order_data);
                    $obj_order_data = null;
                    unset($obj_order_data);
                    $new_ebay_id = $oa->addOrder($obj_order);
                    $obj_order = null;
                    unset($obj_order);
                    if ($new_ebay_id !== false) {
                        echo "\t订单[{$our_sys_ordersn}] 汇总数据入库成功=>\n\tUserID:{$UserID}" . " AMT:{$AmountPaid} recordNO:{$addrecordnumber} ";
                        echo "付款状态:{$CompleteStatus} 交易ID:{$ptid}\n";
                        $check_ordersn = $our_sys_ordersn;
                        //检验ebay 订单号 是否在订单号汇总表中
                        if (check_ebay_orderid_exists_in_statistic_table($orderid, $ebay_account) === false) {
                            save_ebay_orderid_table($new_ebay_id, $ptid, $orderid, $ebay_account, $CreatedDate);
                        }
                    } else {
                        echo "\t订单[{$our_sys_ordersn}] 入库失败\n";
                    }
                }
                if ($new_ebay_id !== false) {
                    //添加订单明细
                    $sql = "select \tebay_id from ebay_orderdetail \n\t\t\t\t\t\t\t\twhere \tebay_ordersn='{$check_ordersn}' \n\t\t\t\t\t\t\t\tand \trecordnumber='{$tran_recordnumber}'";
                    $sql = $dbConn->query($sql);
                    $sql = $dbConn->fetch_array_all($sql);
                    if (count($sql) == 0) {
                        /* 多属性订单 */
                        $Variation = @$Transaction['Variation']['VariationSpecifics']['NameValueList'];
                        $attribute = '';
                        if (!empty($Variation)) {
                            if (!isset($Variation['Name']) || !isset($Variation['Value'])) {
                                foreach ($Variation as $variate) {
                                    $aname = $variate['Name'];
                                    $avalue = $variate['Value'];
                                    $attribute .= $aname . ":" . $avalue . " ";
                                }
                            } else {
                                $attribute = $Variation['Name'] . ":" . $Variation['Value'];
                            }
                            unset($Variation);
                        }
                        $obj_order_detail = new eBayOrderDetail();
                        $obj_order_detail_data = array('ebay_ordersn' => $check_ordersn, 'ebay_itemid' => $ItemID, 'ebay_itemtitle' => $Title, 'ebay_itemprice' => $CurrentPrice, 'ebay_amount' => $QuantityPurchased, 'ebay_createdtime' => $CreatedDate, 'ebay_shiptype' => $shipingservice, 'ebay_user' => $user, 'sku' => $sku, 'shipingfee' => $shipingfee, 'ebay_account' => $ebay_account, 'addtime' => $mctime, 'ebay_itemurl' => '', 'ebay_site' => $site, 'recordnumber' => $tran_recordnumber, 'storeid' => '', 'ListingType' => $ListingType, 'ebay_tid' => $tid, 'FeeOrCreditAmount' => $FeeOrCreditAmount, 'FinalValueFee' => $FinalValueFee, 'attribute' => $attribute, 'notes' => $BuyerCheckoutMessage, 'goods_location' => @get_good_location($sku, $user));
                        $obj_order_detail->init($obj_order_detail_data);
                        $obj_order_detail_data = null;
                        unset($obj_order_detail_data);
                        if (false !== $oa->addOrderDetail($obj_order_detail)) {
                            echo "\t订单[{$check_ordersn}] 编号[{$tran_recordnumber}]明细入库OK!\n";
                        } else {
                            echo "\t订单[{$check_ordersn}] 编号[{$tran_recordnumber}]明细入库Error!\n";
                        }
                        $obj_order_detail = null;
                        unset($obj_order_detail);
                    }
                    $sql = "select ebay_id from ebay_orderdetail \n\t\t\t\t\t\t\t\twhere ebay_ordersn='{$check_ordersn}' \n\t\t\t\t\t\t\t\tand recordnumber='{$tran_recordnumber}'";
                    $sql = $dbConn->query($sql);
                    $sql = $dbConn->fetch_array_all($sql);
                    if (count($sql) >= 2 && strlen($check_ordersn) >= 5) {
                        $id = $sql[0]['ebay_id'];
                        $ss = "delete from ebay_orderdetail where ebay_id='{$id}'";
                        $dbConn->query($ss);
                    }
                    if ($ShippedTime > 0) {
                        $ss = "update ebay_order set ShippedTime='{$ShippedTime}',\n\t\t\t\t\t\t\t\t\tebay_status='2',ebay_markettime='{$ShippedTime}' \n\t\t\t\t\t\t\t\t\twhere ebay_ordersn='{$check_ordersn}' and ebay_status='1'";
                        $dbConn->query($ss);
                    }
                }
            } else {
                echo "销售编号[{$addrecordnumber}]无效 不入库...\n";
            }
        }
        if ($id == '' && $type == '1') {
            if ($Ack == '' || $Ack == 'Failure') {
                $ss = "insert into errors_ack(ebay_account,starttime,endtime,status,notes,currentpage) \n\t\t\t\t\t\t\tvalues('{$ebay_account}','{$ebay_starttime}','{$ebay_endtime}','0','Ack False','{$pcount}')";
                $dbConn->query($ss);
            }
        }
        if ($pcount >= $TotalNumberOfPages) {
            echo $hasmore . "程序退出了\n";
            break;
        }
        $pcount++;
        $hasmore = strtolower($hasmore) == 'true' ? true : false;
    } while ($hasmore);
}
Ejemplo n.º 18
0
 function notify($request, $class_act)
 {
     //print_r($_POST);
     //print_r($_GET);
     //print_r($_REQUEST);
     //print_r($request);
     /*
     		if ($class_act == 'DoLoans'){
     			require_once(APP_ROOT_PATH.'system/collocation/baofoo/DoLoans.php');
     			$str3Req = array();
     			$str3Req['order_id'] = 17022;
     			$str3Req['code'] = 'CSD000';
     			print_r(DoLoansCallBack($str3Req));
     			exit;
     		}*/
     $merchant_id = $this->cfg['merchant_id'];
     $terminal_id = $this->cfg['terminal_id'];
     $key = $this->cfg['key'];
     $iv = $this->cfg['iv'];
     $baofoo_log = array();
     $baofoo_log['code'] = 'notify';
     $baofoo_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
     $baofoo_log['strxml'] = $class_act;
     $baofoo_log['html'] = print_r($_POST, true);
     $GLOBALS['db']->autoExecute(DB_PREFIX . "baofoo_log", $baofoo_log);
     //exit;
     $Md5sign = "";
     if ($class_act == 'CreateNewAcct' || $class_act == 'DoDpTrade' || $class_act == 'DoDwTrade') {
         //Md5sign = Md5(result + ~|~ + "商户密钥")
         $result = $_POST["result"];
         $sign = $_POST["sign"];
         $Md5sign = Md5($result . '~|~' . $key);
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($result);
         $str3Req = $str3ParaInfo['crs'];
     } else {
         if ($class_act == 'RegisterCreditor' || $class_act == 'DoBids' || $class_act == 'DoLoans') {
             require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
             $result = $_POST["result"];
             $str3ParaInfo = @XML_unserialize($result);
             $str3Req = $str3ParaInfo['crs'];
             //print_r($str3ParaInfo);exit;
             //Sign =  MD5 ( code + ~|~ + msg + ~|~ + orderId + ~|~+商户秘钥 );
             $Md5sign = Md5($str3Req['code'] . '~|~' . $str3Req['msg'] . '~|~' . $str3Req['order_id'] . '~|~' . $key);
             $sign = $str3Req["sign"];
         }
     }
     if ($Md5sign == $sign) {
         //echo "<br/>验签通过";exit;
         //
         $pErrMsg = $str3Req['msg'];
         if ($class_act == 'CreateNewAcct') {
             require_once APP_ROOT_PATH . 'system/collocation/baofoo/CreateNewAcct.php';
             $user_type = CreateNewAcctCallBack($str3Req);
         } else {
             if ($class_act == 'DoDpTrade') {
                 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDpTrade.php';
                 DoDpTradeCallBack($str3Req);
             } else {
                 if ($class_act == 'DoDwTrade') {
                     require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoDwTrade.php';
                     DoDwTradeCallBack($str3Req);
                 } else {
                     if ($class_act == 'RegisterCreditor') {
                         //投资,登记债权人
                         require_once APP_ROOT_PATH . 'system/collocation/baofoo/RegisterCreditor.php';
                         $ipsdata = RegisterCreditorCallBack($str3Req);
                     } else {
                         if ($class_act == 'DoLoans') {
                             //满标放款
                             require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoLoans.php';
                             DoLoansCallBack($str3Req);
                         } else {
                             if ($class_act == 'DoBids') {
                                 //流标
                                 require_once APP_ROOT_PATH . 'system/collocation/baofoo/DoBids.php';
                                 DoBidsCallBack($str3Req);
                             }
                         }
                     }
                 }
             }
         }
     } else {
         echo "<br/>验签不通过";
         exit;
     }
 }
Ejemplo n.º 19
0
 function _transitparseResult($xmlTransitResult)
 {
     $transitTime = array();
     // Parse XML message returned by the UPS post server.
     $doc = XML_unserialize($xmlTransitResult);
     // Get version. Must be xpci version 1.0001 or this might not work.
     // 1.0001 and 1.0002 seem to be very similar, forget about this for the moment
     /*        $responseVersion = $doc['TimeInTransitResponse']['Response']['TransactionReference']['XpciVersion'];
             if ($this->transitxpci_version != $responseVersion) {
                 $message = MODULE_SHIPPING_UPSXML_RATES_TEXT_COMM_VERSION_ERROR;
                 return $message;
             } */
     // Get response code. 1 = SUCCESS, 0 = FAIL
     $responseStatusCode = $doc['TimeInTransitResponse']['Response']['ResponseStatusCode'];
     if ($responseStatusCode != '1') {
         $errorMsg = $doc['TimeInTransitResponse']['Response']['Error']['ErrorCode'];
         $errorMsg .= ": ";
         $errorMsg .= $doc['TimeInTransitResponse']['Response']['Error']['ErrorDescription'];
         // send email if enabled in the admin section
         if ($this->email_errors) {
             error_log("UPSXML TimeInTransit Error: " . $errorMsg . " experienced by customer with id " . $_SESSION['customer_id'] . " on " . date('Y-m-d H:i:s'), 1, STORE_OWNER_EMAIL_ADDRESS);
         }
         // log errors to file ups_error.log when set
         if ($this->ups_error_file) {
             error_log(date('Y-m-d H:i:s') . "\tTimeInTransit\t" . $errorMsg . "\t" . $_SESSION['customer_id'] . "\n", 3, $this->ups_error_file);
         }
         //  return $errorMsg;
         return false;
     }
     if (isset($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'][0])) {
         // more than one EDD
         foreach ($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'] as $key_index => $service_array) {
             // index by description because that's all we can relate back to the service
             // with (though it can probably return the code as well but they are very
             // different from those used by the Rates Service and there is a lot of
             // duplication so pretty useless)
             $serviceDesc = $service_array['Service']['Description'];
             // hack to get EDD for UPS Saver recognized (Time in Transit uses UPS Worldwide Saver
             // but the service in Rates and Services is called UPS Saver)
             if ($serviceDesc == "UPS Worldwide Saver") {
                 $serviceDesc = "UPS Saver";
             }
             // only date is used so why bother with days and guaranteed?
             // $transitTime[$serviceDesc]["days"] = $serviceSummary[$s]->getValueByPath("EstimatedArrival/BusinessTransitDays");
             $transitTime[$serviceDesc]['date'] = $service_array['EstimatedArrival']['Date'];
             // $transitTime[$serviceDesc]["guaranteed"] = $serviceSummary[$s]->getValueByPath("Guaranteed/Code");
         }
         // end foreach ($doc['TimeInTransitResponse']['ServiceSummary'] etc.
     } elseif (isset($doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary'])) {
         // only one EDD
         $serviceDesc = $doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary']['Service']['Description'];
         $transitTime[$serviceDesc]['date'] = $doc['TimeInTransitResponse']['TransitResponse']['ServiceSummary']['EstimatedArrival']['Date'];
     } else {
         $errorMsg = MODULE_SHIPPING_UPSXML_TIME_IN_TRANSIT_TEXT_NO_RATES;
         if ($this->ups_error_file) {
             error_log(date('Y-m-d H:i:s') . "\tTimeInTransit\t" . $errorMsg . "\t" . $_SESSION['customer_id'] . "\n", 3, $this->ups_error_file);
         }
         return false;
     }
     if ($this->logfile) {
         error_log("------------------------------------------\n", 3, $this->logfile);
         foreach ($transitTime as $desc => $time) {
             error_log("Business Transit: " . $desc . " = " . $time["date"] . "\n", 3, $this->logfile);
         }
     }
     return $transitTime;
 }
Ejemplo n.º 20
0
function QueryForAccBalance($cfg, $user_id, $post_url)
{
    $merchant_id = $cfg['merchant_id'];
    $terminal_id = $cfg['terminal_id'];
    $key = $cfg['key'];
    $iv = $cfg['iv'];
    /* 请求参数 */
    $strxml = "<?xml version='1.0' encoding='UTF-8'?>" . "<custody_req>" . "<merchant_id>" . $merchant_id . "</merchant_id>" . "<user_id>" . $user_id . "</user_id>" . "</custody_req>";
    $strxml = preg_replace("/[\\s]{2,}/", "", $strxml);
    //去除空格、回车、换行等空白符
    $requestParams = str_replace('\\', '', $strxml);
    //去除转义反斜杠\
    $sign = md5($requestParams . "~|~" . $key);
    //$aes=new MyAES();
    //$requestParams=$aes->encrypt($requestParams,$key,$iv); //加密
    //PHP提交POST
    $post_data = array("merchant_id" => $merchant_id, "terminal_id" => $terminal_id, "sign" => $sign, "requestParams" => $requestParams);
    /*
    $baofoo_log = array();
    $baofoo_log['code'] = 'accountBalance';
    $baofoo_log['create_date'] = to_date(TIME_UTC,'Y-m-d H:i:s');
    $baofoo_log['strxml'] =$requestParams;
    $baofoo_log['html'] = print_r($post_data,true);
    $GLOBALS['db']->autoExecute(DB_PREFIX."baofoo_log",$baofoo_log);
    */
    $resultStr = httpRequestPOST($post_url . "custody/accountBalance.do", $post_data);
    //print($result);
    if (empty($resultStr)) {
        $result = array();
        $result['pErrCode'] = 9999;
        $result['pErrMsg'] = '返回出错';
        $result['pIpsAcctNo'] = '';
        $result['pBalance'] = 0;
        $result['pLock'] = 0;
        $result['pNeedstl'] = 0;
    } else {
        require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
        $str3ParaInfo = @XML_unserialize($resultStr);
        //print_r($str3ParaInfo);
        $str3Req = $str3ParaInfo['crs'];
        $sign = $str3Req["sign"];
        $Md5sign = Md5($str3Req["code"] . '~|~' . $str3Req["balance"] . '~|~' . $key);
        if ($sign == $Md5sign) {
            $result = array();
            $result['pErrCode'] = '0000';
            $result['pErrMsg'] = $str3Req["msg"];
            $result['pIpsAcctNo'] = $user_id;
            $result['pBalance'] = $str3Req["balance"];
            $result['pLock'] = 0;
            $result['pNeedstl'] = 0;
            // $str3Req["availableAmount"];
        } else {
            $result = array();
            $result['pErrCode'] = $str3Req["code"];
            $result['pErrMsg'] = '签名验证失败';
            $result['pIpsAcctNo'] = '';
            $result['pBalance'] = 0;
            $result['pLock'] = 0;
            $result['pNeedstl'] = 0;
        }
    }
    return $result;
    /*
    * <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <response platformNo="10040011137">
        <code>1</code>
        <description>操作成功</description>
        <memberType>PERSONAL</memberType>
        <activeStatus>ACTIVATED</activeStatus>
        <balance>9980.98</balance>
        <availableAmount>9980.98</availableAmount>
        <freezeAmount>0.00</freezeAmount>
        <cardNo>********5512</cardNo>
        <cardStatus>VERIFIED</cardStatus>
        <bank>CCB</bank>
        <autoTender>false</autoTender>
    </response>
    */
}
Ejemplo n.º 21
0
$password = '******';
$dbms = 'asteriskvoip';
/*mysql_connect($host,$username,$password) or die ('Error connecting to mysql');
mysql_select_db($dbms); */
$db_voip = new mysqli($host, $username, $password, $dbms);
#$dbserver = "10.10.26.134";
$dbserver = "cluster-db.crfsqbh1kkpg.us-west-2.rds.amazonaws.com";
$dbuser = "******";
$dbpass = "******";
$dbdata = "voicechanger_web";
$db2 = new mysqli($dbserver, $dbuser, $dbpass, $dbdata);
$rxml = urldecode($rxml);
$db->logfile("voicechanger; {$rxml} ;");
if (trim($rxml) != '') {
    $rxml = str_replace('XMLDATA=', '', $rxml);
    $pxml = XML_unserialize($rxml);
    $partner = $pxml['GetSmsService']['Header']['Account'];
    $transid = $pxml['GetSmsService']['GetSmsList']['GetSms']['TransactionID'];
    $originator = $pxml['GetSmsService']['GetSmsList']['GetSms']['OriginatingNumber'];
    $datetime = $pxml['GetSmsService']['GetSmsList']['GetSms']['DateTime'];
    $body = $pxml['GetSmsService']['GetSmsList']['GetSms']['Body'];
    $csc = $pxml['GetSmsService']['GetSmsList']['GetSms']['Shortcode'];
    $carrier = $pxml['GetSmsService']['GetSmsList']['GetSms']['Carrier'];
    # SAMPLE DATA #
    #$csc = 56474;
    #$originator = "16503916605";
    #$body = "VC 16503916606";
    $receiver = trim(preg_replace('/[^0-9]/', "", $body));
    if (is_numeric($receiver) && (strlen((string) $receiver) == 11 || strlen((string) $receiver) == 10)) {
        if (strlen((string) $receiver) == 11) {
            $receiver = substr($receiver, 1);
Ejemplo n.º 22
0
function GetListByItemID($token, $itemid, $account)
{
    global $dbcon, $devID, $appID, $certID, $serverUrl, $siteID, $detailLevel, $compatabilityLevel;
    $user = '******';
    $verb = 'GetItem';
    $requestXmlBody = '<?xml version="1.0" encoding="utf-8"?>
								<GetItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">
								<RequesterCredentials>
									<eBayAuthToken>' . $token . '</eBayAuthToken>
								</RequesterCredentials>
								<ItemID>' . $itemid . '</ItemID>
								<WarningLevel>High</WarningLevel>
								</GetItemRequest>';
    $session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
    $responseXml = $session->sendHttpRequest($requestXmlBody);
    if (stristr($responseXml, 'HTTP 404') || $responseXml == '') {
        return 'id not found';
    }
    $responseDoc = new DomDocument();
    $responseDoc->loadXML($responseXml);
    $data = XML_unserialize($responseXml);
    //print_r($data);
    $Ack = $data['GetItemResponse']['Ack'];
    if ($Ack == 'Success') {
        $result = $data['GetItemResponse']['Item'];
        $ViewItemURL = $result['ListingDetails']['ViewItemURL'];
        $main_QuantitySold = $result['SellingStatus']['QuantitySold'];
        $main_Quantity = $result['Quantity'];
        $Title = $result['Title'];
        $main_SKU = $result['SKU'];
        $ListingType = $result['ListingType'];
        $StartPrice = $result['StartPrice'];
        $main_QuantityAvailable = $main_Quantity - $main_QuantitySold;
        $StartPricecurrencyID = $result['BuyItNowPrice attr']['currencyID'];
        $ShippingCost = $result['ShippingDetails']['ShippingServiceOptions']['ShippingServiceCost'];
        $Site = $result['Site'];
        echo '运费:' . $ShippingCost . "\n";
        $pos = strpos($main_SKU, ':');
        if ($pos === false) {
            $realsku = str_pad($main_SKU, 3, '0', STR_PAD_LEFT);
        } else {
            $realsku = substr($main_SKU, 0, $pos);
        }
        $sql = "select id from ebay_list where ItemID='{$itemid}' and ebay_account ='{$account}' ";
        $sql = $dbcon->execute($sql);
        $sql = $dbcon->getResultArray($sql);
        if (count($sql) == 1) {
            $del = "delete from ebay_list where ItemID='{$itemid}'";
            $dbcon->execute($del);
        }
        $main_list = "insert into ebay_list(status,ItemID,ViewItemURL,QuantitySold,Quantity,Title,SKU,realSKU,ListingType,StartPrice,ebay_account,ebay_user,QuantityAvailable,StartPricecurrencyID,ShippingCost,Site) value('0','{$itemid}','{$ViewItemURL}','{$main_QuantitySold}','{$main_Quantity}','{$Title}','{$main_SKU}','{$realsku}','{$ListingType}','{$StartPrice}','{$account}','{$user}','{$main_QuantityAvailable}','{$StartPricecurrencyID}','{$ShippingCost}','{$Site}')";
        //echo $main_list."\n";
        if ($dbcon->execute($main_list)) {
            echo $itemid . '同步成功' . "\n";
            $Variations = $result['Variations']['Variation'];
            if ($Variations != '') {
                for ($i = 0; $i < count($Variations); $i++) {
                    $SKU = $Variations[$i]['SKU'];
                    $Quantity = $Variations[$i]['Quantity'];
                    $StartPrice = $Variations[$i]['StartPrice'];
                    $QuantitySold = $Variations[$i]['SellingStatus']['QuantitySold'];
                    $tjstr = '';
                    $VariationSpecifics = $Variations[$i]['VariationSpecifics'];
                    if ($VariationSpecifics != '') {
                        $NameValueList = $Variations[$i]['VariationSpecifics']['NameValueList']['Name'];
                        if ($NameValueList != '') {
                            $NameValueList = array();
                            $NameValueList[0] = $Variations[$i]['VariationSpecifics']['NameValueList'];
                        }
                        for ($n = 0; $n < count($NameValueList); $n++) {
                            $Nname = $NameValueList[$n]['Name'];
                            $Nvalue = $NameValueList[$n]['Value'];
                            $tjstr .= $Nname . '**' . $Nvalue . '++';
                        }
                        $tjstr = mysql_real_escape_string($tjstr);
                    }
                    $QuantityAvailable = $Quantity - $QuantitySold;
                    $sel = "select id from ebay_listvariations where ebay_account='{$account}' and itemid='{$itemid}' and SKU='{$SKU}' ";
                    $sel = $dbcon->execute($sel);
                    $sel = $dbcon->getResultArray($sel);
                    if (count($sel) != 0) {
                        $d_del = "delete from ebay_listvariations where itemid='{$itemid}'";
                        $dbcon->execute($d_del);
                    }
                    $detail_list = "insert into ebay_listvariations(SKU,Quantity,StartPrice,itemid,ebay_account,QuantitySold,QuantityAvailable,VariationSpecifics) values('{$SKU}','{$Quantity}','{$StartPrice}','{$itemid}','{$account}','{$QuantitySold}','{$QuantityAvailable}','{$tjstr}')";
                    //echo $detail_list."\n";
                    $dbcon->execute($detail_list);
                }
            }
        } else {
            echo $itemid . '同步失败<br>';
        }
    }
}
 function checkPayment()
 {
     $result = $this->sendToHost('www.mollie.nl', '/xml/micropayment/', 'a=check' . '&servicenumber=' . urlencode($this->servicenumber) . '&paycode=' . urlencode($this->paycode));
     if (!$result) {
         return false;
     }
     list($headers, $xml) = preg_split("/(\r?\n){2}/", $result, 2);
     $data = XML_unserialize($xml);
     $this->payed = $data['response']['item']['payed'] == 'true';
     $this->durationdone = isset($data['response']['item']['durationdone']) ? $data['response']['item']['durationdone'] : '';
     $this->durationleft = isset($data['response']['item']['durationleft']) ? $data['response']['item']['durationleft'] : '';
     $this->paystatus = $data['response']['item']['paystatus'];
     $this->amount = $data['response']['item']['amount'];
     $this->duration = isset($data['response']['item']['duration']) ? $data['response']['item']['duration'] : '';
     $this->mode = $data['response']['item']['mode'];
     $this->costperminute = isset($data['response']['item']['costperminute']) ? $data['response']['item']['costperminute'] : '';
     $this->costpercall = isset($data['response']['item']['costpercall']) ? $data['response']['item']['costpercall'] : '';
     $this->currency = $data['response']['item']['currency'];
     return $this->payed;
 }
Ejemplo n.º 24
0
    public function markAsRead($messageid, $type = 'Read', $flag = '')
    {
        //return TRUE;
        $msg_obj = new messageModel();
        $msginof = $msg_obj->getMessageInfo(array($messageid));
        $verb = 'ReviseMyMessages';
        global $devID, $appID, $certID, $serverUrl, $siteID, $compatabilityLevel, $mctime, $userToken;
        $xmlRequest = '<?xml version="1.0" encoding="utf-8"?>
			<ReviseMyMessagesRequest xmlns="urn:ebay:apis:eBLBaseComponents">
  			<WarningLevel>High</WarningLevel>
  			<MessageIDs>
    		<MessageID>' . $msginof[0]['message_id'] . '</MessageID>
  			</MessageIDs>
        ';
        $xmlRequest .= '<Read>true</Read>';
        $xmlRequest .= '
  			<RequesterCredentials>
    		<eBayAuthToken>' . $userToken . '</eBayAuthToken>
  			</RequesterCredentials>
  			<WarningLevel>High</WarningLevel>
			</ReviseMyMessagesRequest>
			';
        $session = new eBaySession($userToken, $devID, $appID, $certID, $serverUrl, $compatabilityLevel, $siteID, $verb);
        $responseXml = $session->sendHttpRequest($xmlRequest);
        //echo $responseXml;exit;
        if (stristr($responseXml, 'HTTP 404') || $responseXml == '' || $responseXml === FALSE) {
            self::$errCode = 9001;
            self::$sender = $msginof[0]['replyuser_id'];
            self::$errMsg = __METHOD__ . '发送请求失败! in line ' . __LINE__;
            self::$sendMsg = __METHOD__ . '发送请求失败! in line ' . __LINE__;
            return FALSE;
        }
        $data = XML_unserialize($responseXml);
        //print_r($data);
        $ack = $data['ReviseMyMessagesResponse'];
        $ack = $ack['Ack'];
        if ($ack == 'Success') {
            return TRUE;
        } else {
            self::$sender = $msginof[0]['replyuser_id'];
            self::$errMsg = $xmlRequest . '-----' . $responseXml . __LINE__ . "\n";
            $obj_return = simplexml_load_string($responseXml);
            if ($obj_return && isset($obj_return->Errors->LongMessage)) {
                self::$sendMsg = 'MSGID:' . $msginof[0]['message_id'] . '发送人:' . $msginof[0]['sendid'] . ' ++++ 原因 :' . $obj_return->Errors->LongMessage;
            } else {
                self::$sendMsg = 'MSGID:' . $msginof[0]['message_id'] . '发送人:' . $msginof[0]['sendid'] . ' ++++ ' . '原因未知';
            }
            return FALSE;
        }
    }
 function fetch_request($request)
 {
     global $CFG;
     make_upload_directory('/cache/youtube');
     $cache = new RSSCache($CFG->dataroot . '/cache/youtube', YOUTUBE_CACHE_EXPIRATION);
     $cache_status = $cache->check_cache($request);
     if ($cache_status == 'HIT') {
         $cached_response = $cache->get($request);
         $xmlobj = XML_unserialize($cached_response);
         return $this->render_video_list($xmlobj);
     }
     if ($cache_status == 'STALE') {
         $cached_response = $cache->get($request);
     }
     $response = download_file_content($request);
     if (empty($response)) {
         $response = $cached_response;
     } else {
         $cache->set($request, $response);
     }
     $xmlobj = XML_unserialize($response);
     return $this->render_video_list($xmlobj);
 }
Ejemplo n.º 26
0
 function notify($request, $class_act)
 {
     $pMerCode = $request["pMerCode"];
     $pErrCode = $request["pErrCode"];
     $pErrMsg = $request["pErrMsg"];
     $p3DesXmlPara = $request["p3DesXmlPara"];
     $pSign = $request["pSign"];
     $signPlainText = $pMerCode . $pErrCode . $pErrMsg . $p3DesXmlPara . $this->cert_md5;
     $localSign = md5($signPlainText);
     if ($localSign == $pSign) {
         //echo "<br/>验签通过";
         $Crypt3Des = new Crypt3Des();
         //new 3des class
         $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara);
         //3des解密
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($str3XmlParaInfo);
         $str3Req = $str3ParaInfo['pReq'];
         //
         if ($class_act == 'CreateNewAcct') {
             require_once APP_ROOT_PATH . 'system/collocation/ips/CreateNewAcct.php';
             CreateNewAcctCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
         } else {
             if ($class_act == 'RegisterSubject') {
                 require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterSubject.php';
                 RegisterSubjectCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                 //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
             } else {
                 if ($class_act == 'RegisterCreditor') {
                     require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCreditor.php';
                     RegisterCreditorCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                     //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
                 } else {
                     if ($class_act == 'RegisterCretansfer') {
                         require_once APP_ROOT_PATH . 'system/collocation/ips/RegisterCretansfer.php';
                         RegisterCretansferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                         //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
                     } else {
                         if ($class_act == 'GuaranteeUnfreeze') {
                             require_once APP_ROOT_PATH . 'system/collocation/ips/GuaranteeUnfreeze.php';
                             GuaranteeUnfreezeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                             //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
                         } else {
                             if ($class_act == 'RepaymentNewTrade') {
                                 require_once APP_ROOT_PATH . 'system/collocation/ips/RepaymentNewTrade.php';
                                 RepaymentNewTradeCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                 //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
                             } else {
                                 if ($class_act == 'Transfer') {
                                     require_once APP_ROOT_PATH . 'system/collocation/ips/Transfer.php';
                                     TransferCallBack($pMerCode, $pErrCode, $pErrMsg, $str3Req);
                                     //showSuccess($pErrMsg,0,SITE_DOMAIN.APP_ROOT);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     } else {
         echo "<br/>验签不通过:{$localSign}<br/>";
         $Crypt3Des = new Crypt3Des();
         //new 3des class
         $str3XmlParaInfo = $Crypt3Des->DESDecrypt($p3DesXmlPara);
         //3des解密
         print_r($str3XmlParaInfo);
         require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
         $str3ParaInfo = @XML_unserialize($str3XmlParaInfo);
         print_r($str3ParaInfo);
         exit;
     }
 }
Ejemplo n.º 27
0
function RepaymentNewTradeCallBack($str3Req, $platformNo, $post_url)
{
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=Yeepay&class_act=RepaymentRepayCallBack&from=" . $_REQUEST['from'];
    //s2s方式返回
    $requestNo = $str3Req["requestNo"];
    $where = " requestNo = '" . $requestNo . "'";
    $sql = "update " . DB_PREFIX . "yeepay_cp_transaction set is_callback = 1 where is_callback = 0 and " . $where;
    $GLOBALS['db']->query($sql);
    if ($str3Req["code"] == "1") {
        //操作成功
        $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $str3Req, 'UPDATE', $where);
        $ipsdata = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "yeepay_cp_transaction where " . $where);
        $deal_id = intval($ipsdata['tenderOrderNo']);
        $deal_repay_id = intval($ipsdata['deal_repay_id']);
        if ($str3Req['code'] == '1') {
            //确认转账
            $data = array();
            $data['requestNo'] = $requestNo;
            //请求流水号
            $data['platformNo'] = $platformNo;
            // 商户编号
            $data['mode'] = "CONFIRM";
            /* 请求参数 */
            $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo=\"" . $data['platformNo'] . "\">" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<mode>" . $data['mode'] . "</mode>" . "<notifyUrl><![CDATA[" . $pS2SUrl . "]]></notifyUrl>" . "</request>";
            /* 签名数据 */
            $sign = "xxxx";
            /* 调用账户查询服务 */
            $service = "COMPLETE_TRANSACTION";
            $yeepay_log = array();
            $yeepay_log['code'] = 'bhaController';
            $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
            $yeepay_log['strxml'] = $req;
            $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
            $ch = curl_init($post_url . "/bhaexter/bhaController");
            curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
            $resultStr = curl_exec($ch);
            if (empty($resultStr)) {
                $result = array();
                $result['pErrCode'] = 9999;
                $result['pErrMsg'] = '返回出错';
                $result['pIpsAcctNo'] = '';
                $result['pBalance'] = 0;
                $result['pLock'] = 0;
                $result['pNeedstl'] = 0;
            } else {
                require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
                $str3ParaInfo = @XML_unserialize($resultStr);
                //print_r($str3ParaInfo);exit;
                $str3Req = $str3ParaInfo['response'];
                $result = array();
                $result['pErrCode'] = $str3Req["code"];
                $result['pErrMsg'] = $str3Req["description"];
                //$result['pIpsAcctNo'] = $user_id;
                $yeepay_log = array();
                $yeepay_log['code'] = 'response';
                $yeepay_log['create_date'] = to_date(TIME_UTC, 'Y-m-d H:i:s');
                $yeepay_log['strxml'] = $resultStr;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
                if ($str3Req["code"] == '1') {
                    $platformNo = $str3Req["platformNo"];
                    $where = " requestNo = '" . $requestNo . "'";
                    $sql = "update " . DB_PREFIX . "yeepay_cp_transaction set is_complete_transaction = 1 where is_callback = 1 and " . $where;
                    $GLOBALS['db']->query($sql);
                    $sql = "select * from " . DB_PREFIX . "yeepay_cp_transaction_detail where deal_load_repay_id > 0 and pid = " . $ipsdata['id'];
                    $list = $GLOBALS['db']->getAll($sql);
                    foreach ($list as $k => $v) {
                        $load_repay = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal_load_repay where id = " . $v['deal_load_repay_id']);
                        $detail = array();
                        $detail['repay_manage_impose_money'] = $v["repay_manage_impose_money"];
                        //平台收取 借款者 的管理费逾期罚息
                        $detail['impose_money'] = $v["impose_money"];
                        //投资者收取 借款者 的逾期罚息
                        $detail['status'] = $v["repay_status"];
                        //还款状态
                        $detail['true_repay_time'] = $v["true_repay_time"];
                        //还款时间
                        $detail['true_repay_date'] = to_date($v["true_repay_time"]);
                        $detail['has_repay'] = 1;
                        //0未收到还款,1已收到还款
                        $detail['true_manage_money'] = $load_repay['manage_money'];
                        $detail['true_manage_interest_money'] = $load_repay["manage_interest_money"];
                        $detail['true_repay_manage_money'] = $load_repay["repay_manage_money"];
                        $detail['true_repay_money'] = $load_repay["repay_money"];
                        $detail['true_self_money'] = $load_repay['self_money'];
                        $detail['true_interest_money'] = $load_repay['interest_money'];
                        $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_load_repay", $detail, 'UPDATE', " has_repay = 0 and id = " . intval($v['deal_load_repay_id']));
                    }
                    require_once APP_ROOT_PATH . "app/Lib/deal_func.php";
                    //更新用户回款计划
                    $deal_id = $GLOBALS['db']->getOne("select tenderOrderNo from " . DB_PREFIX . "yeepay_cp_transaction where id = " . $ipsdata['id']);
                    syn_deal_repay_status($deal_id, $deal_repay_id);
                    return;
                }
            }
            return 1;
        } else {
            return 1;
        }
    }
}
Ejemplo n.º 28
0
/**
 * 标的登记 及 流标
 * @param int $deal_id
 * @param int $pOperationType 标的操作类型,1:新增,2:结束 “新增”代表新增标的,“结束”代表标的正常还清、丌 需要再还款戒者标的流标等情况。标的“结束”后,投资 人投标冻结金额、担保方保证金、借款人保证金均自劢解 冻
 * @param int $status; 0:新增; 2:流标结束
 * @param string $status_msg 主要是status_msg=2时记录的,流标原因
 * @param unknown_type $platformNo
 * @param unknown_type $post_url
 * @return string
 */
function DoBids($deal_id, $pOperationType, $status, $status_msg, $platformNo, $post_url, $sys = 'pc')
{
    $pWebUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=response&class_name=yeepay&class_act=DoBids";
    //web方式返回
    $pS2SUrl = SITE_DOMAIN . APP_ROOT . "/index.php?ctl=collocation&act=notify&class_name=yeepay&class_act=DoBids";
    //s2s方式返回
    //$requestNo = $GLOBALS['db']->getOne("select * from ".DB_PREFIX."yeepay_cp_transaction where is_callback = 1 and code = 1 and tenderOrderNo = '".$deal_id."'");
    $deal = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "deal where id = " . $deal_id);
    if ($deal['type'] == 3) {
        $t_arr = $GLOBALS['db']->getAll("select ycp.*,dorder.type as order_type,dorder.progress as order_progress,dorder.deal_id,dorder.user_id from " . DB_PREFIX . "yeepay_cp_transaction as ycp left join " . DB_PREFIX . "deal_order as dorder on dorder.requestNo=ycp.requestNo where ycp.is_callback = 1 and ycp.tenderId = " . $deal_id . " and ycp.bizType = 'TENDER' and   ycp.is_complete_transaction = 0");
    } else {
        $t_arr = $GLOBALS['db']->getAll("select ycp.*,dorder.type as order_type,dorder.progress as order_progress,dorder.deal_id,dorder.user_id from " . DB_PREFIX . "yeepay_cp_transaction as ycp left join " . DB_PREFIX . "deal_order as dorder on dorder.requestNo=ycp.requestNo where ycp.is_callback = 1 and ycp.tenderId = " . $deal_id . " and ycp.bizType = 'TENDER' and   ycp.is_complete_transaction = 0");
    }
    $err_count = 0;
    foreach ($t_arr as $k => $v) {
        $data = array();
        $data['requestNo'] = $v["requestNo"];
        //请求流水号
        $data['platformNo'] = $platformNo;
        // 商户编号
        $data['mode'] = "CANCEL";
        /* 请求参数 */
        $req = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" . "<request platformNo=\"" . $platformNo . "\">" . "<requestNo>" . $data['requestNo'] . "</requestNo>" . "<mode>" . $data['mode'] . "</mode>" . "<notifyUrl><![CDATA[" . $pS2SUrl . "]]></notifyUrl>" . "</request>";
        /* 签名数据 */
        $sign = cfca($req);
        $yeepay_log = array();
        $yeepay_log['code'] = 'COMPLETE_TRANSACTION';
        $yeepay_log['create_date'] = to_date(NOW_TIME, 'Y-m-d H:i:s');
        $yeepay_log['strxml'] = $req;
        $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_log", $yeepay_log);
        //$id = $GLOBALS['db']->insert_id();
        /* 调用账户查询服务 */
        $service = "COMPLETE_TRANSACTION";
        $ch = curl_init($post_url . "/bhaexter/bhaController");
        curl_setopt_array($ch, array(CURLOPT_POST => TRUE, CURLOPT_RETURNTRANSFER => TRUE, CURLOPT_SSL_VERIFYPEER => 0, CURLOPT_SSL_VERIFYHOST => 0, CURLOPT_POSTFIELDS => 'service=' . $service . '&req=' . rawurlencode($req) . "&sign=" . rawurlencode($sign)));
        $resultStr = curl_exec($ch);
        if (empty($resultStr)) {
            $err_count++;
        } else {
            require_once APP_ROOT_PATH . 'system/collocation/ips/xml.php';
            $str3ParaInfo = @XML_unserialize($resultStr);
            $str3Req = $str3ParaInfo['response'];
            $result['pErrCode'] = $str3Req["code"];
            $result['pErrMsg'] = $str3Req["description"];
            if ($str3Req["code"] == 1) {
                $requestNo = $v["requestNo"];
                $t_data = array();
                $t_data["is_complete_transaction"] = 2;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "yeepay_cp_transaction", $t_data, 'UPDATE', " requestNo = '" . $requestNo . "'");
                $deal_load = array();
                $deal_load['is_complete_transaction'] = 2;
                //2#退款成功
                $deal_load['is_refund'] = 1;
                $where = " requestNo = " . $requestNo;
                $GLOBALS['db']->autoExecute(DB_PREFIX . "deal_order", $deal_load, 'UPDATE', $where);
                if ($GLOBALS['db']->affected_rows()) {
                    deal_order_progress($v['deal_id'], $v['user_id'], 4);
                }
            }
        }
    }
    //showIpsInfo('同步成功',"");
}
Ejemplo n.º 29
0
function wangguard_conf()
{
    global $wpdb;
    global $wangguard_nonce, $wangguard_api_key;
    if (!current_user_can('level_10')) {
        die(__('Cheatin&#8217; uh?', 'wangguard'));
    }
    $key_status = "";
    $selectedTab = 0;
    if (isset($_POST['submit'])) {
        check_admin_referer($wangguard_nonce);
        $key = preg_replace('/[^a-h0-9]/i', '', $_POST['key']);
        if (empty($key)) {
            $key_status = 'empty';
            $ms[] = 'new_key_empty';
            wangguard_update_option('wangguard_api_key', "");
        } else {
            $key_status = wangguard_verify_key($key);
        }
        if ($key_status == 'valid') {
            wangguard_update_option('wangguard_api_key', $key);
            $ms[] = 'new_key_valid';
        } else {
            if ($key_status == 'invalid') {
                $ms[] = 'new_key_invalid';
            } else {
                if ($key_status == 'failed') {
                    $ms[] = 'new_key_failed';
                }
            }
        }
    } elseif (isset($_POST['saveblockeddomain'])) {
        echo "<div id='wangguard-warning' class='updated fade'><p><strong>" . __('Blocked domains has been saved.', 'wangguard') . "</strong></p></div>";
        $selectedDomains = array();
        if (is_array($_POST['domains'])) {
            foreach ($_POST['domains'] as $domain) {
                $selectedDomains[$domain] = true;
            }
        }
        wangguard_update_option('blocked-list-domains', $selectedDomains);
        $selectedTab = 3;
    } elseif (isset($_POST['check'])) {
        wangguard_get_server_connectivity(0);
        $selectedTab = 4;
    } elseif (isset($_POST['optssave'])) {
        wangguard_update_option('wangguard-expertmode', @$_POST['wangguardexpertmode'] == '1' ? 1 : 0);
        wangguard_update_option('wangguard-report-posts', @$_POST['wangguardreportposts'] == '1' ? 1 : 0);
        wangguard_update_option('wangguard-delete-users-on-report', @$_POST['wangguard-delete-users-on-report'] == '1' ? 1 : -1);
        wangguard_update_option('wangguard-enable-bp-report-btn', @$_POST['wangguardenablebpreportbtn'] == '1' ? 1 : -1);
        wangguard_update_option('wangguard-enable-bp-report-blog', @$_POST['wangguardenablebpreportblog'] == '1' ? 1 : -1);
        wangguard_update_option('wangguard-verify-gmail', @$_POST['wangguard-verify-gmail'] == '1' ? 1 : 0);
        wangguard_update_option('wangguard_disable-meta-header', @$_POST['wangguard_disable-meta-header'] == '1' ? 1 : 0);
        wangguard_update_option('wangguard-verify-dns-mx', @$_POST['wangguard-verify-dns-mx'] == '1' ? 1 : 0);
        wangguard_update_option('wangguard-do-not-check-client-ip', @$_POST['wangguard-do-not-check-client-ip'] == '1' ? 1 : 0);
        $selectedTab = 2;
        echo "<div id='wangguard-warning' class='updated fade'><p><strong>" . __('WangGuard settings has been saved.', 'wangguard') . "</strong></p></div>";
    }
    if ($key_status != 'valid') {
        $key = wangguard_get_option('wangguard_api_key');
        if (empty($key)) {
            if ($key_status != 'failed') {
                if (wangguard_verify_key('1234567890ab') == 'failed') {
                    $ms[] = 'no_connection';
                } else {
                    $ms[] = 'key_empty';
                }
            }
            $key_status = 'empty';
        } else {
            $key_status = wangguard_verify_key($key);
        }
        if ($key_status == 'valid') {
            $ms[] = 'key_valid';
        } else {
            if ($key_status == 'invalid') {
                delete_option('wangguard_api_key');
                $ms[] = 'key_empty';
            } else {
                if (!empty($key) && $key_status == 'failed') {
                    $ms[] = 'key_failed';
                }
            }
        }
    }
    $messages = array('new_key_empty' => array('class' => 'wangguard-info', 'text' => __('Your key has been cleared.', 'wangguard')), 'new_key_valid' => array('class' => 'wangguard-info wangguard-success', 'text' => __('Your key has been verified!', 'wangguard')), 'new_key_invalid' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key you entered is invalid. Please double-check it.', 'wangguard')), 'new_key_failed' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key you entered could not be verified because a connection to wangguard.com could not be established. Please check your server configuration.', 'wangguard')), 'no_connection' => array('class' => 'wangguard-info wangguard-error', 'text' => __('There was a problem connecting to the WangGuard server. Please check your server configuration.', 'wangguard')), 'key_empty' => array('class' => 'wangguard-info', 'text' => sprintf(__('Please enter an API key. (<a href="%s" style="color:#fff">Get your key here.</a>)', 'wangguard'), 'http://wangguard.com/getapikey')), 'key_valid' => array('class' => 'wangguard-info wangguard-success', 'text' => __('This key is valid.', 'wangguard')), 'key_failed' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key below was previously validated but a connection to wangguard.com can not be established at this time. Please check your server configuration.', 'wangguard')));
    wp_enqueue_script("jquery-ui-tabs");
    wp_print_scripts("jquery-ui-tabs");
    ?>


<?php 
    if (!empty($_POST['submit'])) {
        ?>
<div id="message" class="updated fade"><p><strong><?php 
        _e('Options saved.', 'wangguard');
        ?>
</strong></p></div>
<?php 
    }
    ?>


<div class="wrap">
	<div class="icon32" id="icon-wangguard"><br></div>
	<h2><?php 
    _e('WangGuard Configuration', 'wangguard');
    ?>
</h2>
	<div class="">


		<div id="wangguard-conf-tabs">
			<ul id="wangguard-tabs">
				<li><a href="#wangguard-conf-apikeys"><?php 
    _e('WangGuard API Key', 'wangguard');
    ?>
</a></li>
				<li><a href="#wangguard-conf-questions"><?php 
    _e('Security questions', 'wangguard');
    ?>
</a></li>
				<li><a href="#wangguard-conf-settings"><?php 
    _e('WangGuard settings', 'wangguard');
    ?>
</a></li>
				<li><a href="#wangguard-conf-domains"><?php 
    _e('Blocked domains', 'wangguard');
    ?>
</a></li>
				<li><a href="#wangguard-conf-conectivity"><?php 
    _e('Server Connectivity', 'wangguard');
    ?>
</a></li>
			</ul>
			<div id="wangguard-tabs-container">
				

			<!--WANGGUARD API KEY-->
			<div id="wangguard-conf-apikeys">
					<div class="wangguard-confico"><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wangguard/img/apikey.png" alt="<?php 
    echo htmlentities(__('WangGuard API Key', 'wangguard'));
    ?>
" /></div>
				<form action="" method="post" id="wangguard-conf" style="margin: auto;">
					<p><?php 
    printf(__('For many people, <a href="%1$s">WangGuard</a> will greatly reduce or even completely eliminate the Sploggers you get on your site. If one does happen to get through, simply mark it as Splogger on the Users screen. If you don\'t have an API key yet, <a href="%2$s" target="_new">get one here</a>.', 'wangguard'), 'http://wangguard.com/', 'http://wangguard.com/getapikey');
    ?>
</p>

					<h3><label for="key"><?php 
    _e('WangGuard API Key', 'wangguard');
    ?>
</label></h3>
					<?php 
    foreach ($ms as $m) {
        ?>
						<p class="<?php 
        echo $messages[$m]['class'];
        ?>
"><?php 
        echo $messages[$m]['text'];
        ?>
</p>
					<?php 
    }
    ?>
					<p><input id="key" name="key" type="text" size="35" maxlength="32" value="<?php 
    echo wangguard_get_option('wangguard_api_key');
    ?>
" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php 
    _e('<a href="http://wangguard.com/faq" target="_new">What is this?</a>', 'wangguard');
    ?>
)</p>

					<?php 
    if ($key_status == 'invalid') {
        ?>
						<h3><?php 
        _e('Why might my key be invalid?', 'wangguard');
        ?>
</h3>
						<p><?php 
        _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the WangGuard servers, which is most often caused by an issue with your web host around firewalls or similar.', 'wangguard');
        ?>
</p>
					<?php 
    }
    ?>


					<?php 
    wangguard_nonce_field($wangguard_nonce);
    ?>

					<p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php 
    _e('Update options &raquo;', 'wangguard');
    ?>
" /></p>
				</form>
			</div>



			<!--WANGGUARD QUESTIONS-->
			<div id="wangguard-conf-questions" style="margin: auto;">

				<div class="wangguard-confico"><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wangguard/img/security.png" alt="<?php 
    echo htmlentities(__('Security questions', 'wangguard'));
    ?>
" /></div>
				
				<h3><?php 
    _e('Security questions', 'wangguard');
    ?>
</h3>
				<p><?php 
    _e('Security questions are randomly asked on the registration form to prevent automated signups.', 'wangguard');
    ?>
</p>
				<p><?php 
    _e('Security questions are optional, it\'s up to you whether to use them or not.', 'wangguard');
    ?>
</p>
				<p><?php 
    _e('Create you own security questions from the form below, or delete the questions you don\'t want anymore.', 'wangguard');
    ?>
</p>
				<?php 
    $table_name = $wpdb->base_prefix . "wangguardquestions";
    $wgquestRs = $wpdb->get_results("select * from {$table_name} order by id");
    ?>
				
				<h4><?php 
    _e('Existing security questions', 'wangguard');
    ?>
</h4>				
				
				<?php 
    if (empty($wgquestRs)) {
        ?>
<div id="wangguard-question-noquestion"><?php 
        _e('No security questions created yet', 'wangguard');
        ?>
</div><?php 
    }
    foreach ($wgquestRs as $question) {
        ?>
					<div class="wangguard-question" id="wangguard-question-<?php 
        echo $question->id;
        ?>
">
					<?php 
        _e("Question", 'wangguard');
        ?>
: <strong><?php 
        echo $question->Question;
        ?>
</strong><br/>
					<?php 
        _e("Answer", 'wangguard');
        ?>
: <strong><?php 
        echo $question->Answer;
        ?>
</strong><br/>
					<?php 
        _e("Replied OK / Wrong", 'wangguard');
        ?>
: <strong><?php 
        echo $question->RepliedOK;
        ?>
 / <?php 
        echo $question->RepliedWRONG;
        ?>
</strong><br/>
					<a href="javascript:void(0)" rel="<?php 
        echo $question->id;
        ?>
" class="wangguard-delete-question"><?php 
        _e('delete question', 'wangguard');
        ?>
</a>
					</div>
				<?php 
    }
    ?>
				<div id="wangguard-new-question-container">
				</div>

				<h4><?php 
    _e('Add a new security question', 'wangguard');
    ?>
</h4>
				<?php 
    _e("Question", 'wangguard');
    ?>
<br/><input type="text" name="wangguardnewquestion" id="wangguardnewquestion" class="wangguard-input" maxlength="255" value="" />
				<br/><br style="line-height: 5px"/>
				<?php 
    _e("Answer", 'wangguard');
    ?>
<br/><input type="text" name="wangguardnewquestionanswer" id="wangguardnewquestionanswer" class="wangguard-input" maxlength="50" value="" />
				<div id="wangguardnewquestionerror">
					<?php 
    _e('Fill in both the question and the answer fields to create a new security question', 'wangguard');
    ?>
				</div>
				<p class="submit"><input type="button" id="wangguardnewquestionbutton" class="button-primary" name="submit" value="<?php 
    _e('Create question &raquo;', 'wangguard');
    ?>
" /></p>
			</div>


			
			


			<!--WANGGUARD SETTINGS-->
			<div id="wangguard-conf-settings" style="margin: auto;">
				
				<div class="wangguard-confico"><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wangguard/img/settings.png" alt="<?php 
    echo htmlentities(__('WangGuard settings', 'wangguard'));
    ?>
" /></div>
				
				<?php 
    $wangguard_edit_prefix = "";
    if (function_exists('is_network_admin')) {
        if (is_network_admin()) {
            $wangguard_edit_prefix = "../";
        }
    }
    ?>
				<form action="" method="post" id="wangguard-settings" style="margin:0px auto 0 auto; ">
					<h3><?php 
    _e("WangGuard settings", 'wangguard');
    ?>
</h3>
					<p>
						<input type="checkbox" name="wangguardreportposts" id="wangguardreportposts" value="1" <?php 
    echo wangguard_get_option("wangguard-report-posts") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguardreportposts"><?php 
    _e(sprintf("<strong>Allow reporting users from Posts admin screen.</strong><br/>By checking this option a new link to report a post's author will be added for each post on the <a href=\"%s\">Posts admin screen</a>.", $wangguard_edit_prefix . "edit.php"), 'wangguard');
    ?>
</label>
					</p>
					<p>
						<input type="checkbox" name="wangguard-delete-users-on-report" id="wangguard-delete-users-on-report" value="1" <?php 
    echo wangguard_get_option("wangguard-delete-users-on-report") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguard-delete-users-on-report"><?php 
    _e("<strong>Delete users when reporting them to WangGuard.</strong><br/>By checking this option, the users you report as Sploggers will be deleted from your site.", 'wangguard');
    ?>
</label>
					</p>
					
					<?php 
    if (defined('BP_VERSION')) {
        ?>
					<p>
						<input type="checkbox" name="wangguardenablebpreportbtn" id="wangguardenablebpreportbtn" value="1" <?php 
        echo wangguard_get_option("wangguard-enable-bp-report-btn") == '1' ? 'checked' : '';
        ?>
 />
						<label for="wangguardenablebpreportbtn"><?php 
        _e("<strong>Show the 'report user' button on BuddyPress.</strong><br/>BuddyPress only. By checking this option a link called 'report user' will be shown on each user's activity and profile page.", 'wangguard');
        ?>
</label>
					</p>
					<?php 
    }
    ?>
					<?php 
    if (defined('BP_VERSION') || wangguard_is_multisite()) {
        ?>
					<p>
						<input type="checkbox" name="wangguardenablebpreportblog" id="wangguardenablebpreportblog" value="1" <?php 
        echo wangguard_get_option("wangguard-enable-bp-report-blog") == '1' ? 'checked' : '';
        ?>
 />
						<label for="wangguardenablebpreportblog"><?php 
        _e("<strong>Show the 'Report blog and author' menu item in the Admin Bar.</strong><br/>By checking this option a new menu item on the Admin Bar called 'Report blog and author' will be shown on each blog.", 'wangguard');
        ?>
</label>
					</p>
					<?php 
    }
    ?>

					<p>
						<input type="checkbox" name="wangguard-verify-gmail" id="wangguard-verify-gmail" value="1" <?php 
    echo wangguard_get_option("wangguard-verify-gmail") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguard-verify-gmail"><?php 
    _e("<strong>Check for duplicated gmail.com and googlemail.com emails on sign up.</strong><br/>Checks that duplicated accounts @gmail.com and @googlemail.com accounts doesn't exists, also takes in count that gMail ignores the dots and what's after a + sign on the left side of the @.", 'wangguard');
    ?>
</label>
					</p>

					<p>
						<input type="checkbox" name="wangguard_disable-meta-header" id="wangguard_disable-meta-header" value="1" <?php 
    echo wangguard_get_option("wangguard_disable-meta-header") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguard_disable-meta-header"><?php 
    _e("<strong>Remove the generator META tag.</strong><br/>By checking this option, WangGuard will remove the generator META tag from the generated pages of your site, this will prevent automated bots to easilly identify a WordPress site by looking at this META tag.", 'wangguard');
    ?>
</label>
					</p>

					<?php 
    //verifies if the getmxrr() function is availabe
    $wangguard_mx_ok = function_exists('getmxrr');
    ?>
					<p>
						<input <?php 
    echo !$wangguard_mx_ok ? "disabled = 'disabled'" : "";
    ?>
 type="checkbox" name="wangguard-verify-dns-mx" id="wangguard-verify-dns-mx" value="1" <?php 
    echo $wangguard_mx_ok && wangguard_get_option("wangguard-verify-dns-mx") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguard-verify-dns-mx"><?php 
    _e("<strong>Check email domains agains the DNS server.</strong><br/>Verifies that an associated Mail eXchange (MX) record exists for the email domain, if the verification fails, the sign up process is stopped. Recommeded for non multi user or BuddyPress WordPress installations. Users may notice a small delay of around 1 or 2 seconds on the sign up process due to the DNS verification.", 'wangguard');
    ?>
</label>
						<?php 
    if (!$wangguard_mx_ok) {
        echo "<div>";
        _e("<strong>Warning:</strong> PHP function <strong>getmxrr()</strong> is not available on your server. Contact your server admin to enable it in order to activate this feature.", "wangguard");
        echo "</div>";
    }
    ?>
					</p>

					<p>
						<input type="checkbox" name="wangguard-do-not-check-client-ip" id="wangguard-do-not-check-client-ip" value="1" <?php 
    echo wangguard_get_option("wangguard-do-not-check-client-ip") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguard-do-not-check-client-ip"><?php 
    _e("<strong>Do NOT verify client IP address.</strong><br/>By checking this option, when checking a user, the IP address of the user will not be sent along with the e-mail address to the WangGuard service. Selecting this option reduces WangGuard effectiveness, but if your new accounts come mostly from the same IP, in the case of colleges, universities or other large institutions, this would prevent WangGuard from flagging the IP address as suspicious.", 'wangguard');
    ?>
</label>
					</p>

					<p>
						<input type="checkbox" name="wangguardexpertmode" id="wangguardexpertmode" value="1" <?php 
    echo wangguard_get_option("wangguard-expertmode") == '1' ? 'checked' : '';
    ?>
 />
						<label for="wangguardexpertmode"><?php 
    _e("<strong>Ninja mode.</strong><br/>By checking this option no confirmation message will be asked for report operations on the Users manager. Just remember that users gets deleted when reported and the option 'Delete users when reporting them to WangGuard' is selected.", 'wangguard');
    ?>
</label>
					</p>

					<p class="submit"><input class="button-primary" type="submit" name="optssave" value="<?php 
    _e('Save options &raquo;', 'wangguard');
    ?>
" /></p>

				</form>
			</div>

			


			
			
			

			<!--WANGGUARD BLOCKED DOMAINS-->
			<div id="wangguard-conf-domains" style="margin: auto;">
				
				<div class="wangguard-confico"><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wangguard/img/blocked.png" alt="<?php 
    echo htmlentities(__('Blocked domains', 'wangguard'));
    ?>
" /></div>
				
				<h3><?php 
    _e('Blocked domains', 'wangguard');
    ?>
</h3>
				<p><?php 
    _e('Here are different domain lists maintained by WangGuard.', 'wangguard');
    ?>
</p>
				<p><?php 
    _e('You should never block all domains contained in these listings or no one can register on your site.', 'wangguard');
    ?>
</p>
				<p><?php 
    _e('If a domain is in this list, it is because one or more of its users have used for undesirable activities, but that does not mean they are entirely sploggers.', 'wangguard');
    ?>
</p>
				<p><?php 
    _e('These lists are updated automatically each time you enter this screen.', 'wangguard');
    ?>
</p>
				
				<?php 
    $lang = substr(WPLANG, 0, 2);
    $response = wangguard_http_post("wg=<in><apikey>{$wangguard_api_key}</apikey><lang>{$lang}</lang></in>", 'get-domain-list.php');
    $xml = XML_unserialize($response);
    if (!is_array($xml)) {
        ?>
<p><?php 
        _e("There was an error while pulling the domains list from WangGuard, please try again later. If the problem persists please contact WangGuard to report it.", 'wangguard');
        ?>
</p><?php 
    } else {
        $selectedDomains = maybe_unserialize(wangguard_get_option('blocked-list-domains'));
        if (!is_array($selectedDomains)) {
            $selectedDomains = array();
        }
        ?>
					<form action="" method="post" id="wangguard-blockeddomainsform">
						<?php 
        $first = true;
        $lists = $xml['out']['list'];
        $domainix = 0;
        foreach ($lists as $ix => $list) {
            $domainQ = 0;
            if (@is_array($list['domains']['domain'])) {
                $domainQ = count($list['domains']['domain']);
            } elseif (isset($list['domains']['domain'])) {
                $domainQ = 1;
            }
            echo "<div class='wangguard-blockeddomain-header' id='wangguard-blockeddomain-header-" . $ix . "'><a href='javascript:void(0)' rel='" . $ix . "'>" . $list['name'] . "&nbsp;&nbsp;&nbsp;(<span id='wangguard-domain-count-" . $ix . "'>0</span> " . sprintf(__('out of %d domains selected', 'wangguard'), $domainQ) . ")</a></div>";
            echo "<div class='wangguard-blockeddomain-domains' id='wangguard-blockeddomain-domains-" . $ix . "' wgix='" . $ix . "' " . "style='display:none'" . ">";
            echo "<p>" . $list['description'] . "</p>";
            echo "<div class='wangguard-blockeddomain-list'>";
            echo '<table class="wp-list-table widefat" cellspacing="0">';
            echo '<thead>';
            echo '<tr>';
            echo '<td colspan="4" class="check-column" style="padding: 4px 7px 2px; font-style:italic; font-weight:bold">';
            echo "<input type='checkbox' wgix='" . $ix . "' id='wangguard-selectall-" . $ix . "' /> <label for='wangguard-selectall-" . $ix . "'>" . __('select / unselect all domains', 'wangguard') . "</label><br/>";
            echo "</td>";
            echo "</tr>";
            echo '</thead>';
            echo '<tbody>';
            if (@is_array($list['domains']['domain'])) {
                echo '<tr>';
                $colIX = 1;
                foreach ($list['domains']['domain'] as $domain) {
                    $checked = isset($selectedDomains[$domain]) ? "checked" : "";
                    echo '<td class="check-column wangguard-domain" style="padding: 4px 7px 2px;">';
                    echo "<input wgix='" . $ix . "' name='domains[]' type='checkbox' value='{$domain}' {$checked} id='wangguard-domain-" . ++$domainix . "' /> <label for='wangguard-domain-" . $domainix . "'>" . $domain . "</label><br/>";
                    echo "</td>";
                    if (++$colIX > 4) {
                        echo '</tr><tr>';
                        $colIX = 1;
                    }
                }
                echo "</tr>";
            } elseif (isset($list['domains']['domain'])) {
                $domain = $list['domains']['domain'];
                $checked = isset($selectedDomains[$domain]) ? "checked" : "";
                echo '<tr>';
                echo '<td class="check-column wangguard-domain" style="padding: 4px 7px 2px;">';
                echo "<input wgix='" . $ix . "' name='domains[]' type='checkbox' value='{$domain}' {$checked} id='wangguard-domain-" . ++$domainix . "' /> <label for='wangguard-domain-" . $domainix . "'>" . $domain . "</label><br/>";
                echo "</td>";
                echo "</tr>";
            }
            echo "</tbody>";
            echo "</table>";
            echo "</div>";
            echo "</div>";
            $first = false;
        }
        ?>
						<p class="submit"><input class="button-primary" type="submit" name="saveblockeddomain" value="<?php 
        _e('Save blocked domains &raquo;', 'wangguard');
        ?>
" /></p>
					</form>
					<script type="text/javascript">
						
						function wangguard_update_domain_count(ix) {
							var q = jQuery("#wangguard-blockeddomain-domains-"+ix+" td.wangguard-domain input[type=checkbox]:checked").length;
							jQuery('#wangguard-domain-count-' + ix).html(q);
						}
						
						var wangguardDomainBlockIX = -1;
						jQuery(document).ready(function() {
							
							jQuery(".wangguard-blockeddomain-domains input[type=checkbox]").change(function() {
								wangguard_update_domain_count(jQuery(this).attr("wgix"));
							});
							
							jQuery(".wangguard-blockeddomain-header a").click(function() {
								var ix = jQuery(this).attr('rel');
								
								if (wangguardDomainBlockIX == ix) {
									jQuery('#wangguard-blockeddomain-domains-'+wangguardDomainBlockIX).slideUp('fast');
									wangguardDomainBlockIX = -1;
								}
								else {
									if (wangguardDomainBlockIX != -1)
										jQuery('#wangguard-blockeddomain-domains-'+wangguardDomainBlockIX).slideUp('fast');
									
									jQuery('#wangguard-blockeddomain-domains-'+ix).slideDown('fast');
									wangguardDomainBlockIX = ix;
								}
							});
							
							jQuery(".wangguard-blockeddomain-domains").each(function() {
								wangguard_update_domain_count(jQuery(this).attr("wgix"));
							});
						});
					</script>
					<?php 
    }
    ?>
				
			</div>
			<!--WANGGUARD BLOCKED DOMAINS-->

			

			<!--WANGGUARD SERVERS-->
			<div id="wangguard-conf-conectivity" style="margin: auto;">

				<div class="wangguard-confico"><img src="<?php 
    echo WP_PLUGIN_URL;
    ?>
/wangguard/img/connectivity.png" alt="<?php 
    echo htmlentities(__('Server Connectivity', 'wangguard'));
    ?>
" /></div>
			
				<form action="" method="post" id="wangguard-connectivity" style="margin:0px auto 0 auto;  ">

					<h3 style="margin-bottom: 30px;"><?php 
    _e('Server Connectivity', 'wangguard');
    ?>
</h3>
				<?php 
    if (!function_exists('fsockopen') || !function_exists('gethostbynamel')) {
        ?>
							<p style="padding: .5em; background-color: #00a000; color: #fff; font-weight:bold;"><?php 
        _e('Network functions are disabled.', 'wangguard');
        ?>
</p>
							<p><?php 
        echo sprintf(__('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions.  <strong>WangGuard cannot work correctly until this is fixed.</strong>  Please contact your web host or firewall administrator.', 'wangguard'));
        ?>
</p>
						<?php 
    } else {
        $servers = wangguard_get_server_connectivity();
        $fail_count = count($servers) - count(array_filter($servers));
        if (is_array($servers) && count($servers) > 0) {
            // some connections work, some fail
            if ($fail_count > 0 && $fail_count < count($servers)) {
                ?>
								<p class="wangguard-info wangguard-error"><?php 
                _e('Unable to reach some WangGuard servers.', 'wangguard');
                ?>
</p>
								<p><?php 
                echo sprintf(__('A network problem or firewall is blocking some connections from your web server to WangGuard.com.  WangGuard is working but this may cause problems during times of network congestion.', 'wangguard'));
                ?>
</p>
							<?php 
                // all connections fail
            } elseif ($fail_count > 0) {
                ?>
								<p class="wangguard-info wangguard-error"><?php 
                _e('Unable to reach any WangGuard servers.', 'wangguard');
                ?>
</p>
								<p><?php 
                echo sprintf(__('A network problem or firewall is blocking all connections from your web server to WangGuard.com.  <strong>WangGuard cannot work correctly until this is fixed.</strong>', 'wangguard'));
                ?>
</p>
							<?php 
                // all connections work
            } else {
                ?>
								<p class="wangguard-info wangguard-success"><?php 
                _e('All WangGuard servers are available.', 'wangguard');
                ?>
</p>
								<p><?php 
                _e('WangGuard is working correctly.  All servers are accessible.', 'wangguard');
                ?>
</p>
							<?php 
            }
        } else {
            ?>
								<p class="wangguard-info wangguard-error"><?php 
            _e('Unable to find WangGuard servers.', 'wangguard');
            ?>
</p>
								<p><?php 
            echo sprintf(__('A DNS problem or firewall is preventing all access from your web server to wangguard.com.  <strong>WangGuard cannot work correctly until this is fixed.</strong>', 'wangguard'));
            ?>
</p>
							<?php 
        }
    }
    if (!empty($servers)) {
        ?>
						<table style="width: 100%;"> 
						<thead>
							<th style="border-bottom: 1px solid #999; padding-bottom: 5px; margin-bottom: 5px;"><?php 
        _e('WangGuard server', 'wangguard');
        ?>
</th>
							<th style="border-bottom: 1px solid #999; padding-bottom: 5px; margin-bottom: 5px;"><?php 
        _e('Network Status', 'wangguard');
        ?>
</th>
						</thead>
						<tbody>
							<?php 
        asort($servers);
        foreach ($servers as $ip => $status) {
            $class = $status ? 'wangguard-info wangguard-success' : 'wangguard-info wangguard-error';
            ?>
							<tr>
								<td style="text-align:center; font-weight:bold;"><?php 
            echo htmlspecialchars($ip);
            ?>
</td>
								<td><p class="<?php 
            echo $class;
            ?>
"><?php 
            echo $status ? __('No problems', 'wangguard') : __('Obstructed', 'wangguard');
            ?>
</p></td>
							</tr>
							<?php 
        }
        ?>
						</tbody>
						</table>
						<?php 
    }
    ?>
					<p><?php 
    if (wangguard_get_option('wangguard_connectivity_time')) {
        echo sprintf(__('Last checked %s ago.', 'wangguard'), human_time_diff(wangguard_get_option('wangguard_connectivity_time')));
    }
    ?>
</p>
					<p class="submit"><input type="submit" name="check" class="button-primary" value="<?php 
    _e('Check network status &raquo;', 'wangguard');
    ?>
" /></p>
				</form>
			</div>

			</div>
			
		</div>


		<script type="text/javascript">
		  jQuery(document).ready(function() {
			  jQuery('#wangguard-conf-tabs').tabs();
			  jQuery('#wangguard-conf-tabs').tabs("select" , <?php 
    echo $selectedTab;
    ?>
);
		  });
		</script>

	</div>
</div>
<?php 
}
Ejemplo n.º 30
0
<?php

###################################################################################
#
# XML Library, by Keith Devens, version 1.2b
# http://keithdevens.com/software/phpxml
#
# This code is Open Source, released under terms similar to the Artistic License.
# Read the license at http://keithdevens.com/software/license
#
###################################################################################
if (isset($HTTP_GET_VARS['url'])) {
    echo '<pre>';
    print_r(XML_unserialize(implode('', file($HTTP_GET_VARS['url']))));
    echo '</pre>';
}
###################################################################################
# XML_unserialize: takes raw XML as a parameter (a string)
# and returns an equivalent PHP data structure
###################################################################################
function &XML_unserialize(&$xml)
{
    $xml_parser =& new XML();
    $data =& $xml_parser->parse($xml);
    $xml_parser->destruct();
    return $data;
}
###################################################################################
# XML_serialize: serializes any PHP data structure into XML
# Takes one parameter: the data to serialize. Must be an array.
###################################################################################