source: branches/feature-module-zeus/data/downloads/module/mdl_zero/mdl_zeus.inc @ 15407

Revision 15407, 3.8 KB checked in by naka, 17 years ago (diff)
Line 
1<?php
2/**
3 *
4 * @copyright   2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 * @version CVS: $Id: mdl_epsilon.inc 7162 2006-11-18 09:53:33Z kakinaka $
6 * @link        http://www.lockon.co.jp/
7 *
8 */
9
10/**** ¢§Äê¿ôÀë¸À *********************************************************************************************/
11
12define("MDL_ZEUS_ID", 10);
13
14// ¥¯¥ì¥¸¥Ã¥Èʬ³ä²ó¿ô
15$arrPaymentClass = array(
16    '1' => '°ì³çʧ¤¤',
17);
18
19define("ZERO_PC", 1);        // dtb_payment ¤Î¶èʬÍÑ
20define("ZERO_MOBILE", 2);    // dtb_payment ¤Î¶èʬÍÑ
21define("ZERO_CREDIT_ID", 1);      // dtb_payment ¤Î¶èʬÍÑ
22
23// Á÷¿®¥Ñ¥é¥á¡¼¥¿
24define ("SEND_PARAM_CUSTOM", "yes");
25define ("SEND_PARAM_ACT", "imode");
26define ("SEND_PARAM_SEND", "jpall");
27define ("SEND_PARAM_PC_URL", "https://credit.zeroweb.ne.jp/cgi-bin/order.cgi?orders");
28define ("SEND_PARAM_MOBILE_URL", "https://credit.zeroweb.ne.jp/cgi-bin/order.cgi");
29define ("SEND_PARAM_DELIMITER", "_");                           // sendid¤Îʬ³äʸ»ú
30
31// ʸ»ú¿ôÀ©¸Â
32define ("CLIENTIP_LEN", 5);
33define ("SEND_LEN", 20);
34
35/**** ¢§ÊÑ¿ôÀë¸À *********************************************************************************************/
36
37
38/**** ¢§´Ø¿ô *********************************************************************************************/
39
40/**
41 * XML¥¿¥°¤ÎÆâÍƤò¼èÆÀ¤¹¤ë
42 * @param array $arrVal Value¥Ç¡¼¥¿
43 * @param string $tag Tag¥Ç¡¼¥¿
44 * @param string $att Âоݥ¿¥°Ì¾
45 * @return string
46 */
47function sfGetXMLValue($arrVal, $tag, $att) {
48    $ret = "";
49    foreach((array)$arrVal as $array) {
50        if($tag == $array['tag']) {
51            if(!is_array($array['attributes'])) {
52                continue;
53            }
54            foreach($array['attributes'] as $key => $val) {
55                if($key == $att) {
56                    $ret = mb_convert_encoding(urldecode($val), 'EUC-JP', 'SJIS');
57                    break;
58                }
59            }           
60        }
61    }
62   
63    return $ret;
64}
65
66/**
67 * ¥¼¥í¤Ø¥Ç¡¼¥¿¤òÁ÷¿®¤¹¤ë¡£
68 * @param string $order_url  Á÷¿®ÀèURL
69 * @param array $arrData POST¥Ç¡¼¥¿
70 * @param boolean $err_page ¥¨¥é¡¼¥Ú¡¼¥¸É½¼¨Í­Ìµ
71 * @param boolean $is_xml XML¤Ç±þÅú¾ðÊ󤬵¢¤Ã¤Æ¤¯¤ë¾ì¹ç
72 * @return array ±þÅú¾ðÊó
73 */
74function sfPostPaymentData($order_url, $arrData, $err_page = true, $is_xml = false){
75    $arrVal = array();
76    $response = "";
77
78    // POST¥Ç¡¼¥¿¤òÁ÷¿®¤·¡¢±þÅú¾ðÊó¤ò¼èÆÀ¤¹¤ë
79    $response = sfSendPostData($order_url, $arrData, array(200));
80   
81    // ¤Ê¤Ë¤âÊ֤äƤ³¤Ê¤ì¤Ð¡¢¥¨¥é¡¼
82    if ($response == "") {
83        if ($err_page) {
84            // ¥¨¥é¡¼²èÌ̤òɽ¼¨¤¹¤ë¡£
85            $_SESSION['site']['now_page'] ="";
86            sfDispSiteError(FREE_ERROR_MSG, "", true, "¹ØÆþ½èÍýÃæ¤Ë¥¨¥é¡¼¤¬È¯À¸¤·¤Þ¤·¤¿¡£<br>¤³¤Î¼ê³¤­¤Ï̵¸ú¤È¤Ê¤ê¤Þ¤·¤¿¡£");
87        }else{
88            return "" ;
89        }
90    }
91
92    // ±þÅú¤Î¥¨¥ó¥³¡¼¥É¤âUNICODE¤ËÊÑ´¹
93    $response = mb_convert_encoding($response, CHAR_CODE, auto);
94
95    // ±þÅú¤¬XML¤Î¾ì¹ç
96    if($is_xml){
97       
98        // XML¥Ñ¡¼¥µ¤òÀ¸À®¤¹¤ë¡£
99        $parser = xml_parser_create('utf-8');
100       
101        // ¶õÇòʸ»ú¤ÏÆɤßÈô¤Ð¤·¤ÆXML¤òÆɤ߼è¤ë
102        xml_parser_set_option($parser,XML_OPTION_TARGET_ENCODING,"UTF-8");
103        xml_parser_set_option($parser,XML_OPTION_SKIP_WHITE,1);
104       
105        // ÇÛÎó¤ËXML¤Î¥Ç¡¼¥¿¤ò³ÊǼ¤¹¤ë
106        $err = xml_parse_into_struct($parser,$response,$arrVal,$idx);
107       
108        // ³«Êü¤¹¤ë
109        xml_parser_free($parser);
110    }else{
111        $arrVal = $response;
112    }
113
114    return $arrVal;
115}
116/**************************************************************************************************************
117 * ´Ø¿ô̾   ¡§sfZeusDisp
118 * ½èÍýÆâÍÆ ¡§¶¦Ä̤Îɽ¼¨½èÍý
119 * °ú¿ô1    ¡§
120 * °ú¿ô2    ¡§
121 * °ú¿ô3    ¡§
122 * Ìá¤êÃÍ   ¡§¼èÆÀ·ë²Ì
123 **************************************************************************************************************/
124function sfZeusDisp($objPage, $payment_id) {
125    $objQuery = new SC_Query();
126    // »Ùʧ¤¤ÊýË¡¤ÎÀâÌÀ²èÁü¤ò¼èÆÀ¤¹¤ë¡£
127    $arrRet = $objQuery->select("payment_method, payment_image", "dtb_payment", "payment_id = ?", array($payment_id));
128    $objPage->tpl_payment_method = $arrRet[0]['payment_method'];
129    $objPage->tpl_payment_image = $arrRet[0]['payment_image'];
130    return $objPage;
131}
132?>
Note: See TracBrowser for help on using the repository browser.