Index: branches/beta/data/include/module.inc
===================================================================
--- branches/beta/data/include/module.inc	(revision 8)
+++ branches/beta/data/include/module.inc	(revision 15120)
@@ -1,9 +1,9 @@
 <?php
 
-// ¥¿¥°½ÐÎÏÍÑ¥¯¥é¥¹
+// ¥¨¥Ó¥¹¥¿¥°½ÐÎÏÍÑ¥¯¥é¥¹
 class LC_EbisPage {
-	function LC_EbisPage() {
-		$this->tpl_mainpage = MODULE_PATH . "ebis_tag_text.tpl";
-	}
+    function LC_EbisPage() {
+        $this->tpl_mainpage = MODULE_PATH . "mdl_ebis_tag/ebis_tag_text.tpl";
+    }
 }
 
@@ -11,19 +11,14 @@
 function sfPrintEbisTag($pid = "") {
 	$objQuery = new SC_Query();
-	$arrRet = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(EBIS_TAG_MID));
+	$arrRet   = $objQuery->select("sub_data", "dtb_module", "module_id = ?", array(EBIS_TAG_MID));
 	$arrSubData = unserialize($arrRet[0]['sub_data']);
-	$arrEbis = array();
-	
-	if($arrSubData['cid'] != "") {
-		$arrEbis['cid'] = $arrSubData['cid'];
-	} else {
-		return;
-	}
-	
-	// ¡Ö/¡×¤¬½ÅÊ£¤·¤Æ¤¤¤ë¤â¤Î¤Ø¤ÎÂÐ±þ
-	$php_self = ereg_replace("[/]+", "/", $_SERVER['PHP_SELF']);
-	// PHP¥Õ¥¡¥¤¥ë¤Î¸å¤í¤Ë¡Ö/¡×¤¬¤Ä¤¤¤Æ¤·¤Þ¤Ã¤Æ¤¤¤ë¤â¤Î¤Ø¤ÎÂÐ±þ
-	$php_self = ereg_replace(".php[/]+$", ".php", $php_self);
-	
+    
+    if ( empty($arrSubData['cid']) ) return;
+    
+    $arrEbis = array(
+        'cid'       => $arrSubData['cid'],
+        'login_url' => $arrSubData['login_url'],
+    );
+    
 	if(!is_array($pid) && $pid != "") {
 		if(!ereg(".tpl$", $pid)) {
@@ -32,8 +27,9 @@
 		} else {
 			// ¥Æ¥ó¥×¥ì¡¼¥È¤Î¥Ñ¥¹¤¬Í¿¤¨¤é¤ì¤Æ¤¤¤ë¾ì¹ç
-			$temp_id = ereg_replace(HTML_PATH,"",$pid);			
-			$temp_id = ereg_replace("^[/]+","",$temp_id);
-			$temp_id = ereg_replace(".tpl$","",$temp_id);
-			$temp_id = ereg_replace("[\./]","_",$temp_id);
+            $temp_id = str_replace(USER_TEMPLATE_PATH, '', $pid);
+            $temp_id = str_replace(HTML_PATH,   '',  $temp_id);
+            $temp_id = preg_replace('|^/+|',    '',  $temp_id);
+            $temp_id = preg_replace('|\.tpl$|', '',  $temp_id);
+            $temp_id = preg_replace('|[\./]|',  '_', $temp_id);
 			$arrEbis['pid'] = $temp_id;
 		}
@@ -51,5 +47,8 @@
 		$arrEbis['pid'] = ereg_replace("detail.php\?product_id=", "detail-p", $filename);
 	}
-	
+
+    // ¹ØÆþ´°Î»¥Ú¡¼¥¸(thanks¥Ú¡¼¥¸)¤ÏÆÃ¼ìID¤òÈ¯¹Ô
+    lfSetThanksPegeTag($arrEbis, $arrSubData);
+
 	// ID³ä¤êÅö¤Æ¤µ¤ì¤Æ¤¤¤Ê¤¤¥Ú¡¼¥¸¤Ï¡¢¼«Æ°Åª¤ËÀ¸À®¤¹¤ë¡£
 	if($arrEbis['pid'] == "") {				
@@ -59,5 +58,5 @@
 		$arrEbis['pid'] = $temp_id;
 	}
-			
+
 	// ¥Ú¡¼¥¸ID¤¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Î¤ß¥¿¥°¤ò½ÐÎÏ¤¹¤ë¡£
 	if($arrEbis['pid'] != "") {
@@ -68,4 +67,76 @@
 		$objSubView->display($objSubPage->tpl_mainpage);
 	}
+}
+
+// ¹ØÆþ´°Î»²èÌÌ¤Î¥¨¥Ó¥¹¥¿¥°¤òÀßÄê
+function lfSetThanksPegeTag(&$arrEbis, $arrSubData){
+    $pattern = "|/shopping/complete.php$|";
+    $target  = $_SERVER["REQUEST_URI"];
+    if( !preg_match($pattern, $target) ) return;
+    
+    global $arrEBiSTagAttrTagName;
+    global $arrJobEN;
+    global $arrSexEN;
+    global $order_id;
+    
+    $objQuery = new SC_Query();
+    $arrRet   = $objQuery->select('*', 'dtb_order', 'order_id = ?', array($order_id));
+    $arrCustomerInfo = $arrRet[0];
+    $arrEbis['pid']  = 'thanks'; // ¥Ú¡¼¥¸ID¤ò¥»¥Ã¥È
+    
+    /**
+     * $arrSubData == Array (
+     *      [user] => username
+     *      [pass] => password
+     *      [login_url] => http://login_url/
+     *      [cid] => ebis_parameter
+     *      [m1id] => 1
+     *      [a1id] => 2
+     *      [o1id] => 3
+     *      [o2id] => 4
+     *      [o3id] => 0
+     *      [o4id] => 0
+     *      [o5id] => 0
+     * )
+     * $arrEBiSTagAttrTagName == Array(
+     *      'm1id', 'a1id', 'o1id', 'o2id'
+     *      'o3id', 'o4id', 'o5id'
+     * )
+     **/
+    
+    foreach ($arrEBiSTagAttrTagName as $tagname) {
+        if ( empty($arrSubData[$tagname]) ) continue;
+        
+        $value = $arrSubData[$tagname];
+        
+        // Â°À­¾ðÊó¤ò¥»¥Ã¥È
+        switch ($value) {
+        case EBiS_TAG_ATTR_CUSTOMER_ID:
+            $arrEbis[$tagname] = $arrCustomerInfo['customer_id'];
+            break;
+        case EBiS_TAG_ATTR_PAYMENT:
+            $arrEbis[$tagname] = $arrCustomerInfo['payment_total'];
+            break;
+        case EBiS_TAG_ATTR_JOB:
+            if ( empty($arrCustomerInfo['order_job']) ) break;
+            $arrEbis[$tagname] = $arrJobEN[$arrCustomerInfo['order_job']];
+            break;
+        case EBiS_TAG_ATTR_SEX:
+            $arrEbis[$tagname] = $arrSexEN[$arrCustomerInfo['order_sex']];
+            break;
+        case EBiS_TAG_ATTR_AGE:
+            if ( empty($arrCustomerInfo['order_birth']) ) break;
+            $arrEbis[$tagname] = gfGetAge($arrCustomerInfo['order_birth']);
+            break;
+        case EBiS_TAG_ATTR_IS_CUSTOMER:
+            if ( $arrCustomerInfo['customer_id'] == '0' ) {
+                $arrEbis[$tagname] = '0';
+            } else {
+                $arrEbis[$tagname] = '1';
+            }
+            break;
+        default:
+        }
+    }
 }
 
